Skip to content

Commit

Permalink
435 mechanical completion migration (#638)
Browse files Browse the repository at this point in the history
* feat: ♻️ mc migration init

* feat: ✨ grouping and garden description

* fix: 🐛 gettagsize fix

* fix: 🐛 buggy popover fix

* use data.commissioningStatus

* feat: ✨ sidesheet tabs

* merge main

* add ncr to sidesheet

* added url to sidesheet header

* app.config

* resolve
  • Loading branch information
espenkalle authored Dec 6, 2023
1 parent e090891 commit d6247c3
Show file tree
Hide file tree
Showing 36 changed files with 602 additions and 989 deletions.
4 changes: 2 additions & 2 deletions apps/mechanicalcompletion/app.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ export default () => ({
name: name,
},
environment: {
uri: 'https://fusion-s-dataproxy-CI.azurewebsites.net',
defaultScopes: ['5a842df8-3238-415d-b168-9f16a6a6031b/.default'],
uri: 'https://backend-fusion-data-gateway-test.radix.equinor.com',
defaultScopes: ['api://ed6de162-dd30-4757-95eb-0ffc8d34fbe0/access_as_user'],
},
endpoints: {},
});
4 changes: 2 additions & 2 deletions apps/mechanicalcompletion/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import { createRender, RootAppWrapper } from '@cc-components/shared';
import { useHttpClient } from '@equinor/fusion-framework-react-app/http';

const McApp = () => {
const client = useHttpClient('data-proxy');
const client = useHttpClient('cc-app');
return (
<RootAppWrapper client={client}>
<WorkspaceWrapper />
</RootAppWrapper>
);
};

export const render = createRender(McApp, configure, 'Mechanical completion');
export const render = createRender(McApp, configure, 'mechanical-completion');
export default render;
2 changes: 1 addition & 1 deletion libs/mechanicalcompletionapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"@cc-components/mechanicalcompletionshared": "workspace:^",
"@cc-components/mechanicalcompletionsidesheet": "workspace:^",
"@cc-components/shared": "workspace:^",
"@equinor/workspace-fusion": "0.20.4-alpha.6.0"
"@cc-components/sharedcomponents": "workspace:^"
}
}
6 changes: 0 additions & 6 deletions libs/mechanicalcompletionapp/src/lib/config/contextConfig.ts

This file was deleted.

