Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🖌️: Pipetest Frontend #836

Merged
merged 35 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
9988090
Fixed API types and updated mappings in gridC
kjellhaaland Jan 23, 2024
d7d2c9f
Adapted Workorders and Checklist components
kjellhaaland Jan 25, 2024
f340ef8
Added pipetest fetching in sidesheet. Refactored data hooks
kjellhaaland Jan 25, 2024
e49fc76
Added insulation boxes. Cleanup
kjellhaaland Jan 29, 2024
b2c734d
Updated carden setup
kjellhaaland Jan 29, 2024
6dfd4cf
Added TagUrl to PipetestChecklists
kjellhaaland Jan 29, 2024
e1310ba
Added CircuitDiagram/ElectricalNetworks
kjellhaaland Jan 31, 2024
73f30b0
Updated Pipetest model and updated Grid properties.
kjellhaaland Jan 31, 2024
42af3e9
Updated sidesheet to fit with schemas from API. Removed TODOs.
kjellhaaland Jan 31, 2024
23ae1d7
Cleanup and refactoring in Pipetest
kjellhaaland Jan 31, 2024
981c036
Cleanup and refactoring in Pipetest
kjellhaaland Jan 31, 2024
8195947
Merge branch '465-pipetest-frontend' of https://github.com/equinor/cc…
kjellhaaland Feb 1, 2024
4bb1fda
Fixed API types and updated mappings in gridC
kjellhaaland Jan 23, 2024
88e2896
Adapted Workorders and Checklist components
kjellhaaland Jan 25, 2024
eb10b23
Added pipetest fetching in sidesheet. Refactored data hooks
kjellhaaland Jan 25, 2024
533c488
Added insulation boxes. Cleanup
kjellhaaland Jan 29, 2024
8129f66
Updated carden setup
kjellhaaland Jan 29, 2024
bde8dc0
Added TagUrl to PipetestChecklists
kjellhaaland Jan 29, 2024
516d238
Added CircuitDiagram/ElectricalNetworks
kjellhaaland Jan 31, 2024
dbbc6de
Updated Pipetest model and updated Grid properties.
kjellhaaland Jan 31, 2024
9523987
Updated sidesheet to fit with schemas from API. Removed TODOs.
kjellhaaland Jan 31, 2024
54febd6
Cleanup and refactoring in Pipetest
kjellhaaland Jan 31, 2024
3f9e51b
Merge branch '465-pipetest-frontend' of https://github.com/equinor/cc…
kjellhaaland Feb 1, 2024
e7f9bec
Added columns sorting in grid, PipetestNo and support for CircuitDiagram
kjellhaaland Feb 5, 2024
28eb33e
Minor PR-related fixes
kjellhaaland Feb 5, 2024
fd8bcec
Fixed displayName issues in Garden.
kjellhaaland Feb 5, 2024
5194f90
Fixed import
kjellhaaland Feb 6, 2024
54ecc5c
Fixed punch build error
kjellhaaland Feb 6, 2024
b4408a9
Updated FAM Models
kjellhaaland Feb 7, 2024
c811fce
Merge branch 'main' into 465-pipetest-frontend
kjellhaaland Feb 7, 2024
7523219
Updated Pipetest SidesheetHeader with url/button and description.
kjellhaaland Feb 7, 2024
e75d532
Added new fields to grid
kjellhaaland Feb 8, 2024
85f9ed0
Changed garden item height
kjellhaaland Feb 8, 2024
ac772a5
Adjustments after testing
kjellhaaland Feb 8, 2024
1034125
Updated field name for MC Location
kjellhaaland Feb 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/piping/app.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export default () => ({
},
environment: {
uri: 'https://backend-fusion-data-gateway-test.radix.equinor.com',
electricalUri:
'https://electrical-consumers-fusion-data-gateway-test.radix.equinor.com',
kjellhaaland marked this conversation as resolved.
Show resolved Hide resolved
defaultScopes: ['api://ed6de162-dd30-4757-95eb-0ffc8d34fbe0/access_as_user'],
},
endpoints: {},
Expand Down
3 changes: 3 additions & 0 deletions apps/piping/app.config.local.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ export default () => ({
},
environment: {
uri: 'https://localhost:7074',
electricalUri:
'https://electrical-consumers-fusion-data-gateway-test.radix.equinor.com',
// electricalUri: 'https://localhost:7075',
defaultScopes: ['api://ed6de162-dd30-4757-95eb-0ffc8d34fbe0/access_as_user'],
},
endpoints: {},
Expand Down
7 changes: 6 additions & 1 deletion libs/pipingapp/src/lib/config/frameworkConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export const configure = async (config: IAppConfigurator, c: ComponentRenderArgs
});
});
});
// Add more config if needed, e.g. enableAgGrid

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

