diff --git a/client/apps/portal-administration/src/components/Actions/ActivateSelectedWithContextButton.tsx b/client/apps/portal-administration/src/components/Actions/ActivateSelectedWithContextButton.tsx index 5d00eca8..d2fb2e0c 100644 --- a/client/apps/portal-administration/src/components/Actions/ActivateSelectedWithContextButton.tsx +++ b/client/apps/portal-administration/src/components/Actions/ActivateSelectedWithContextButton.tsx @@ -1,7 +1,8 @@ import { Button, Icon } from '@equinor/eds-core-react'; -import { PortalApp, PortalApplication } from '../../types'; +import { PortalApplication } from '../../types'; import { add_circle_filled } from '@equinor/eds-icons'; +import { useMemo } from 'react'; type ActivateSelectedWithContextButtonProps = { selection: PortalApplication[]; @@ -12,7 +13,9 @@ export const ActivateSelectedWithContextButton = ({ selection, activateSelectedWithContext, }: ActivateSelectedWithContextButtonProps) => { - const isActive = selection.some((a) => !a.isActive) && selection.length < 2; + + // Only active if one is selected or the selected has contextTypes active + const isActive = useMemo(()=> (!!selection.find(app => app.contextTypes.length !== 0) && selection.some((a) => !a.isActive) && selection.length < 2),[selection]); if (!isActive) { return null; diff --git a/client/apps/portal-administration/src/components/PortalApps/ContextAppSideSheet.tsx b/client/apps/portal-administration/src/components/PortalApps/ContextAppSideSheet.tsx index 44b3ca64..1a9a4e59 100644 --- a/client/apps/portal-administration/src/components/PortalApps/ContextAppSideSheet.tsx +++ b/client/apps/portal-administration/src/components/PortalApps/ContextAppSideSheet.tsx @@ -78,9 +78,10 @@ export function ContextAppSideSheet({ const { activeContexts, contextTypes } = useActiveOnboardedContext(); const [selectedContexts, setSelectedContexts] = useState([]); - const { data: activeApp, isLoading } = useGetPortalApp(activePortalId, app.key); + const { data: activeApp, isLoading } = useGetPortalApp(activePortalId, app.appManifest.appKey); const contexts: OnboardedContext[] = useMemo(() => { + console.log(activeApp) if (!activeApp || !activeContexts) return []; return activeContexts.map((context) => ({ @@ -103,7 +104,7 @@ export function ContextAppSideSheet({ minWidth={1200} isDismissable={true} > - + @@ -165,9 +166,9 @@ export function ContextAppSideSheet({ onCellValueChanged: (event) => { if (event.newValue) { console.log('Activate context', event.data); - add({ appKey: app.key, contextIds: [event.data.contextId] }); + add({ appKey: app.appManifest.appKey, contextIds: [event.data.contextId] }); } else { - remove({ appKey: app.key, contextIds: [event.data.contextId] }); + remove({ appKey: app.appManifest.appKey, contextIds: [event.data.contextId] }); } }, }, @@ -200,7 +201,7 @@ export function ContextAppSideSheet({