-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #358 from fairdataihub/staging
feat: 15.2.0
- Loading branch information
Showing
33 changed files
with
520 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
...omponents/tables/singleColumn/clickHandlers/clickHandlersAccounts/clickHandlerAccounts.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
import { | ||
swalConfirmAction, | ||
swalShowError, | ||
swalShowInfo, | ||
swalShowLoading, | ||
} from "../../../../../scripts/utils/swal-utils"; | ||
import { clientError } from "../../../../../scripts/others/http-error-handler/error-handler"; | ||
|
||
export const accountsClickHandlers = async (index) => { | ||
switch (index) { | ||
case 0: | ||
connectPennsieveAccountClickHandler(); | ||
break; | ||
case 1: | ||
changeWorkspaceClickHandler(); | ||
break; | ||
case 2: | ||
disconnectPennsieveAccountClickHandler(); | ||
break; | ||
case 3: | ||
testPennsieveConnectionClickHandler(); | ||
break; | ||
default: | ||
console.log("Invalid row index"); | ||
break; | ||
} | ||
}; | ||
|
||
const connectPennsieveAccountClickHandler = () => { | ||
window.addBfAccount(null, false); | ||
}; | ||
|
||
const changeWorkspaceClickHandler = () => { | ||
window.openDropdownPrompt(null, "organization", false); | ||
}; | ||
|
||
const disconnectPennsieveAccountClickHandler = async () => { | ||
let defaultProfile = window.getDefaultProfile(); | ||
if (!defaultProfile) { | ||
swalShowError( | ||
"Cannot Disconnect Account", | ||
"If you have previously connected your Pennsieve account with SODA then you will need to make it the active account before you can disconnect it. To make your account active please click the 'Connect Your Pennsieve Account' option. " | ||
); | ||
return; | ||
} | ||
// TODO: Force user to login and check the resulting profile matches the current account before allowing them to disconnect? | ||
let response = await swalConfirmAction( | ||
"warning", | ||
"Disconnect Pennsieve Account from SODA", | ||
"You will need to reconnect your Pennsieve account to use Pennsieve features in SODA. Are you sure you want to disconnect?", | ||
"Yes", | ||
"No" | ||
); | ||
if (response) { | ||
window.disconnectPennsieveAccount(defaultProfile.profile_key); | ||
} | ||
}; | ||
|
||
const testPennsieveConnectionClickHandler = async () => { | ||
swalShowLoading("Testing Connection", "Please wait while we test your connection to Pennsieve."); | ||
|
||
if ( | ||
!( | ||
window.defaultBfAccount !== undefined || | ||
(window.defaultBfAccount === undefined && window.getDefaultProfile()) | ||
) | ||
) { | ||
await new Promise((resolve) => setTimeout(resolve, 1000)); | ||
await swalShowError( | ||
"No Pennsieve Account Connected", | ||
"Please use the 'Connect Your Pennsieve Account' option and try again." | ||
); | ||
return; | ||
} | ||
|
||
try { | ||
const accountValid = await window.check_api_key(); | ||
if (!accountValid) { | ||
await swalShowError( | ||
"Your Pennsieve account connected to SODA is invalid", | ||
"Please use the 'Connect Your Pennsieve Account' option and try again." | ||
); | ||
return; | ||
} | ||
await window.synchronizePennsieveWorkspace(); | ||
} catch (e) { | ||
clientError(e); | ||
await swalShowInfo( | ||
"Something went wrong while verifying your profile", | ||
"Please try again. If this issue persists please use our `Contact Us` page to report the issue." | ||
); | ||
return; | ||
} | ||
|
||
swalShowInfo( | ||
"Connection Test Passed", | ||
"All Pennsieve based features of SODA should work as expected." | ||
); | ||
}; |
9 changes: 9 additions & 0 deletions
9
src/renderer/src/components/tables/singleColumn/clickHandlers/clickHandlersFactory.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { accountsClickHandlers } from "./clickHandlersAccounts/clickHandlerAccounts"; | ||
|
||
export const getClickHandlerFunctions = (id) => { | ||
if (id === "account-options-table") { | ||
return accountsClickHandlers; | ||
} else { | ||
return () => console.log("No click handler found for this table"); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
src/renderer/src/components/tables/singleColumn/rows/defaultRow.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { Table } from "@mantine/core"; | ||
|
||
export const defaultRow = (row, index, handleRowClick) => ( | ||
<Table.Tr key={index} onClick={() => handleRowClick(index)}> | ||
<Table.Td style={{ textAlign: "left" }}>{row}</Table.Td> | ||
</Table.Tr> | ||
); |
20 changes: 20 additions & 0 deletions
20
src/renderer/src/components/tables/singleColumn/rows/iconAfterTextRow.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Table } from "@mantine/core"; | ||
import { IconChevronRight } from "@tabler/icons-react"; | ||
|
||
export const singleColumnIconAfterTextRow = (row, index, handleRowClick) => ( | ||
<Table.Tr key={index} onClick={() => handleRowClick(index)}> | ||
<Table.Td style={{ textAlign: "left", cursor: "pointer" }}> | ||
<div | ||
style={{ | ||
display: "flex", | ||
justifyContent: "space-between", | ||
alignItems: "center", | ||
width: "100%", | ||
}} | ||
> | ||
{row} | ||
<IconChevronRight /> | ||
</div> | ||
</Table.Td> | ||
</Table.Tr> | ||
); |
10 changes: 10 additions & 0 deletions
10
src/renderer/src/components/tables/singleColumn/rows/rowConfigurationFactory.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { singleColumnIconAfterTextRow } from "./iconAfterTextRow"; | ||
import { defaultRow } from "./defaultRow"; | ||
|
||
export const getRowConfiguration = (id) => { | ||
if (id === "account-options-table") { | ||
return singleColumnIconAfterTextRow; | ||
} else { | ||
return defaultRow; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.