130 changes: 0 additions & 130 deletions libs/mechanicalcompletionapp/src/lib/config/filterConfig.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ export const configure = async (config: IAppConfigurator, c: ComponentRenderArgs

const envConfig: MechEnvConfig = c.env.config?.environment as MechEnvConfig;

if (!envConfig) {
throw new Error('Failed to load environemnt config for workorder');
if (!envConfig.uri) {
throw new Error('Failed to load environemnt config for MC');
}
config.configureHttpClient('data-proxy', {
config.configureHttpClient('cc-app', {
baseUri: envConfig?.uri,
defaultScopes: envConfig?.defaultScopes,
});
Expand All @@ -37,4 +37,5 @@ export const configure = async (config: IAppConfigurator, c: ComponentRenderArgs
type MechEnvConfig = {
uri: string;
defaultScopes: string[];
pr?: string;
};
77 changes: 49 additions & 28 deletions libs/mechanicalcompletionapp/src/lib/config/gardenConfig.tsx
Original file line number Diff line number Diff line change
@@ -1,32 +1,53 @@
import { McPackage } from '@cc-components/mechanicalcompletionshared';
import { GardenConfig } from '@equinor/workspace-fusion/garden';
import { CustomGroupByKeys, ExtendedGardenFields } from '../types';
import { GardenHeader, GardenItem, GardenGroupBy } from '../ui-garden';
import { fieldSettings } from '../utils-garden/fieldSettings';
import { getHighlightedColumn } from '../utils-garden/getHighlightedColumn';
import { getItemWidth } from '../utils-garden/getItemWidth';
import { GardenItem } from '../ui-garden';
import { useGardenDataSource } from '@cc-components/shared/workspace-config';
import { useHttpClient } from '@cc-components/shared';
import { FilterState } from '@equinor/workspace-fusion/filter';

export const gardenConfig: GardenConfig<
McPackage,
ExtendedGardenFields,
CustomGroupByKeys,
Record<'averageTagVolume', number>
> = {
getDisplayName: (item) => item.mcPkgNumber,
customGroupByKeys: {
plannedForecast: 'Planned',
weeklyDaily: 'Weekly',
},
initialGrouping: { horizontalGroupingAccessor: 'rfcmc', verticalGroupingKeys: [] },
fieldSettings: fieldSettings,
customViews: {
customItemView: GardenItem,
customHeaderView: GardenHeader,
customGroupByView: GardenGroupBy,
},
visuals: {
calculateItemWidth: getItemWidth,
highlightHorizontalColumn: getHighlightedColumn,
rowHeight: 30,
},
export const useGardenConfig = (
contextId: string
): GardenConfig<McPackage, FilterState> => {
const client = useHttpClient();

const { getBlockAsync, getGardenMeta, getHeader, getSubgroupItems } =
useGardenDataSource({
getBlockAsync: (requestArgs) =>
client.fetch(
`/api/contexts/${contextId}/mechanical-completion/garden`,
requestArgs
),
getGardenMeta: (requestArgs) =>
client.fetch(
`/api/contexts/${contextId}/mechanical-completion/garden-meta`,
requestArgs
),
getHeader: (requestArgs) =>
client.fetch(
`/api/contexts/${contextId}/mechanical-completion/garden`,
requestArgs
),
getSubgroupItems: (requestArgs) =>
client.fetch(
`/api/contexts/${contextId}/mechanical-completion/subgroup-items`,
requestArgs
),
});

return {
getDisplayName: (item) => item.mechanicalCompletionPackageNo,
initialGrouping: ['RFCC'],
initialDateVariant: 'Planned',
initialTimeInterval: 'Weekly',
getBlockAsync,
getGardenMeta,
getHeader,
getSubgroupItems,
customViews: {
customItemView: GardenItem,
},
visuals: {
rowHeight: 31,
},
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ import { SidesheetConfig } from '@equinor/workspace-fusion/sidesheet';
export const sidesheetConfig: SidesheetConfig<McPackage> = {
type: 'default',
DetailsSidesheet: (props) => (
<McSideSheet.Component
id={props.id}
item={props.item}
closeSidesheet={props.controller.close}
/>
<McSideSheet.Component id={props.id} item={props.item} closeSidesheet={props.close} />
),
};
51 changes: 20 additions & 31 deletions libs/mechanicalcompletionapp/src/lib/config/statusBarConfig.ts
Original file line number Diff line number Diff line change
@@ -1,34 +1,23 @@
import { McPackage } from '@cc-components/mechanicalcompletionshared';
import { numberFormat } from '@cc-components/shared/utils-formatting';
import { useHttpClient } from '@cc-components/shared';
import { StatusBarConfig } from '@equinor/workspace-fusion/status-bar';
import { getStatusBarData } from '../utils-status-bar';
export const statusBarConfig: StatusBarConfig<McPackage> = (data) => {
const kpis = getStatusBarData(data);

return [
{
title: 'Total MCpkgs',
value: numberFormat(kpis.mcPkgsCount),
},
{
title: 'Final punch',
value: numberFormat(kpis.finalPunchCount),
},
{
title: 'Punch status Accepted',
value: numberFormat(kpis.punchAcceptedCount),
},
{
title: 'MC to Com',
value: numberFormat(kpis.mcToComCount),
},
{
title: 'RFCC',
value: numberFormat(kpis.rfccCount),
},
{
title: 'RFCC %',
value: `${numberFormat(kpis.rfccPercentage)}%`,
},
];
export const useStatusBarConfig = (contextId: string): StatusBarConfig => {
const client = useHttpClient();

return async (filters, signal) => {
const res = await client.fetch(
`/api/contexts/${contextId}/mechanical-completion/kpis`,
{
method: 'POST',
body: JSON.stringify({
filter: filters,
}),
signal,
headers: {
['content-type']: 'application/json',
},
}
);
return (await res.json()).map((s: any) => ({ ...s, title: s.name }));
};
};
Loading

0 comments on commit d6247c3

Please sign in to comment.