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 heat trace app #415

Merged
merged 39 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
4e43dea
feat: :sparkles: init. Implement table view
MagnusGjosund Jun 19, 2023
36b6599
feat: :sparkles: mabye done with garden. Need to take a look at anoth…
MagnusGjosund Jun 20, 2023
38d096f
feat: :sparkles: add sidesheet
MagnusGjosund Jun 21, 2023
ff5eb7e
refactor: :twisted_rightwards_arrows: merge with main
MagnusGjosund Aug 3, 2023
8b19d87
feat: :sparkles: Add grid and filter
MagnusGjosund Aug 10, 2023
e73dcaa
style: Remove some comments
MagnusGjosund Aug 10, 2023
291340d
feat: :sparkles: Add KPI
MagnusGjosund Aug 10, 2023
39fb845
style: :green_heart: add capital T in HeatTrace
MagnusGjosund Aug 10, 2023
0824da5
style: :green_heart: fix a import
MagnusGjosund Aug 10, 2023
61787c6
Merge branch 'main' of https://github.com/equinor/cc-components into …
MagnusGjosund Aug 14, 2023
7326d34
feat: :sparkles: Add garden and garden functionallity. Need some chan…
MagnusGjosund Aug 17, 2023
8c43989
refactor: Merge main into heattrace
MagnusGjosund Aug 17, 2023
8968bb6
feat: :sparkles: implement auth check
MagnusGjosund Aug 17, 2023
f64c02a
Merge branch 'main' of https://github.com/equinor/cc-components into …
MagnusGjosund Aug 17, 2023
5f635d0
feat: :sparkles:
MagnusGjosund Aug 21, 2023
dbf3e40
chore: remove app.manifest and update package.json
MagnusGjosund Aug 21, 2023
fbd3c2c
refactor: :construction: some changes on sidesheet
MagnusGjosund Aug 22, 2023
f979933
chore: :construction: change sidesheet banner and some small other ch…
MagnusGjosund Aug 22, 2023
416b73d
Merge branch 'main' of https://github.com/equinor/cc-components into …
MagnusGjosund Aug 23, 2023
1e3d476
Merge branch 'main' into feat/implement-heat-trace-app
Gustav-Eikaas Aug 23, 2023
34a5f2a
refactor: :recycle: merge with main and update imports
MagnusGjosund Sep 13, 2023
7a6a880
Merge branch 'feat/implement-heat-trace-app' of https://github.com/eq…
MagnusGjosund Sep 13, 2023
afb392c
Merge branch 'main' of https://github.com/equinor/cc-components into …
MagnusGjosund Sep 13, 2023
bd73b2c
Merge branch 'main' of https://github.com/equinor/cc-components into …
MagnusGjosund Sep 14, 2023
c4399ea
feat: :sparkles: update heattrace and heattracechecklist models
MagnusGjosund Sep 14, 2023
3f38f63
feat: :sparkles: Update sidesheet
MagnusGjosund Sep 14, 2023
1e6914f
feat: :sparkles: add checklist tab
MagnusGjosund Sep 18, 2023
eb9dd23
Merge branch 'main' of https://github.com/equinor/cc-components into …
MagnusGjosund Sep 20, 2023
ecfdbf6
Merge branch 'main' of https://github.com/equinor/cc-components into …
MagnusGjosund Sep 26, 2023
694e31f
chore: :bug: rename rfc_planner_forecast_date to rfcPlannedForecastDate
MagnusGjosund Sep 26, 2023
b4982c0
Merge branch 'main' of https://github.com/equinor/cc-components into …
MagnusGjosund Sep 27, 2023
3889f3b
feat: :sparkles: add urls
MagnusGjosund Sep 27, 2023
fb6161e
Merge branch 'main' of https://github.com/equinor/cc-components into …
MagnusGjosund Sep 28, 2023
10c1650
Merge branch 'main' of https://github.com/equinor/cc-components into …
MagnusGjosund Sep 29, 2023
662eb4c
wip
MagnusGjosund Sep 29, 2023
ce520f3
Merge branch 'main' of https://github.com/equinor/cc-components into …
MagnusGjosund Sep 29, 2023
f7d0064
feat: :sparkles: add circuit diagram
MagnusGjosund Sep 29, 2023
a15b808
chore:
MagnusGjosund Oct 2, 2023
6887fba
change workorder to heattrace
MagnusGjosund Oct 2, 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
3 changes: 3 additions & 0 deletions apps/heattrace/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/heattrace/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# heattrace

Add readme
15 changes: 15 additions & 0 deletions apps/heattrace/app.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
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',
defaultScopes: ['api://ed6de162-dd30-4757-95eb-0ffc8d34fbe0/access_as_user'],
},
endpoints: {},
});
23 changes: 23 additions & 0 deletions apps/heattrace/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "heat-trace",
"displayName": "Heat Trace",
"shortName": "heat-trace",
"version": "0.0.1",
"main": "/src/main.tsx",
"private": true,
"type": "module",
"scripts": {
"dev": "fusion-framework-cli app dev",
"build": "tsc -b -f",
"pr:deploy": "npx ts-node --esm ../../github-action/src/releasePr.ts release",
"fprd:deploy": "npx ts-node --esm ../../github-action/src/releaseMain.ts release"
},
"dependencies": {
"@cc-components/heattraceapp": "workspace:^",
"@cc-components/shared": "workspace:^"
},
"files": [
"dist/app-bundle.js",
"app-manifest.json"
]
}
Empty file added apps/heattrace/prod.skip
Empty file.
15 changes: 15 additions & 0 deletions apps/heattrace/src/main.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { configure, WorkspaceWrapper } from '@cc-components/heattraceapp';
import { useHttpClient } from '@equinor/fusion-framework-react-app/http';
import { createRender, RootAppWrapper } from '@cc-components/shared';

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

