diff --git a/apps/swcr/src/main.tsx b/apps/swcr/src/main.tsx index 48d181555..31f6b7908 100644 --- a/apps/swcr/src/main.tsx +++ b/apps/swcr/src/main.tsx @@ -1,6 +1,6 @@ +import { createRender, RootAppWrapper } from '@cc-components/shared'; import { configure, WorkspaceWrapper } from '@cc-components/swcrapp'; import { useHttpClient } from '@equinor/fusion-framework-react-app/http'; -import { createRender, RootAppWrapper } from '@cc-components/shared'; const SwcrApp = () => { const client = useHttpClient('cc-api'); diff --git a/libs/shared/src/packages/sidesheet/src/lib/sidesheet/tabs/swcr/SwcrTab.tsx b/libs/shared/src/packages/sidesheet/src/lib/sidesheet/tabs/swcr/SwcrTab.tsx index 90e19e940..1bf96b9b1 100644 --- a/libs/shared/src/packages/sidesheet/src/lib/sidesheet/tabs/swcr/SwcrTab.tsx +++ b/libs/shared/src/packages/sidesheet/src/lib/sidesheet/tabs/swcr/SwcrTab.tsx @@ -1,6 +1,6 @@ import { TabTable } from '../../../../../../table-helpers/src/lib/table/TabTable/TabTable'; import { StyledContentWrapper } from '@cc-components/sharedcomponents'; -import { columns } from './columns'; +import { columns } from './detailsColumns'; import { SwcrBase } from './types'; type SwcrTabProps = { diff --git a/libs/shared/src/packages/sidesheet/src/lib/sidesheet/tabs/swcr/columns.tsx b/libs/shared/src/packages/sidesheet/src/lib/sidesheet/tabs/swcr/detailsColumns.tsx similarity index 96% rename from libs/shared/src/packages/sidesheet/src/lib/sidesheet/tabs/swcr/columns.tsx rename to libs/shared/src/packages/sidesheet/src/lib/sidesheet/tabs/swcr/detailsColumns.tsx index 5b329f0d9..6083c0b28 100644 --- a/libs/shared/src/packages/sidesheet/src/lib/sidesheet/tabs/swcr/columns.tsx +++ b/libs/shared/src/packages/sidesheet/src/lib/sidesheet/tabs/swcr/detailsColumns.tsx @@ -1,42 +1,42 @@ -import { ColDef, ICellRendererProps } from '@equinor/workspace-ag-grid'; - -import { DescriptionCell } from '../../../../../../table-helpers/src/lib/table/cells/DescriptionCell'; -import { LinkCell } from '../../../../../../table-helpers/src/lib/table/cells/LinkCell'; -import { SwcrBase } from './types'; - -export const columns: ColDef[] = [ - { - field: '#', - valueGetter: (pkg) => pkg.data?.softwareChangeRecordNo, - cellRenderer: (props: ICellRendererProps) => { - return ( - - ); - }, - minWidth: 100, - }, - { - field: 'Description', - valueGetter: (pkg) => pkg.data?.description, - cellRenderer: (props: ICellRendererProps) => ( - - ), - flex: 1, - minWidth: 200, - }, - { - field: 'Status', - valueGetter: (pkg) => pkg.data?.status, - flex: 1, - minWidth: 100, - }, - { - field: 'Priority', - valueGetter: (pkg) => pkg.data?.priority, - flex: 1, - minWidth: 100, - }, -]; +import { ColDef, ICellRendererProps } from '@equinor/workspace-ag-grid'; + +import { DescriptionCell } from '../../../../../../table-helpers/src/lib/table/cells/DescriptionCell'; +import { LinkCell } from '../../../../../../table-helpers/src/lib/table/cells/LinkCell'; +import { SwcrBase } from './types'; + +export const columns: ColDef[] = [ + { + field: '#', + valueGetter: (pkg) => pkg.data?.softwareChangeRecordNo, + cellRenderer: (props: ICellRendererProps) => { + return ( + + ); + }, + minWidth: 100, + }, + { + field: 'Description', + valueGetter: (pkg) => pkg.data?.description, + cellRenderer: (props: ICellRendererProps) => ( + + ), + flex: 1, + minWidth: 200, + }, + { + field: 'Status', + valueGetter: (pkg) => pkg.data?.status, + flex: 1, + minWidth: 100, + }, + { + field: 'Priority', + valueGetter: (pkg) => pkg.data?.priority, + flex: 1, + minWidth: 100, + }, +]; diff --git a/libs/shared/src/packages/sidesheet/src/lib/sidesheet/tabs/swcr/types.ts b/libs/shared/src/packages/sidesheet/src/lib/sidesheet/tabs/swcr/types.ts index 23c8f2d8b..a6d112725 100644 --- a/libs/shared/src/packages/sidesheet/src/lib/sidesheet/tabs/swcr/types.ts +++ b/libs/shared/src/packages/sidesheet/src/lib/sidesheet/tabs/swcr/types.ts @@ -1,8 +1,8 @@ export type SwcrBase = { softwareChangeRecordNo: string; - softwareChangeRecordId: string; softwareChangeRecordUrl: string; - status: string; + softwareChangeRecordId: string; description: string; priority: string; + status: string; }; diff --git a/libs/swcrapp/package.json b/libs/swcrapp/package.json index c39809eba..f571376ad 100644 --- a/libs/swcrapp/package.json +++ b/libs/swcrapp/package.json @@ -12,7 +12,6 @@ "@cc-components/shared": "workspace:^", "@cc-components/swcrshared": "workspace:^", "@cc-components/swcrsidesheet": "workspace:^", - "@equinor/workspace-fusion": "5.1.0", "@cc-components/sharedcomponents": "workspace:^" } } diff --git a/libs/swcrapp/src/lib/config/filterConfig.tsx b/libs/swcrapp/src/lib/config/filterConfig.tsx deleted file mode 100644 index 1997d9463..000000000 --- a/libs/swcrapp/src/lib/config/filterConfig.tsx +++ /dev/null @@ -1,112 +0,0 @@ -// import { SwcrPackage, SwcrStatus } from '@cc-components/swcrshared'; -// import { FilterConfig } from '@equinor/workspace-fusion/filter'; -// import { StatusFilter } from '../ui-filter'; -// import { -// getLatestSignedRankingKey, -// getNextSignatureRoleKeys, -// getNextToSignKeys, -// } from '../utils-keys'; -// import { sortBySwcrStatusPriority } from '../utils-statuses'; - -// export const filterConfig: FilterConfig[] = { -// filterGroups: [ -// { -// name: 'Status', -// valueFormatter: ({ status }) => status, -// isQuickFilter: true, -// sort: (filterValues) => -// filterValues.sort((a, b) => sortBySwcrStatusPriority(a as string, b as string)), -// customValueRender: (value) => { -// return ; -// }, -// }, -// { -// name: 'Project identifier', -// valueFormatter: ({ projectIdentifier }) => projectIdentifier, -// defaultHidden: true, -// }, -// { -// name: 'Contract', -// valueFormatter: ({ contract }) => contract, -// isQuickFilter: true, -// }, -// { -// name: 'Supplier', -// valueFormatter: ({ supplier }) => (supplier ? supplier : null), -// isQuickFilter: true, -// }, -// { -// name: 'System', -// valueFormatter: ({ system }) => system, -// isQuickFilter: true, -// }, -// { -// name: 'Types', -// valueFormatter: ({ types }) => (types.length > 0 ? types.split(',') : []), -// isQuickFilter: true, -// }, -// { -// name: 'Plant', -// valueFormatter: ({ siteCode }) => siteCode, -// defaultHidden: true, -// }, -// { -// name: 'Priority', -// valueFormatter: ({ priority }) => (priority ? priority : null), -// defaultHidden: false, -// }, -// { -// name: 'Control system', -// valueFormatter: ({ controlSystem }) => controlSystem, -// defaultHidden: true, -// }, -// { -// name: 'Next signature by', -// valueFormatter: (swcr) => getNextToSignKeys(swcr, ''), -// }, -// { -// name: 'Next signature role', -// valueFormatter: (swcr) => getNextSignatureRoleKeys(swcr, ''), -// }, -// { -// name: 'Last signed ranking', -// valueFormatter: (swcr) => getLatestSignedRankingKey(swcr, ''), -// defaultHidden: true, -// }, -// { -// name: 'Action', -// valueFormatter: ({ action }) => action, -// defaultHidden: true, -// }, -// { -// name: 'Node', -// valueFormatter: ({ node }) => node, -// defaultHidden: true, -// }, -// { -// name: 'Estimated manhours', -// valueFormatter: ({ estimatedManhours }) => estimatedManhours, -// defaultHidden: true, -// }, -// { -// name: 'COMMPK no', -// valueFormatter: ({ cpkgNo }) => cpkgNo, -// defaultHidden: true, -// }, -// { -// name: 'COMM phase', -// valueFormatter: ({ cpkgPhase }) => cpkgPhase, -// defaultHidden: true, -// }, -// { -// name: 'Other references', -// valueFormatter: ({ referenceTypes }) => referenceTypes, -// defaultHidden: true, -// }, -// { -// name: 'Due date', -// valueFormatter: ({ dueAtDate }) => dueAtDate, -// defaultHidden: true, -// }, -// ], -// }; diff --git a/libs/swcrapp/src/lib/config/gardenConfig.tsx b/libs/swcrapp/src/lib/config/gardenConfig.tsx index 1e5641972..b89aa1b8f 100644 --- a/libs/swcrapp/src/lib/config/gardenConfig.tsx +++ b/libs/swcrapp/src/lib/config/gardenConfig.tsx @@ -1,12 +1,13 @@ -import { SwcrPackage } from '@cc-components/swcrshared'; -import { GardenConfig } from '@equinor/workspace-fusion/garden'; -import SwcrItem from '../ui-garden/Item'; -import { FilterState } from '@equinor/workspace-fusion/filter'; import { useGardenDataSource } from '@cc-components/shared/workspace-config'; +import { SwcrPackage } from '@cc-components/swcrshared'; import { useHttpClient } from '@equinor/fusion-framework-react-app/http'; +import { FilterState } from '@equinor/workspace-fusion/filter'; +import { GardenConfig } from '@equinor/workspace-fusion/garden'; +import SwcrItem from '../ui-garden/Item'; - -export const useGardenConfig = (contextId: string): GardenConfig => { +export const useGardenConfig = ( + contextId: string +): GardenConfig => { const client = useHttpClient('cc-api'); const { getBlockAsync, getGardenMeta, getHeader, getSubgroupItems } = useGardenDataSource({ @@ -24,7 +25,7 @@ export const useGardenConfig = (contextId: string): GardenConfig item.softwareChangeRecordNo, - initialGrouping: ['System'], + initialGrouping: ['RFC_PlannedDate'], visuals: { rowHeight: 25, }, diff --git a/libs/swcrapp/src/lib/config/index.ts b/libs/swcrapp/src/lib/config/index.ts index 478a11122..95d225774 100644 --- a/libs/swcrapp/src/lib/config/index.ts +++ b/libs/swcrapp/src/lib/config/index.ts @@ -1,2 +1,2 @@ -export { WorkspaceWrapper } from './workspaceConfig'; export { configure } from './frameworkConfig'; +export { WorkspaceWrapper } from './workspaceConfig'; diff --git a/libs/swcrapp/src/lib/config/sidesheetConfig.tsx b/libs/swcrapp/src/lib/config/sidesheetConfig.tsx index e44d37318..eb9f68ae0 100644 --- a/libs/swcrapp/src/lib/config/sidesheetConfig.tsx +++ b/libs/swcrapp/src/lib/config/sidesheetConfig.tsx @@ -1,6 +1,6 @@ -import { SidesheetConfig } from '@equinor/workspace-fusion/sidesheet'; -import { SwcrSidesheet } from '@cc-components/swcrsidesheet'; import { SwcrPackage } from '@cc-components/swcrshared'; +import { SwcrSidesheet } from '@cc-components/swcrsidesheet'; +import { SidesheetConfig } from '@equinor/workspace-fusion/sidesheet'; export const sidesheetConfig: SidesheetConfig = { type: 'default', DetailsSidesheet: (props) => ( diff --git a/libs/swcrapp/src/lib/config/statusBarConfig.ts b/libs/swcrapp/src/lib/config/statusBarConfig.ts index 2909012da..34242cd0f 100644 --- a/libs/swcrapp/src/lib/config/statusBarConfig.ts +++ b/libs/swcrapp/src/lib/config/statusBarConfig.ts @@ -1,8 +1,8 @@ +import { useHttpClient } from '@cc-components/shared'; import { StatusBarConfig } from '@equinor/workspace-fusion/status-bar'; -import { useHttpClient } from '@equinor/fusion-framework-react-app/http'; export const useStatusBarConfig = (contextId: string): StatusBarConfig => { - const client = useHttpClient('cc-api'); + const client = useHttpClient(); return async (filters, signal) => { const res = await client.fetch(`/api/contexts/${contextId}/SWCR/kpis`, { diff --git a/libs/swcrapp/src/lib/config/tableConfig.tsx b/libs/swcrapp/src/lib/config/tableConfig.tsx index 405c2c1d6..f0852de68 100644 --- a/libs/swcrapp/src/lib/config/tableConfig.tsx +++ b/libs/swcrapp/src/lib/config/tableConfig.tsx @@ -1,14 +1,15 @@ +import { useHttpClient } from '@cc-components/shared'; import { DescriptionCell, - StyledMonospace, LinkCell, + StyledMonospace, } from '@cc-components/shared/table-helpers'; import { DataResponse, defaultGridOptions, useGridDataSource, } from '@cc-components/shared/workspace-config'; -import { useHttpClient } from '@equinor/fusion-framework-react-app/http'; +import { SwcrPackage } from '@cc-components/swcrshared'; import { FilterState } from '@equinor/workspace-fusion/filter'; import { ColDef, @@ -17,10 +18,11 @@ import { ICellRendererProps, MenuModule, } from '@equinor/workspace-fusion/grid'; -import { SwcrPackage } from 'libs/swcrshared/dist/src'; -export const useTableConfig = (contextId: string): GridConfig => { - const client = useHttpClient('cc-api'); +export const useTableConfig = ( + contextId: string +): GridConfig => { + const client = useHttpClient(); const { getRows, colDefs } = useGridDataSource(async (req) => { const res = await client.fetch(`/api/contexts/${contextId}/SWCR/grid`, req); @@ -51,192 +53,142 @@ export const useTableConfig = (contextId: string): GridConfig[] = [ - { - colId: 'SwcrNo', - field: 'SWCRs', - headerName: 'Software Change Requests', - valueGetter: (pkg) => pkg.data?.softwareChangeRecordNo, - cellRenderer: (props: ICellRendererProps) => { - if (!props.data?.swcrUrl || !props.data?.softwareChangeRecordNo) { - return null; - } - return ; - }, - onCellClicked: () => {}, - }, - // valueFormatter: (pkg) => - // pkg.data?.swcrId ? proCoSysUrls.getSwcrUrl(pkg.data.swcrId) : '', - // cellRenderer: (props: ICellRendererProps) => { - // if (!props.valueFormatted) { - // return null; - // } - // return ; - // }, - { - - colId: 'Title', - field: 'Title', - headerTooltip: 'Title', - valueGetter: (pkg) => pkg.data?.title, - cellRenderer: (props: ICellRendererProps) => { - return ; - }, - width: 500, - }, - { - colId: 'Contract', - field: 'Contract', - headerTooltip: 'Contract', - valueGetter: (pkg) => pkg.data?.contract, - width: 200, + { + colId: 'SwcrNo', + field: 'SWCRs', + headerName: 'Software Change Requests', + valueGetter: (pkg) => pkg.data?.softwareChangeRecordNo, + cellRenderer: (props: ICellRendererProps) => { + if (!props.data?.swcrUrl || !props.data?.softwareChangeRecordNo) { + return null; + } + return ( + + ); }, - { - colId: 'System', - field: 'System', - headerTooltip: 'System', - valueGetter: (pkg) => pkg.data?.system, - cellRenderer: (props: ICellRendererProps) => { - return {props.data?.system}; - }, - enableRowGroup: true, - width: 150, + onCellClicked: () => {}, + }, + { + colId: 'Title', + field: 'Title', + headerTooltip: 'Title', + valueGetter: (pkg) => pkg.data?.title, + cellRenderer: (props: ICellRendererProps) => { + return ; }, - { - colId: 'Status', - field: 'Status', - headerTooltip: 'Status', - valueGetter: (pkg) => pkg.data?.status, - enableRowGroup: true, - width: 200, + width: 500, + }, + { + colId: 'Contract', + field: 'Contract', + headerTooltip: 'Contract', + valueGetter: (pkg) => pkg.data?.contract, + width: 200, + }, + { + colId: 'System', + field: 'System', + headerTooltip: 'System', + valueGetter: (pkg) => pkg.data?.system, + cellRenderer: (props: ICellRendererProps) => { + return {props.data?.system}; }, - // next sign by will be included with "Next sign role" - // { - // field: 'Next sign by', - // headerTooltip: 'Next sign by', - // valueGetter: (pkg) => pkg.data?.nextToSign, - // enableRowGroup: true, - // width: 400, - // }, - - // { - // field: 'Next sign by', - // headerTooltip: 'Next Sign by ', - // valueGetter: (pkg) => pkg.data?.nextToSign, - // cellRenderer: (props: ICellRendererProps) => { - // if (!props.data) { - // return null; - // } else { - // const keys = getNextToSignKeys(props.data, ''); - // return ( - //
- // {keys} - //
- // ); - // } - // }, - // width: 400, - // }, - { - //TODO SJEKK med Atle - colId: 'NextSignBy', - field: 'Next Sign Role', - headerTooltip: 'Next Sign Role', - valueGetter: (pkg) => { - const ranking = pkg.data?.nextToSignRanking ?? '(blank)'; - const role = pkg.data?.nextToSign ?? '(blank)'; - return `${ranking}: ${role}`; - }, - enableRowGroup: true, - width: 300, + enableRowGroup: true, + width: 150, + }, + { + colId: 'Status', + field: 'Status', + headerTooltip: 'Status', + valueGetter: (pkg) => pkg.data?.status, + enableRowGroup: true, + width: 200, + }, + // next sign by will be included with "Next sign role" + { + colId: 'NextSignBy', + field: 'Next sign by', //denne heter functionalrole i FAM. + headerTooltip: 'Next Sign by', + valueGetter: (pkg) => { + const ranking = pkg.data?.nextToSignRanking ?? ''; + const role = pkg.data?.nextToSignFunctionalRole ?? ''; + return (ranking || role) ? `${ranking}: ${role}` : ''; }, - { - colId: 'LatestSignBy', - field: 'Lastest Signed Role', - headerTooltip: 'Lastest Signed Role', - valueGetter: (pkg) => { - const ranking = pkg.data?.latestSignedRanking ?? '(blank)'; - const role = pkg.data?.latestSignedRole ?? '(blank)'; - return `${ranking}: ${role}`; - }, - enableRowGroup: true, - width: 300, + width: 400, + }, + { + colId: 'NextSignRole', + field: 'Next Sign Role', + headerTooltip: 'Next Sign Role', + valueGetter: (pkg) => { + const ranking = pkg.data?.nextToSignRanking ?? ''; + const role = pkg.data?.nextToSignRole ?? ''; + return (ranking || role) ? `${ranking}: ${role}` : ''; }, - - // { - // field: 'Next sign role', - // headerTooltip: 'Next Sign Role', - // valueGetter: (pkg) => pkg.data?.nextSignRanking, - // cellRenderer: (props: ICellRendererProps) => { - // if (!props.data) { - // return null; - // } else { - // const keys = getNextSignatureRoleKeys(props.data, ''); - // return ( - //
- // {keys} - //
- // ); - // } - // }, - // width: 300, - // }, - { - colId: 'Supplier', - field: 'Supplier', - headerTooltip: 'Supplier', - valueGetter: (pkg) => pkg.data?.supplier, - width: 150, + enableRowGroup: true, + minWidth: 200, + }, + { + colId: 'LatestSignBy', + field: 'Latest Sign By', + headerTooltip: 'Latest Sign By', + valueGetter: (pkg) => { + const ranking = pkg.data?.latestSignedRanking ?? ''; + const role = pkg.data?.latestSignedRoleFunctionalRole ?? ''; + return (ranking || role) ? `${ranking}: ${role}` : ''; }, - // { - // field: 'Types', - // headerTooltip: 'Types', - // valueGetter: (pkg) => pkg.data?.types, - // cellRenderer: (props: ICellRendererProps) => { - // if (!props.data) { - // return null; - // } else { - // const keys = getTypeKeys(props.data, ''); - // return
{keys}
; - // } - // }, - // enableRowGroup: true, - // width: 150, - // }, - { - colId: 'Priority', - field: 'Priority', - headerTooltip: 'Priority', - valueGetter: (pkg) => pkg.data?.priority, - enableRowGroup: true, - width: 150, - }, - { - colId: 'AutomationControlSystem', - field: 'Control System', - headerTooltip: 'Control System', - valueGetter: (pkg) => pkg.data?.automationControlSystem, - width: 200, + }, + + { + colId: 'LatestSignByRole', + field: 'Latest Signed By Role', + headerTooltip: 'Latest Signed Role', + valueGetter: (pkg) => { + const ranking = pkg.data?.latestSignedRanking ?? ''; + const role = pkg.data?.latestSignedRole ?? ''; + return (ranking || role) ? `${ranking}: ${role}` : ''; }, - { - colId: 'Node', - field: 'Node', - headerTooltip: 'Node', - valueGetter: (pkg) => pkg.data?.nodeIdentifier, - cellRenderer: (props: ICellRendererProps) => { - return {props.data?.nodeIdentifier}; - }, - width: 150, + enableRowGroup: true, + width: 300, + }, + { + colId: 'Supplier', + field: 'Supplier', + headerTooltip: 'Supplier', + valueGetter: (pkg) => pkg.data?.supplier, + width: 150, + }, + { + colId: 'Types', + field: 'Types', + headerTooltip: 'Types', + valueGetter: (pkg) => pkg.data?.swcrTypes, + enableRowGroup: true, + width: 150, + }, + { + colId: 'Priority', + field: 'Priority', + headerTooltip: 'Priority', + valueGetter: (pkg) => pkg.data?.priority, + enableRowGroup: true, + width: 150, + }, + { + colId: 'AutomationControlSystem', + field: 'Control System', + headerTooltip: 'Control System', + valueGetter: (pkg) => pkg.data?.automationControlSystem, + width: 200, + }, + { + colId: 'Node', + field: 'Node', + headerTooltip: 'Node', + valueGetter: (pkg) => pkg.data?.nodeIdentifier, + cellRenderer: (props: ICellRendererProps) => { + return {props.data?.nodeIdentifier}; }, - ]; + width: 150, + }, +]; diff --git a/libs/swcrapp/src/lib/config/workspaceConfig.tsx b/libs/swcrapp/src/lib/config/workspaceConfig.tsx index aecdda7ec..1998a9c41 100644 --- a/libs/swcrapp/src/lib/config/workspaceConfig.tsx +++ b/libs/swcrapp/src/lib/config/workspaceConfig.tsx @@ -4,19 +4,19 @@ import { useHttpClient, usePBIOptions, } from '@cc-components/shared'; -import { CCApiAccessLoading } from '@cc-components/sharedcomponents'; import { useFilterConfig } from '@cc-components/shared/workspace-config'; +import { CCApiAccessLoading } from '@cc-components/sharedcomponents'; import Workspace from '@equinor/workspace-fusion'; import { sidesheetConfig } from './sidesheetConfig'; -import { powerBiModule } from '@equinor/workspace-fusion/power-bi-module'; import { gardenModule } from '@equinor/workspace-fusion/garden-module'; import { gridModule } from '@equinor/workspace-fusion/grid-module'; +import { powerBiModule } from '@equinor/workspace-fusion/power-bi-module'; -import { useTableConfig } from './tableConfig'; -import { useStatusBarConfig } from './statusBarConfig'; import { useGardenConfig } from './gardenConfig'; +import { useStatusBarConfig } from './statusBarConfig'; +import { useTableConfig } from './tableConfig'; export const WorkspaceWrapper = () => { const contextId = useContextId(); diff --git a/libs/swcrapp/src/lib/ui-garden/Grouped.tsx b/libs/swcrapp/src/lib/ui-garden/Grouped.tsx deleted file mode 100644 index ed81b413f..000000000 --- a/libs/swcrapp/src/lib/ui-garden/Grouped.tsx +++ /dev/null @@ -1,41 +0,0 @@ -// import { CustomGroupView } from '@equinor/workspace-fusion/garden'; -// import { -// StyledChevron, -// StyledCount, -// StyledGroupedTitle, -// StyledGroupText, -// StyledSwcrGroup, -// } from './garden.styles'; -// import { Icon } from '@equinor/eds-core-react'; -// import { tokens } from '@equinor/eds-tokens'; -// import { memo } from 'react'; -// import { SwcrPackage } from '@cc-components/swcrshared'; - -// export const ChevronUp = (): JSX.Element => ( -// -// ); - -// export const ChevronDown = (): JSX.Element => ( -// -// ); - -// export const ChevronRight = (): JSX.Element => ( -// -// ); - -// const SwcrGrouped = (props: CustomGroupView) => { -// const { data, onClick } = props; - -// return ( -// -// {/* {data.status?.statusElement} */} -// -// {data.value} -// ({data.count}) -// -// {data.isExpanded ? : } -// -// ); -// }; - -// export const GardenGrouped = memo(SwcrGrouped); diff --git a/libs/swcrapp/src/lib/ui-garden/Header.tsx b/libs/swcrapp/src/lib/ui-garden/Header.tsx deleted file mode 100644 index 614294060..000000000 --- a/libs/swcrapp/src/lib/ui-garden/Header.tsx +++ /dev/null @@ -1,21 +0,0 @@ -// import { SwcrPackage } from '@cc-components/swcrshared'; -// import { CustomHeaderView } from '@equinor/workspace-fusion/garden'; -// import { memo } from 'react'; -// import { getMinorTitle, getTitle } from '../utils-garden/getHeaderValues'; -// import { StyledHeaderContainer } from './garden.styles'; - -// const SwcrHeader = (props: CustomHeaderView) => { -// const { columnIndex, garden } = props; -// const column = garden[columnIndex]; -// const { groupKey } = column; -// const title = getTitle(groupKey, column); - -// return ( -// -//
{getMinorTitle(groupKey, column)}
-//
{title}
-//
-// ); -// }; - -// export const GardenHeader = memo(SwcrHeader); diff --git a/libs/swcrapp/src/lib/ui-garden/Item.tsx b/libs/swcrapp/src/lib/ui-garden/Item.tsx index 1d70586f7..e0dd27bfc 100644 --- a/libs/swcrapp/src/lib/ui-garden/Item.tsx +++ b/libs/swcrapp/src/lib/ui-garden/Item.tsx @@ -2,7 +2,6 @@ import { getSwcrStatusColor, SwcrPackage } from '@cc-components/swcrshared'; import { tokens } from '@equinor/eds-tokens'; import { CustomItemView } from '@equinor/workspace-fusion/garden'; import { memo, useMemo } from 'react'; -import { ExtendedGardenFields } from '../types'; import { StyledItemWrapper, StyledRoot } from './garden.styles'; export const SwcrItem = (props: CustomItemView) => { diff --git a/libs/swcrapp/src/lib/ui-garden/index.ts b/libs/swcrapp/src/lib/ui-garden/index.ts deleted file mode 100644 index 4dbfa9890..000000000 --- a/libs/swcrapp/src/lib/ui-garden/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -// export { GardenItem } from './Item'; -// export { GardenHeader } from './Header'; -// export { GardenGrouped } from './Grouped'; diff --git a/libs/swcrapp/src/lib/utils-garden/fieldSettings.ts b/libs/swcrapp/src/lib/utils-garden/fieldSettings.ts deleted file mode 100644 index a6ebf5ca9..000000000 --- a/libs/swcrapp/src/lib/utils-garden/fieldSettings.ts +++ /dev/null @@ -1,76 +0,0 @@ -// import { getYearAndWeekFromString } from '@cc-components/shared/utils-dates'; -// import { sortByNumber } from '@cc-components/shared/utils-sorting'; -// import { SwcrPackage } from '@cc-components/swcrshared'; -// import { FieldSettings } from '@equinor/workspace-fusion/garden'; -// import { ExtendedGardenFields } from '../types'; -// // import { -// // getHoursGroupKey, -// // getIsSafetyKey, -// // getLatestSignedRankingKey, -// // getNextSignatureRoleKeys, -// // getNextToSignKeys, -// // getRfccDueDateKey, -// // getRfccKey, -// // getRfocKey, -// // getStartImplForecastKey, -// // getTypeKeys, -// // } from '../utils-keys'; -// import { sortBySwcrStatusPriority } from '../utils-statuses'; - -// import { sortByDate } from './sortByDate'; -// import { sortByIsSafety } from './sortByIsSafety'; -// import { sortByLastSignedRanking } from './sortByLastSignedRanking'; - -// export const fieldSettings: FieldSettings = { -// isSafety: { label: 'Is Safety', getKey: getIsSafetyKey, getColumnSort: sortByIsSafety }, -// estimatedManhours: { -// label: 'Estimated man hours', -// getKey: getHoursGroupKey, -// getColumnSort: sortByNumber, -// }, -// types: { label: 'Types', getKey: getTypeKeys }, -// nextToSign: { label: 'Next signature by', getKey: getNextToSignKeys }, -// nextSignatureRole: { label: 'Next signature role', getKey: getNextSignatureRoleKeys }, -// latestSignRanking: { -// label: 'Last signed ranking', -// getKey: getLatestSignedRankingKey, -// getColumnSort: sortByLastSignedRanking, -// }, -// RFCC: { label: 'RFCC', getKey: getRfccKey }, -// RFCCDueDate: { -// label: 'RFCC duedate', -// getKey: getRfccDueDateKey, -// getColumnSort: sortByDate, -// }, -// startImplForecast: { -// label: 'Start impl. forecast', -// getKey: getStartImplForecastKey, -// getColumnSort: sortByDate, -// }, -// RFOC: { label: 'RFOC', getKey: getRfocKey }, -// closedAtDate: { -// label: 'Closed at date', -// getKey: (item) => [getYearAndWeekFromString(item.closedAtDate)], -// getColumnSort: sortByDate, -// }, -// dueAtDate: { -// label: 'Due date', -// getKey: (item) => [getYearAndWeekFromString(item.dueAtDate)], -// getColumnSort: sortByDate, -// }, -// siteCode: { label: 'Site Code' }, -// projectIdentifier: { label: 'ProjectIdentifier' }, -// swcrNo: { label: 'Swcr No' }, -// priority: { label: 'Priority' }, -// system: { label: 'System' }, -// controlSystem: { label: 'Control System' }, -// contract: { label: 'Contract' }, -// action: { label: 'Action' }, -// supplier: { label: 'Supplier' }, -// node: { label: 'Node' }, -// referenceTypes: { label: 'Reference Types' }, -// nextSignRanking: { label: 'Next signature ' }, -// cpkgNo: { label: 'CommPK' }, -// cpkgPhase: { label: 'Phase' }, -// status: { key: 'status', label: 'Status', getColumnSort: sortBySwcrStatusPriority }, -// }; diff --git a/libs/swcrapp/src/lib/utils-garden/getHeaderValues.ts b/libs/swcrapp/src/lib/utils-garden/getHeaderValues.ts deleted file mode 100644 index 1b1d2df80..000000000 --- a/libs/swcrapp/src/lib/utils-garden/getHeaderValues.ts +++ /dev/null @@ -1,37 +0,0 @@ -// import { GardenGroup } from '@equinor/workspace-fusion/garden'; -// import { SwcrPackage } from '@cc-components/swcrshared'; -// import { DATE_BLANKSTRING } from '../constants/dateBlankString'; -// import { DEFAULT_BLANKSTRING } from '../constants/defaultBlankString'; - -// export const getMinorTitle = ( -// groupKey: string, -// column: GardenGroup -// ): string => { -// if (column.value === DEFAULT_BLANKSTRING || column.value === DATE_BLANKSTRING) -// return ''; - -// switch (groupKey) { -// case 'RFCC': -// case 'RFCCDueDate': -// case 'startImplForecast': -// case 'RFOC': -// case 'closedAtDate': -// case 'dueAtDate': { -// return column.value.split('-')[0] || ''; -// } -// default: -// return ''; -// } -// }; - -// export const getTitle = (groupKey: string, column: GardenGroup): string => { -// switch (groupKey) { -// case 'dueAtDate': { -// if (column.value === 'N/A') return column.value; - -// return 'W' + column.value.split('-')[1]?.padStart(2, '0') || ''; -// } -// default: -// return column.value; -// } -// }; diff --git a/libs/swcrapp/src/lib/utils-garden/getHighlightedColumn.ts b/libs/swcrapp/src/lib/utils-garden/getHighlightedColumn.ts deleted file mode 100644 index df8c767c7..000000000 --- a/libs/swcrapp/src/lib/utils-garden/getHighlightedColumn.ts +++ /dev/null @@ -1,11 +0,0 @@ -// import { getYearAndWeekFromDate } from '@cc-components/shared/utils-dates'; -// import { SwcrPackage } from '@cc-components/swcrshared'; -// import { ExtendedGardenFields } from '../types'; - -// export const getHighlighColumn = ( -// groupByKey: keyof SwcrPackage | ExtendedGardenFields -// ) => { -// return groupByKey === 'createdAtDate' || groupByKey === 'dueAtDate' -// ? getYearAndWeekFromDate(new Date()) -// : undefined; -// }; diff --git a/libs/swcrapp/src/lib/utils-garden/getItemWidth.ts b/libs/swcrapp/src/lib/utils-garden/getItemWidth.ts deleted file mode 100644 index 7d1c36d28..000000000 --- a/libs/swcrapp/src/lib/utils-garden/getItemWidth.ts +++ /dev/null @@ -1,40 +0,0 @@ -// import { hasProperty } from '@cc-components/shared/utils-typescript'; -// import { SwcrPackage } from '@cc-components/swcrshared'; -// import { -// GardenGroups, -// getGardenItems, -// isSubGroup, -// } from '@equinor/workspace-fusion/garden'; -// import { ExtendedGardenFields } from '../types'; - -// export const getItemWidth = ( -// garden: GardenGroups, -// groupByKey: keyof SwcrPackage | ExtendedGardenFields -// ) => { -// const gardenItemList: SwcrPackage[] = []; -// const columnName = groupByKey -// .replace('nextSignatureBy', 'nextToSign') -// .replace('nextSignatureRole', 'nextToSign'); - -// garden.forEach((column) => { -// const gardenItems = getGardenItems(column); -// gardenItems && -// gardenItems.forEach((gardenItem) => { -// !isSubGroup(gardenItem) && gardenItemList.push(gardenItem.item); -// }); -// }); - -// const longestKey = Math.max( -// ...gardenItemList.map((gardenItem) => { -// const titleLength = hasProperty(gardenItem, columnName) -// ? gardenItem[columnName] -// ? gardenItem[columnName].length -// : 0 -// : 0; -// return titleLength >= gardenItem.swcrNo.length -// ? titleLength -// : gardenItem.swcrNo.length; -// }) -// ); -// return Math.max(longestKey * 8 + 85, 170); -// }; diff --git a/libs/swcrapp/src/lib/utils-keys/getHoursGroupKey.ts b/libs/swcrapp/src/lib/utils-keys/getHoursGroupKey.ts deleted file mode 100644 index e0ac3c4b6..000000000 --- a/libs/swcrapp/src/lib/utils-keys/getHoursGroupKey.ts +++ /dev/null @@ -1,30 +0,0 @@ -// import { SwcrPackage } from '@cc-components/swcrshared'; -// import { GetKeyFunction } from '../types/getKeyFunction'; - -// export const getHoursGroupKey: GetKeyFunction = (item) => { -// const hours = parseInt(item.estimatedManhours) || 0; -// switch (true) { -// case hours === 0: -// return ['0']; -// case hours >= 1000: -// return ['1000+++']; -// case hours >= 500: -// return ['500-999']; -// case hours >= 200: -// return ['200-499']; -// case hours >= 100: -// return ['100-199']; -// case hours >= 50: -// return ['50-99']; -// case hours >= 20: -// return ['20-49']; -// case hours >= 10: -// return ['10-19']; -// case hours >= 5: -// return ['5-9']; -// case hours >= 1: -// return ['1-4']; -// default: -// return ['0']; -// } -// }; diff --git a/libs/swcrapp/src/lib/utils-keys/getIsSafetyKey.ts b/libs/swcrapp/src/lib/utils-keys/getIsSafetyKey.ts deleted file mode 100644 index 479c5af03..000000000 --- a/libs/swcrapp/src/lib/utils-keys/getIsSafetyKey.ts +++ /dev/null @@ -1,11 +0,0 @@ -// import { SwcrPackage } from '@cc-components/swcrshared'; -// import { GetKeyFunction } from '../types/getKeyFunction'; - -// export const getIsSafetyKey: GetKeyFunction = (item) => [ -// item.types?.toLocaleLowerCase().includes('safety') -// ? 'Related' -// : ['70', '71', '72', '74', '79'].includes(item.system) || -// ['E', 'F', 'P'].includes(item.controlSystem) -// ? 'Yes' -// : 'No', -// ]; diff --git a/libs/swcrapp/src/lib/utils-keys/getLatestSignedRankingKey.ts b/libs/swcrapp/src/lib/utils-keys/getLatestSignedRankingKey.ts deleted file mode 100644 index 0db574a63..000000000 --- a/libs/swcrapp/src/lib/utils-keys/getLatestSignedRankingKey.ts +++ /dev/null @@ -1,6 +0,0 @@ -// import { SwcrPackage } from '@cc-components/swcrshared'; -// import { GetKeyFunction } from '../types'; - -// export const getLatestSignedRankingKey: GetKeyFunction = (item) => [ -// `${item.latestSignRanking || '0'}: ${item.status}`, -// ]; diff --git a/libs/swcrapp/src/lib/utils-keys/getNextSingatureRoleKeys.ts b/libs/swcrapp/src/lib/utils-keys/getNextSingatureRoleKeys.ts deleted file mode 100644 index 5d587abff..000000000 --- a/libs/swcrapp/src/lib/utils-keys/getNextSingatureRoleKeys.ts +++ /dev/null @@ -1,20 +0,0 @@ -// import { GetKeyFunction } from '../types'; -// import { nextToSignParallelRuleValidation } from './nextToSignParallelRuleValidation'; -// import { DEFAULT_BLANKSTRING } from '../constants/defaultBlankString'; -// import { SwcrPackage } from '@cc-components/swcrshared'; - -// const getNextSignatureRoleKey = (nextToSign: string, ranking?: string): string => { -// if (!ranking?.length) ranking = '0'; - -// const nextSignatureRoleKey = -// nextToSign.substring(0, nextToSign.indexOf('(')).trimEnd() || DEFAULT_BLANKSTRING; - -// return ranking === '0' && nextSignatureRoleKey === DEFAULT_BLANKSTRING -// ? nextSignatureRoleKey -// : `${ranking}: ${nextSignatureRoleKey}`; -// }; - -// export const getNextSignatureRoleKeys: GetKeyFunction = (item) => -// item.nextToSign -// .filter(nextToSignParallelRuleValidation) -// .map((next) => getNextSignatureRoleKey(next, item.nextToSignRanking)); diff --git a/libs/swcrapp/src/lib/utils-keys/getNextToSignKeys.ts b/libs/swcrapp/src/lib/utils-keys/getNextToSignKeys.ts deleted file mode 100644 index 6218bbae4..000000000 --- a/libs/swcrapp/src/lib/utils-keys/getNextToSignKeys.ts +++ /dev/null @@ -1,21 +0,0 @@ -// import { GetKeyFunction } from '../types'; -// import { DEFAULT_BLANKSTRING } from '../constants/defaultBlankString'; -// import { SwcrPackage } from '@cc-components/swcrshared'; -// const getNextToSignKey = (nextToSign: string, ranking?: string): string => { -// if (!ranking?.length) ranking = '0'; - -// const nextToSignKey = -// nextToSign -// .substring(nextToSign.indexOf('(')) -// .replace('(', '') -// .replace(')', '') -// .replace('Function:', '') -// .replace('Person:', '') -// .trimEnd() || DEFAULT_BLANKSTRING; - -// return ranking === '0' && nextToSignKey === DEFAULT_BLANKSTRING -// ? nextToSignKey -// : `${ranking}: ${nextToSignKey}`; -// }; -// export const getNextToSignKeys: GetKeyFunction = (item) => -// item.nextToSign.map((next) => getNextToSignKey(next, item.nextToSignRanking)); diff --git a/libs/swcrapp/src/lib/utils-keys/getRfccDueDateKey.ts b/libs/swcrapp/src/lib/utils-keys/getRfccDueDateKey.ts deleted file mode 100644 index b0dfa29ed..000000000 --- a/libs/swcrapp/src/lib/utils-keys/getRfccDueDateKey.ts +++ /dev/null @@ -1,25 +0,0 @@ -// import { getYearAndWeekFromDate } from '@cc-components/shared/utils-dates'; -// import { SwcrPackage } from '@cc-components/swcrshared'; -// import { DateTime } from 'luxon'; -// import { DATE_BLANKSTRING } from '../constants/dateBlankString'; -// import { GetKeyFunction } from '../types/getKeyFunction'; - -// export const getRfccDueDateKey: GetKeyFunction = (item) => { -// const dueDate = new Date(item.dueAtDate); -// const startDate = new Date(item.cpkgStartForecastAtDate || item.cpkgStartPlannedAtDate); - -// let groupByKey = DATE_BLANKSTRING; -// if (DateTime.fromJSDate(dueDate).isValid && DateTime.fromJSDate(startDate).isValid) { -// const date = dueDate > startDate ? dueDate : startDate; -// groupByKey = getYearAndWeekFromDate(new Date(date.setDate(date.getDate() - 56))); -// } else if (DateTime.fromJSDate(dueDate).isValid) -// groupByKey = getYearAndWeekFromDate( -// new Date(dueDate.setDate(dueDate.getDate() - 56)) -// ); -// else if (DateTime.fromJSDate(startDate).isValid) -// groupByKey = getYearAndWeekFromDate( -// new Date(startDate.setDate(startDate.getDate() - 56)) -// ); - -// return [groupByKey]; -// }; diff --git a/libs/swcrapp/src/lib/utils-keys/getRfccKey.ts b/libs/swcrapp/src/lib/utils-keys/getRfccKey.ts deleted file mode 100644 index 64c281081..000000000 --- a/libs/swcrapp/src/lib/utils-keys/getRfccKey.ts +++ /dev/null @@ -1,7 +0,0 @@ -// import { getYearAndWeekFromString } from '@cc-components/shared/utils-dates'; -// import { SwcrPackage } from '@cc-components/swcrshared'; -// import { GetKeyFunction } from '../types/getKeyFunction'; - -// export const getRfccKey: GetKeyFunction = (item) => [ -// getYearAndWeekFromString(item.cpkgStartForecastAtDate || item.cpkgStartPlannedAtDate), -// ]; diff --git a/libs/swcrapp/src/lib/utils-keys/getRfocKey.ts b/libs/swcrapp/src/lib/utils-keys/getRfocKey.ts deleted file mode 100644 index 78374f5c3..000000000 --- a/libs/swcrapp/src/lib/utils-keys/getRfocKey.ts +++ /dev/null @@ -1,7 +0,0 @@ -// import { getYearAndWeekFromString } from '@cc-components/shared/utils-dates'; -// import { SwcrPackage } from '@cc-components/swcrshared'; -// import { GetKeyFunction } from '../types/getKeyFunction'; - -// export const getRfocKey: GetKeyFunction = (item) => [ -// getYearAndWeekFromString(item.cpkgFinishForecastAtDate || item.cpkgFinishPlannedAtDate), -// ]; diff --git a/libs/swcrapp/src/lib/utils-keys/getStartImplForecastKey.ts b/libs/swcrapp/src/lib/utils-keys/getStartImplForecastKey.ts deleted file mode 100644 index 65d0c12d1..000000000 --- a/libs/swcrapp/src/lib/utils-keys/getStartImplForecastKey.ts +++ /dev/null @@ -1,17 +0,0 @@ -// import { getYearAndWeekFromString } from '@cc-components/shared/utils-dates'; -// import { SwcrPackage } from '@cc-components/swcrshared'; -// import { GetKeyFunction } from '../types'; - -// export const getStartImplForecastKey: GetKeyFunction = (item) => { -// const workdays = -// parseInt(item.estimatedManhours) > 0 -// ? Math.floor(parseInt(item.estimatedManhours) / 8) -// : 0; - -// return [ -// getYearAndWeekFromString( -// item.cpkgStartForecastAtDate || item.cpkgStartPlannedAtDate, -// 14 + workdays -// ), -// ]; -// }; diff --git a/libs/swcrapp/src/lib/utils-keys/getTypeKeys.ts b/libs/swcrapp/src/lib/utils-keys/getTypeKeys.ts deleted file mode 100644 index c2a7781bb..000000000 --- a/libs/swcrapp/src/lib/utils-keys/getTypeKeys.ts +++ /dev/null @@ -1,6 +0,0 @@ -// import { GetKeyFunction } from '../types'; -// import { DEFAULT_BLANKSTRING } from '../constants/defaultBlankString'; -// import { SwcrPackage } from '@cc-components/swcrshared'; - -// export const getTypeKeys: GetKeyFunction = (item) => -// item.types.length ? item.types.split(',') : [DEFAULT_BLANKSTRING]; diff --git a/libs/swcrapp/src/lib/utils-keys/index.ts b/libs/swcrapp/src/lib/utils-keys/index.ts deleted file mode 100644 index b2f0438c9..000000000 --- a/libs/swcrapp/src/lib/utils-keys/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -// export { getNextToSignKeys } from './getNextToSignKeys'; -// export { getNextSignatureRoleKeys } from './getNextSingatureRoleKeys'; -// export { getLatestSignedRankingKey } from './getLatestSignedRankingKey'; -// export { getTypeKeys } from './getTypeKeys'; -// export { getHoursGroupKey } from './getHoursGroupKey'; -// export { getIsSafetyKey } from './getIsSafetyKey'; -// export { getRfccDueDateKey } from './getRfccDueDateKey'; -// export { getRfccKey } from './getRfccKey'; -// export { getRfocKey } from './getRfocKey'; -// export { getStartImplForecastKey } from './getStartImplForecastKey'; diff --git a/libs/swcrshared/src/lib/types/swcrPackage.ts b/libs/swcrshared/src/lib/types/swcrPackage.ts index 8d1a7062a..af90a90be 100644 --- a/libs/swcrshared/src/lib/types/swcrPackage.ts +++ b/libs/swcrshared/src/lib/types/swcrPackage.ts @@ -24,10 +24,12 @@ export type SwcrPackage = { action: string; status: SwcrStatus; famUpsertedTime: string; - nextToSign: string; + nextToSignRole: string; + nextToSignFunctionalRole: string; nextToSignRanking: number; latestSignedRanking: number; latestSignedRole: string; + latestSignedRoleFunctionalRole: string; closedDate: string; isOpen: boolean; commissioningPackageNo: string; @@ -41,4 +43,5 @@ export type SwcrPackage = { rfCForecastDate: string; system: string; automationControlSystem: string; + swcrTypes: string; }; diff --git a/libs/swcrsidesheet/src/lib/types/signature.ts b/libs/swcrsidesheet/src/lib/types/signature.ts index c9bf99375..639668b0a 100644 --- a/libs/swcrsidesheet/src/lib/types/signature.ts +++ b/libs/swcrsidesheet/src/lib/types/signature.ts @@ -7,4 +7,5 @@ export type SwcrSignature = { signedDate: string; status: string; softwareChangeRecordId: string; + signedBy: string; }; diff --git a/libs/swcrsidesheet/src/lib/ui-sidesheet/DetailsTab.tsx b/libs/swcrsidesheet/src/lib/ui-sidesheet/DetailsTab.tsx index 951f22889..83743b6df 100644 --- a/libs/swcrsidesheet/src/lib/ui-sidesheet/DetailsTab.tsx +++ b/libs/swcrsidesheet/src/lib/ui-sidesheet/DetailsTab.tsx @@ -1,20 +1,11 @@ +import { StyledTabContent } from '@cc-components/shared/sidesheet'; import { SwcrPackage } from '@cc-components/swcrshared'; import { SwcrSignature } from '../types'; import { PreBlock, - SignatureBlock, - StyledAttachments, - StyledChipText, - StyledSignatures, - StyledTags, - StyledTagsAndAttachmentBlock, StyledTextBlock, - StyledTextBlockEmpty, + StyledTextBlockEmpty } from './sidesheet.styles'; -import { Chip, CircularProgress } from '@equinor/eds-core-react'; -import { Fragment } from 'react'; -import { StyledTabContent, StyledTable } from '@cc-components/shared/sidesheet'; -import { StyledItemLink } from '@cc-components/shared/common'; type DetailsTabProps = { item: SwcrPackage | undefined; signatures: SwcrSignature[] | undefined; @@ -23,39 +14,9 @@ type DetailsTabProps = { }; export const DetailsTab = ({ item, - signatures, - signaturesFetching, - attachmentsUrls, }: DetailsTabProps) => { return ( - - - - {item?.contract || '-'} - - - {item?.priority || '-'} - - {/* - {item?.referenceTypes || '-'} - */} - - {item?.supplier || '-'} - - - {item?.system || '-'} - - - {/* {parseInt(item?.cntAttachments || '0') > 0 && ( - - Attachments: - - {item?.cntAttachments} - - - )} */} -
Description
{item?.description ? ( @@ -72,33 +33,6 @@ export const DetailsTab = ({ No modifications )}
- - -
Signatures
- {signaturesFetching ? ( - - ) : ( - signatures && signatures.length > 0 ? ( - <> -
Next signatures
-
Seq
-
By
- {signatures - .filter((signature) => !signature.signedDate) - .map((signature, key) => ( - - {signature.signatureRole} - {signature.sequence} - {signature.functionalRole} - - )) - } - - ) : ( -

There are no signatures

- ) - )} -
); }; diff --git a/libs/swcrsidesheet/src/lib/ui-sidesheet/SignaturesTab.tsx b/libs/swcrsidesheet/src/lib/ui-sidesheet/SignaturesTab.tsx new file mode 100644 index 000000000..206ce5d41 --- /dev/null +++ b/libs/swcrsidesheet/src/lib/ui-sidesheet/SignaturesTab.tsx @@ -0,0 +1,28 @@ +import { TabTable } from '@cc-components/shared'; +import { StyledContentWrapper } from '@cc-components/sharedcomponents'; +import { SwcrSignature } from '../types'; +import { signatureColumns } from '../utils-sidesheet/signatureColumns'; + +type SignatureTabProps = { + signatures: SwcrSignature[] | undefined; + isFetching: boolean; + error: Error | null; +}; + +export const SignaturesTab = ({ + signatures, + error, + isFetching, +}: SignatureTabProps): JSX.Element => { + return ( + + + + ); +}; diff --git a/libs/swcrsidesheet/src/lib/ui-sidesheet/SwcrSidesheet.tsx b/libs/swcrsidesheet/src/lib/ui-sidesheet/SwcrSidesheet.tsx index 324ca018f..42eab4460 100644 --- a/libs/swcrsidesheet/src/lib/ui-sidesheet/SwcrSidesheet.tsx +++ b/libs/swcrsidesheet/src/lib/ui-sidesheet/SwcrSidesheet.tsx @@ -1,26 +1,37 @@ +import { createWidget } from '@cc-components/shared'; import { StatusCircle } from '@cc-components/shared/common'; +import { LinkCell } from '@cc-components/shared/table-helpers'; import { BannerItem, SidesheetHeader, StyledBanner, StyledPanels, StyledSideSheetContainer, + StyledTabListWrapper, StyledTabs, - TabsWrapper, + StyledTabsList, + TabTitle, } from '@cc-components/sharedcomponents'; -import { getSwcrStatusColor, SwcrPackage } from '@cc-components/swcrshared'; +import { SwcrPackage, getSwcrStatusColor } from '@cc-components/swcrshared'; import { Tabs } from '@equinor/eds-core-react'; -import { createWidget } from '@cc-components/shared'; +import { useState } from 'react'; import { useSignatures } from '../utils-sidesheet'; import { DetailsTab } from './DetailsTab'; +import { SignaturesTab } from './SignaturesTab'; export const SwcrSidesheet = createWidget(({ props }) => { - const { signatures, signaturesFetching } = useSignatures(props.id); + const { signatures, signaturesFetching, error } = useSignatures(props.id); + const [activeTab, setActiveTab] = useState(0); + const handleChange = (index: number) => { + setActiveTab(index); + }; const attachmentsUrls = props?.item?.swcrUrl.replace('#', '#tab=attachments&'); return ( @@ -28,13 +39,14 @@ export const SwcrSidesheet = createWidget(({ props }) => { - // {props?.item?.swcrNo} - // + props?.item?.softwareChangeRecordNo && props?.item?.swcrUrl ? ( + + ) : ( + props?.item?.softwareChangeRecordNo ?? 'N/A' + ) } /> (({ props }) => { /> } /> + + + + - - - Details - - + + + + Details + + Signatures + + + (({ props }) => { signaturesFetching={signaturesFetching} /> + + + diff --git a/libs/swcrsidesheet/src/lib/utils-sidesheet/signatureColumns.tsx b/libs/swcrsidesheet/src/lib/utils-sidesheet/signatureColumns.tsx new file mode 100644 index 000000000..b0d85e10e --- /dev/null +++ b/libs/swcrsidesheet/src/lib/utils-sidesheet/signatureColumns.tsx @@ -0,0 +1,40 @@ +import { ColDef, ICellRendererProps } from '@equinor/workspace-ag-grid'; +import { SwcrSignature} from '../types'; +import { + StyledMonospace, +} from '@cc-components/shared/table-helpers'; +import { SwcrPackage } from '@cc-components/swcrshared'; + + +export const signatureColumns: ColDef[] = [ + { + field: 'Signature Role', + valueGetter: (pkg) => pkg.data?.signatureRole, + cellRenderer: (props: ICellRendererProps) => { + return {props.data?.signatureRole}; + }, + minWidth: 350, + }, + { + field: 'Seq', + valueGetter: (pkg) => pkg.data?.sequence, + minWidth: 100, + }, + { + field: 'By', + valueGetter: (pkg) => pkg.data?.signedBy, + cellRenderer: (props: ICellRendererProps) => { + return {props.data?.signedBy}; + }, + minWidth: 450, + }, + { + field: 'Date', + valueGetter: (pkg) => pkg.data?.signedDate, + cellRenderer: (props: ICellRendererProps) => { + return {props.data?.signedDate}; + }, + minWidth: 100, + }, +]; + diff --git a/libs/swcrsidesheet/src/lib/utils-sidesheet/useSignatures.ts b/libs/swcrsidesheet/src/lib/utils-sidesheet/useSignatures.ts index 2ded35a3b..b155ab49a 100644 --- a/libs/swcrsidesheet/src/lib/utils-sidesheet/useSignatures.ts +++ b/libs/swcrsidesheet/src/lib/utils-sidesheet/useSignatures.ts @@ -1,25 +1,29 @@ import { useContextId } from '@cc-components/shared/hooks'; -import { useHttpClient } from '@equinor/fusion-framework-react-app/http'; +import { useHttpClient } from '@cc-components/shared'; import { useCallback, useEffect, useState } from 'react'; import { SwcrSignature } from '../types'; type UseSignatures = { signatures: SwcrSignature[]; signaturesFetching: boolean; + error: Error | null; }; export const useSignatures = (swcrId: string): UseSignatures => { const [signatures, setSignatures] = useState([]); const [signaturesFetching, setSignaturesFetching] = useState(false); const contextId = useContextId(); - const dataProxy = useHttpClient('cc-api'); + const [error, setError] = useState(null); + const dataProxy = useHttpClient(); const getSignatures = useCallback(async (swcrId: string) => { setSignaturesFetching(true); try { const result = await dataProxy.fetch( `api/contexts/${contextId}/swcr/${swcrId}/signatures` ); - + if (!result.ok) { + throw new Error('Failed to fetch signatures'); + } const parsedSignatures = JSON.parse(await result.text()) as SwcrSignature[]; setSignatures(parsedSignatures); } catch { @@ -36,5 +40,6 @@ export const useSignatures = (swcrId: string): UseSignatures => { return { signatures, signaturesFetching, + error, }; }; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0da4f3824..7342ebf69 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -577,9 +577,6 @@ importers: '@cc-components/swcrsidesheet': specifier: workspace:^ version: link:../swcrsidesheet - '@equinor/workspace-fusion': - specifier: 5.1.0 - version: 5.1.0(@ag-grid-enterprise/core@28.1.1)(@babel/core@7.23.2)(@types/react@18.2.22)(@types/sortablejs@1.15.4)(react-dom@18.2.0)(react-is@18.2.0)(styled-components@5.3.6)(vite@4.4.9) libs/swcrshared: dependencies: @@ -3683,41 +3680,6 @@ packages: - vite dev: false - /@equinor/workspace-fusion@5.1.0(@ag-grid-enterprise/core@28.1.1)(@babel/core@7.23.2)(@types/react@18.2.22)(@types/sortablejs@1.15.4)(react-dom@18.2.0)(react-is@18.2.0)(styled-components@5.3.6)(vite@4.4.9): - resolution: {integrity: sha512-6BCPDUs0uiN+9LtkKcnBXlx0LwxRUT7E6gBtxKLoQaJM5bZOJY1Tk55RyXwmwvo19Tv9Og/CjFLgt1yka7DIng==} - peerDependencies: - react-dom: '>= 16.8.0' - react-is: '>= 16.8.0' - styled-components: ^5.3.6 - dependencies: - '@equinor/eds-core-react': 0.27.0(@babel/core@7.23.2)(react-dom@18.2.0)(react@18.2.0)(styled-components@5.3.6) - '@equinor/eds-icons': 0.17.0 - '@equinor/eds-tokens': 0.9.0 - '@equinor/workspace-ag-grid': 1.2.2(@ag-grid-enterprise/core@28.1.1)(react-dom@18.2.0)(react-is@18.2.0)(react@18.2.0)(styled-components@5.3.6) - '@equinor/workspace-filter': 2.0.9(@babel/core@7.23.2)(@types/sortablejs@1.15.4)(react-dom@18.2.0)(react-is@18.2.0)(react@18.2.0)(styled-components@5.3.6) - '@equinor/workspace-garden': 5.1.5(@babel/core@7.23.2)(react-dom@18.2.0)(react-is@18.2.0)(react@18.2.0)(styled-components@5.3.6) - '@equinor/workspace-powerbi': 1.0.7(@babel/core@7.23.2)(@types/sortablejs@1.15.4)(react-dom@18.2.0)(react-is@18.2.0)(react@18.2.0)(styled-components@5.3.6) - '@equinor/workspace-react': 1.0.4(@babel/core@7.23.2)(@types/react@18.2.22)(react-dom@18.2.0)(react-is@18.2.0)(react@18.2.0)(styled-components@5.3.6) - '@tanstack/react-query': 4.35.3(react-dom@18.2.0)(react@18.2.0) - '@types/react-dom': 18.2.7 - react: 18.2.0 - react-dom: 18.2.0(react@18.2.0) - react-error-boundary: 3.1.4(react@18.2.0) - react-is: 18.2.0 - rxjs: 7.8.1 - styled-components: 5.3.6(@babel/core@7.23.2)(react-dom@18.2.0)(react-is@18.2.0)(react@18.2.0) - vite-plugin-environment: 1.1.3(vite@4.4.9) - transitivePeerDependencies: - - '@ag-grid-enterprise/core' - - '@babel/core' - - '@types/react' - - '@types/sortablejs' - - immer - - react-native - - supports-color - - vite - dev: false - /@equinor/workspace-fusion@5.2.1(@ag-grid-enterprise/core@28.1.1)(@babel/core@7.23.2)(@types/react@18.2.22)(@types/sortablejs@1.15.4)(react-dom@18.2.0)(react-is@18.2.0)(styled-components@5.3.6)(vite@4.4.9): resolution: {integrity: sha512-ngnExAr5ZMRh5ifUvFynzp3LUUV29PY5CsVVhvYH73mj94MvvUe7xqdkxoD8G1O1oTmBDm5/oNEOOM5Wy/Vyhw==} peerDependencies: