Skip to content

Commit

Permalink
feat: add display name to grouping keys (#771)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustav-Eikaas authored Dec 21, 2023
1 parent fe67075 commit b64803b
Show file tree
Hide file tree
Showing 23 changed files with 369 additions and 369 deletions.
7 changes: 4 additions & 3 deletions libs/handoverapp/src/lib/config/gardenConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { HandoverPackage } from '@cc-components/handovershared';
import { useGardenDataSource } from '@cc-components/shared/workspace-config';
import { useHttpClient } from '@equinor/fusion-framework-react-app/http';
import { FilterState } from '@equinor/workspace-fusion/filter';
import { GardenConfig } from '@equinor/workspace-fusion/garden';
import { CustomItemView, GardenConfig } from '@equinor/workspace-fusion/garden';
import { GardenHeader, GardenItem } from '../ui-garden';

export const useGardenConfig = (
Expand Down Expand Up @@ -32,8 +32,9 @@ export const useGardenConfig = (
getHeader,
getSubgroupItems,
customViews: {
customItemView: GardenItem,
customHeaderView: GardenHeader,
//bs typescript error
customItemView: GardenItem as any,
customHeaderView: GardenHeader as any,
},
visuals: {
rowHeight: 31,
Expand Down
4 changes: 2 additions & 2 deletions libs/handoverapp/src/lib/ui-garden/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
import { PopoverContent } from './PopoverContent';
import { ItemOptions } from './types';

const HandoverItem = (props: CustomItemView<HandoverPackage>) => {
const HandoverItem = (args: CustomItemView<HandoverPackage>) => {
const [isOpen, setIsOpen] = useState(false);
const hoverTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);

Expand All @@ -32,7 +32,7 @@ const HandoverItem = (props: CustomItemView<HandoverPackage>) => {
rowStart,
columnStart,
parentRef,
} = props;
} = args;

const size = getItemSize(data.volume, 100 || 0);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useContextId, usePackageResource } from '@cc-components/shared/hooks';
import { useHttpClient } from '@equinor/fusion-framework-react-app/http';

import { useCallback } from 'react';
import {
HandoverDetails,
Expand Down
2 changes: 1 addition & 1 deletion libs/heattraceapp/src/lib/config/gardenConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const useGardenConfig = (
getDisplayName: (item) => item.heatTraceCableNo,
initialGrouping: ['RFC'],
customViews: {
customItemView: GardenItem,
customItemView: GardenItem as any,
},
};
};
5 changes: 3 additions & 2 deletions libs/loopapp/src/lib/config/gardenConfig.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Loop } from '@cc-components/loopshared';
import { GardenConfig } from '@equinor/workspace-fusion/garden';
import { CustomItemView, GardenConfig } from '@equinor/workspace-fusion/garden';
import { FilterState } from '@equinor/workspace-fusion/filter';
import { GardenItem } from '../ui-garden';
import { useHttpClient } from '@equinor/fusion-framework-react-app/http';
Expand All @@ -25,7 +25,8 @@ export const useGardenConfig = (contextId: string): GardenConfig<Loop, FilterSta
getDisplayName: (item) => item.loopNo,
initialGrouping: ['Responsible'],
customViews: {
customItemView: GardenItem,
//bs typescript error
customItemView: GardenItem as any,
},
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const useGardenConfig = (
getHeader,
getSubgroupItems,
customViews: {
customItemView: GardenItem,
customItemView: GardenItem as any,
},
visuals: {
rowHeight: 31,
Expand Down
4 changes: 2 additions & 2 deletions libs/modelviewer/src/modules/configurator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
BaseConfigBuilder,
ConfigBuilderCallbackArgs,
} from '@equinor/fusion-framework-module';
import { type IHttpClient } from '@equinor/fusion-framework-module-http';
import { IAuthProvider } from '@equinor/fusion-framework-module-msal';

export type ClientOptions = {
baseUrl: string;
Expand Down Expand Up @@ -31,7 +31,7 @@ export class ModelViewerConfigurator extends BaseConfigBuilder<IModelViewerConfi
protected async _getAutModule({
hasModule,
requireInstance,
}: ConfigBuilderCallbackArgs) {
}: ConfigBuilderCallbackArgs): Promise<IAuthProvider> {
if (!hasModule('auth')) {
throw new Error('Fusion MsalModule required to activate this module');
}
Expand Down
3 changes: 2 additions & 1 deletion libs/modelviewer/src/services/htmlOverlayToolHandler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { HtmlOverlayOptions, HtmlOverlayTool } from '@cognite/reveal';
import { HtmlOverlayOptions, HtmlOverlayTool } from '@cognite/reveal/tools';

import { throttle } from 'throttle-typescript';
import { debounce } from '../utils/debounceUtils';
import { Echo3dViewer } from '@equinor/echo-3d-viewer';
Expand Down
2 changes: 1 addition & 1 deletion libs/modelviewer/src/utils/overlayUtils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AabbModel, Echo3dViewer, combineHierarchyAabbs } from '@equinor/echo-3d-viewer';
import { Cluster } from '../types/cluster';

import { HtmlOverlayTool } from '@cognite/reveal';
import { HtmlOverlayTool } from '@cognite/reveal/tools';
import { OverlayTag, TagMap, TagOverlay } from '../types/overlayTags';
import { HtmlOverlayToolHandler } from '../services';
import { ViewerNodeSelection } from '../types/viewerNodeSelection';
Expand Down
2 changes: 1 addition & 1 deletion libs/pipingapp/src/lib/config/gardenConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const useGardenConfig = (
getDisplayName: (item) => item.id,
initialGrouping: ['Priority1'],
customViews: {
customItemView: GardenItem,
customItemView: GardenItem as any,
},
};
};
2 changes: 1 addition & 1 deletion libs/punchapp/src/lib/config/gardenConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const useGardenConfig = (contextId: string): GardenConfig<Punch, FilterSt
rowHeight: 25,
},
customViews: {
customItemView: PunchGardenItem,
customItemView: PunchGardenItem as any,
},
};
};
2 changes: 1 addition & 1 deletion libs/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"@cc-components/sharedcomponents": "workspace:^",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@equinor/workspace-ag-grid": "2.0.3",
"@equinor/workspace-ag-grid": "2.0.5",
"@remirror/pm": "^2.0.8",
"@remirror/react": "^2.0.27",
"@remirror/react-editors": "^1.0.38",
Expand Down
3 changes: 2 additions & 1 deletion libs/shared/src/packages/cc-api/useCCApiAccessCheck.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useQuery } from '@tanstack/react-query';
import { CCApiUnauthorizedError } from '../error-boundary';
import { IHttpClient } from '@equinor/fusion-framework-react-app/http';

