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

Feat/implement pipingapp #701

Merged
merged 32 commits into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
666f6cc
feat: initial commit
MagnusGjosund May 16, 2023
217ca3f
update gitignore
MagnusGjosund May 16, 2023
e3415e4
wip
MagnusGjosund May 16, 2023
3da7f31
Merge branch 'main' of https://github.com/equinor/cc-components into …
MagnusGjosund May 22, 2023
dafcb11
wip
MagnusGjosund May 25, 2023
7bbb3b6
Merge branch 'main' of https://github.com/equinor/cc-components into …
MagnusGjosund May 30, 2023
34c6c44
Merge branch 'main' of https://github.com/equinor/cc-components into …
MagnusGjosund May 31, 2023
5c90cf5
wip: garden, sidesheet
MagnusGjosund May 31, 2023
4a35ea8
Merge branch 'main' of https://github.com/equinor/cc-components into …
MagnusGjosund Jun 1, 2023
f800a23
feat: :sparkles: add workorder tab in sidesheet
MagnusGjosund Jun 1, 2023
46e613a
feat: :sparkles: add Insulation tab
MagnusGjosund Jun 2, 2023
14f134b
Merge branch 'main' of https://github.com/equinor/cc-components into …
MagnusGjosund Jun 2, 2023
375e10f
Insulation table header
MagnusGjosund Jun 2, 2023
1f9fd23
forgot to change to h4
MagnusGjosund Jun 2, 2023
1b7d951
feat: :sparkles: add Checklist tab
MagnusGjosund Jun 2, 2023
74fea99
need to commit before merge
MagnusGjosund Jun 20, 2023
51cf65f
Merge branch 'main' of https://github.com/equinor/cc-components into …
MagnusGjosund Jun 20, 2023
fa12033
feat: :sparkles: update fusion workspace to 2.1.4
MagnusGjosund Jun 20, 2023
6971514
Merge branch 'main' of https://github.com/equinor/cc-components into …
MagnusGjosund Oct 2, 2023
757c945
Merge branch 'main' of https://github.com/equinor/cc-components into …
MagnusGjosund Oct 4, 2023
9f9803f
Merge branch 'main' of https://github.com/equinor/cc-components into …
MagnusGjosund Oct 4, 2023
e27d1ac
Merge branch 'main' of https://github.com/equinor/cc-components into …
MagnusGjosund Oct 18, 2023
8228dfa
feat: :sparkles: update api-calls
MagnusGjosund Oct 18, 2023
ff8ccc4
feat: :sparkles: add the rest of the app
MagnusGjosund Oct 20, 2023
fe8c7bb
Merge branch 'main' of https://github.com/equinor/cc-components into …
MagnusGjosund Nov 17, 2023
552bb12
merge with main
MagnusGjosund Nov 17, 2023
acfdd7b
Merge branch 'main' of https://github.com/equinor/cc-components into …
MagnusGjosund Nov 17, 2023
15f238d
feat: :sparkles: connect backend and frontend
MagnusGjosund Nov 17, 2023
d0cafc0
Merge branch 'main' of https://github.com/equinor/cc-components into …
MagnusGjosund Nov 17, 2023
6724a3d
fix pr feedback
MagnusGjosund Nov 20, 2023
042f13f
change appname in package.json
MagnusGjosund Nov 20, 2023
0836fe9
Merge branch 'main' into feat/implement-pipingapp
MagnusGjosund Nov 20, 2023
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ dist/
bin/
# dependencies
node_modules
**/responsePiping.json
MagnusGjosund marked this conversation as resolved.
Show resolved Hide resolved

# IDEs and editors
/.idea
Expand Down
3 changes: 3 additions & 0 deletions apps/piping/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Version 0.0.1

Init app
3 changes: 3 additions & 0 deletions apps/piping/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# piping

Add readme
16 changes: 16 additions & 0 deletions apps/piping/app.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { readFileSync } from 'fs';

const { name } = JSON.parse(readFileSync('./package.json').toString('utf-8'));