export const render = createRender(MyApp, configure);
export default render;
22 changes: 22 additions & 0 deletions apps/heattrace/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/heattrace/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"
}
]
}
19 changes: 19 additions & 0 deletions apps/heattrace/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { defineConfig } from 'vite';
import EnvironmentPlugin from 'vite-plugin-environment';

export default defineConfig({
plugins: [
EnvironmentPlugin({
NODE_ENV: 'production',
}),
],
appType: 'custom',
build: {
emptyOutDir: true,
lib: {
entry: './src/main.tsx',
fileName: 'app-bundle',
formats: ['es'],
},
},
});
3 changes: 3 additions & 0 deletions libs/heattraceapp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# heattraceapp

Add readme
16 changes: 16 additions & 0 deletions libs/heattraceapp/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "@cc-components/heattraceapp",
"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/heattraceshared": "workspace:^",
"@cc-components/heattracesidesheet": "workspace:^"
}
}
1 change: 1 addition & 0 deletions libs/heattraceapp/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './lib';
40 changes: 40 additions & 0 deletions libs/heattraceapp/src/lib/config/frameworkConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { enableAgGrid } from '@equinor/fusion-framework-module-ag-grid';
import {
ComponentRenderArgs,
IAppConfigurator,
} from '@equinor/fusion-framework-react-app';
import { enableContext } from '@equinor/fusion-framework-react-module-context';
import buildQuery from 'odata-query';

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,
},
},
});
});
});

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

if (!envConfig) {
throw new Error('Failed to load environemnt config for workorder');
MagnusGjosund marked this conversation as resolved.
Show resolved Hide resolved
}
config.configureHttpClient('cc-api', {
baseUri: envConfig?.uri,
defaultScopes: envConfig?.defaultScopes,
});

enableAgGrid(config);
};

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

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

return {
getBlockAsync,
getGardenMeta,
getHeader,
getSubgroupItems,
getDisplayName: (item) => item.heatTraceCableNo,
initialGrouping: ['Priority1'],
customViews: {
customItemView: GardenItem,
},
};
};
10 changes: 10 additions & 0 deletions libs/heattraceapp/src/lib/config/heattraceSidesheet.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { SidesheetConfig } from '@equinor/workspace-fusion/sidesheet';
import { HeatTrace } from '@cc-components/heattraceshared';
import { HeattraceSidesheet } from '@cc-components/heattracesidesheet';

export const sidesheetConfig: SidesheetConfig<HeatTrace> = {
type: 'default',
DetailsSidesheet: (props) => (
<HeattraceSidesheet.Component id={props.id} item={props.item} close={props.close} />
),
};
2 changes: 2 additions & 0 deletions libs/heattraceapp/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';
20 changes: 20 additions & 0 deletions libs/heattraceapp/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 '@cc-components/shared';

export const useStatusBarConfig = (contextId: string): StatusBarConfig => {
const client = useHttpClient();

return async (filters, signal) => {
const res = await client.fetch(`/api/contexts/${contextId}/heat-trace/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 }));
};
};
95 changes: 95 additions & 0 deletions libs/heattraceapp/src/lib/config/tableConfig.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import { ColDef, GridConfig, ICellRendererProps } from '@equinor/workspace-fusion/grid';
import { CheckList, HeatTrace } from '@cc-components/heattraceshared';
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';

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

const { getRows, colDefs } = useGridDataSource<HeatTrace>(async (req) => {
const res = await client.fetch(`/api/contexts/${contextId}/heat-trace/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<HeatTrace>, ...ColDef<HeatTrace>[]],
};
};

const columnDefinitions: [ColDef<HeatTrace>, ...ColDef<HeatTrace>[]] = [
{
colId: 'HeatTraceCableNo',
field: 'Heat Trace',
valueGetter: (pkg) => pkg.data?.heatTraceCableNo,
cellRenderer: (props: ICellRendererProps<HeatTrace, string>) => {
return <StyledMonospace>{props.value}</StyledMonospace>;
},
},
{
colId: 'HeatTraceCableDescription',
field: 'Description',
valueGetter: (pkg) => pkg.data?.heatTraceCableDescription,
cellRenderer: (props: ICellRendererProps<HeatTrace, string | null>) => {
return <DescriptionCell description={props.value} />;
},
width: 300,
MagnusGjosund marked this conversation as resolved.
Show resolved Hide resolved
},
//Think it should be priority1, but priority1 has no data
{ colId: 'Priority1', field: 'Priority', valueGetter: (pkg) => pkg.data?.priority2 },
{
colId: 'Location',
field: 'Location',
valueGetter: (pkg) => pkg.data?.location,
cellRenderer: (props: ICellRendererProps<HeatTrace, string>) => {
return <StyledMonospace>{props.value}</StyledMonospace>;
},
},
{ field: 'Checklist status', valueGetter: (pkg) => 't.b.d :D' },
{ field: 'Current step', valueGetter: (pkg) => 't.b.d :D' },
// think this column only belongs to piptest
{
field: 'RFC',
valueGetter: (pkg) => 'RFC',
cellRenderer: (props: ICellRendererProps<HeatTrace, string | null | undefined>) => {
return props.value ? <DateCell dateString={props.value} /> : null;
},
},
{
field: 'Pipetests',
valueGetter: (pkg) => pkg.data?.pipetest,
cellRenderer: (props: ICellRendererProps<HeatTrace, CheckList[]>) => {
if (!props.value) return null;
return props.value;
// (
// <StyledMonospace>
// {generateCommaSeperatedStringArrayColumn(getHTList(props.value))}
MagnusGjosund marked this conversation as resolved.
Show resolved Hide resolved
// </StyledMonospace>
// );
},
},
];
Loading
Loading