Skip to content

Commit

Permalink
Added facility support for MC (#1147)
Browse files Browse the repository at this point in the history
  • Loading branch information
kjellhaaland authored Oct 10, 2024
1 parent aee6fde commit 315b217
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import buildQuery from 'odata-query';

export const configure = async (config: IAppConfigurator, c: ComponentRenderArgs) => {
enableContext(config, async (builder) => {
builder.setContextType(['ProjectMaster']);
builder.setContextType(['ProjectMaster', 'Facility']);
builder.setContextParameterFn(({ search, type }) => {
return buildQuery({
search,
Expand Down
22 changes: 18 additions & 4 deletions libs/mechanicalcompletionapp/src/lib/config/workspaceConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,31 @@ import { useGardenConfig } from './gardenConfig';
import { sidesheetConfig } from './sidesheetConfig';
import { useStatusBarConfig } from './statusBarConfig';
import { useTableConfig } from './tableConfig';
import { useModuleCurrentContext } from '@equinor/fusion-framework-react-module-context';

const pbi_context_mapping = {
Facility: {
column: 'Facility',
table: 'Dim_Facility',
},
ProjectMaster: {
column: 'ProjectMaster GUID',
table: 'Dim_ProjectMaster',
},
} as const;

export const WorkspaceWrapper = () => {
const contextId = useContextId();
useCloseSidesheetOnContextChange();
const client = useHttpClient('cc-app');
const { isLoading } = useCCApiAccessCheck(contextId, client, 'mechanical-completion');

const pbi = usePBIOptions('mc-analytics', {
column: 'ProjectMaster GUID',
table: 'Dim_ProjectMaster',
});
const { currentContext } = useModuleCurrentContext();

const pbi = usePBIOptions(
'mc-analytics',
pbi_context_mapping[currentContext?.type.id as 'ProjectMaster' | 'Facility']
);

const { bookmarkKey, currentBookmark, onBookmarkChange } = useWorkspaceBookmarks();

Expand Down

0 comments on commit 315b217

Please sign in to comment.