export default () => ({
manifest: {
key: name,
name: name,
},
environment: {
// uri: 'https://backend-fusion-data-gateway-test.radix.equinor.com',
MagnusGjosund marked this conversation as resolved.
Show resolved Hide resolved
uri: 'https://localhost:7074',
defaultScopes: ['api://ed6de162-dd30-4757-95eb-0ffc8d34fbe0/access_as_user'],
},
endpoints: {},
});
26 changes: 26 additions & 0 deletions apps/piping/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "piping",
"displayName": "Piping",
"version": "0.0.1",
"main": "/src/main.tsx",
"private": true,
"type": "module",
"scripts": {
MagnusGjosund marked this conversation as resolved.
Show resolved Hide resolved
"dev": "fusion-framework-cli app dev",
"build": "tsc -b",
"windows-zip": "powershell Compress-Archive -Path dist/app-bundle.js, app-manifest.json -DestinationPath dist/bundle.zip",
"build:spa": "fusion-framework-cli app build",
"postbuild:spa": "zip dist/bundle.zip -Dj dist/app-bundle.js app-manifest.json",
"deploy:spa": "fdev portal upload -e ci -k piping dist/bundle.zip",
"postdeploy:spa": "fdev portal publish -e ci -k piping",
"shipit": "pnpm build && pnpm build:spa && pnpm windows-zip && pnpm deploy:spa"
},
"dependencies": {
"@cc-components/pipingapp": "workspace:^",
"@cc-components/shared": "workspace:^"
},
"files": [
"dist/app-bundle.js",
"app-manifest.json"
]
}
15 changes: 15 additions & 0 deletions apps/piping/src/main.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { configure, WorkspaceWrapper } from '@cc-components/pipingapp';
import { useHttpClient } from '@equinor/fusion-framework-react-app/http';
import { createRender, RootAppWrapper } from '@cc-components/shared';

const PipingApp = () => {
const client = useHttpClient('cc-api');
return (
<RootAppWrapper client={client}>
<WorkspaceWrapper />
</RootAppWrapper>
);
};

export const render = createRender(PipingApp, configure, 'Piping');
export default render;
22 changes: 22 additions & 0 deletions apps/piping/tsconfig.app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./dist",
"types": ["node"],
"rootDir": "."
},
"exclude": [
"jest.config.ts",
"**/*.spec.ts",
"**/*.test.ts",
"**/*.spec.tsx",
"**/*.test.tsx",
"**/*.spec.js",
"**/*.test.js",
"**/*.spec.jsx",
"**/*.test.jsx",
"dist",
"vite.config.ts"
],
"include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"]
}
22 changes: 22 additions & 0 deletions apps/piping/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"jsx": "react-jsx",
"allowJs": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.app.json"
}
]
}
4 changes: 4 additions & 0 deletions apps/piping/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import viteConfigBase from '../../vite.config.base';
export default {
...viteConfigBase,
MagnusGjosund marked this conversation as resolved.
Show resolved Hide resolved
};
2 changes: 0 additions & 2 deletions libs/loopsidesheet/src/lib/ui-sidesheet/LoopSidesheet.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { Loop } from '@cc-components/loopshared';
import { createWidget } from '@cc-components/shared';

import { useState } from 'react';
import { DetailsTab } from './DetailsTab';
import { Tabs } from '@equinor/eds-core-react';

import { useGetWorkorders } from '../utils-sidesheet';
import { Checklists } from './Checklists';
import { ContentDetails } from './ContentDetails';
Expand Down
3 changes: 3 additions & 0 deletions libs/pipingapp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# pipingapp

Add readme
17 changes: 17 additions & 0 deletions libs/pipingapp/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "@cc-components/pipingapp",
"version": "0.0.1",
"type": "module",
"scripts": {
"build": "tsc -b"
},
"module": "./dist/src/index.js",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"dependencies": {
"@cc-components/shared": "workspace:^",
"@cc-components/sharedcomponents": "workspace:^",
"@cc-components/pipingshared": "workspace:^",
"@cc-components/pipingsidesheet": "workspace:^"
}
}
1 change: 1 addition & 0 deletions libs/pipingapp/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './lib';
41 changes: 41 additions & 0 deletions libs/pipingapp/src/lib/config/frameworkConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import {
IAppConfigurator,
ComponentRenderArgs,
} from '@equinor/fusion-framework-react-app';
import { enableContext } from '@equinor/fusion-framework-react-module-context';
import buildQuery from 'odata-query';
import { enableAgGrid } from '@equinor/fusion-framework-module-ag-grid';

export const configure = async (config: IAppConfigurator, c: ComponentRenderArgs) => {
enableContext(config, async (builder) => {
builder.setContextType(['ProjectMaster']);
builder.setContextParameterFn(({ search, type }) => {
return buildQuery({
search,
filter: {
type: {
in: type,
},
},
});
});
});
// Add more config if needed, e.g. enableAgGrid

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

if (!envConfig) {
throw new Error('Failed to load environemnt config for workorder');
}
config.configureHttpClient('cc-api', {
baseUri: envConfig?.uri,
defaultScopes: envConfig?.defaultScopes,
});

enableAgGrid(config);
};

