@itwin/grouping-mapping-widget 0.29.0 → 0.30.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -5
- package/lib/cjs/WidgetShell/GroupingMapping.d.ts +1 -1
- package/lib/cjs/WidgetShell/GroupingMapping.js +2 -1
- package/lib/cjs/WidgetShell/GroupingMapping.js.map +1 -1
- package/lib/cjs/components/GroupingMappingContext.d.ts +1 -0
- package/lib/cjs/components/GroupingMappingContext.js +3 -1
- package/lib/cjs/components/GroupingMappingContext.js.map +1 -1
- package/lib/cjs/components/Mappings/hooks/useRunExtraction.js +3 -0
- package/lib/cjs/components/Mappings/hooks/useRunExtraction.js.map +1 -1
- package/lib/cjs/components/Properties/GroupProperties/GroupPropertyAction.js +6 -4
- package/lib/cjs/components/Properties/GroupProperties/GroupPropertyAction.js.map +1 -1
- package/lib/cjs/components/context/ExtractionClientContext.js +1 -1
- package/lib/cjs/components/context/ExtractionClientContext.js.map +1 -1
- package/lib/cjs/components/context/GroupingApiConfigContext.d.ts +1 -0
- package/lib/cjs/components/context/GroupingApiConfigContext.js +0 -2
- package/lib/cjs/components/context/GroupingApiConfigContext.js.map +1 -1
- package/lib/cjs/components/context/GroupsClientContext.js +1 -1
- package/lib/cjs/components/context/GroupsClientContext.js.map +1 -1
- package/lib/cjs/components/context/MappingClientContext.js +1 -1
- package/lib/cjs/components/context/MappingClientContext.js.map +1 -1
- package/lib/cjs/components/context/PropertiesClientContext.js +1 -1
- package/lib/cjs/components/context/PropertiesClientContext.js.map +1 -1
- package/lib/esm/WidgetShell/GroupingMapping.d.ts +1 -1
- package/lib/esm/WidgetShell/GroupingMapping.js +2 -1
- package/lib/esm/WidgetShell/GroupingMapping.js.map +1 -1
- package/lib/esm/components/GroupingMappingContext.d.ts +1 -0
- package/lib/esm/components/GroupingMappingContext.js +3 -1
- package/lib/esm/components/GroupingMappingContext.js.map +1 -1
- package/lib/esm/components/Mappings/hooks/useRunExtraction.js +3 -0
- package/lib/esm/components/Mappings/hooks/useRunExtraction.js.map +1 -1
- package/lib/esm/components/Properties/GroupProperties/GroupPropertyAction.js +6 -4
- package/lib/esm/components/Properties/GroupProperties/GroupPropertyAction.js.map +1 -1
- package/lib/esm/components/context/ExtractionClientContext.js +1 -1
- package/lib/esm/components/context/ExtractionClientContext.js.map +1 -1
- package/lib/esm/components/context/GroupingApiConfigContext.d.ts +1 -0
- package/lib/esm/components/context/GroupingApiConfigContext.js +0 -2
- package/lib/esm/components/context/GroupingApiConfigContext.js.map +1 -1
- package/lib/esm/components/context/GroupsClientContext.js +1 -1
- package/lib/esm/components/context/GroupsClientContext.js.map +1 -1
- package/lib/esm/components/context/MappingClientContext.js +1 -1
- package/lib/esm/components/context/MappingClientContext.js.map +1 -1
- package/lib/esm/components/context/PropertiesClientContext.js +1 -1
- package/lib/esm/components/context/PropertiesClientContext.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -12,11 +12,7 @@ This package provides a viewer 'widget'. Documentation on how to add a widget to
|
|
|
12
12
|
|
|
13
13
|
## Permissions and Scopes
|
|
14
14
|
|
|
15
|
-
The SPA client used by your iTwin viewer must have
|
|
16
|
-
|
|
17
|
-
- `insights:read`
|
|
18
|
-
- `insights:modify`
|
|
19
|
-
- `itwins:read`
|
|
15
|
+
The SPA client used by your iTwin viewer must have the `itwin-platform` scope.
|
|
20
16
|
|
|
21
17
|
In addition, users must have the `imodels_read` and `imodels_write` [permissions](https://developer.bentley.com/apis/insights/operations/create-mapping/#authorization) assigned at either the Project or iModel level. Further instruction on how to create roles and assign permissions can be found in the [iTwin Platform Projects API documentation](https://developer.bentley.com/apis/projects/tutorials/).
|
|
22
18
|
|
|
@@ -3,7 +3,7 @@ import type { GroupMinimal, Mapping, Property } from "@itwin/insights-client";
|
|
|
3
3
|
import type { GroupingMappingContextProps } from "../components/GroupingMappingContext";
|
|
4
4
|
import "./GroupingMapping.scss";
|
|
5
5
|
import type { ContextCustomUI } from "../components/customUI/GroupingMappingCustomUI";
|
|
6
|
-
export declare type GroupingMappingProps = Omit<GroupingMappingContextProps, "iModelId"> & {
|
|
6
|
+
export declare type GroupingMappingProps = Omit<GroupingMappingContextProps, "iModelId" | "changesetId"> & {
|
|
7
7
|
hideRefreshIcon?: boolean;
|
|
8
8
|
};
|
|
9
9
|
export declare enum RouteStep {
|
|
@@ -51,6 +51,7 @@ const GroupingMapping = (props) => {
|
|
|
51
51
|
const activeIModelConnection = (0, appui_react_1.useActiveIModelConnection)();
|
|
52
52
|
const iModelConnection = props.iModelConnection ?? activeIModelConnection;
|
|
53
53
|
const iModelId = iModelConnection?.iModelId ?? "";
|
|
54
|
+
const changeSetId = iModelConnection?.changeset.id ?? "";
|
|
54
55
|
const navigateTo = (0, react_1.useCallback)((toRoute) => {
|
|
55
56
|
setRoutingHistory((r) => [...r, toRoute(r[r.length - 1])]);
|
|
56
57
|
}, []);
|
|
@@ -74,7 +75,7 @@ const GroupingMapping = (props) => {
|
|
|
74
75
|
// No group UI's provided means the widget provides its own
|
|
75
76
|
...(props.customUIs ?? DefaultGroupingUI_1.defaultGroupingUI),
|
|
76
77
|
], [props.customUIs, navigateTo]);
|
|
77
|
-
return (react_1.default.createElement(GroupingMappingContext_1.GroupingMappingContext, { iModelId: iModelId, ...props, customUIs: injectedCustomUI },
|
|
78
|
+
return (react_1.default.createElement(GroupingMappingContext_1.GroupingMappingContext, { iModelId: iModelId, changeSetId: changeSetId, ...props, customUIs: injectedCustomUI },
|
|
78
79
|
react_1.default.createElement("div", { className: "gmw-group-mapping-container" },
|
|
79
80
|
react_1.default.createElement(GroupingMappingHeader_1.GroupingMappingHeader, { goBack: goBack, currentRoute: currentRoute }),
|
|
80
81
|
react_1.default.createElement(GroupingMappingContent_1.GroupingMappingContent, { routingHistory: routingHistory, navigateTo: navigateTo, goBack: goBack, hideRefreshIcon: props.hideRefreshIcon }))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupingMapping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,CAAC,GAAG,EAAE,CAAC;QACrB,iBAAiB,CAAC,cAAc,CAAC,CAAC;IACpC,CAAC,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC;IAErB,MAAM,gBAAgB,GAAG,IAAA,eAAO,EAC9B,GAAG,EAAE,CAAC;QACJ;YACE,IAAI,EAAE,YAAY;YAClB,YAAY,EAAE,YAAY;YAC1B,IAAI,EAAE,qDAA2B,CAAC,OAAO;YACzC,IAAI,EAAE,8BAAC,6BAAO,OAAG;YACjB,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CACjB,UAAU,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;gBACpB,IAAI,EAAE,SAAS,CAAC,UAAU;gBAC1B,KAAK,EAAE,KAAK,CAAC,SAAS;gBACtB,mBAAmB,EAAE,EAAE,GAAG,IAAI,EAAE,mBAAmB,EAAE,KAAK,EAAE;aAC7D,CAAC,CAAC;SACN;QACD,2DAA2D;QAC3D,GAAG,CAAC,KAAK,CAAC,SAAS,IAAI,qCAAiB,CAAC;KAC1C,EACD,CAAC,KAAK,CAAC,SAAS,EAAE,UAAU,CAAC,CAC9B,CAAC;IAEF,OAAO,CACL,8BAAC,+CAAsB,IAAC,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,KAAM,KAAK,EAAE,SAAS,EAAE,gBAAgB;QAC1G,uCAAK,SAAS,EAAC,6BAA6B;YAC1C,8BAAC,6CAAqB,IAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,GAAI;YACrE,8BAAC,+CAAsB,IAAC,cAAc,EAAE,cAAc,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,KAAK,CAAC,eAAe,GAAI,CACtI,CACiB,CAC1B,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,eAAe,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport type { GroupMinimal, Mapping, Property } from \"@itwin/insights-client\";\nimport React, { useCallback, useMemo, useState } from \"react\";\nimport type { GroupingMappingContextProps } from \"../components/GroupingMappingContext\";\nimport { GroupingMappingContext } from \"../components/GroupingMappingContext\";\nimport \"./GroupingMapping.scss\";\nimport { useActiveIModelConnection } from \"@itwin/appui-react\";\nimport type { ContextCustomUI, GroupingMappingCustomUI } from \"../components/customUI/GroupingMappingCustomUI\";\nimport { GroupingMappingCustomUIType } from \"../components/customUI/GroupingMappingCustomUI\";\nimport { SvgList } from \"@itwin/itwinui-icons-react\";\nimport { GroupingMappingContent } from \"./GroupingMappingContent\";\nimport { GroupingMappingHeader } from \"./GroupingMappingHeader\";\nimport { defaultGroupingUI } from \"../components/customUI/DefaultGroupingUI\";\n\nexport type GroupingMappingProps = Omit<GroupingMappingContextProps, \"iModelId\" | \"changesetId\"> & {\n hideRefreshIcon?: boolean;\n};\n\nexport enum RouteStep {\n Mappings,\n MappingsAction,\n Groups,\n GroupAction,\n GroupContextCustomUI,\n Properties,\n PropertyAction,\n CalculatedPropertyAction,\n CustomCalculationPropertyAction,\n}\n\nexport interface Route {\n step: RouteStep;\n title: string;\n groupingRouteFields: GroupingRouteFields;\n}\n\nexport interface GroupingRouteFields {\n mapping?: Mapping;\n group?: GroupMinimal;\n property?: Property;\n calculatedProperty?: Property;\n customCalculation?: Property;\n // Optional prop but cannot be declared undefined.\n groupContextCustomUI?: Exclude<ContextCustomUI[\"uiComponent\"], undefined>;\n queryGenerationType?: string;\n}\n\nconst GroupingMapping = (props: GroupingMappingProps) => {\n const [routingHistory, setRoutingHistory] = useState<Route[]>([{ step: RouteStep.Mappings, title: \"Mapping\", groupingRouteFields: {} }]);\n const currentRoute = routingHistory[routingHistory.length - 1];\n const activeIModelConnection = useActiveIModelConnection();\n const iModelConnection = props.iModelConnection ?? activeIModelConnection;\n const iModelId = iModelConnection?.iModelId ?? \"\";\n const changeSetId = iModelConnection?.changeset.id ?? \"\";\n const navigateTo = useCallback((toRoute: (prev: Route | undefined) => Route) => {\n setRoutingHistory((r) => [...r, toRoute(r[r.length - 1])]);\n }, []);\n\n const goBack = useCallback(() => {\n const updatedRouting = [...routingHistory];\n updatedRouting.pop();\n setRoutingHistory(updatedRouting);\n }, [routingHistory]);\n\n const injectedCustomUI = useMemo<GroupingMappingCustomUI[]>(\n () => [\n {\n name: \"Properties\",\n displayLabel: \"Properties\",\n type: GroupingMappingCustomUIType.Context,\n icon: <SvgList />,\n onClick: (group) =>\n navigateTo((prev) => ({\n step: RouteStep.Properties,\n title: group.groupName,\n groupingRouteFields: { ...prev?.groupingRouteFields, group },\n })),\n },\n // No group UI's provided means the widget provides its own\n ...(props.customUIs ?? defaultGroupingUI),\n ],\n [props.customUIs, navigateTo],\n );\n\n return (\n <GroupingMappingContext iModelId={iModelId} changeSetId={changeSetId} {...props} customUIs={injectedCustomUI}>\n <div className=\"gmw-group-mapping-container\">\n <GroupingMappingHeader goBack={goBack} currentRoute={currentRoute} />\n <GroupingMappingContent routingHistory={routingHistory} navigateTo={navigateTo} goBack={goBack} hideRefreshIcon={props.hideRefreshIcon} />\n </div>\n </GroupingMappingContext>\n );\n};\n\nexport default GroupingMapping;\n"]}
|
|
@@ -21,6 +21,7 @@ export interface GroupingMappingContextProps {
|
|
|
21
21
|
* Used for iTwin and iModel APIs.
|
|
22
22
|
* Also used for Mapping API if a custom IMappingsClient is not provided.
|
|
23
23
|
*/
|
|
24
|
+
changeSetId?: string;
|
|
24
25
|
prefix?: ClientPrefix;
|
|
25
26
|
/**
|
|
26
27
|
* A custom implementation of MappingClient.
|
|
@@ -95,6 +95,7 @@ const GroupingMappingContext = (props) => {
|
|
|
95
95
|
getAccessToken: props.getAccessToken ?? authorizationClientGetAccessToken,
|
|
96
96
|
iModelId: props.iModelId,
|
|
97
97
|
prefix: props.prefix,
|
|
98
|
+
changeSetId: props.changeSetId,
|
|
98
99
|
});
|
|
99
100
|
const [hiddenGroupsIds, setHiddenGroupsIds] = (0, react_1.useState)(new Set());
|
|
100
101
|
const [showGroupColor, setShowGroupColor] = (0, react_1.useState)(false);
|
|
@@ -117,8 +118,9 @@ const GroupingMappingContext = (props) => {
|
|
|
117
118
|
iModelId: props.iModelId,
|
|
118
119
|
getAccessToken: props.getAccessToken ?? authorizationClientGetAccessToken,
|
|
119
120
|
iModelConnection: props.iModelConnection ?? activeIModelConnection,
|
|
121
|
+
changeSetId: props.changeSetId,
|
|
120
122
|
}));
|
|
121
|
-
}, [activeIModelConnection, props.getAccessToken, props.iModelConnection, props.iModelId, props.prefix]);
|
|
123
|
+
}, [activeIModelConnection, props.changeSetId, props.getAccessToken, props.iModelConnection, props.iModelId, props.prefix]);
|
|
122
124
|
(0, react_1.useEffect)(() => {
|
|
123
125
|
setMappingClient((0, MappingClientContext_1.createMappingClient)(mappingsClientProp));
|
|
124
126
|
}, [mappingsClientProp]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupingMappingContext.js","sourceRoot":"","sources":["../../../src/components/GroupingMappingContext.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;gGAGgG;AAChG,+CAA4D;AAE5D,wDAAiD;AAEjD,iFAAqF;AACrF,yEAA2F;AAE3F,6FAAyH;AAGzH,uFAAoF;AACpF,uFAAoF;AACpF,oDAA+D;AAC/D,+EAAoG;AAEpG,uDAAoG;AACpG,wDAA+C;AAC/C,2CAAkD;AAClD,2CAAwC;AACxC,mFAAiF;AACjF,uEAAwF;AACxF,+EAAoG;AAmDpG,MAAM,iCAAiC,GAAG,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,yBAAS,CAAC,mBAAmB,EAAE,cAAc,EAAE,CAAC,IAAI,EAAE,CAAC;AAEpH,MAAM,kBAAkB,GAAG,IAAI,yBAAW,CAAC;IACzC,cAAc,EAAE;QACd,OAAO,EAAE;YACP,oBAAoB,EAAE,KAAK;YAC3B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AC,CAAC;QACL,cAAc,EAAE,mBAAmB;QACnC,iBAAiB,EAAE,sBAAsB;KAC1C,CAAC,EACF,CAAC,mBAAmB,CAAC,CACtB,CAAC;IAEF,MAAM,oBAAoB,GAAG,IAAA,eAAO,EAClC,GAAG,EAAE,CAAC,CAAC;QACL,SAAS;QACT,YAAY;KACb,CAAC,EACF,CAAC,SAAS,CAAC,CACZ,CAAC;IAEF,MAAM,8BAA8B,GAAG,IAAA,eAAO,EAC5C,GAAG,EAAE,CAAC,CAAC;QACL,gBAAgB;QAChB,mBAAmB;KACpB,CAAC,EACF,CAAC,gBAAgB,CAAC,CACnB,CAAC;IAEF,OAAO,CACL,8BAAC,iCAAmB,IAAC,MAAM,EAAE,WAAW;QACtC,8BAAC,0DAA+B,CAAC,QAAQ,IAAC,KAAK,EAAE,SAAS;YACxD,8BAAC,2CAAoB,CAAC,QAAQ,IAAC,KAAK,EAAE,aAAa;gBACjD,8BAAC,yCAAmB,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY;oBAC/C,8BAAC,iDAAuB,CAAC,QAAQ,IAAC,KAAK,EAAE,gBAAgB;wBACvD,8BAAC,iDAAuB,CAAC,QAAQ,IAAC,KAAK,EAAE,gBAAgB;4BACvD,8BAAC,sDAA0B,CAAC,QAAQ,IAAC,KAAK,EAAE,8BAA8B;gCACxE,8BAAC,+DAA8B,CAAC,QAAQ,IAAC,KAAK,EAAE,oBAAoB;oCAClE,8BAAC,yDAA2B,CAAC,QAAQ,IAAC,KAAK,EAAE,2BAA2B;wCACtE,8BAAC,yDAA2B,CAAC,QAAQ,IAAC,KAAK,EAAE,sBAAsB,IAAG,KAAK,CAAC,QAAQ,CAAwC,CACvF,CACC,CACN,CACL,CACF,CACN,CACD,CACS,CACvB,CACvB,CAAC;AACJ,CAAC,CAAC;AAzIW,QAAA,sBAAsB,0BAyIjC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport React, { useEffect, useMemo, useState } from \"react\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport type { ClientPrefix, GetAccessTokenFn, GroupingMappingApiConfig } from \"./context/GroupingApiConfigContext\";\nimport { GroupingMappingApiConfigContext } from \"./context/GroupingApiConfigContext\";\nimport { createMappingClient, MappingClientContext } from \"./context/MappingClientContext\";\nimport type { Group, IExtractionClient, IGroupsClient, IMappingsClient, IPropertiesClient } from \"@itwin/insights-client\";\nimport { createGroupingMappingCustomUI, GroupingMappingCustomUIContext } from \"./context/GroupingMappingCustomUIContext\";\nimport type { GroupingMappingCustomUI } from \"./customUI/GroupingMappingCustomUI\";\nimport type { OverlappedElementsMetadata } from \"./context/GroupHilitedElementsContext\";\nimport { GroupHilitedElementsContext } from \"./context/GroupHilitedElementsContext\";\nimport { PropertiesGroupColorContext } from \"./context/PropertiesGroupColorContext\";\nimport { useActiveIModelConnection } from \"@itwin/appui-react\";\nimport { createExtractionClient, ExtractionClientContext } from \"./context/ExtractionClientContext\";\nimport type { Query } from \"@tanstack/react-query\";\nimport { MutationCache, QueryCache, QueryClient, QueryClientProvider } from \"@tanstack/react-query\";\nimport { toaster } from \"@itwin/itwinui-react\";\nimport { getErrorMessage } from \"../common/utils\";\nimport { TErrCodes } from \"./Constants\";\nimport { ExtractionStatusJobContext } from \"./context/ExtractionStateJobContext\";\nimport { createGroupsClient, GroupsClientContext } from \"./context/GroupsClientContext\";\nimport { createPropertiesClient, PropertiesClientContext } from \"./context/PropertiesClientContext\";\n\n/**\n * Props for the {@link GroupingMappingContext} component.\n * @public\n */\nexport interface GroupingMappingContextProps {\n /**\n * Custom callback to retrieve access token.\n */\n getAccessToken?: GetAccessTokenFn;\n /**\n * The iTwin iModel Id.\n */\n iModelId: string;\n /**\n * Used for iTwin and iModel APIs.\n * Also used for Mapping API if a custom IMappingsClient is not provided.\n */\n prefix?: ClientPrefix;\n /**\n * A custom implementation of MappingClient.\n */\n mappingsClient?: IMappingsClient;\n /**\n * A custom implementation of GroupsClient.\n */\n groupsClient?: IGroupsClient;\n /**\n * A custom implementation of PropertiesClient.\n */\n propertiesClient?: IPropertiesClient;\n /**\n * A custom implementation of ExtractionClient.\n */\n extractionClient?: IExtractionClient;\n /**\n * Custom UI to add and update groups or provide additional group context capabilities.\n */\n customUIs?: GroupingMappingCustomUI[];\n /**\n * A custom iModelConnection to use instead of the active iModelConnection from UiFramework.\n */\n iModelConnection?: IModelConnection;\n /**\n * A custom QueryClient. If not provided, a default QueryClient will be used.\n */\n queryClient?: QueryClient;\n children?: React.ReactNode;\n}\n\nconst authorizationClientGetAccessToken = async () => (await IModelApp.authorizationClient?.getAccessToken()) ?? \"\";\n\nconst defaultQueryClient = new QueryClient({\n defaultOptions: {\n queries: {\n refetchOnWindowFocus: false,\n staleTime: 20 * 60 * 1000, // 20 minutes\n },\n },\n queryCache: new QueryCache({\n onError: (error: any, query: Query) => {\n switch (query.meta?.errorCode) {\n case TErrCodes.QUERY_HILITE_FETCH_FAILED:\n toaster.negative(query.meta?.message as string);\n break;\n default: {\n if (error.status) toaster.negative(getErrorMessage(error.status));\n else toaster.negative(\"An error occurred while fetching data.\");\n }\n }\n },\n }),\n mutationCache: new MutationCache({\n onError: (error: any) => {\n if (error.status) toaster.negative(getErrorMessage(error.status));\n else toaster.negative(\"A network error occured while processing this action.\");\n },\n }),\n});\n\n/**\n * Grouping and Mapping Context providers required for all components.\n * @public\n */\nexport const GroupingMappingContext = (props: GroupingMappingContextProps) => {\n const activeIModelConnection = useActiveIModelConnection();\n const mappingsClientProp: IMappingsClient | ClientPrefix = props.mappingsClient ?? props.prefix;\n const groupsClientProp: IGroupsClient | ClientPrefix = props.groupsClient ?? props.prefix;\n const propertiesClientProp: IPropertiesClient | ClientPrefix = props.propertiesClient ?? props.prefix;\n const extractionClientProp: IExtractionClient | ClientPrefix = props.extractionClient ?? props.prefix;\n const [mappingClient, setMappingClient] = useState<IMappingsClient>(createMappingClient(mappingsClientProp));\n const [groupsClient, setGroupsClient] = useState<IGroupsClient>(createGroupsClient(groupsClientProp));\n const [propertiesClient, setPropertiesClient] = useState<IPropertiesClient>(createPropertiesClient(propertiesClientProp));\n const [extractionClient, setExtractionClient] = useState<IExtractionClient>(createExtractionClient(extractionClientProp));\n const [customUIs, setCustomUIs] = useState<GroupingMappingCustomUI[]>(createGroupingMappingCustomUI(props.customUIs));\n const [apiConfig, setApiConfig] = useState<GroupingMappingApiConfig>({\n getAccessToken: props.getAccessToken ?? authorizationClientGetAccessToken,\n iModelId: props.iModelId,\n prefix: props.prefix,\n });\n const [hiddenGroupsIds, setHiddenGroupsIds] = useState<Set<string>>(new Set());\n const [showGroupColor, setShowGroupColor] = useState<boolean>(false);\n const [propertiesShowGroup, setPropertiesShowGroup] = useState<boolean>(false);\n const [groups, setGroups] = useState<Group[]>([]);\n const [numberOfVisualizedGroups, setNumberOfVisualizedGroups] = useState(0);\n const [isOverlappedColored, setIsOverlappedColored] = useState<boolean>(false);\n const [currentHilitedGroups, setCurrentHilitedGroups] = useState<number>(1);\n const [isVisualizationsEnabled, setIsVisualizationsEnabled] = useState<boolean>(false);\n const [overlappedElementsMetadata, setOverlappedElementsMetadata] = useState<OverlappedElementsMetadata>({\n overlappedElementsInfo: new Map(),\n groupElementsInfo: new Map(),\n overlappedElementGroupPairs: [],\n });\n const queryClient = props.queryClient ?? defaultQueryClient;\n const [mappingIdJobInfo, setMappingIdJobInfo] = useState<Map<string, string>>(new Map());\n\n useEffect(() => {\n setApiConfig(() => ({\n prefix: props.prefix,\n iModelId: props.iModelId,\n getAccessToken: props.getAccessToken ?? authorizationClientGetAccessToken,\n iModelConnection: props.iModelConnection ?? activeIModelConnection,\n }));\n }, [activeIModelConnection, props.getAccessToken, props.iModelConnection, props.iModelId, props.prefix]);\n\n useEffect(() => {\n setMappingClient(createMappingClient(mappingsClientProp));\n }, [mappingsClientProp]);\n\n useEffect(() => {\n setGroupsClient(createGroupsClient(groupsClientProp));\n }, [groupsClientProp]);\n\n useEffect(() => {\n setPropertiesClient(createPropertiesClient(propertiesClientProp));\n }, [propertiesClientProp]);\n\n useEffect(() => {\n setExtractionClient(createExtractionClient(extractionClientProp));\n }, [extractionClientProp]);\n\n useEffect(() => {\n setCustomUIs(createGroupingMappingCustomUI(props.customUIs));\n }, [props.customUIs]);\n\n const hilitedElementsContextValue = useMemo(\n () => ({\n showGroupColor,\n setShowGroupColor,\n hiddenGroupsIds,\n setHiddenGroupsIds,\n groups,\n setGroups,\n numberOfVisualizedGroups,\n setNumberOfVisualizedGroups,\n isOverlappedColored,\n setIsOverlappedColored,\n currentHilitedGroups,\n setCurrentHilitedGroups,\n isVisualizationsEnabled,\n setIsVisualizationsEnabled,\n overlappedElementsMetadata,\n setOverlappedElementsMetadata,\n }),\n [\n showGroupColor,\n hiddenGroupsIds,\n groups,\n numberOfVisualizedGroups,\n isOverlappedColored,\n currentHilitedGroups,\n isVisualizationsEnabled,\n overlappedElementsMetadata,\n ],\n );\n\n const propertiesContextValue = useMemo(\n () => ({\n showGroupColor: propertiesShowGroup,\n setShowGroupColor: setPropertiesShowGroup,\n }),\n [propertiesShowGroup],\n );\n\n const customUIContextValue = useMemo(\n () => ({\n customUIs,\n setCustomUIs,\n }),\n [customUIs],\n );\n\n const extractionStateJobContextValue = useMemo(\n () => ({\n mappingIdJobInfo,\n setMappingIdJobInfo,\n }),\n [mappingIdJobInfo],\n );\n\n return (\n <QueryClientProvider client={queryClient}>\n <GroupingMappingApiConfigContext.Provider value={apiConfig}>\n <MappingClientContext.Provider value={mappingClient}>\n <GroupsClientContext.Provider value={groupsClient}>\n <PropertiesClientContext.Provider value={propertiesClient}>\n <ExtractionClientContext.Provider value={extractionClient}>\n <ExtractionStatusJobContext.Provider value={extractionStateJobContextValue}>\n <GroupingMappingCustomUIContext.Provider value={customUIContextValue}>\n <GroupHilitedElementsContext.Provider value={hilitedElementsContextValue}>\n <PropertiesGroupColorContext.Provider value={propertiesContextValue}>{props.children}</PropertiesGroupColorContext.Provider>\n </GroupHilitedElementsContext.Provider>\n </GroupingMappingCustomUIContext.Provider>\n </ExtractionStatusJobContext.Provider>\n </ExtractionClientContext.Provider>\n </PropertiesClientContext.Provider>\n </GroupsClientContext.Provider>\n </MappingClientContext.Provider>\n </GroupingMappingApiConfigContext.Provider>\n </QueryClientProvider>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"GroupingMappingContext.js","sourceRoot":"","sources":["../../../src/components/GroupingMappingContext.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;gGAGgG;AAChG,+CAA4D;AAE5D,wDAAiD;AAEjD,iFAAqF;AACrF,yEAA2F;AAE3F,6FAAyH;AAGzH,uFAAoF;AACpF,uFAAoF;AACpF,oDAA+D;AAC/D,+EAAoG;AAEpG,uDAAoG;AACpG,wDAA+C;AAC/C,2CAAkD;AAClD,2CAAwC;AACxC,mFAAiF;AACjF,uEAAwF;AACxF,+EAAoG;AAoDpG,MAAM,iCAAiC,GAAG,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,yBAAS,CAAC,mBAAmB,EAAE,cAAc,EAAE,CAAC,IAAI,EAAE,CAAC;AAEpH,MAAM,kBAAkB,GAAG,IAAI,yBAAW,CAAC;IACzC,cAAc,EAAE;QACd,OAAO,EAAE;YACP,oBAAoB,EAAE,KAAK;YAC3B,SAAS,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,aAAa;SACzC;KACF;IACD,UAAU,EAAE,IAAI,wBAAU,CAAC;QACzB,OAAO,EAAE,CAAC,KAAU,EAAE,KAAY,EAAE,EAAE;YACpC,QAAQ,KAAK,CAAC,IAAI,EAAE,SAAS,EAAE;gBAC7B,KAAK,qBAAS,CAAC,yBAAyB;oBACtC,uBAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,OAAiB,CAAC,CAAC;oBAChD,MAAM;gBACR,OAAO,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AAC;IAEF,MAAM,8BAA8B,GAAG,IAAA,eAAO,EAC5C,GAAG,EAAE,CAAC,CAAC;QACL,gBAAgB;QAChB,mBAAmB;KACpB,CAAC,EACF,CAAC,gBAAgB,CAAC,CACnB,CAAC;IAEF,OAAO,CACL,8BAAC,iCAAmB,IAAC,MAAM,EAAE,WAAW;QACtC,8BAAC,0DAA+B,CAAC,QAAQ,IAAC,KAAK,EAAE,SAAS;YACxD,8BAAC,2CAAoB,CAAC,QAAQ,IAAC,KAAK,EAAE,aAAa;gBACjD,8BAAC,yCAAmB,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY;oBAC/C,8BAAC,iDAAuB,CAAC,QAAQ,IAAC,KAAK,EAAE,gBAAgB;wBACvD,8BAAC,iDAAuB,CAAC,QAAQ,IAAC,KAAK,EAAE,gBAAgB;4BACvD,8BAAC,sDAA0B,CAAC,QAAQ,IAAC,KAAK,EAAE,8BAA8B;gCACxE,8BAAC,+DAA8B,CAAC,QAAQ,IAAC,KAAK,EAAE,oBAAoB;oCAClE,8BAAC,yDAA2B,CAAC,QAAQ,IAAC,KAAK,EAAE,2BAA2B;wCACtE,8BAAC,yDAA2B,CAAC,QAAQ,IAAC,KAAK,EAAE,sBAAsB,IAAG,KAAK,CAAC,QAAQ,CAAwC,CACvF,CACC,CACN,CACL,CACF,CACN,CACD,CACS,CACvB,CACvB,CAAC;AACJ,CAAC,CAAC;AA3IW,QAAA,sBAAsB,0BA2IjC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport React, { useEffect, useMemo, useState } from \"react\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport type { ClientPrefix, GetAccessTokenFn, GroupingMappingApiConfig } from \"./context/GroupingApiConfigContext\";\nimport { GroupingMappingApiConfigContext } from \"./context/GroupingApiConfigContext\";\nimport { createMappingClient, MappingClientContext } from \"./context/MappingClientContext\";\nimport type { Group, IExtractionClient, IGroupsClient, IMappingsClient, IPropertiesClient } from \"@itwin/insights-client\";\nimport { createGroupingMappingCustomUI, GroupingMappingCustomUIContext } from \"./context/GroupingMappingCustomUIContext\";\nimport type { GroupingMappingCustomUI } from \"./customUI/GroupingMappingCustomUI\";\nimport type { OverlappedElementsMetadata } from \"./context/GroupHilitedElementsContext\";\nimport { GroupHilitedElementsContext } from \"./context/GroupHilitedElementsContext\";\nimport { PropertiesGroupColorContext } from \"./context/PropertiesGroupColorContext\";\nimport { useActiveIModelConnection } from \"@itwin/appui-react\";\nimport { createExtractionClient, ExtractionClientContext } from \"./context/ExtractionClientContext\";\nimport type { Query } from \"@tanstack/react-query\";\nimport { MutationCache, QueryCache, QueryClient, QueryClientProvider } from \"@tanstack/react-query\";\nimport { toaster } from \"@itwin/itwinui-react\";\nimport { getErrorMessage } from \"../common/utils\";\nimport { TErrCodes } from \"./Constants\";\nimport { ExtractionStatusJobContext } from \"./context/ExtractionStateJobContext\";\nimport { createGroupsClient, GroupsClientContext } from \"./context/GroupsClientContext\";\nimport { createPropertiesClient, PropertiesClientContext } from \"./context/PropertiesClientContext\";\n\n/**\n * Props for the {@link GroupingMappingContext} component.\n * @public\n */\nexport interface GroupingMappingContextProps {\n /**\n * Custom callback to retrieve access token.\n */\n getAccessToken?: GetAccessTokenFn;\n /**\n * The iTwin iModel Id.\n */\n iModelId: string;\n /**\n * Used for iTwin and iModel APIs.\n * Also used for Mapping API if a custom IMappingsClient is not provided.\n */\n changeSetId?: string;\n prefix?: ClientPrefix;\n /**\n * A custom implementation of MappingClient.\n */\n mappingsClient?: IMappingsClient;\n /**\n * A custom implementation of GroupsClient.\n */\n groupsClient?: IGroupsClient;\n /**\n * A custom implementation of PropertiesClient.\n */\n propertiesClient?: IPropertiesClient;\n /**\n * A custom implementation of ExtractionClient.\n */\n extractionClient?: IExtractionClient;\n /**\n * Custom UI to add and update groups or provide additional group context capabilities.\n */\n customUIs?: GroupingMappingCustomUI[];\n /**\n * A custom iModelConnection to use instead of the active iModelConnection from UiFramework.\n */\n iModelConnection?: IModelConnection;\n /**\n * A custom QueryClient. If not provided, a default QueryClient will be used.\n */\n queryClient?: QueryClient;\n children?: React.ReactNode;\n}\n\nconst authorizationClientGetAccessToken = async () => (await IModelApp.authorizationClient?.getAccessToken()) ?? \"\";\n\nconst defaultQueryClient = new QueryClient({\n defaultOptions: {\n queries: {\n refetchOnWindowFocus: false,\n staleTime: 20 * 60 * 1000, // 20 minutes\n },\n },\n queryCache: new QueryCache({\n onError: (error: any, query: Query) => {\n switch (query.meta?.errorCode) {\n case TErrCodes.QUERY_HILITE_FETCH_FAILED:\n toaster.negative(query.meta?.message as string);\n break;\n default: {\n if (error.status) toaster.negative(getErrorMessage(error.status));\n else toaster.negative(\"An error occurred while fetching data.\");\n }\n }\n },\n }),\n mutationCache: new MutationCache({\n onError: (error: any) => {\n if (error.status) toaster.negative(getErrorMessage(error.status));\n else toaster.negative(\"A network error occured while processing this action.\");\n },\n }),\n});\n\n/**\n * Grouping and Mapping Context providers required for all components.\n * @public\n */\nexport const GroupingMappingContext = (props: GroupingMappingContextProps) => {\n const activeIModelConnection = useActiveIModelConnection();\n const mappingsClientProp: IMappingsClient | ClientPrefix = props.mappingsClient ?? props.prefix;\n const groupsClientProp: IGroupsClient | ClientPrefix = props.groupsClient ?? props.prefix;\n const propertiesClientProp: IPropertiesClient | ClientPrefix = props.propertiesClient ?? props.prefix;\n const extractionClientProp: IExtractionClient | ClientPrefix = props.extractionClient ?? props.prefix;\n const [mappingClient, setMappingClient] = useState<IMappingsClient>(createMappingClient(mappingsClientProp));\n const [groupsClient, setGroupsClient] = useState<IGroupsClient>(createGroupsClient(groupsClientProp));\n const [propertiesClient, setPropertiesClient] = useState<IPropertiesClient>(createPropertiesClient(propertiesClientProp));\n const [extractionClient, setExtractionClient] = useState<IExtractionClient>(createExtractionClient(extractionClientProp));\n const [customUIs, setCustomUIs] = useState<GroupingMappingCustomUI[]>(createGroupingMappingCustomUI(props.customUIs));\n const [apiConfig, setApiConfig] = useState<GroupingMappingApiConfig>({\n getAccessToken: props.getAccessToken ?? authorizationClientGetAccessToken,\n iModelId: props.iModelId,\n prefix: props.prefix,\n changeSetId: props.changeSetId,\n });\n const [hiddenGroupsIds, setHiddenGroupsIds] = useState<Set<string>>(new Set());\n const [showGroupColor, setShowGroupColor] = useState<boolean>(false);\n const [propertiesShowGroup, setPropertiesShowGroup] = useState<boolean>(false);\n const [groups, setGroups] = useState<Group[]>([]);\n const [numberOfVisualizedGroups, setNumberOfVisualizedGroups] = useState(0);\n const [isOverlappedColored, setIsOverlappedColored] = useState<boolean>(false);\n const [currentHilitedGroups, setCurrentHilitedGroups] = useState<number>(1);\n const [isVisualizationsEnabled, setIsVisualizationsEnabled] = useState<boolean>(false);\n const [overlappedElementsMetadata, setOverlappedElementsMetadata] = useState<OverlappedElementsMetadata>({\n overlappedElementsInfo: new Map(),\n groupElementsInfo: new Map(),\n overlappedElementGroupPairs: [],\n });\n const queryClient = props.queryClient ?? defaultQueryClient;\n const [mappingIdJobInfo, setMappingIdJobInfo] = useState<Map<string, string>>(new Map());\n\n useEffect(() => {\n setApiConfig(() => ({\n prefix: props.prefix,\n iModelId: props.iModelId,\n getAccessToken: props.getAccessToken ?? authorizationClientGetAccessToken,\n iModelConnection: props.iModelConnection ?? activeIModelConnection,\n changeSetId: props.changeSetId,\n }));\n }, [activeIModelConnection, props.changeSetId, props.getAccessToken, props.iModelConnection, props.iModelId, props.prefix]);\n\n useEffect(() => {\n setMappingClient(createMappingClient(mappingsClientProp));\n }, [mappingsClientProp]);\n\n useEffect(() => {\n setGroupsClient(createGroupsClient(groupsClientProp));\n }, [groupsClientProp]);\n\n useEffect(() => {\n setPropertiesClient(createPropertiesClient(propertiesClientProp));\n }, [propertiesClientProp]);\n\n useEffect(() => {\n setExtractionClient(createExtractionClient(extractionClientProp));\n }, [extractionClientProp]);\n\n useEffect(() => {\n setCustomUIs(createGroupingMappingCustomUI(props.customUIs));\n }, [props.customUIs]);\n\n const hilitedElementsContextValue = useMemo(\n () => ({\n showGroupColor,\n setShowGroupColor,\n hiddenGroupsIds,\n setHiddenGroupsIds,\n groups,\n setGroups,\n numberOfVisualizedGroups,\n setNumberOfVisualizedGroups,\n isOverlappedColored,\n setIsOverlappedColored,\n currentHilitedGroups,\n setCurrentHilitedGroups,\n isVisualizationsEnabled,\n setIsVisualizationsEnabled,\n overlappedElementsMetadata,\n setOverlappedElementsMetadata,\n }),\n [\n showGroupColor,\n hiddenGroupsIds,\n groups,\n numberOfVisualizedGroups,\n isOverlappedColored,\n currentHilitedGroups,\n isVisualizationsEnabled,\n overlappedElementsMetadata,\n ],\n );\n\n const propertiesContextValue = useMemo(\n () => ({\n showGroupColor: propertiesShowGroup,\n setShowGroupColor: setPropertiesShowGroup,\n }),\n [propertiesShowGroup],\n );\n\n const customUIContextValue = useMemo(\n () => ({\n customUIs,\n setCustomUIs,\n }),\n [customUIs],\n );\n\n const extractionStateJobContextValue = useMemo(\n () => ({\n mappingIdJobInfo,\n setMappingIdJobInfo,\n }),\n [mappingIdJobInfo],\n );\n\n return (\n <QueryClientProvider client={queryClient}>\n <GroupingMappingApiConfigContext.Provider value={apiConfig}>\n <MappingClientContext.Provider value={mappingClient}>\n <GroupsClientContext.Provider value={groupsClient}>\n <PropertiesClientContext.Provider value={propertiesClient}>\n <ExtractionClientContext.Provider value={extractionClient}>\n <ExtractionStatusJobContext.Provider value={extractionStateJobContextValue}>\n <GroupingMappingCustomUIContext.Provider value={customUIContextValue}>\n <GroupHilitedElementsContext.Provider value={hilitedElementsContextValue}>\n <PropertiesGroupColorContext.Provider value={propertiesContextValue}>{props.children}</PropertiesGroupColorContext.Provider>\n </GroupHilitedElementsContext.Provider>\n </GroupingMappingCustomUIContext.Provider>\n </ExtractionStatusJobContext.Provider>\n </ExtractionClientContext.Provider>\n </PropertiesClientContext.Provider>\n </GroupsClientContext.Provider>\n </MappingClientContext.Provider>\n </GroupingMappingApiConfigContext.Provider>\n </QueryClientProvider>\n );\n};\n"]}
|
|
@@ -7,12 +7,14 @@ exports.useRunExtraction = void 0;
|
|
|
7
7
|
*--------------------------------------------------------------------------------------------*/
|
|
8
8
|
const ExtractionClientContext_1 = require("../../context/ExtractionClientContext");
|
|
9
9
|
const react_query_1 = require("@tanstack/react-query");
|
|
10
|
+
const GroupingApiConfigContext_1 = require("../../context/GroupingApiConfigContext");
|
|
10
11
|
const react_1 = require("react");
|
|
11
12
|
const ExtractionStateJobContext_1 = require("../../context/ExtractionStateJobContext");
|
|
12
13
|
const useRunExtraction = ({ iModelId, getAccessToken }) => {
|
|
13
14
|
const extractionClient = (0, ExtractionClientContext_1.useExtractionClient)();
|
|
14
15
|
const [isJobStarted, setIsJobStarted] = (0, react_1.useState)(false);
|
|
15
16
|
const { mappingIdJobInfo, setMappingIdJobInfo } = (0, ExtractionStateJobContext_1.useExtractionStateJobContext)();
|
|
17
|
+
const { changeSetId } = (0, GroupingApiConfigContext_1.useGroupingMappingApiConfig)();
|
|
16
18
|
const { mutateAsync: runExtraction, isLoading: isRunExtractionLoading, isSuccess: isRunExtractionSuccess, } = (0, react_query_1.useMutation)({
|
|
17
19
|
mutationKey: ["runExtraction"],
|
|
18
20
|
mutationFn: async (mappings) => {
|
|
@@ -24,6 +26,7 @@ const useRunExtraction = ({ iModelId, getAccessToken }) => {
|
|
|
24
26
|
const extractionRequest = {
|
|
25
27
|
mappings: mappingIds,
|
|
26
28
|
iModelId,
|
|
29
|
+
changesetId: changeSetId,
|
|
27
30
|
};
|
|
28
31
|
const runExtractionResponse = await extractionClient.runExtraction(accessToken, extractionRequest);
|
|
29
32
|
return runExtractionResponse;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRunExtraction.js","sourceRoot":"","sources":["../../../../../src/components/Mappings/hooks/useRunExtraction.ts"],"names":[],"mappings":";;;AAAA;;;gGAGgG;AAChG,mFAA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AiB,CAAC,CAAC;gBACnG,OAAO,qBAAqB,CAAC;aAC9B;YACD,OAAO;QACT,CAAC;QACD,SAAS,EAAE,KAAK,EAAE,qBAAqB,EAAE,QAAQ,EAAE,EAAE;YACnD,IAAI,qBAAqB,EAAE;gBACzB,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;oBAC9B,IAAI,gBAAgB,EAAE,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,SAAS,EAAE;wBACnD,mBAAmB,CAAC,CAAC,OAA4B,EAAE,EAAE;4BACnD,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;4BAChC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,EAAE,qBAAqB,CAAC,EAAE,CAAC,CAAC;4BACjD,OAAO,MAAM,CAAC;wBAChB,CAAC,CAAC,CAAC;qBACJ;iBACF;aACF;QACH,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,CAAC;AAC1G,CAAC,CAAC;AA7CW,QAAA,gBAAgB,oBA6C3B","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport { useExtractionClient } from \"../../context/ExtractionClientContext\";\nimport { useMutation } from \"@tanstack/react-query\";\nimport type { GroupingMappingApiConfig } from \"../../context/GroupingApiConfigContext\";\nimport { useGroupingMappingApiConfig } from \"../../context/GroupingApiConfigContext\";\nimport type { ExtractionMapping, ExtractionRequestDetails, Mapping } from \"@itwin/insights-client\";\nimport { useState } from \"react\";\nimport { useExtractionStateJobContext } from \"../../context/ExtractionStateJobContext\";\n\nexport interface FetchExtractionStatesProps extends GroupingMappingApiConfig {\n jobId?: string;\n}\n\nexport const useRunExtraction = ({ iModelId, getAccessToken }: FetchExtractionStatesProps) => {\n const extractionClient = useExtractionClient();\n const [isJobStarted, setIsJobStarted] = useState<boolean>(false);\n const { mappingIdJobInfo, setMappingIdJobInfo } = useExtractionStateJobContext();\n const { changeSetId } = useGroupingMappingApiConfig();\n\n const {\n mutateAsync: runExtraction,\n isLoading: isRunExtractionLoading,\n isSuccess: isRunExtractionSuccess,\n } = useMutation({\n mutationKey: [\"runExtraction\"],\n mutationFn: async (mappings: Mapping[]) => {\n if (mappings.length > 0) {\n const accessToken = await getAccessToken();\n const mappingIds: ExtractionMapping[] = mappings.map((mapping) => {\n return { id: mapping.id };\n });\n const extractionRequest: ExtractionRequestDetails = {\n mappings: mappingIds,\n iModelId,\n changesetId: changeSetId,\n };\n\n const runExtractionResponse = await extractionClient.runExtraction(accessToken, extractionRequest);\n return runExtractionResponse;\n }\n return;\n },\n onSuccess: async (runExtractionResponse, mappings) => {\n if (runExtractionResponse) {\n for (const mapping of mappings) {\n if (mappingIdJobInfo?.get(mapping.id) === undefined) {\n setMappingIdJobInfo((prevMap: Map<string, string>) => {\n const newMap = new Map(prevMap);\n newMap.set(mapping.id, runExtractionResponse.id);\n return newMap;\n });\n }\n }\n }\n },\n });\n\n return { isRunExtractionLoading, isRunExtractionSuccess, isJobStarted, setIsJobStarted, runExtraction };\n};\n"]}
|
|
@@ -85,6 +85,8 @@ const GroupPropertyAction = ({ mappingId, group, groupProperty, onSaveSuccess, o
|
|
|
85
85
|
const [showSaveConfirmationModal, setShowSaveConfirmationModal] = (0, react_1.useState)(false);
|
|
86
86
|
const [calculatedPropertyType, setCalculatedPropertyType] = (0, react_1.useState)(groupProperty?.calculatedPropertyType ?? undefined);
|
|
87
87
|
const [isCalculatedBlockExpanded, setIsCalculatedBlockExpanded] = (0, react_1.useState)(!!calculatedPropertyType);
|
|
88
|
+
const [isMappedBlockExpanded, setIsMappedBlockExpanded] = (0, react_1.useState)((groupProperty?.ecProperties?.length ?? 0) > 0);
|
|
89
|
+
const [isFormulaBlockExpanded, setIsFormulaBlockExpanded] = (0, react_1.useState)(!!groupProperty?.formula);
|
|
88
90
|
const [formula, setFormula] = (0, react_1.useState)(groupProperty?.formula ?? undefined);
|
|
89
91
|
const [formulaErrorMessage, setFormulaErrorMessage] = (0, react_1.useState)(undefined);
|
|
90
92
|
const { getAccessToken, iModelId, iModelConnection } = (0, GroupingApiConfigContext_1.useGroupingMappingApiConfig)();
|
|
@@ -164,7 +166,7 @@ const GroupPropertyAction = ({ mappingId, group, groupProperty, onSaveSuccess, o
|
|
|
164
166
|
propertyName,
|
|
165
167
|
dataType,
|
|
166
168
|
quantityType,
|
|
167
|
-
ecProperties: selectedProperties.map((p) => (0, GroupPropertyUtils_1.convertToECProperties)(p)).flat(),
|
|
169
|
+
ecProperties: selectedProperties.length > 0 ? selectedProperties.map((p) => (0, GroupPropertyUtils_1.convertToECProperties)(p)).flat() : undefined,
|
|
168
170
|
calculatedPropertyType,
|
|
169
171
|
formula,
|
|
170
172
|
};
|
|
@@ -221,7 +223,7 @@ const GroupPropertyAction = ({ mappingId, group, groupProperty, onSaveSuccess, o
|
|
|
221
223
|
react_1.default.createElement(itwinui_react_1.LabeledSelect, { label: "Quantity Type", options: exports.quantityTypesSelectionOptions, value: quantityType, onChange: setQuantityType, onShow: () => { }, onHide: () => { }, placeholder: "No Quantity Type" })),
|
|
222
224
|
propertiesNotFoundAlert && (react_1.default.createElement(itwinui_react_1.Alert, { type: "warning" }, "Warning: Could not match saved properties from the current generated list. It does not confirm or deny validity. Overwriting will occur if a new selection is made and saved.")),
|
|
223
225
|
react_1.default.createElement(ScrollableExpandableBlock_1.ScrollableExpandableBlock, { title: "Mapped Properties", endIcon: react_1.default.createElement(itwinui_react_1.Icon, { fill: selectedProperties.length > 0 ? "informational" : "default" },
|
|
224
|
-
react_1.default.createElement(itwinui_icons_react_1.SvgLabel, null)), isExpanded:
|
|
226
|
+
react_1.default.createElement(itwinui_icons_react_1.SvgLabel, null)), isExpanded: isMappedBlockExpanded, setIsExpanded: setIsMappedBlockExpanded },
|
|
225
227
|
react_1.default.createElement("div", { className: "gmw-property-view-container" },
|
|
226
228
|
react_1.default.createElement("div", { className: "gmw-property-view-button" },
|
|
227
229
|
react_1.default.createElement(itwinui_react_1.Button, { onClick: async () => setShowPropertiesSelectionModal(true), disabled: isLoading }, "Select Properties")),
|
|
@@ -229,10 +231,10 @@ const GroupPropertyAction = ({ mappingId, group, groupProperty, onSaveSuccess, o
|
|
|
229
231
|
react_1.default.createElement(itwinui_react_1.Text, null, "No properties selected."),
|
|
230
232
|
react_1.default.createElement(itwinui_react_1.Text, null, "Press the \"Select Properties\" button for options."))) : (selectedProperties.map((property) => (react_1.default.createElement(GroupPropertyListItem_1.GroupPropertyListItem, { key: property.key, content: `${property.displayLabel}`, title: `${property.actualECClassName}`, description: property.categoryLabel }))))))),
|
|
231
233
|
react_1.default.createElement(ScrollableExpandableBlock_1.ScrollableExpandableBlock, { parentRef: actionContainerRef, ref: calculatedPropertyActionRef, title: "Calculated Property", endIcon: react_1.default.createElement(itwinui_react_1.Icon, { fill: calculatedPropertyType ? "informational" : "default" },
|
|
232
|
-
react_1.default.createElement(itwinui_icons_react_1.SvgMeasure, null)), isExpanded:
|
|
234
|
+
react_1.default.createElement(itwinui_icons_react_1.SvgMeasure, null)), isExpanded: isCalculatedBlockExpanded, setIsExpanded: setIsCalculatedBlockExpanded },
|
|
233
235
|
react_1.default.createElement(CalculatedPropertyActionWithVisuals_1.CalculatedPropertyActionWithVisuals, { group: group, calculatedPropertyType: calculatedPropertyType, setCalculatedPropertyType: setCalculatedPropertyType })),
|
|
234
236
|
react_1.default.createElement(ScrollableExpandableBlock_1.ScrollableExpandableBlock, { parentRef: actionContainerRef, ref: customCalculationActionRef, title: "Custom Calculation", endIcon: react_1.default.createElement(itwinui_react_1.Icon, { fill: formula ? "informational" : "default" },
|
|
235
|
-
react_1.default.createElement(itwinui_icons_react_1.SvgFunction, null)), isExpanded:
|
|
237
|
+
react_1.default.createElement(itwinui_icons_react_1.SvgFunction, null)), isExpanded: isFormulaBlockExpanded, setIsExpanded: setIsFormulaBlockExpanded },
|
|
236
238
|
react_1.default.createElement(CustomCalculationAction_1.CustomCalculationAction, { formula: formula, setFormula: setFormula, formulaErrorMessage: formulaErrorMessage, forceValidation: forceValidation, disabled: isLoading }))),
|
|
237
239
|
react_1.default.createElement(ActionPanel_1.default, { onSave: handleSaveClick, onCancel: onClickCancel, onSaveCapture: viewerUtils_1.clearAll, onCancelCapture: viewerUtils_1.clearAll, isLoading: isLoading, isSavingDisabled: !propertyName || dataType === undefined || formulaErrorMessage !== undefined }),
|
|
238
240
|
react_1.default.createElement(GroupsPropertiesSelectionModal_1.GroupsPropertiesSelectionModal, { showModal: showPropertiesSelectionModal, setShowModal: setShowPropertiesSelectionModal, selectedProperties: selectedProperties, setSelectedProperties: setSelectedProperties, propertiesMetaData: propertiesMetaData }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupPropertyAction.js","sourceRoot":"","sources":["../../../../../src/components/Properties/GroupProperties/GroupPropertyAction.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;gGAGgG;AAChG,oEAAiE;AAEjE,wDAAwG;AACxG,+CAAwE;AACxE,qFAA6D;AAC7D,sEAAwE;AACxE,qFAAqF;AACrF,4DAAgE;AAEhE,sCAAoC;AAEpC,6DAAqI;AACrI,6DAAwE;AACxE,2CAAwC;AACxC,qFAAkF;AAClF,uDAA8E;AAC9E,mEAAgE;AAChE,mFAA4E;AAC5E,oEAA+E;AAC/E,qHAAkH;AAClH,iDAAoD;AACpD,2FAAwF;AACxF,oEAAiE;AACjE,wEAAqE;AACrE,4EAAyE;AAc5D,QAAA,6BAA6B,GAA6C;IACrF,EAAE,KAAK,EAAE,8BAAY,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE;IAC3C,EAAE,KAAK,EAAE,8BAAY,CAAC,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE;IACnD,EAAE,KAAK,E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------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport { PropertyValueFormat } from \"@itwin/presentation-common\";\nimport type { SelectOption } from \"@itwin/itwinui-react\";\nimport { Alert, Button, Fieldset, Icon, LabeledInput, LabeledSelect, Text } from \"@itwin/itwinui-react\";\nimport React, { useCallback, useEffect, useRef, useState } from \"react\";\nimport ActionPanel from \"../../SharedComponents/ActionPanel\";\nimport useValidator, { NAME_REQUIREMENTS } from \"../hooks/useValidator\";\nimport { useGroupingMappingApiConfig } from \"../../context/GroupingApiConfigContext\";\nimport { DataType, QuantityType } from \"@itwin/insights-client\";\nimport type { CalculatedPropertyType, GroupMinimal, Property, PropertyModify } from \"@itwin/insights-client\";\nimport \"./GroupPropertyAction.scss\";\nimport type { PropertyMetaData } from \"./GroupPropertyUtils\";\nimport { convertPresentationFields, convertToECProperties, fetchPresentationDescriptor, findProperties } from \"./GroupPropertyUtils\";\nimport { clearAll, manufactureKeys } from \"../../../common/viewerUtils\";\nimport { SaveModal } from \"./SaveModal\";\nimport { GroupsPropertiesSelectionModal } from \"./GroupsPropertiesSelectionModal\";\nimport { useMutation, useQuery, useQueryClient } from \"@tanstack/react-query\";\nimport { GroupPropertyListItem } from \"./GroupPropertyListItem\";\nimport { usePropertiesClient } from \"../../context/PropertiesClientContext\";\nimport { SvgFunction, SvgLabel, SvgMeasure } from \"@itwin/itwinui-icons-react\";\nimport { CalculatedPropertyActionWithVisuals } from \"../CalculatedProperties/CalculatedPropertyActionWithVisuals\";\nimport { handleError } from \"../../../common/utils\";\nimport { CustomCalculationAction } from \"../CustomCalculations/CustomCalculationAction\";\nimport { usePropertiesQuery } from \"../hooks/usePropertiesQuery\";\nimport { useFormulaValidation } from \"../hooks/useFormulaValidation\";\nimport { ScrollableExpandableBlock } from \"../ScrollableExpandableBlock\";\n\n/**\n * Props for the {@link GroupPropertyAction} component.\n * @public\n */\nexport interface GroupPropertyActionProps {\n mappingId: string;\n group: GroupMinimal;\n groupProperty?: Property;\n onSaveSuccess: () => void;\n onClickCancel?: () => void;\n}\n\nexport const quantityTypesSelectionOptions: SelectOption<QuantityType | undefined>[] = [\n { value: QuantityType.Area, label: \"Area\" },\n { value: QuantityType.Distance, label: \"Distance\" },\n { value: QuantityType.Force, label: \"Force\" },\n { value: QuantityType.Mass, label: \"Mass\" },\n { value: QuantityType.Monetary, label: \"Monetary\" },\n { value: QuantityType.Time, label: \"Time\" },\n { value: QuantityType.Volume, label: \"Volume\" },\n { value: undefined, label: \"No Quantity Type\" },\n];\n\n/**\n * Component to create or update a group.\n * @public\n */\nexport const GroupPropertyAction = ({ mappingId, group, groupProperty, onSaveSuccess, onClickCancel }: GroupPropertyActionProps) => {\n const actionContainerRef = useRef<HTMLDivElement>(null);\n const calculatedPropertyActionRef = useRef<HTMLDivElement>(null);\n const customCalculationActionRef = useRef<HTMLDivElement>(null);\n const propertiesClient = usePropertiesClient();\n const queryClient = useQueryClient();\n\n const [propertyName, setPropertyName] = useState<string>(\"\");\n const [oldPropertyName, setOldPropertyName] = useState<string>(\"\");\n const [dataType, setDataType] = useState<DataType>(groupProperty?.dataType ?? DataType.String);\n const [quantityType, setQuantityType] = useState<QuantityType | undefined>(groupProperty?.quantityType ?? undefined);\n const [selectedProperties, setSelectedProperties] = useState<PropertyMetaData[]>([]);\n const [propertiesMetaData, setPropertiesMetaData] = useState<PropertyMetaData[]>([]);\n const [propertiesNotFoundAlert, setPropertiesNotFoundAlert] = useState<boolean>(false);\n const [validator, showValidationMessage] = useValidator();\n const [showPropertiesSelectionModal, setShowPropertiesSelectionModal] = useState<boolean>(false);\n const [showSaveConfirmationModal, setShowSaveConfirmationModal] = useState<boolean>(false);\n const [calculatedPropertyType, setCalculatedPropertyType] = useState<CalculatedPropertyType | undefined>(groupProperty?.calculatedPropertyType ?? undefined);\n const [isCalculatedBlockExpanded, setIsCalculatedBlockExpanded] = useState<boolean>(!!calculatedPropertyType);\n const [formula, setFormula] = useState<string | undefined>(groupProperty?.formula ?? undefined);\n const [formulaErrorMessage, setFormulaErrorMessage] = useState<string | undefined>(undefined);\n\n const { getAccessToken, iModelId, iModelConnection } = useGroupingMappingApiConfig();\n const { data: groupProperties, isFetching: isLoadingGroupProperties } = usePropertiesQuery(iModelId, mappingId, group.id, getAccessToken, propertiesClient);\n const { forceValidation } = useFormulaValidation(propertyName.toLowerCase(), formula, groupProperties?.properties ?? [], setFormulaErrorMessage, dataType);\n\n const reset = useCallback(() => {\n setPropertyName(\"\");\n setDataType(DataType.String);\n setQuantityType(undefined);\n setSelectedProperties([]);\n setCalculatedPropertyType(undefined);\n setFormula(undefined);\n }, []);\n\n const fetchPropertiesMetadata = useCallback(async () => {\n if (!iModelConnection) return;\n\n const result = await manufactureKeys(group.query, iModelConnection);\n const descriptor = await fetchPresentationDescriptor(iModelConnection, result);\n\n // Only allow primitives and structs\n const propertyFields =\n descriptor?.fields.filter((field) => field.type.valueFormat === PropertyValueFormat.Primitive || field.type.valueFormat === PropertyValueFormat.Struct) ??\n [];\n\n const propertiesMetaData = convertPresentationFields(propertyFields);\n\n let groupPropertyDetails = null;\n if (groupProperty) {\n const accessToken = await getAccessToken();\n groupPropertyDetails = await propertiesClient.getProperty(accessToken, mappingId, group.id, groupProperty.id);\n }\n\n return { propertiesMetaData, groupPropertyDetails };\n }, [getAccessToken, group.id, group.query, groupProperty, iModelConnection, mappingId, propertiesClient]);\n\n const scrollToFormulaErrorMessage = useCallback(() => {\n setTimeout(() => {\n if (actionContainerRef.current && customCalculationActionRef.current) {\n actionContainerRef.current.scrollTo({\n top: customCalculationActionRef.current.offsetTop,\n behavior: \"smooth\",\n });\n }\n }, 500);\n }, [actionContainerRef]);\n\n const {\n data,\n isFetching: isLoadingProperties,\n isSuccess: isLoadingPropertiesSuccessful,\n } = useQuery([\"properties\", iModelId, mappingId, group.id, groupProperty?.id, \"metadata\"], fetchPropertiesMetadata);\n\n useEffect(() => {\n if (isLoadingPropertiesSuccessful && data?.propertiesMetaData) {\n setPropertiesMetaData(data.propertiesMetaData);\n\n if (data.groupPropertyDetails) {\n setPropertyName(data.groupPropertyDetails.propertyName);\n setOldPropertyName(data.groupPropertyDetails.propertyName);\n setDataType(data.groupPropertyDetails.dataType);\n if (data.groupPropertyDetails.quantityType) setQuantityType(data.groupPropertyDetails.quantityType);\n\n if (data.groupPropertyDetails.ecProperties) {\n const properties = findProperties(data.groupPropertyDetails.ecProperties, data.propertiesMetaData);\n if (properties.length === 0) {\n setPropertiesNotFoundAlert(true);\n }\n setSelectedProperties(properties);\n }\n }\n }\n }, [data, isLoadingPropertiesSuccessful]);\n\n useEffect(() => {\n if (calculatedPropertyType) {\n setDataType(DataType.Double);\n }\n\n if (isCalculatedBlockExpanded === false || !calculatedPropertyType) {\n clearAll();\n }\n }, [calculatedPropertyType, isCalculatedBlockExpanded]);\n\n useEffect(() => {\n if (formulaErrorMessage) {\n scrollToFormulaErrorMessage();\n }\n }, [formulaErrorMessage, scrollToFormulaErrorMessage]);\n\n const { mutate: onSave, isLoading: isSaving } = useMutation({\n mutationFn: async () => {\n const accessToken = await getAccessToken();\n const newGroupProperty: PropertyModify = {\n propertyName,\n dataType,\n quantityType,\n ecProperties: selectedProperties.map((p) => convertToECProperties(p)).flat(),\n calculatedPropertyType,\n formula,\n };\n\n return groupProperty\n ? propertiesClient.updateProperty(accessToken, mappingId, group.id, groupProperty.id, newGroupProperty)\n : propertiesClient.createProperty(accessToken, mappingId, group.id, newGroupProperty);\n },\n onSuccess: async () => {\n onSaveSuccess();\n reset();\n await queryClient.invalidateQueries([\"properties\", iModelId, mappingId, group.id]);\n },\n onError(error: any) {\n handleError(error.status);\n },\n });\n\n const handleSaveClick = async () => {\n if (!validator.allValid()) {\n showValidationMessage(true);\n return;\n }\n if (oldPropertyName !== propertyName && oldPropertyName !== \"\") {\n setShowSaveConfirmationModal(true);\n } else {\n onSave();\n }\n };\n\n const handleCloseSaveModal = () => {\n setShowSaveConfirmationModal(false);\n };\n\n const isLoading = isLoadingProperties || isSaving || isLoadingGroupProperties;\n\n return (\n <>\n <div className=\"gmw-group-property-action-container\" ref={actionContainerRef}>\n <Fieldset disabled={isLoading} className=\"gmw-property-options\" legend=\"Property Details\">\n <Text variant=\"small\" as=\"small\" className=\"gmw-field-legend\">\n Asterisk * indicates mandatory fields.\n </Text>\n <LabeledInput\n id=\"propertyName\"\n label=\"Property Name\"\n value={propertyName}\n required\n onChange={(event) => {\n setPropertyName(event.target.value);\n validator.showMessageFor(\"propertyName\");\n }}\n message={validator.message(\"propertyName\", propertyName, NAME_REQUIREMENTS)}\n status={validator.message(\"propertyName\", propertyName, NAME_REQUIREMENTS) ? \"negative\" : undefined}\n onBlur={() => {\n validator.showMessageFor(\"propertyName\");\n }}\n />\n <LabeledSelect<DataType>\n label={\"Data Type\"}\n id=\"dataType\"\n options={[\n { value: DataType.Boolean, label: \"Boolean\" },\n { value: DataType.Integer, label: \"Integer\" },\n { value: DataType.Double, label: \"Double\" },\n { value: DataType.String, label: \"String\" },\n ]}\n required\n value={calculatedPropertyType ? DataType.Double : dataType}\n onChange={(value) => {\n validator.showMessageFor(\"dataType\");\n setDataType(value);\n }}\n message={validator.message(\"dataType\", propertyName, \"required\")}\n status={validator.message(\"dataType\", propertyName, \"required\") ? \"negative\" : undefined}\n onBlur={() => {\n validator.showMessageFor(\"dataType\");\n }}\n disabled={calculatedPropertyType ? true : false}\n onShow={() => {}}\n onHide={() => {}}\n />\n <LabeledSelect<QuantityType | undefined>\n label=\"Quantity Type\"\n options={quantityTypesSelectionOptions}\n value={quantityType}\n onChange={setQuantityType}\n onShow={() => {}}\n onHide={() => {}}\n placeholder=\"No Quantity Type\"\n />\n </Fieldset>\n {propertiesNotFoundAlert && (\n <Alert type=\"warning\">\n Warning: Could not match saved properties from the current generated list. It does not confirm or deny validity. Overwriting will occur if a new\n selection is made and saved.\n </Alert>\n )}\n <ScrollableExpandableBlock\n title={\"Mapped Properties\"}\n endIcon={\n <Icon fill={selectedProperties.length > 0 ? \"informational\" : \"default\"}>\n <SvgLabel />\n </Icon>\n }\n isExpanded={selectedProperties.length > 0}\n setIsExpanded={() => {}}\n >\n <div className=\"gmw-property-view-container\">\n <div className=\"gmw-property-view-button\">\n <Button onClick={async () => setShowPropertiesSelectionModal(true)} disabled={isLoading}>\n Select Properties\n </Button>\n </div>\n <div className=\"gmw-properties-list\">\n {selectedProperties.length === 0 && !isLoading ? (\n <div className=\"gmw-empty-selection\">\n <Text>No properties selected.</Text>\n <Text>Press the "Select Properties" button for options.</Text>\n </div>\n ) : (\n selectedProperties.map((property) => (\n <GroupPropertyListItem\n key={property.key}\n content={`${property.displayLabel}`}\n title={`${property.actualECClassName}`}\n description={property.categoryLabel}\n />\n ))\n )}\n </div>\n </div>\n </ScrollableExpandableBlock>\n <ScrollableExpandableBlock\n parentRef={actionContainerRef}\n ref={calculatedPropertyActionRef}\n title={\"Calculated Property\"}\n endIcon={\n <Icon fill={calculatedPropertyType ? \"informational\" : \"default\"}>\n <SvgMeasure />\n </Icon>\n }\n isExpanded={!!calculatedPropertyType}\n setIsExpanded={setIsCalculatedBlockExpanded}\n >\n <CalculatedPropertyActionWithVisuals\n group={group}\n calculatedPropertyType={calculatedPropertyType}\n setCalculatedPropertyType={setCalculatedPropertyType}\n />\n </ScrollableExpandableBlock>\n <ScrollableExpandableBlock\n parentRef={actionContainerRef}\n ref={customCalculationActionRef}\n title={\"Custom Calculation\"}\n endIcon={\n <Icon fill={formula ? \"informational\" : \"default\"}>\n <SvgFunction />\n </Icon>\n }\n isExpanded={formula !== undefined}\n setIsExpanded={() => {}}\n >\n <CustomCalculationAction\n formula={formula}\n setFormula={setFormula}\n formulaErrorMessage={formulaErrorMessage}\n forceValidation={forceValidation}\n disabled={isLoading}\n />\n </ScrollableExpandableBlock>\n </div>\n <ActionPanel\n onSave={handleSaveClick}\n onCancel={onClickCancel}\n onSaveCapture={clearAll}\n onCancelCapture={clearAll}\n isLoading={isLoading}\n isSavingDisabled={!propertyName || dataType === undefined || formulaErrorMessage !== undefined}\n />\n <GroupsPropertiesSelectionModal\n showModal={showPropertiesSelectionModal}\n setShowModal={setShowPropertiesSelectionModal}\n selectedProperties={selectedProperties}\n setSelectedProperties={setSelectedProperties}\n propertiesMetaData={propertiesMetaData}\n />\n <SaveModal onSave={onSave} onClose={handleCloseSaveModal} showSaveModal={showSaveConfirmationModal} />\n </>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"GroupPropertyAction.js","sourceRoot":"","sources":["../../../../../src/components/Properties/GroupProperties/GroupPropertyAction.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;gGAGgG;AAChG,oEAAiE;AAEjE,wDAAwG;AACxG,+CAAwE;AACxE,qFAA6D;AAC7D,sEAAwE;AACxE,qFAAqF;AACrF,4DAAgE;AAEhE,sCAAoC;AAEpC,6DAAqI;AACrI,6DAAwE;AACxE,2CAAwC;AACxC,qFAAkF;AAClF,uDAA8E;AAC9E,mEAAgE;AAChE,mFAA4E;AAC5E,oEAA+E;AAC/E,qHAAkH;AAClH,iDAAoD;AACpD,2FAAwF;AACxF,oEAAiE;AACjE,wEAAqE;AACrE,4EAAyE;AAc5D,QAAA,6BAA6B,GAA6C;IACrF,EAAE,KAAK,EAAE,8BAAY,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE;IAC3C,EAAE,KAAK,EAAE,8BAAY,CAAC,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE;IACnD,EAAE,KAAK,EAAE,8BAAY,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE;IAC7C,EAAE,KAAK,EAAE,8BAAY,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE;IAC3C,EAAE,KAAK,EAAE,8BAAY,CAAC,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE;IACnD,EAAE,KAAK,EAAE,8BAAY,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE;I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AAE,yBAAyB,EACrC,aAAa,EAAE,4BAA4B;gBAE3C,8BAAC,yEAAmC,IAClC,KAAK,EAAE,KAAK,EACZ,sBAAsB,EAAE,sBAAsB,EAC9C,yBAAyB,EAAE,yBAAyB,GACpD,CACwB;YAC5B,8BAAC,qDAAyB,IACxB,SAAS,EAAE,kBAAkB,EAC7B,GAAG,EAAE,0BAA0B,EAC/B,KAAK,EAAE,oBAAoB,EAC3B,OAAO,EACL,8BAAC,oBAAI,IAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,SAAS;oBAC/C,8BAAC,iCAAW,OAAG,CACV,EAET,UAAU,EAAE,sBAAsB,EAClC,aAAa,EAAE,yBAAyB;gBAExC,8BAAC,iDAAuB,IACtB,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,UAAU,EACtB,mBAAmB,EAAE,mBAAmB,EACxC,eAAe,EAAE,eAAe,EAChC,QAAQ,EAAE,SAAS,GACnB,CACwB,CACxB;QACN,8BAAC,qBAAW,IACV,MAAM,EAAE,eAAe,EACvB,QAAQ,EAAE,aAAa,EACvB,aAAa,EAAE,sBAAQ,EACvB,eAAe,EAAE,sBAAQ,EACzB,SAAS,EAAE,SAAS,EACpB,gBAAgB,EAAE,CAAC,YAAY,IAAI,QAAQ,KAAK,SAAS,IAAI,mBAAmB,KAAK,SAAS,GAC9F;QACF,8BAAC,+DAA8B,IAC7B,SAAS,EAAE,4BAA4B,EACvC,YAAY,EAAE,+BAA+B,EAC7C,kBAAkB,EAAE,kBAAkB,EACtC,qBAAqB,EAAE,qBAAqB,EAC5C,kBAAkB,EAAE,kBAAkB,GACtC;QACF,8BAAC,qBAAS,IAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,yBAAyB,GAAI,CACrG,CACJ,CAAC;AACJ,CAAC,CAAC;AAvTW,QAAA,mBAAmB,uBAuT9B","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport { PropertyValueFormat } from \"@itwin/presentation-common\";\nimport type { SelectOption } from \"@itwin/itwinui-react\";\nimport { Alert, Button, Fieldset, Icon, LabeledInput, LabeledSelect, Text } from \"@itwin/itwinui-react\";\nimport React, { useCallback, useEffect, useRef, useState } from \"react\";\nimport ActionPanel from \"../../SharedComponents/ActionPanel\";\nimport useValidator, { NAME_REQUIREMENTS } from \"../hooks/useValidator\";\nimport { useGroupingMappingApiConfig } from \"../../context/GroupingApiConfigContext\";\nimport { DataType, QuantityType } from \"@itwin/insights-client\";\nimport type { CalculatedPropertyType, GroupMinimal, Property, PropertyModify } from \"@itwin/insights-client\";\nimport \"./GroupPropertyAction.scss\";\nimport type { PropertyMetaData } from \"./GroupPropertyUtils\";\nimport { convertPresentationFields, convertToECProperties, fetchPresentationDescriptor, findProperties } from \"./GroupPropertyUtils\";\nimport { clearAll, manufactureKeys } from \"../../../common/viewerUtils\";\nimport { SaveModal } from \"./SaveModal\";\nimport { GroupsPropertiesSelectionModal } from \"./GroupsPropertiesSelectionModal\";\nimport { useMutation, useQuery, useQueryClient } from \"@tanstack/react-query\";\nimport { GroupPropertyListItem } from \"./GroupPropertyListItem\";\nimport { usePropertiesClient } from \"../../context/PropertiesClientContext\";\nimport { SvgFunction, SvgLabel, SvgMeasure } from \"@itwin/itwinui-icons-react\";\nimport { CalculatedPropertyActionWithVisuals } from \"../CalculatedProperties/CalculatedPropertyActionWithVisuals\";\nimport { handleError } from \"../../../common/utils\";\nimport { CustomCalculationAction } from \"../CustomCalculations/CustomCalculationAction\";\nimport { usePropertiesQuery } from \"../hooks/usePropertiesQuery\";\nimport { useFormulaValidation } from \"../hooks/useFormulaValidation\";\nimport { ScrollableExpandableBlock } from \"../ScrollableExpandableBlock\";\n\n/**\n * Props for the {@link GroupPropertyAction} component.\n * @public\n */\nexport interface GroupPropertyActionProps {\n mappingId: string;\n group: GroupMinimal;\n groupProperty?: Property;\n onSaveSuccess: () => void;\n onClickCancel?: () => void;\n}\n\nexport const quantityTypesSelectionOptions: SelectOption<QuantityType | undefined>[] = [\n { value: QuantityType.Area, label: \"Area\" },\n { value: QuantityType.Distance, label: \"Distance\" },\n { value: QuantityType.Force, label: \"Force\" },\n { value: QuantityType.Mass, label: \"Mass\" },\n { value: QuantityType.Monetary, label: \"Monetary\" },\n { value: QuantityType.Time, label: \"Time\" },\n { value: QuantityType.Volume, label: \"Volume\" },\n { value: undefined, label: \"No Quantity Type\" },\n];\n\n/**\n * Component to create or update a group.\n * @public\n */\nexport const GroupPropertyAction = ({ mappingId, group, groupProperty, onSaveSuccess, onClickCancel }: GroupPropertyActionProps) => {\n const actionContainerRef = useRef<HTMLDivElement>(null);\n const calculatedPropertyActionRef = useRef<HTMLDivElement>(null);\n const customCalculationActionRef = useRef<HTMLDivElement>(null);\n const propertiesClient = usePropertiesClient();\n const queryClient = useQueryClient();\n\n const [propertyName, setPropertyName] = useState<string>(\"\");\n const [oldPropertyName, setOldPropertyName] = useState<string>(\"\");\n const [dataType, setDataType] = useState<DataType>(groupProperty?.dataType ?? DataType.String);\n const [quantityType, setQuantityType] = useState<QuantityType | undefined>(groupProperty?.quantityType ?? undefined);\n const [selectedProperties, setSelectedProperties] = useState<PropertyMetaData[]>([]);\n const [propertiesMetaData, setPropertiesMetaData] = useState<PropertyMetaData[]>([]);\n const [propertiesNotFoundAlert, setPropertiesNotFoundAlert] = useState<boolean>(false);\n const [validator, showValidationMessage] = useValidator();\n const [showPropertiesSelectionModal, setShowPropertiesSelectionModal] = useState<boolean>(false);\n const [showSaveConfirmationModal, setShowSaveConfirmationModal] = useState<boolean>(false);\n const [calculatedPropertyType, setCalculatedPropertyType] = useState<CalculatedPropertyType | undefined>(groupProperty?.calculatedPropertyType ?? undefined);\n const [isCalculatedBlockExpanded, setIsCalculatedBlockExpanded] = useState<boolean>(!!calculatedPropertyType);\n const [isMappedBlockExpanded, setIsMappedBlockExpanded] = useState<boolean>((groupProperty?.ecProperties?.length ?? 0) > 0);\n const [isFormulaBlockExpanded, setIsFormulaBlockExpanded] = useState<boolean>(!!groupProperty?.formula);\n const [formula, setFormula] = useState<string | undefined>(groupProperty?.formula ?? undefined);\n const [formulaErrorMessage, setFormulaErrorMessage] = useState<string | undefined>(undefined);\n\n const { getAccessToken, iModelId, iModelConnection } = useGroupingMappingApiConfig();\n const { data: groupProperties, isFetching: isLoadingGroupProperties } = usePropertiesQuery(iModelId, mappingId, group.id, getAccessToken, propertiesClient);\n const { forceValidation } = useFormulaValidation(propertyName.toLowerCase(), formula, groupProperties?.properties ?? [], setFormulaErrorMessage, dataType);\n\n const reset = useCallback(() => {\n setPropertyName(\"\");\n setDataType(DataType.String);\n setQuantityType(undefined);\n setSelectedProperties([]);\n setCalculatedPropertyType(undefined);\n setFormula(undefined);\n }, []);\n\n const fetchPropertiesMetadata = useCallback(async () => {\n if (!iModelConnection) return;\n\n const result = await manufactureKeys(group.query, iModelConnection);\n const descriptor = await fetchPresentationDescriptor(iModelConnection, result);\n\n // Only allow primitives and structs\n const propertyFields =\n descriptor?.fields.filter((field) => field.type.valueFormat === PropertyValueFormat.Primitive || field.type.valueFormat === PropertyValueFormat.Struct) ??\n [];\n\n const propertiesMetaData = convertPresentationFields(propertyFields);\n\n let groupPropertyDetails = null;\n if (groupProperty) {\n const accessToken = await getAccessToken();\n groupPropertyDetails = await propertiesClient.getProperty(accessToken, mappingId, group.id, groupProperty.id);\n }\n\n return { propertiesMetaData, groupPropertyDetails };\n }, [getAccessToken, group.id, group.query, groupProperty, iModelConnection, mappingId, propertiesClient]);\n\n const scrollToFormulaErrorMessage = useCallback(() => {\n setTimeout(() => {\n if (actionContainerRef.current && customCalculationActionRef.current) {\n actionContainerRef.current.scrollTo({\n top: customCalculationActionRef.current.offsetTop,\n behavior: \"smooth\",\n });\n }\n }, 500);\n }, [actionContainerRef]);\n\n const {\n data,\n isFetching: isLoadingProperties,\n isSuccess: isLoadingPropertiesSuccessful,\n } = useQuery([\"properties\", iModelId, mappingId, group.id, groupProperty?.id, \"metadata\"], fetchPropertiesMetadata);\n\n useEffect(() => {\n if (isLoadingPropertiesSuccessful && data?.propertiesMetaData) {\n setPropertiesMetaData(data.propertiesMetaData);\n\n if (data.groupPropertyDetails) {\n setPropertyName(data.groupPropertyDetails.propertyName);\n setOldPropertyName(data.groupPropertyDetails.propertyName);\n setDataType(data.groupPropertyDetails.dataType);\n if (data.groupPropertyDetails.quantityType) setQuantityType(data.groupPropertyDetails.quantityType);\n\n if (data.groupPropertyDetails.ecProperties) {\n const properties = findProperties(data.groupPropertyDetails.ecProperties, data.propertiesMetaData);\n if (properties.length === 0) {\n setPropertiesNotFoundAlert(true);\n }\n setSelectedProperties(properties);\n }\n }\n }\n }, [data, isLoadingPropertiesSuccessful]);\n\n useEffect(() => {\n if (calculatedPropertyType) {\n setDataType(DataType.Double);\n }\n\n if (isCalculatedBlockExpanded === false || !calculatedPropertyType) {\n clearAll();\n }\n }, [calculatedPropertyType, isCalculatedBlockExpanded]);\n\n useEffect(() => {\n if (formulaErrorMessage) {\n scrollToFormulaErrorMessage();\n }\n }, [formulaErrorMessage, scrollToFormulaErrorMessage]);\n\n const { mutate: onSave, isLoading: isSaving } = useMutation({\n mutationFn: async () => {\n const accessToken = await getAccessToken();\n const newGroupProperty: PropertyModify = {\n propertyName,\n dataType,\n quantityType,\n ecProperties: selectedProperties.length > 0 ? selectedProperties.map((p) => convertToECProperties(p)).flat() : undefined,\n calculatedPropertyType,\n formula,\n };\n\n return groupProperty\n ? propertiesClient.updateProperty(accessToken, mappingId, group.id, groupProperty.id, newGroupProperty)\n : propertiesClient.createProperty(accessToken, mappingId, group.id, newGroupProperty);\n },\n onSuccess: async () => {\n onSaveSuccess();\n reset();\n await queryClient.invalidateQueries([\"properties\", iModelId, mappingId, group.id]);\n },\n onError(error: any) {\n handleError(error.status);\n },\n });\n\n const handleSaveClick = async () => {\n if (!validator.allValid()) {\n showValidationMessage(true);\n return;\n }\n if (oldPropertyName !== propertyName && oldPropertyName !== \"\") {\n setShowSaveConfirmationModal(true);\n } else {\n onSave();\n }\n };\n\n const handleCloseSaveModal = () => {\n setShowSaveConfirmationModal(false);\n };\n\n const isLoading = isLoadingProperties || isSaving || isLoadingGroupProperties;\n\n return (\n <>\n <div className=\"gmw-group-property-action-container\" ref={actionContainerRef}>\n <Fieldset disabled={isLoading} className=\"gmw-property-options\" legend=\"Property Details\">\n <Text variant=\"small\" as=\"small\" className=\"gmw-field-legend\">\n Asterisk * indicates mandatory fields.\n </Text>\n <LabeledInput\n id=\"propertyName\"\n label=\"Property Name\"\n value={propertyName}\n required\n onChange={(event) => {\n setPropertyName(event.target.value);\n validator.showMessageFor(\"propertyName\");\n }}\n message={validator.message(\"propertyName\", propertyName, NAME_REQUIREMENTS)}\n status={validator.message(\"propertyName\", propertyName, NAME_REQUIREMENTS) ? \"negative\" : undefined}\n onBlur={() => {\n validator.showMessageFor(\"propertyName\");\n }}\n />\n <LabeledSelect<DataType>\n label={\"Data Type\"}\n id=\"dataType\"\n options={[\n { value: DataType.Boolean, label: \"Boolean\" },\n { value: DataType.Integer, label: \"Integer\" },\n { value: DataType.Double, label: \"Double\" },\n { value: DataType.String, label: \"String\" },\n ]}\n required\n value={calculatedPropertyType ? DataType.Double : dataType}\n onChange={(value) => {\n validator.showMessageFor(\"dataType\");\n setDataType(value);\n }}\n message={validator.message(\"dataType\", propertyName, \"required\")}\n status={validator.message(\"dataType\", propertyName, \"required\") ? \"negative\" : undefined}\n onBlur={() => {\n validator.showMessageFor(\"dataType\");\n }}\n disabled={calculatedPropertyType ? true : false}\n onShow={() => {}}\n onHide={() => {}}\n />\n <LabeledSelect<QuantityType | undefined>\n label=\"Quantity Type\"\n options={quantityTypesSelectionOptions}\n value={quantityType}\n onChange={setQuantityType}\n onShow={() => {}}\n onHide={() => {}}\n placeholder=\"No Quantity Type\"\n />\n </Fieldset>\n {propertiesNotFoundAlert && (\n <Alert type=\"warning\">\n Warning: Could not match saved properties from the current generated list. It does not confirm or deny validity. Overwriting will occur if a new\n selection is made and saved.\n </Alert>\n )}\n <ScrollableExpandableBlock\n title={\"Mapped Properties\"}\n endIcon={\n <Icon fill={selectedProperties.length > 0 ? \"informational\" : \"default\"}>\n <SvgLabel />\n </Icon>\n }\n isExpanded={isMappedBlockExpanded}\n setIsExpanded={setIsMappedBlockExpanded}\n >\n <div className=\"gmw-property-view-container\">\n <div className=\"gmw-property-view-button\">\n <Button onClick={async () => setShowPropertiesSelectionModal(true)} disabled={isLoading}>\n Select Properties\n </Button>\n </div>\n <div className=\"gmw-properties-list\">\n {selectedProperties.length === 0 && !isLoading ? (\n <div className=\"gmw-empty-selection\">\n <Text>No properties selected.</Text>\n <Text>Press the "Select Properties" button for options.</Text>\n </div>\n ) : (\n selectedProperties.map((property) => (\n <GroupPropertyListItem\n key={property.key}\n content={`${property.displayLabel}`}\n title={`${property.actualECClassName}`}\n description={property.categoryLabel}\n />\n ))\n )}\n </div>\n </div>\n </ScrollableExpandableBlock>\n <ScrollableExpandableBlock\n parentRef={actionContainerRef}\n ref={calculatedPropertyActionRef}\n title={\"Calculated Property\"}\n endIcon={\n <Icon fill={calculatedPropertyType ? \"informational\" : \"default\"}>\n <SvgMeasure />\n </Icon>\n }\n isExpanded={isCalculatedBlockExpanded}\n setIsExpanded={setIsCalculatedBlockExpanded}\n >\n <CalculatedPropertyActionWithVisuals\n group={group}\n calculatedPropertyType={calculatedPropertyType}\n setCalculatedPropertyType={setCalculatedPropertyType}\n />\n </ScrollableExpandableBlock>\n <ScrollableExpandableBlock\n parentRef={actionContainerRef}\n ref={customCalculationActionRef}\n title={\"Custom Calculation\"}\n endIcon={\n <Icon fill={formula ? \"informational\" : \"default\"}>\n <SvgFunction />\n </Icon>\n }\n isExpanded={isFormulaBlockExpanded}\n setIsExpanded={setIsFormulaBlockExpanded}\n >\n <CustomCalculationAction\n formula={formula}\n setFormula={setFormula}\n formulaErrorMessage={formulaErrorMessage}\n forceValidation={forceValidation}\n disabled={isLoading}\n />\n </ScrollableExpandableBlock>\n </div>\n <ActionPanel\n onSave={handleSaveClick}\n onCancel={onClickCancel}\n onSaveCapture={clearAll}\n onCancelCapture={clearAll}\n isLoading={isLoading}\n isSavingDisabled={!propertyName || dataType === undefined || formulaErrorMessage !== undefined}\n />\n <GroupsPropertiesSelectionModal\n showModal={showPropertiesSelectionModal}\n setShowModal={setShowPropertiesSelectionModal}\n selectedProperties={selectedProperties}\n setSelectedProperties={setSelectedProperties}\n propertiesMetaData={propertiesMetaData}\n />\n <SaveModal onSave={onSave} onClose={handleCloseSaveModal} showSaveModal={showSaveConfirmationModal} />\n </>\n );\n};\n"]}
|
|
@@ -11,7 +11,7 @@ const prefixUrl = (baseUrl, prefix) => {
|
|
|
11
11
|
};
|
|
12
12
|
const createDefaultExtractionClient = (prefix) => {
|
|
13
13
|
const url = prefixUrl(insights_client_1.GROUPING_AND_MAPPING_BASE_PATH, prefix);
|
|
14
|
-
return new insights_client_1.ExtractionClient(
|
|
14
|
+
return new insights_client_1.ExtractionClient(url);
|
|
15
15
|
};
|
|
16
16
|
exports.createDefaultExtractionClient = createDefaultExtractionClient;
|
|
17
17
|
const createExtractionClient = (clientProp) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExtractionClientContext.js","sourceRoot":"","sources":["../../../../src/components/context/ExtractionClientContext.ts"],"names":[],"mappings":";;;AAKA,iCAAkD;AAClD,4DAA0F;AAG1F,MAAM,SAAS,GAAG,CAAC,OAAgB,EAAE,MAAe,EAAE,EAAE;IACtD,IAAI,MAAM,IAAI,OAAO,EAAE;QACrB,OAAO,OAAO,CAAC,OAAO,CAAC,iBAAiB,EAAE,GAAG,MAAM,kBAAkB,CAAC,CAAC;KACxE;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEK,MAAM,6BAA6B,GAAG,CAAC,MAAqB,EAAqB,EAAE;IACxF,MAAM,GAAG,GAAG,SAAS,CAAC,gDAA8B,EAAE,MAAM,CAAC,CAAC;IAC9D,OAAO,IAAI,kCAAgB,CAAC,
|
|
1
|
+
{"version":3,"file":"ExtractionClientContext.js","sourceRoot":"","sources":["../../../../src/components/context/ExtractionClientContext.ts"],"names":[],"mappings":";;;AAKA,iCAAkD;AAClD,4DAA0F;AAG1F,MAAM,SAAS,GAAG,CAAC,OAAgB,EAAE,MAAe,EAAE,EAAE;IACtD,IAAI,MAAM,IAAI,OAAO,EAAE;QACrB,OAAO,OAAO,CAAC,OAAO,CAAC,iBAAiB,EAAE,GAAG,MAAM,kBAAkB,CAAC,CAAC;KACxE;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEK,MAAM,6BAA6B,GAAG,CAAC,MAAqB,EAAqB,EAAE;IACxF,MAAM,GAAG,GAAG,SAAS,CAAC,gDAA8B,EAAE,MAAM,CAAC,CAAC;IAC9D,OAAO,IAAI,kCAAgB,CAAC,GAAG,CAAC,CAAC;AACnC,CAAC,CAAC;AAHW,QAAA,6BAA6B,iCAGxC;AAEK,MAAM,sBAAsB,GAAG,CAAC,UAA4C,EAAE,EAAE;IACrF,IAAI,SAAS,KAAK,UAAU,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE;QAC9D,OAAO,IAAA,qCAA6B,EAAC,UAA0B,CAAC,CAAC;KAClE;IACD,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AALW,QAAA,sBAAsB,0BAKjC;AAEW,QAAA,uBAAuB,GAAG,IAAA,qBAAa,EAAoB,IAAA,qCAA6B,GAAE,CAAC,CAAC;AAElG,MAAM,mBAAmB,GAAG,GAAG,EAAE;IACtC,MAAM,OAAO,GAAG,IAAA,kBAAU,EAAC,+BAAuB,CAAC,CAAC;IACpD,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,KAAK,CAAC,8EAA8E,CAAC,CAAC;KACjG;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AANW,QAAA,mBAAmB,uBAM9B","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport type { IExtractionClient } from \"@itwin/insights-client\";\nimport { createContext, useContext } from \"react\";\nimport { ExtractionClient, GROUPING_AND_MAPPING_BASE_PATH } from \"@itwin/insights-client\";\nimport type { ClientPrefix } from \"./GroupingApiConfigContext\";\n\nconst prefixUrl = (baseUrl?: string, prefix?: string) => {\n if (prefix && baseUrl) {\n return baseUrl.replace(\"api.bentley.com\", `${prefix}-api.bentley.com`);\n }\n return baseUrl;\n};\n\nexport const createDefaultExtractionClient = (prefix?: ClientPrefix): IExtractionClient => {\n const url = prefixUrl(GROUPING_AND_MAPPING_BASE_PATH, prefix);\n return new ExtractionClient(url);\n};\n\nexport const createExtractionClient = (clientProp: IExtractionClient | ClientPrefix) => {\n if (undefined === clientProp || typeof clientProp === \"string\") {\n return createDefaultExtractionClient(clientProp as ClientPrefix);\n }\n return clientProp;\n};\n\nexport const ExtractionClientContext = createContext<IExtractionClient>(createDefaultExtractionClient());\n\nexport const useExtractionClient = () => {\n const context = useContext(ExtractionClientContext);\n if (!context) {\n throw new Error(\"useExtractionClient should be used within a ExtractionClientContext provider\");\n }\n return context;\n};\n"]}
|
|
@@ -32,8 +32,6 @@ const react_1 = require("react");
|
|
|
32
32
|
exports.GroupingMappingApiConfigContext = (0, react_1.createContext)({
|
|
33
33
|
getAccessToken: async () => "",
|
|
34
34
|
iModelId: "",
|
|
35
|
-
prefix: undefined,
|
|
36
|
-
iModelConnection: undefined,
|
|
37
35
|
});
|
|
38
36
|
/**
|
|
39
37
|
* Hook to access the GroupingMappingApiConfig from the context.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupingApiConfigContext.js","sourceRoot":"","sources":["../../../../src/components/context/GroupingApiConfigContext.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,6CAA+B;AAC/B,iCAAsC;
|
|
1
|
+
{"version":3,"file":"GroupingApiConfigContext.js","sourceRoot":"","sources":["../../../../src/components/context/GroupingApiConfigContext.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,6CAA+B;AAC/B,iCAAsC;AAuBtC;;GAEG;AACU,QAAA,+BAA+B,GAAG,IAAA,qBAAa,EAA2B;IACrF,cAAc,EAAE,KAAK,IAAI,EAAE,CAAC,EAAE;IAC9B,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC;AAEH;;;GAGG;AACI,MAAM,2BAA2B,GAAG,GAAG,EAAE;IAC9C,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,uCAA+B,CAAC,CAAC;IAClE,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,KAAK,CAAC,8FAA8F,CAAC,CAAC;KACjH;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AANW,QAAA,2BAA2B,+BAMtC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport type { AccessToken } from \"@itwin/core-bentley\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport * as React from \"react\";\nimport { createContext } from \"react\";\n\n/**\n * @public\n */\nexport type ClientPrefix = \"\" | \"dev\" | \"qa\" | undefined;\n\n/**\n * @public\n */\nexport type GetAccessTokenFn = () => Promise<AccessToken>;\n\n/**\n * @public\n */\nexport interface GroupingMappingApiConfig {\n getAccessToken: GetAccessTokenFn;\n iModelId: string;\n iModelConnection?: IModelConnection;\n changeSetId?: string;\n prefix?: ClientPrefix;\n}\n\n/**\n * @public\n */\nexport const GroupingMappingApiConfigContext = createContext<GroupingMappingApiConfig>({\n getAccessToken: async () => \"\",\n iModelId: \"\",\n});\n\n/**\n * Hook to access the GroupingMappingApiConfig from the context.\n * @public\n */\nexport const useGroupingMappingApiConfig = () => {\n const context = React.useContext(GroupingMappingApiConfigContext);\n if (!context) {\n throw new Error(\"useGroupingMappingApiConfig should be used within a GroupingMappingApiConfigContext provider\");\n }\n return context;\n};\n"]}
|
|
@@ -14,7 +14,7 @@ const prefixUrl = (baseUrl, prefix) => {
|
|
|
14
14
|
*/
|
|
15
15
|
const createDefaultGroupsClient = (prefix) => {
|
|
16
16
|
const url = prefixUrl(insights_client_1.GROUPING_AND_MAPPING_BASE_PATH, prefix);
|
|
17
|
-
return new insights_client_1.GroupsClient(
|
|
17
|
+
return new insights_client_1.GroupsClient(url);
|
|
18
18
|
};
|
|
19
19
|
exports.createDefaultGroupsClient = createDefaultGroupsClient;
|
|
20
20
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupsClientContext.js","sourceRoot":"","sources":["../../../../src/components/context/GroupsClientContext.ts"],"names":[],"mappings":";;;AAKA,4DAAsF;AACtF,iCAAkD;AAGlD,MAAM,SAAS,GAAG,CAAC,OAAgB,EAAE,MAAe,EAAE,EAAE;IACtD,IAAI,MAAM,IAAI,OAAO,EAAE;QACrB,OAAO,OAAO,CAAC,OAAO,CAAC,iBAAiB,EAAE,GAAG,MAAM,kBAAkB,CAAC,CAAC;KACxE;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF;;GAEG;AACI,MAAM,yBAAyB,GAAG,CAAC,MAAqB,EAAiB,EAAE;IAChF,MAAM,GAAG,GAAG,SAAS,CAAC,gDAA8B,EAAE,MAAM,CAAC,CAAC;IAC9D,OAAO,IAAI,8BAAY,CAAC,
|
|
1
|
+
{"version":3,"file":"GroupsClientContext.js","sourceRoot":"","sources":["../../../../src/components/context/GroupsClientContext.ts"],"names":[],"mappings":";;;AAKA,4DAAsF;AACtF,iCAAkD;AAGlD,MAAM,SAAS,GAAG,CAAC,OAAgB,EAAE,MAAe,EAAE,EAAE;IACtD,IAAI,MAAM,IAAI,OAAO,EAAE;QACrB,OAAO,OAAO,CAAC,OAAO,CAAC,iBAAiB,EAAE,GAAG,MAAM,kBAAkB,CAAC,CAAC;KACxE;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF;;GAEG;AACI,MAAM,yBAAyB,GAAG,CAAC,MAAqB,EAAiB,EAAE;IAChF,MAAM,GAAG,GAAG,SAAS,CAAC,gDAA8B,EAAE,MAAM,CAAC,CAAC;IAC9D,OAAO,IAAI,8BAAY,CAAC,GAAG,CAAC,CAAC;AAC/B,CAAC,CAAC;AAHW,QAAA,yBAAyB,6BAGpC;AAEF;;GAEG;AACI,MAAM,kBAAkB,GAAG,CAAC,UAAwC,EAAE,EAAE;IAC7E,IAAI,SAAS,KAAK,UAAU,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE;QAC9D,OAAO,IAAA,iCAAyB,EAAC,UAA0B,CAAC,CAAC;KAC9D;IACD,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AALW,QAAA,kBAAkB,sBAK7B;AAEF;;GAEG;AACU,QAAA,mBAAmB,GAAG,IAAA,qBAAa,EAAgB,IAAA,iCAAyB,GAAE,CAAC,CAAC;AAE7F;;GAEG;AACI,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,MAAM,OAAO,GAAG,IAAA,kBAAU,EAAC,2BAAmB,CAAC,CAAC;IAChD,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,KAAK,CAAC,sEAAsE,CAAC,CAAC;KACzF;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AANW,QAAA,eAAe,mBAM1B","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport type { IGroupsClient } from \"@itwin/insights-client\";\nimport { GROUPING_AND_MAPPING_BASE_PATH, GroupsClient } from \"@itwin/insights-client\";\nimport { createContext, useContext } from \"react\";\nimport type { ClientPrefix } from \"./GroupingApiConfigContext\";\n\nconst prefixUrl = (baseUrl?: string, prefix?: string) => {\n if (prefix && baseUrl) {\n return baseUrl.replace(\"api.bentley.com\", `${prefix}-api.bentley.com`);\n }\n return baseUrl;\n};\n\n/**\n * @internal\n */\nexport const createDefaultGroupsClient = (prefix?: ClientPrefix): IGroupsClient => {\n const url = prefixUrl(GROUPING_AND_MAPPING_BASE_PATH, prefix);\n return new GroupsClient(url);\n};\n\n/**\n * @internal\n */\nexport const createGroupsClient = (clientProp: IGroupsClient | ClientPrefix) => {\n if (undefined === clientProp || typeof clientProp === \"string\") {\n return createDefaultGroupsClient(clientProp as ClientPrefix);\n }\n return clientProp;\n};\n\n/**\n * @internal\n */\nexport const GroupsClientContext = createContext<IGroupsClient>(createDefaultGroupsClient());\n\n/**\n * @internal\n */\nexport const useGroupsClient = () => {\n const context = useContext(GroupsClientContext);\n if (!context) {\n throw new Error(\"useGroupsClient should be used within a GroupsClientContext provider\");\n }\n return context;\n};\n"]}
|
|
@@ -14,7 +14,7 @@ const prefixUrl = (baseUrl, prefix) => {
|
|
|
14
14
|
*/
|
|
15
15
|
const createDefaultMappingClient = (prefix) => {
|
|
16
16
|
const url = prefixUrl(insights_client_1.GROUPING_AND_MAPPING_BASE_PATH, prefix);
|
|
17
|
-
return new insights_client_1.MappingsClient(
|
|
17
|
+
return new insights_client_1.MappingsClient(url);
|
|
18
18
|
};
|
|
19
19
|
exports.createDefaultMappingClient = createDefaultMappingClient;
|
|
20
20
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MappingClientContext.js","sourceRoot":"","sources":["../../../../src/components/context/MappingClientContext.ts"],"names":[],"mappings":";;;AAKA,4DAAwF;AACxF,iCAAkD;AAGlD,MAAM,SAAS,GAAG,CAAC,OAAgB,EAAE,MAAe,EAAE,EAAE;IACtD,IAAI,MAAM,IAAI,OAAO,EAAE;QACrB,OAAO,OAAO,CAAC,OAAO,CAAC,iBAAiB,EAAE,GAAG,MAAM,kBAAkB,CAAC,CAAC;KACxE;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF;;GAEG;AACI,MAAM,0BAA0B,GAAG,CAAC,MAAqB,EAAmB,EAAE;IACnF,MAAM,GAAG,GAAG,SAAS,CAAC,gDAA8B,EAAE,MAAM,CAAC,CAAC;IAC9D,OAAO,IAAI,gCAAc,CAAC,
|
|
1
|
+
{"version":3,"file":"MappingClientContext.js","sourceRoot":"","sources":["../../../../src/components/context/MappingClientContext.ts"],"names":[],"mappings":";;;AAKA,4DAAwF;AACxF,iCAAkD;AAGlD,MAAM,SAAS,GAAG,CAAC,OAAgB,EAAE,MAAe,EAAE,EAAE;IACtD,IAAI,MAAM,IAAI,OAAO,EAAE;QACrB,OAAO,OAAO,CAAC,OAAO,CAAC,iBAAiB,EAAE,GAAG,MAAM,kBAAkB,CAAC,CAAC;KACxE;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF;;GAEG;AACI,MAAM,0BAA0B,GAAG,CAAC,MAAqB,EAAmB,EAAE;IACnF,MAAM,GAAG,GAAG,SAAS,CAAC,gDAA8B,EAAE,MAAM,CAAC,CAAC;IAC9D,OAAO,IAAI,gCAAc,CAAC,GAAG,CAAC,CAAC;AACjC,CAAC,CAAC;AAHW,QAAA,0BAA0B,8BAGrC;AAEF;;GAEG;AACI,MAAM,mBAAmB,GAAG,CAAC,UAA0C,EAAE,EAAE;IAChF,IAAI,SAAS,KAAK,UAAU,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE;QAC9D,OAAO,IAAA,kCAA0B,EAAC,UAA0B,CAAC,CAAC;KAC/D;IACD,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AALW,QAAA,mBAAmB,uBAK9B;AAEF;;GAEG;AACU,QAAA,oBAAoB,GAAG,IAAA,qBAAa,EAAkB,IAAA,kCAA0B,GAAE,CAAC,CAAC;AAEjG;;GAEG;AACI,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACnC,MAAM,OAAO,GAAG,IAAA,kBAAU,EAAC,4BAAoB,CAAC,CAAC;IACjD,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,KAAK,CAAC,wEAAwE,CAAC,CAAC;KAC3F;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AANW,QAAA,gBAAgB,oBAM3B","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport type { IMappingsClient } from \"@itwin/insights-client\";\nimport { GROUPING_AND_MAPPING_BASE_PATH, MappingsClient } from \"@itwin/insights-client\";\nimport { createContext, useContext } from \"react\";\nimport type { ClientPrefix } from \"./GroupingApiConfigContext\";\n\nconst prefixUrl = (baseUrl?: string, prefix?: string) => {\n if (prefix && baseUrl) {\n return baseUrl.replace(\"api.bentley.com\", `${prefix}-api.bentley.com`);\n }\n return baseUrl;\n};\n\n/**\n * @internal\n */\nexport const createDefaultMappingClient = (prefix?: ClientPrefix): IMappingsClient => {\n const url = prefixUrl(GROUPING_AND_MAPPING_BASE_PATH, prefix);\n return new MappingsClient(url);\n};\n\n/**\n * @internal\n */\nexport const createMappingClient = (clientProp: IMappingsClient | ClientPrefix) => {\n if (undefined === clientProp || typeof clientProp === \"string\") {\n return createDefaultMappingClient(clientProp as ClientPrefix);\n }\n return clientProp;\n};\n\n/**\n * @internal\n */\nexport const MappingClientContext = createContext<IMappingsClient>(createDefaultMappingClient());\n\n/**\n * @internal\n */\nexport const useMappingClient = () => {\n const context = useContext(MappingClientContext);\n if (!context) {\n throw new Error(\"useMappingClient should be used within a MappingClientContext provider\");\n }\n return context;\n};\n"]}
|
|
@@ -14,7 +14,7 @@ const prefixUrl = (baseUrl, prefix) => {
|
|
|
14
14
|
*/
|
|
15
15
|
const createDefaultPropertiesClient = (prefix) => {
|
|
16
16
|
const url = prefixUrl(insights_client_1.GROUPING_AND_MAPPING_BASE_PATH, prefix);
|
|
17
|
-
return new insights_client_1.PropertiesClient(
|
|
17
|
+
return new insights_client_1.PropertiesClient(url);
|
|
18
18
|
};
|
|
19
19
|
exports.createDefaultPropertiesClient = createDefaultPropertiesClient;
|
|
20
20
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertiesClientContext.js","sourceRoot":"","sources":["../../../../src/components/context/PropertiesClientContext.ts"],"names":[],"mappings":";;;AAKA,4DAA0F;AAC1F,iCAAkD;AAGlD,MAAM,SAAS,GAAG,CAAC,OAAgB,EAAE,MAAe,EAAE,EAAE;IACtD,IAAI,MAAM,IAAI,OAAO,EAAE;QACrB,OAAO,OAAO,CAAC,OAAO,CAAC,iBAAiB,EAAE,GAAG,MAAM,kBAAkB,CAAC,CAAC;KACxE;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF;;GAEG;AACI,MAAM,6BAA6B,GAAG,CAAC,MAAqB,EAAqB,EAAE;IACxF,MAAM,GAAG,GAAG,SAAS,CAAC,gDAA8B,EAAE,MAAM,CAAC,CAAC;IAC9D,OAAO,IAAI,kCAAgB,CAAC,
|
|
1
|
+
{"version":3,"file":"PropertiesClientContext.js","sourceRoot":"","sources":["../../../../src/components/context/PropertiesClientContext.ts"],"names":[],"mappings":";;;AAKA,4DAA0F;AAC1F,iCAAkD;AAGlD,MAAM,SAAS,GAAG,CAAC,OAAgB,EAAE,MAAe,EAAE,EAAE;IACtD,IAAI,MAAM,IAAI,OAAO,EAAE;QACrB,OAAO,OAAO,CAAC,OAAO,CAAC,iBAAiB,EAAE,GAAG,MAAM,kBAAkB,CAAC,CAAC;KACxE;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF;;GAEG;AACI,MAAM,6BAA6B,GAAG,CAAC,MAAqB,EAAqB,EAAE;IACxF,MAAM,GAAG,GAAG,SAAS,CAAC,gDAA8B,EAAE,MAAM,CAAC,CAAC;IAC9D,OAAO,IAAI,kCAAgB,CAAC,GAAG,CAAC,CAAC;AACnC,CAAC,CAAC;AAHW,QAAA,6BAA6B,iCAGxC;AAEF;;GAEG;AACI,MAAM,sBAAsB,GAAG,CAAC,UAA4C,EAAE,EAAE;IACrF,IAAI,SAAS,KAAK,UAAU,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE;QAC9D,OAAO,IAAA,qCAA6B,EAAC,UAA0B,CAAC,CAAC;KAClE;IACD,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AALW,QAAA,sBAAsB,0BAKjC;AAEF;;GAEG;AACU,QAAA,uBAAuB,GAAG,IAAA,qBAAa,EAAoB,IAAA,qCAA6B,GAAE,CAAC,CAAC;AAEzG;;GAEG;AACI,MAAM,mBAAmB,GAAG,GAAG,EAAE;IACtC,MAAM,OAAO,GAAG,IAAA,kBAAU,EAAC,+BAAuB,CAAC,CAAC;IACpD,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,KAAK,CAAC,sEAAsE,CAAC,CAAC;KACzF;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AANW,QAAA,mBAAmB,uBAM9B","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport type { IPropertiesClient } from \"@itwin/insights-client\";\nimport { GROUPING_AND_MAPPING_BASE_PATH, PropertiesClient } from \"@itwin/insights-client\";\nimport { createContext, useContext } from \"react\";\nimport type { ClientPrefix } from \"./GroupingApiConfigContext\";\n\nconst prefixUrl = (baseUrl?: string, prefix?: string) => {\n if (prefix && baseUrl) {\n return baseUrl.replace(\"api.bentley.com\", `${prefix}-api.bentley.com`);\n }\n return baseUrl;\n};\n\n/**\n * @internal\n */\nexport const createDefaultPropertiesClient = (prefix?: ClientPrefix): IPropertiesClient => {\n const url = prefixUrl(GROUPING_AND_MAPPING_BASE_PATH, prefix);\n return new PropertiesClient(url);\n};\n\n/**\n * @internal\n */\nexport const createPropertiesClient = (clientProp: IPropertiesClient | ClientPrefix) => {\n if (undefined === clientProp || typeof clientProp === \"string\") {\n return createDefaultPropertiesClient(clientProp as ClientPrefix);\n }\n return clientProp;\n};\n\n/**\n * @internal\n */\nexport const PropertiesClientContext = createContext<IPropertiesClient>(createDefaultPropertiesClient());\n\n/**\n * @internal\n */\nexport const usePropertiesClient = () => {\n const context = useContext(PropertiesClientContext);\n if (!context) {\n throw new Error(\"useGroupsClient should be used within a GroupsClientContext provider\");\n }\n return context;\n};\n"]}
|
|
@@ -3,7 +3,7 @@ import type { GroupMinimal, Mapping, Property } from "@itwin/insights-client";
|
|
|
3
3
|
import type { GroupingMappingContextProps } from "../components/GroupingMappingContext";
|
|
4
4
|
import "./GroupingMapping.scss";
|
|
5
5
|
import type { ContextCustomUI } from "../components/customUI/GroupingMappingCustomUI";
|
|
6
|
-
export declare type GroupingMappingProps = Omit<GroupingMappingContextProps, "iModelId"> & {
|
|
6
|
+
export declare type GroupingMappingProps = Omit<GroupingMappingContextProps, "iModelId" | "changesetId"> & {
|
|
7
7
|
hideRefreshIcon?: boolean;
|
|
8
8
|
};
|
|
9
9
|
export declare enum RouteStep {
|