import { IHttpClient } from '@equinor/fusion-framework-react/http';

export function useCCApiAccessCheck(
contextId: string,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { useFramework } from '@equinor/fusion-framework-react';
import type { IHttpClient } from '@equinor/fusion-framework-react/http';

import { type IHttpClient } from '@equinor/fusion-framework-module-http';
type ServiceDiscoTypes =
| 'app-proxy'
| 'pre-auth-proxy'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useServiceDiscovery } from '../../../hooks/src/lib/useServiceDiscovery';
import { IHttpClient } from '@equinor/fusion-framework-react-app/http';
import { EmbedInfo, EmbedToken, ReportInfo } from './types';
import { useExternalContextId } from '../../../hooks';
import { type IHttpClient } from '@equinor/fusion-framework-module-http';

const isEmbedInfo = (embedInfo: unknown): embedInfo is EmbedInfo => {
return (embedInfo as EmbedInfo).embedConfig.embedUrl !== undefined ? true : false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { IHttpClient } from '@equinor/fusion-framework-react-app/http';
import { PropsWithChildren, createContext, useContext } from 'react';
import { type IHttpClient } from '@equinor/fusion-framework-module-http';

/**
* Facade for fusion framework http client
Expand Down
2 changes: 1 addition & 1 deletion libs/shared/src/packages/root-app-wrapper/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { PropsWithChildren, StrictMode } from 'react';
import { ClientProvider } from './ClientProvider';
import { IHttpClient } from '@equinor/fusion-framework-react-app/http';
import { AppErrorBoundary } from '../../error-boundary';
import { StyledDefaultLayout } from './DefaultLayout';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { type IHttpClient } from '@equinor/fusion-framework-module-http';

const queryClient = new QueryClient();
export const RootAppWrapper = ({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import { FilterState } from '@equinor/workspace-fusion/filter';
import { GardenDataSource } from '@equinor/workspace-fusion/garden';

type GroupingOption = {
displayName: string;
groupingKey: string;
timeInterval: string[] | null;
dateVariant: string[] | null;
};

type ApiGardenMeta = {
startIndex: number | null;
columnCount: number;
columnWidth?: number;
rowCount: number;
subGroupCount: number;
allGroupingOptions:
| string[]
| {
groupingKey: string;
timeInterval: string[] | null;
dateVariant: string[] | null;
}[];
validGroupingOptions: string[];
allGroupingOptions: GroupingOption[];
validGroupingOptions: GroupingOption[];
};

type ApiHeader = {
Expand Down Expand Up @@ -72,24 +73,8 @@ export function useGardenDataSource(
}
const meta: ApiGardenMeta = await res.json();

const possibleItem = meta.allGroupingOptions.at(0);

//TODO: remove when api is migrated
const groupingOptions: {
groupingKey: string;
timeInterval: string[] | null;
dateVariant: string[] | null;
}[] =
typeof possibleItem === 'string'
? meta.allGroupingOptions.map((s) => ({
timeInterval: null,
dateVariant: null,
groupingKey: s as string,
}))
: (meta.allGroupingOptions as any);

return {
allGroupingOptions: groupingOptions,
allGroupingOptions: meta.allGroupingOptions,
columnCount: meta.columnCount,
validGroupingOptions: meta.validGroupingOptions,
columnStart: meta.startIndex,
Expand Down
2 changes: 1 addition & 1 deletion libs/swcrapp/src/lib/config/gardenConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const useGardenConfig = (
rowHeight: 25,
},
customViews: {
customItemView: SwcrItem,
customItemView: SwcrItem as any,
},
};
};
4 changes: 2 additions & 2 deletions libs/workorderapp/src/lib/config/gardenConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ export const useGardenConfig = (
getHeader,
getSubgroupItems,
customViews: {
customItemView: GardenItem,
customHeaderView: GardenHeader,
customItemView: GardenItem as any,
customHeaderView: GardenHeader as any,
},
visuals: {
rowHeight: 30,
Expand Down
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,13 @@
"@equinor/eds-core-react": "^0.28.0",
"@equinor/eds-icons": "0.19.3",
"@equinor/eds-tokens": "0.9.2",
"@equinor/fusion-framework-module-ag-grid": "30.2.0",
"@equinor/fusion-framework-react-app": "^4.1.8",
"@equinor/fusion-framework-react-module-context": "^6.0.14",
"@equinor/fusion-observable": "8.1.2",
"@equinor/workspace-fusion": "6.1.0",
"@equinor/fusion-framework-module-ag-grid": "30.2.1",
"@equinor/fusion-framework-module-msal": "^3.0.8",
"@equinor/fusion-framework-react-app": "^4.1.17",
"@equinor/fusion-framework-react-module-context": "^6.0.18",
"@equinor/fusion-framework-react-module-http": "^4.0.3",
"@equinor/fusion-observable": "8.1.4",
"@equinor/workspace-fusion": "6.1.2-pr.5",
"@microsoft/applicationinsights-web": "^3.0.3",
"@swc/helpers": "0.5.2",
"@tanstack/react-query": "^4.35.3",
Expand Down
Loading

0 comments on commit b64803b

Please sign in to comment.