Skip to content

Commit

Permalink
Merge pull request #1293 from CybercentreCanada/update/borealis
Browse files Browse the repository at this point in the history
Update/Borealis (master)
  • Loading branch information
cccs-nr authored Dec 9, 2024
2 parents 73de7d7 + da78b21 commit 483565f
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"@vitejs/plugin-react": "^4.2.1",
"@vitejs/plugin-react-swc": "^3.5.0",
"autosuggest-highlight": "^3.3.4",
"borealis-ui": "^0.1.13",
"borealis-ui": "^0.4.0",
"browser-detect": "^0.2.28",
"buffer": "^6.0.3",
"chart.js": "^4.4.1",
Expand Down
5 changes: 3 additions & 2 deletions src/components/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const MyAppMain = () => {
const provider = getProvider();
const { setUser, setConfiguration, user, configuration } = useALContext();
const { setReady: setAppLayoutReady } = useAppLayout();
const { setReady: setBorealisReady } = useBorealis();
const { setReady: setBorealisReady, setCustomIconify } = useBorealis();
const { setItems } = useAppSwitcher();
const { bootstrap } = useMyAPI();

Expand All @@ -55,9 +55,10 @@ const MyAppMain = () => {
}
};

const setReady = (layout: boolean, borealis: boolean) => {
const setReady = (layout: boolean, borealis: boolean, iconifyUrl: string = null) => {
setAppLayoutReady(layout);
setBorealisReady(borealis);
setCustomIconify(iconifyUrl);
};

useEffect(() => {
Expand Down
8 changes: 6 additions & 2 deletions src/components/hooks/useMyAPI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type BootstrapProps = {
setConfiguration: (cfg: Configuration) => void;
setLoginParams: (params: LoginParamsProps) => void;
setUser: (user: WhoAmIProps) => void;
setReady: (layout: boolean, borealis: boolean) => void;
setReady: (layout: boolean, borealis: boolean, iconifyUrl: string) => void;
retryAfter?: number;
};

Expand Down Expand Up @@ -155,7 +155,11 @@ const useMyAPI = (): UseMyAPIReturn => {
setUser(user);

// Mark the interface ready
setReady(true, user.configuration.ui.api_proxies.includes('borealis'));
setReady(
true,
'borealis' in user.configuration.ui.api_proxies,
user.configuration?.ui?.api_proxies?.borealis?.custom_iconify || null
);

// Render appropriate page
if (!user.agrees_with_tos && user.configuration.ui.tos) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/models/base/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ export type UI = {
allow_zip_downloads: boolean;

/** Proxy requests to the configured API target and add headers */
api_proxies: string[];
api_proxies: { [proxy: string]: any };

/** Hogwarts App data */
apps: AppSwitcherItem[];
Expand Down
2 changes: 1 addition & 1 deletion src/components/visual/ActionMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ const WrappedActionMenu: React.FC<TagProps> = ({
state.mouseY !== null && state.mouseX !== null ? { top: state.mouseY, left: state.mouseX } : undefined
}
>
{currentUserConfig.ui.api_proxies.includes('borealis') &&
{'borealis' in currentUserConfig.ui.api_proxies &&
type in BOREALIS_TYPE_MAP &&
value !== null &&
setBorealisDetails && (
Expand Down
2 changes: 1 addition & 1 deletion src/components/visual/ActionableCustomChip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const WrappedActionableCustomChip: React.FC<ActionableCustomChipProps> = ({
classification={classification}
/>
)}
{configuration.ui.api_proxies.includes('borealis') && data_type in BOREALIS_TYPE_MAP && label !== null ? (
{'borealis' in configuration.ui.api_proxies && data_type in BOREALIS_TYPE_MAP && label !== null ? (
<EnrichmentCustomChip
dataType={BOREALIS_TYPE_MAP[data_type]}
dataValue={label}
Expand Down
2 changes: 1 addition & 1 deletion src/components/visual/Tag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ const WrappedTag: React.FC<TagProps> = ({
setBorealisDetails={setShowBorealisDetails}
/>
)}
{configuration.ui.api_proxies.includes('borealis') && type in BOREALIS_TYPE_MAP && value !== null ? (
{'borealis' in configuration.ui.api_proxies && type in BOREALIS_TYPE_MAP && value !== null ? (
<EnrichmentCustomChip
dataType={BOREALIS_TYPE_MAP[type]}
dataValue={value}
Expand Down

0 comments on commit 483565f

Please sign in to comment.