Skip to content

Commit

Permalink
DES-2629: Use portal names to build list. (#1258)
Browse files Browse the repository at this point in the history
  • Loading branch information
chandra-tacc authored May 23, 2024
1 parent 89f8246 commit 31b14de
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
1 change: 1 addition & 0 deletions client/modules/_hooks/src/systems/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export type TTapisSystem = {
label?: string;
keyservice?: boolean;
isMyData?: boolean;
portalNames: string[];
};
importRefId?: string;
uuid: string;
Expand Down
18 changes: 12 additions & 6 deletions client/modules/workspace/src/SelectModal/SelectModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type TModalChildren = (props: {
}) => React.ReactElement;

const api = 'tapis';
const portalName = 'DesignSafe';
const HeaderTitle: React.FC<{
api: string;
system: string;
Expand Down Expand Up @@ -109,15 +110,20 @@ export const SelectModal: React.FC<{
const {
data: { storageSystems, defaultStorageSystem },
} = useGetSystems();
// only pick up enabled systems with label
// only pick up enabled systems in this portal
const includedSystems = storageSystems.filter(
(s) => s.enabled && s.notes?.label
(s) => s.enabled && s.notes?.portalNames?.includes(portalName)
);

const systemOptions = includedSystems.map((system) => ({
label: system.notes.label,
value: system.id,
}));
// Sort - so mydata is shown first.
const systemOptions = includedSystems
.sort((a, b) => {
return (a.notes?.isMyData ? 0 : 1) - (b.notes?.isMyData ? 0 : 1);
})
.map((system) => ({
label: system.notes.label,
value: system.id,
}));
systemOptions.push({ label: 'My Projects', value: 'myprojects' });

const defaultParams = useMemo(
Expand Down

0 comments on commit 31b14de

Please sign in to comment.