Expand All @@ -32,10 +31,16 @@ export const configure = async (config: IAppConfigurator, c: ComponentRenderArgs
defaultScopes: envConfig?.defaultScopes,
});

config.configureHttpClient('electrical-api', {
baseUri: envConfig?.electricalUri,
defaultScopes: envConfig?.defaultScopes,
});

enableAgGrid(config);
};

type PipingEnvConfig = {
uri: string;
electricalUri: string;
defaultScopes: string[];
};
4 changes: 2 additions & 2 deletions libs/pipingapp/src/lib/config/gardenConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export const useGardenConfig = (
getGardenMeta,
getHeader,
getSubgroupItems,
getDisplayName: (item) => item.id,
initialGrouping: ['Priority1'],
getDisplayName: (item) => item.pipetestNo,
initialGrouping: ['RFC'],
customViews: {
customItemView: GardenItem as any,
},
Expand Down
49 changes: 30 additions & 19 deletions libs/pipingapp/src/lib/config/tableConfig.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ColDef, GridConfig, ICellRendererProps } from '@equinor/workspace-fusion/grid';
import { CheckList, Pipetest } from '@cc-components/pipingshared';
import { Pipetest } from '@cc-components/pipingshared';
import { FilterState } from '@equinor/workspace-fusion/filter';
import {
defaultGridOptions,
Expand All @@ -11,8 +11,7 @@ import {
StyledMonospace,
useHttpClient,
} from '@cc-components/shared';
import { generateCommaSeperatedStringArrayColumn } from '../utils-table/generateCommaSeperatedStringArrayColumn';
import { getHTList } from '../utils-table/tableHelpers';
import { generateCommaSeperatedString } from '../utils-table/tableHelpers';

export const useTableConfig = (contextId: string): GridConfig<Pipetest, FilterState> => {
const client = useHttpClient();
Expand Down Expand Up @@ -46,47 +45,59 @@ export const useTableConfig = (contextId: string): GridConfig<Pipetest, FilterSt
const columnDefinitions: [ColDef<Pipetest>, ...ColDef<Pipetest>[]] = [
{
headerName: 'Pipetest',
valueGetter: (pkg) => pkg.data?.id,
colId: 'pipetestNo',
kjellhaaland marked this conversation as resolved.
Show resolved Hide resolved
valueGetter: (element) => element.data?.pipetestNo,
cellRenderer: (props: ICellRendererProps<Pipetest, string>) => {
return <StyledMonospace>{props.value}</StyledMonospace>;
},
},
{
headerName: 'Description',
colId: 'description',
valueGetter: (pkg) => pkg.data?.description,
valueGetter: (element) => element.data?.description,
cellRenderer: (props: ICellRendererProps<Pipetest, string | null>) => {
return <DescriptionCell description={props.value} />;
},
width: 300,
},
{ headerName: 'Priority', valueGetter: (pkg) => pkg.data?.commPkPriority1 },
{
headerName: 'Priority1',
colId: 'priority1',
valueGetter: (element) => element.data?.priority1,
},
{
headerName: 'Location',
valueGetter: (pkg) => pkg.data?.location,
colId: 'location',
valueGetter: (element) => element.data?.location,
cellRenderer: (props: ICellRendererProps<Pipetest, string>) => {
return <StyledMonospace>{props.value}</StyledMonospace>;
},
},
{ headerName: 'Checklist status', valueGetter: (pkg) => 't.b.d :D' },
{ headerName: 'Current step', valueGetter: (pkg) => 't.b.d :D' },
{
headerName: 'Checklist status',
colId: 'formStatus',
valueGetter: (element) => element.data?.formStatus,
},
{
headerName: 'Current step',
colId: 'currentStep',
valueGetter: (element) => element.data?.checklistStep,
},
{
headerName: 'RFC',
valueGetter: (pkg) => pkg.data?.rfccPlanned,
colId: 'rfCPlannedForecastDate',
valueGetter: (element) => element.data?.rfCPlannedForecastDate,
cellRenderer: (props: ICellRendererProps<Pipetest, string | null | undefined>) => {
return props.value ? <DateCell dateString={props.value} /> : null;
},
},
{
headerName: 'HT cables',
valueGetter: (pkg) => pkg.data?.checkLists,
cellRenderer: (props: ICellRendererProps<Pipetest, CheckList[]>) => {
if (!props.value) return null;
return (
<StyledMonospace>
{generateCommaSeperatedStringArrayColumn(getHTList(props.value))}
</StyledMonospace>
);
colId: "heatTraceCableNos",
valueGetter: (element) => element.data?.heatTraceCableNos,
cellRenderer: (props: ICellRendererProps<Pipetest, string | null>) => {
const values = generateCommaSeperatedString(props.data?.heatTraceCableNos ?? []);
return <DescriptionCell description={values} />;
},
},
];
];
1 change: 1 addition & 0 deletions libs/pipingapp/src/lib/config/workspaceConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const WorkspaceWrapper = () => {
if (isLoading) {
return <CCApiAccessLoading />;
}

return (
<Workspace
key={contextId + bookmarkKey}
Expand Down
33 changes: 17 additions & 16 deletions libs/pipingapp/src/lib/ui-garden/Item.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { pipetestStatusColormap } from '@cc-components/shared/mapping';
import { colorMap } from '@cc-components/shared/mapping';
import { CustomItemView } from '@equinor/workspace-fusion/garden';
import { memo, useMemo, useRef, useState } from 'react';
import {
Expand All @@ -9,6 +9,8 @@ import {
StyledStatusCircles,
} from './garden.styles';
import { Pipetest } from 'libs/pipingshared/dist/src';
import { PackageStatus, PopoverWrapper } from '@cc-components/shared';
import { getPipetestStatusColors } from '../utils-garden/getPipetestStatusColors';

const PipetestGardenItem = (props: CustomItemView<Pipetest>) => {
const [isOpen, setIsOpen] = useState(false);
Expand All @@ -33,6 +35,8 @@ const PipetestGardenItem = (props: CustomItemView<Pipetest>) => {
const width = useMemo(() => (depth ? 100 - depth * 3 : 100), [depth]);
const maxWidth = useMemo(() => itemWidth * 0.98, [itemWidth]);

const colors = getPipetestStatusColors(data);

return (
<>
<StyledRoot>
Expand All @@ -46,45 +50,42 @@ const PipetestGardenItem = (props: CustomItemView<Pipetest>) => {
hoverTimeout && clearTimeout(hoverTimeout);
setIsOpen(false);
}}
backgroundColor={'green'}
backgroundColor={colors.backgroundColor}
onClick={onClick}
style={{ width: `${columnExpanded ? 100 : width}%`, maxWidth }}
isSelected={isSelected}
>
<StyledItemText>{displayName.replace('@PIPETEST-', '')}</StyledItemText>
<StyledItemText>{displayName}</StyledItemText>
<StyledStatusCircles
mcColor={
data.shortformCompletionStatus
? pipetestStatusColormap[data.shortformCompletionStatus]
data.mechanicalCompletionStatus
? colorMap[data.mechanicalCompletionStatus as PackageStatus]
: null
}
commColor={
data.shortformCompletionStatus
? pipetestStatusColormap[data.shortformCompletionStatus]
data.commissioningStatus
? colorMap[data.commissioningStatus as PackageStatus]
: null
}
/>
</StyledItemWrapper>

{columnExpanded && (
<StyledDescription title={data.description ?? ''}>
{data.description}
</StyledDescription>
<StyledDescription title={data.id ?? ''}>{data.description}</StyledDescription>
)}
</StyledRoot>

{/* {isOpen && (
{isOpen && (
<PopoverWrapper
isOpen={isOpen}
rowStart={rowStart}
columnStart={columnStart}
width={itemWidth}
parentRef={parentRef}
popoverTitle={`${data.loopNo}`}
>
<PopoverContent loop={data} />
</PopoverWrapper>
)} */}
popoverTitle={data.description}
close={() => setIsOpen(false)}
/>
)}
</>
);
};
Expand Down
22 changes: 9 additions & 13 deletions libs/pipingapp/src/lib/ui-garden/garden.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,30 +45,26 @@ type StatusCirclesProps = {
};
export const StyledStatusCircles = styled.div<StatusCirclesProps>`
display: flex;
grid-column: 2/3;
grid-column: 3/4;
justify-content: end;
align-items: center;

::before {
width: ${(props) => (props.mcColor ? '12px' : '13px')};
height: ${(props) => (props.mcColor ? '12px' : '13px')};
border: ${(props) => (props.mcColor ? '1px solid white' : `none`)};
background-color: ${(props) => props.mcColor ?? 'white'};
width: 12px;
height: 12px;
border: 1px solid white;
background-color: ${(props) => props.mcColor};
border-radius: 50%;
margin: 0px 1px;
outline: ${(props) => (props.mcColor ? 'none' : `1px dashed gray`)};
outline-offset: -1px;
content: ' ';
}
::after {
width: ${(props) => (props.commColor ? '12px' : '13px')};
height: ${(props) => (props.commColor ? '12px' : '13px')};
border: ${(props) => (props.commColor ? '1px solid white' : `none`)};
background-color: ${(props) => props.commColor ?? 'white'};
width: 12px;
height: 12px;
border: 1px solid white;
background-color: ${(props) => props.commColor};
border-radius: 50%;
margin: 0px 1px;
outline: ${(props) => (props.commColor ? 'none' : `1px dashed gray`)};
outline-offset: -2px;
content: ' ';
}
`;
Expand Down
12 changes: 12 additions & 0 deletions libs/pipingapp/src/lib/utils-garden/getPipetestStatusColors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Pipetest } from '@cc-components/pipingshared';
import { pipetestStatusColormap } from '@cc-components/shared/mapping';
import { BaseStatus } from 'libs/shared/dist/src/packages';

type PackageStatusReturn = {
backgroundColor: string;
};

export const getPipetestStatusColors = (data: Pipetest): PackageStatusReturn => {
const backgroundColor = pipetestStatusColormap[data.formStatus as BaseStatus];
return { backgroundColor };
};

This file was deleted.

12 changes: 8 additions & 4 deletions libs/pipingapp/src/lib/utils-table/tableHelpers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { CheckList } from '@cc-components/pipingshared';
export const generateCommaSeperatedString = (array: string[], length: number = 3): string => {
const value = array.slice(0, length).join(', ');

export function getHTList(checkLists: CheckList[]): string[] {
return checkLists.filter((x) => x.isHeatTrace).map((ht: CheckList) => ht.tagNo);
}
if (array.length > length) {
return `${value} (+${array.length - length})`;
}

return value;
};
Loading
Loading