type PipingEnvConfig = {
uri: string;
defaultScopes: string[];
};
34 changes: 34 additions & 0 deletions libs/pipingapp/src/lib/config/gardenConfig.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { Pipetest } from '@cc-components/pipingshared';
import { useHttpClient } from '@cc-components/shared';
import { FilterState } from '@equinor/workspace-fusion/filter';
import { GardenConfig } from '@equinor/workspace-fusion/garden';
import { useGardenDataSource } from '@cc-components/shared/workspace-config';
import { GardenItem } from '../ui-garden';

export const useGardenConfig = (
contextId: string
): GardenConfig<Pipetest, FilterState> => {
const client = useHttpClient();
const { getBlockAsync, getGardenMeta, getHeader, getSubgroupItems } =
useGardenDataSource({
getBlockAsync: (req) =>
client.fetch(`/api/contexts/${contextId}/pipetest/garden`, req),
getGardenMeta: (req) =>
client.fetch(`/api/contexts/${contextId}/pipetest/garden-meta`, req),
getHeader: (req) => client.fetch(`/api/contexts/${contextId}/pipetest/garden`, req),
getSubgroupItems: (req) =>
client.fetch(`/api/contexts/${contextId}/pipetest/subgroup-items`, req),
});

return {
getBlockAsync,
getGardenMeta,
getHeader,
getSubgroupItems,
getDisplayName: (item) => item.id,
initialGrouping: ['Priority1'],
customViews: {
customItemView: GardenItem,
},
};
};
2 changes: 2 additions & 0 deletions libs/pipingapp/src/lib/config/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { WorkspaceWrapper } from './workspaceConfig';
export { configure } from './frameworkConfig';
10 changes: 10 additions & 0 deletions libs/pipingapp/src/lib/config/pipingSidesheet.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { SidesheetConfig } from '@equinor/workspace-fusion/sidesheet';
import { Pipetest } from '@cc-components/pipingshared';
import { PipingSidesheet } from '@cc-components/pipingsidesheet';

export const sidesheetConfig: SidesheetConfig<Pipetest> = {
type: 'default',
DetailsSidesheet: (props) => (
<PipingSidesheet.Component id={props.id} item={props.item} close={props.close} />
),
};
20 changes: 20 additions & 0 deletions libs/pipingapp/src/lib/config/statusBarConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
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');

return async (filters, signal) => {
const res = await client.fetch(`/api/contexts/${contextId}/pipetest/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 }));
};
};
92 changes: 92 additions & 0 deletions libs/pipingapp/src/lib/config/tableConfig.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import { ColDef, GridConfig, ICellRendererProps } from '@equinor/workspace-fusion/grid';
import { CheckList, Pipetest } from '@cc-components/pipingshared';
import { FilterState } from '@equinor/workspace-fusion/filter';
import {
defaultGridOptions,
useGridDataSource,
} from '@cc-components/shared/workspace-config';
import {
DateCell,
DescriptionCell,
StyledMonospace,
useHttpClient,
} from '@cc-components/shared';
import { generateCommaSeperatedStringArrayColumn } from '../utils-table/generateCommaSeperatedStringArrayColumn';
import { getHTList } from '../utils-table/tableHelpers';

export const useTableConfig = (contextId: string): GridConfig<Pipetest, FilterState> => {
const client = useHttpClient();

const { getRows, colDefs } = useGridDataSource<Pipetest>(async (req) => {
const res = await client.fetch(`/api/contexts/${contextId}/pipetest/grid`, req);
const meta = await res.json();

return {
rowCount: meta.rowCount,
items: meta.items,
columnDefinitions: meta.columnDefinitions,
};
}, columnDefinitions);
return {
gridOptions: {
...defaultGridOptions,
onFirstDataRendered: (e) => {
e.columnApi.autoSizeColumns(
e.columnApi
.getAllDisplayedColumns()
.filter((column) => column.getColId() !== 'description')
);
},
},
getRows: getRows,
columnDefinitions: colDefs as [ColDef<Pipetest>, ...ColDef<Pipetest>[]],
};
};

const columnDefinitions: [ColDef<Pipetest>, ...ColDef<Pipetest>[]] = [
{
headerName: 'Pipetest',
valueGetter: (pkg) => pkg.data?.id,
cellRenderer: (props: ICellRendererProps<Pipetest, string>) => {
return <StyledMonospace>{props.value}</StyledMonospace>;
},
},
{
headerName: 'Description',
colId: 'description',
valueGetter: (pkg) => pkg.data?.description,
cellRenderer: (props: ICellRendererProps<Pipetest, string | null>) => {
return <DescriptionCell description={props.value} />;
},
width: 300,
},
{ headerName: 'Priority', valueGetter: (pkg) => pkg.data?.commPkPriority1 },
{
headerName: 'Location',
valueGetter: (pkg) => pkg.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: 'RFC',
valueGetter: (pkg) => pkg.data?.rfccPlanned,
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>
);
},
},
];
Loading
Loading