@itwin/reports-config-widget-react 0.7.0 → 0.8.0
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/CHANGELOG.json +31 -1
- package/CHANGELOG.md +18 -2
- package/README.md +1 -5
- package/coverage/clover.xml +77 -79
- package/coverage/coverage-final.json +7 -7
- package/coverage/lcov-report/index.html +10 -10
- package/coverage/lcov-report/src/ReportsConfigWidget.ts.html +2 -2
- package/coverage/lcov-report/src/index.html +1 -1
- package/coverage/lcov-report/src/test/index.html +1 -1
- package/coverage/lcov-report/src/test/test-utils.tsx.html +1 -1
- package/coverage/lcov-report/src/widget/ReportsConfigUiProvider.tsx.html +1 -1
- package/coverage/lcov-report/src/widget/components/ActionPanel.tsx.html +1 -1
- package/coverage/lcov-report/src/widget/components/AddMappingsModal.tsx.html +1 -1
- package/coverage/lcov-report/src/widget/components/BulkExtractor.ts.html +1 -1
- package/coverage/lcov-report/src/widget/components/Constants.ts.html +1 -1
- package/coverage/lcov-report/src/widget/components/DeleteModal.tsx.html +1 -1
- package/coverage/lcov-report/src/widget/components/ExtractionStates/FailedExtractionState.tsx.html +1 -1
- package/coverage/lcov-report/src/widget/components/ExtractionStates/QueuedExtractionState.tsx.html +1 -1
- package/coverage/lcov-report/src/widget/components/ExtractionStates/RunningExtractionState.tsx.html +1 -1
- package/coverage/lcov-report/src/widget/components/ExtractionStates/StartingExtractionState.tsx.html +1 -1
- package/coverage/lcov-report/src/widget/components/ExtractionStates/SucceededExtractionState.tsx.html +1 -1
- package/coverage/lcov-report/src/widget/components/ExtractionStates/index.html +1 -1
- package/coverage/lcov-report/src/widget/components/ExtractionStatus.tsx.html +1 -1
- package/coverage/lcov-report/src/widget/components/ExtractionToast.tsx.html +1 -1
- package/coverage/lcov-report/src/widget/components/HorizontalTile.tsx.html +3 -3
- package/coverage/lcov-report/src/widget/components/LocalizedTablePaginator.tsx.html +1 -1
- package/coverage/lcov-report/src/widget/components/ReportAction.tsx.html +1 -1
- package/coverage/lcov-report/src/widget/components/ReportHorizontalTile.tsx.html +15 -15
- package/coverage/lcov-report/src/widget/components/ReportMappingHorizontalTile.tsx.html +1 -1
- package/coverage/lcov-report/src/widget/components/ReportMappings.tsx.html +11 -20
- package/coverage/lcov-report/src/widget/components/Reports.tsx.html +4 -4
- package/coverage/lcov-report/src/widget/components/ReportsConfigContext.tsx.html +4 -4
- package/coverage/lcov-report/src/widget/components/ReportsContainer.tsx.html +1 -1
- package/coverage/lcov-report/src/widget/components/ReportsHeader.tsx.html +1 -1
- package/coverage/lcov-report/src/widget/components/ReportsRouter.tsx.html +1 -1
- package/coverage/lcov-report/src/widget/components/SearchBar.tsx.html +1 -1
- package/coverage/lcov-report/src/widget/components/SelectIModel.tsx.html +1 -1
- package/coverage/lcov-report/src/widget/components/index.html +11 -11
- package/coverage/lcov-report/src/widget/components/utils.tsx.html +2 -2
- package/coverage/lcov-report/src/widget/context/BulkExtractorContext.tsx.html +1 -1
- package/coverage/lcov-report/src/widget/context/ReportsConfigApiContext.tsx.html +1 -1
- package/coverage/lcov-report/src/widget/context/index.html +1 -1
- package/coverage/lcov-report/src/widget/hooks/index.html +1 -1
- package/coverage/lcov-report/src/widget/hooks/useValidator.ts.html +1 -1
- package/coverage/lcov-report/src/widget/index.html +1 -1
- package/coverage/lcov.info +134 -136
- package/lib/cjs/test/ReportAction.test.js +3 -0
- package/lib/cjs/test/ReportAction.test.js.map +1 -1
- package/lib/cjs/test/ReportMappings.test.js +4 -1
- package/lib/cjs/test/ReportMappings.test.js.map +1 -1
- package/lib/cjs/test/Reports.test.js +3 -0
- package/lib/cjs/test/Reports.test.js.map +1 -1
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/cjs/widget/components/ReportMappings.d.ts.map +1 -1
- package/lib/cjs/widget/components/ReportMappings.js +4 -6
- package/lib/cjs/widget/components/ReportMappings.js.map +1 -1
- package/lib/cjs/widget/components/ReportsConfigContext.js +3 -3
- package/lib/cjs/widget/components/ReportsConfigContext.js.map +1 -1
- package/lib/esm/test/ReportAction.test.js +3 -0
- package/lib/esm/test/ReportAction.test.js.map +1 -1
- package/lib/esm/test/ReportMappings.test.js +4 -1
- package/lib/esm/test/ReportMappings.test.js.map +1 -1
- package/lib/esm/test/Reports.test.js +3 -0
- package/lib/esm/test/Reports.test.js.map +1 -1
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/widget/components/ReportMappings.d.ts.map +1 -1
- package/lib/esm/widget/components/ReportMappings.js +5 -7
- package/lib/esm/widget/components/ReportMappings.js.map +1 -1
- package/lib/esm/widget/components/ReportsConfigContext.js +3 -3
- package/lib/esm/widget/components/ReportsConfigContext.js.map +1 -1
- package/package.json +4 -4
- package/src/test/ReportAction.test.tsx +3 -0
- package/src/test/ReportMappings.test.tsx +4 -1
- package/src/test/Reports.test.tsx +3 -0
- package/src/widget/components/ReportMappings.tsx +5 -8
- package/src/widget/components/ReportsConfigContext.tsx +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReportMappings.d.ts","sourceRoot":"","sources":["../../../../src/widget/components/ReportMappings.tsx"],"names":[],"mappings":";AAOA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAEvD,OAAO,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAA6D,MAAM,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"ReportMappings.d.ts","sourceRoot":"","sources":["../../../../src/widget/components/ReportMappings.tsx"],"names":[],"mappings":";AAOA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAEvD,OAAO,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAA6D,MAAM,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAW/H,oBAAY,iBAAiB,GAAG,uBAAuB,CAAC,aAAa,CAAC,CAAC;AAEvE,oBAAY,uBAAuB,GAAG,iBAAiB,GAAG;IACxD,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAmDF;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,8CAA+C,mBAAmB,uBA8J5F,CAAC"}
|
|
@@ -5,10 +5,9 @@
|
|
|
5
5
|
import { SvgAdd, SvgCopy, SvgRefresh } from "@itwin/itwinui-icons-react";
|
|
6
6
|
import { Button, IconButton, LabeledInput, Text, toaster } from "@itwin/itwinui-react";
|
|
7
7
|
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
8
|
-
import { EmptyMessage,
|
|
8
|
+
import { EmptyMessage, handleError, LoadingOverlay, LoadingSpinner } from "./utils";
|
|
9
9
|
import "./ReportMappings.scss";
|
|
10
10
|
import DeleteModal from "./DeleteModal";
|
|
11
|
-
import { REPORTING_BASE_PATH } from "@itwin/insights-client";
|
|
12
11
|
import { AddMappingsModal } from "./AddMappingsModal";
|
|
13
12
|
import { AccessTokenAdapter } from "@itwin/imodels-access-frontend";
|
|
14
13
|
import { SearchBar } from "./SearchBar";
|
|
@@ -63,7 +62,7 @@ const fetchReportMappings = async (setReportMappings, reportId, setIsLoading, re
|
|
|
63
62
|
* @public
|
|
64
63
|
*/
|
|
65
64
|
export const ReportMappings = ({ report, onClickClose, defaultIModelId }) => {
|
|
66
|
-
const { getAccessToken, reportsClient, iModelsClient, mappingsClient
|
|
65
|
+
const { getAccessToken, reportsClient, iModelsClient, mappingsClient } = useReportsConfigApi();
|
|
67
66
|
const [showDeleteModal, setShowDeleteModal] = useState(undefined);
|
|
68
67
|
const [showAddMapping, setShowAddMapping] = useState(false);
|
|
69
68
|
const { bulkExtractor } = useBulkExtractor();
|
|
@@ -83,7 +82,6 @@ export const ReportMappings = ({ report, onClickClose, defaultIModelId }) => {
|
|
|
83
82
|
const refresh = useCallback(async () => {
|
|
84
83
|
await fetchReportMappings(setReportMappings, report.id, setIsLoading, reportsClient, mappingsClient, iModelsClient, getAccessToken);
|
|
85
84
|
}, [getAccessToken, iModelsClient, mappingsClient, report.id, reportsClient]);
|
|
86
|
-
const odataFeedUrl = `${generateUrl(REPORTING_BASE_PATH, baseUrl)}/odata/${report.id}`;
|
|
87
85
|
const addMapping = useCallback(() => {
|
|
88
86
|
setShowAddMapping(true);
|
|
89
87
|
}, []);
|
|
@@ -96,8 +94,8 @@ export const ReportMappings = ({ report, onClickClose, defaultIModelId }) => {
|
|
|
96
94
|
return null;
|
|
97
95
|
return (React.createElement(React.Fragment, null,
|
|
98
96
|
React.createElement("div", { className: "rcw-report-mappings-container" },
|
|
99
|
-
React.createElement(LabeledInput, { label: ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:ODataFeedURL"), className: "rcw-odata-url-input", readOnly: true, value:
|
|
100
|
-
await navigator.clipboard.writeText(
|
|
97
|
+
React.createElement(LabeledInput, { label: ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:ODataFeedURL"), className: "rcw-odata-url-input", readOnly: true, value: report._links.odata.href, svgIcon: React.createElement(IconButton, { title: ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:Copy"), onClick: async (_) => {
|
|
98
|
+
await navigator.clipboard.writeText(report._links.odata.href);
|
|
101
99
|
toaster.positive(ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:CopiedToClipboard"));
|
|
102
100
|
} },
|
|
103
101
|
React.createElement(SvgCopy, null)), iconDisplayStyle: "inline" }),
|
|
@@ -113,7 +111,7 @@ export const ReportMappings = ({ report, onClickClose, defaultIModelId }) => {
|
|
|
113
111
|
React.createElement("div", null,
|
|
114
112
|
React.createElement(Button, { onClick: addMapping, styleType: "cta" }, ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:LetsAddSomeMappingsCTA")))))) : (React.createElement("div", { className: "rcw-mapping-list" }, filteredReportMappings.map((mapping) => (React.createElement(ReportMappingHorizontalTile, { key: mapping.mappingId, bulkExtractor: bulkExtractor, mapping: mapping, onClickDelete: () => {
|
|
115
113
|
setShowDeleteModal(mapping);
|
|
116
|
-
}, odataFeedUrl:
|
|
114
|
+
}, odataFeedUrl: report._links.odata.href, jobStartEvent: jobStartEvent })))))),
|
|
117
115
|
React.createElement(AddMappingsModal, { show: showAddMapping, reportId: report.id, existingMappings: reportMappings, onClose: onAddMappingsModalClose, defaultIModelId: defaultIModelId }),
|
|
118
116
|
React.createElement(DeleteModal, { entityName: showDeleteModal?.mappingName ?? "", onDelete: async () => {
|
|
119
117
|
const accessToken = await getAccessToken();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReportMappings.js","sourceRoot":"","sources":["../../../../src/widget/components/ReportMappings.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACvF,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEzE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACjG,OAAO,uBAAuB,CAAC;AAC/B,OAAO,WAAW,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM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cAAc;iCACrB,MAAM,CAAC,CAAC,aAAa,EAAE,EAAE,CAAC,aAAa,CAAC,QAAQ,KAAK,QAAQ,CAAC;iCAC9D,GAAG,CAAC,CAAC,sBAAsB,EAAE,EAAE,CAAC,CAAC;gCAChC,EAAE,EAAE,sBAAsB,CAAC,SAAS;6BACrC,CAAC,CAAC;yBACN,CAAC;oBACJ,CAAC,CAAC,CAAC;oBACH,MAAM,aAAa,CAAC,oBAAoB,CAAC,kBAAkB,CAAC,CAAC;oBAC7D,cAAc,CAAC,OAAO,CAAC,CAAC,aAAa,EAAE,EAAE;wBACvC,aAAa,CAAC,UAAU,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;oBACnD,CAAC,CAAC,CAAC;gBACL,CAAC,IAEA,mBAAmB,CAAC,YAAY,CAAC,kBAAkB,CAAC,uCAAuC,CAAC,CACtF;YACT,oBAAC,MAAM,IAAC,SAAS,EAAC,SAAS,EAAC,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,IACjF,mBAAmB,CAAC,YAAY,CAAC,kBAAkB,CAAC,2BAA2B,CAAC,CAC1E,CACL,CACL,CACJ,CAAC;AACJ,CAAC,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 { SvgAdd, SvgCopy, SvgRefresh } from \"@itwin/itwinui-icons-react\";\nimport { Button, IconButton, LabeledInput, Text, toaster } from \"@itwin/itwinui-react\";\nimport React, { useCallback, useEffect, useMemo, useState } from \"react\";\nimport type { CreateTypeFromInterface } from \"./utils\";\nimport { EmptyMessage, generateUrl, handleError, LoadingOverlay, LoadingSpinner } from \"./utils\";\nimport \"./ReportMappings.scss\";\nimport DeleteModal from \"./DeleteModal\";\nimport type { ExtractionRequestDetails, IMappingsClient, IReportsClient, Report, ReportMapping } from \"@itwin/insights-client\";\nimport { REPORTING_BASE_PATH } from \"@itwin/insights-client\";\nimport { AddMappingsModal } from \"./AddMappingsModal\";\nimport type { GetSingleIModelParams, IModelsClient } from \"@itwin/imodels-client-management\";\nimport { AccessTokenAdapter } from \"@itwin/imodels-access-frontend\";\nimport { SearchBar } from \"./SearchBar\";\nimport { useReportsConfigApi } from \"../context/ReportsConfigApiContext\";\nimport { ReportsConfigWidget } from \"../../ReportsConfigWidget\";\nimport { ReportMappingHorizontalTile } from \"./ReportMappingHorizontalTile\";\nimport type { AccessToken } from \"@itwin/core-bentley\";\nimport { BeEvent } from \"@itwin/core-bentley\";\nimport { useBulkExtractor } from \"../context/BulkExtractorContext\";\nexport type ReportMappingType = CreateTypeFromInterface<ReportMapping>;\n\nexport type ReportMappingAndMapping = ReportMappingType & {\n mappingName: string;\n mappingDescription: string;\n iModelName: string;\n};\n\nconst fetchReportMappings = async (\n setReportMappings: (mappings: ReportMappingAndMapping[]) => void,\n reportId: string,\n setIsLoading: (isLoading: boolean) => void,\n reportsClient: IReportsClient,\n mappingsClient: IMappingsClient,\n iModelsClient: IModelsClient,\n getAccessToken: () => Promise<AccessToken>,\n) => {\n try {\n setIsLoading(true);\n const accessToken = await getAccessToken();\n const reportMappings = await reportsClient.getReportMappings(accessToken, reportId);\n const authorization = AccessTokenAdapter.toAuthorizationCallback(accessToken);\n const iModelNames = new Map<string, string>();\n\n const reportMappingsAndMappings = [];\n for (const reportMapping of reportMappings) {\n const iModelId = reportMapping.imodelId;\n let iModelName = \"\";\n const mapping = await mappingsClient.getMapping(accessToken, reportMapping.mappingId);\n if (iModelNames.has(iModelId)) {\n iModelName = iModelNames.get(iModelId) ?? \"\";\n } else {\n const getSingleParams: GetSingleIModelParams = {\n authorization,\n iModelId,\n };\n const iModel = await iModelsClient.iModels.getSingle(getSingleParams);\n iModelName = iModel.displayName;\n iModelNames.set(iModelId, iModelName);\n }\n const reportMappingAndMapping: ReportMappingAndMapping = {\n ...reportMapping,\n iModelName,\n mappingName: mapping.mappingName,\n mappingDescription: mapping.description ?? \"\",\n };\n reportMappingsAndMappings.push(reportMappingAndMapping);\n }\n\n setReportMappings(reportMappingsAndMappings);\n } catch (error: any) {\n handleError(error.status);\n } finally {\n setIsLoading(false);\n }\n};\n\n/**\n * Props for the {@link ReportMappings} component.\n * @public\n */\nexport interface ReportMappingsProps {\n report: Report;\n onClickClose: () => void;\n defaultIModelId?: string;\n}\n\n/**\n * Component to display and manage report mappings.\n * @public\n */\nexport const ReportMappings = ({ report, onClickClose, defaultIModelId }: ReportMappingsProps) => {\n const { getAccessToken, reportsClient, iModelsClient, mappingsClient, baseUrl } = useReportsConfigApi();\n const [showDeleteModal, setShowDeleteModal] = useState<ReportMappingAndMapping | undefined>(undefined);\n const [showAddMapping, setShowAddMapping] = useState<boolean>(false);\n const { bulkExtractor } = useBulkExtractor();\n const [isLoading, setIsLoading] = useState<boolean>(true);\n const [searchValue, setSearchValue] = useState<string>(\"\");\n const [reportMappings, setReportMappings] = useState<ReportMappingAndMapping[]>([]);\n const [jobRunning, setJobRunning] = useState<boolean>(false);\n const jobStartEvent = useMemo(() => new BeEvent<(iModelId: string) => void>(), []);\n\n useEffect(() => {\n void fetchReportMappings(setReportMappings, report.id, setIsLoading, reportsClient, mappingsClient, iModelsClient, getAccessToken);\n }, [getAccessToken, iModelsClient, mappingsClient, report.id, reportsClient, setIsLoading]);\n\n useEffect(() => {\n if (!bulkExtractor) return;\n bulkExtractor.setHook(\n setJobRunning,\n reportMappings.map((x) => x.imodelId),\n );\n }, [bulkExtractor, reportMappings]);\n\n const refresh = useCallback(async () => {\n await fetchReportMappings(setReportMappings, report.id, setIsLoading, reportsClient, mappingsClient, iModelsClient, getAccessToken);\n }, [getAccessToken, iModelsClient, mappingsClient, report.id, reportsClient]);\n\n const odataFeedUrl = `${generateUrl(REPORTING_BASE_PATH, baseUrl)}/odata/${report.id}`;\n\n const addMapping = useCallback(() => {\n setShowAddMapping(true);\n }, []);\n\n const filteredReportMappings = useMemo(\n () => reportMappings.filter((x) => [x.iModelName, x.mappingName, x.mappingDescription].join(\" \").toLowerCase().includes(searchValue.toLowerCase())),\n [reportMappings, searchValue],\n );\n\n const onAddMappingsModalClose = useCallback(async () => {\n await refresh();\n setShowAddMapping(false);\n }, [refresh]);\n\n if (!bulkExtractor) return null;\n\n return (\n <>\n <div className=\"rcw-report-mappings-container\">\n <LabeledInput\n label={ReportsConfigWidget.localization.getLocalizedString(\"ReportsConfigWidget:ODataFeedURL\")}\n className=\"rcw-odata-url-input\"\n readOnly={true}\n value={odataFeedUrl}\n svgIcon={\n <IconButton\n title={ReportsConfigWidget.localization.getLocalizedString(\"ReportsConfigWidget:Copy\")}\n onClick={async (_) => {\n await navigator.clipboard.writeText(odataFeedUrl);\n toaster.positive(ReportsConfigWidget.localization.getLocalizedString(\"ReportsConfigWidget:CopiedToClipboard\"));\n }}\n >\n <SvgCopy />\n </IconButton>\n }\n iconDisplayStyle=\"inline\"\n />\n <div className=\"rcw-toolbar\">\n <Button startIcon={<SvgAdd />} onClick={() => addMapping()} styleType=\"high-visibility\">\n {ReportsConfigWidget.localization.getLocalizedString(\"ReportsConfigWidget:AddMapping\")}\n </Button>\n <div className=\"rcw-search-bar-container\" data-testid=\"rcw-search-bar\">\n <IconButton\n title={ReportsConfigWidget.localization.getLocalizedString(\"ReportsConfigWidget:Refresh\")}\n onClick={refresh}\n disabled={isLoading}\n styleType=\"borderless\"\n >\n <SvgRefresh />\n </IconButton>\n <SearchBar searchValue={searchValue} setSearchValue={setSearchValue} disabled={isLoading} />\n </div>\n </div>\n {isLoading ? (\n <LoadingOverlay />\n ) : reportMappings.length === 0 ? (\n <EmptyMessage>\n <>\n <Text>{ReportsConfigWidget.localization.getLocalizedString(\"ReportsConfigWidget:NoReportMappings\")}</Text>\n <div>\n <Button onClick={addMapping} styleType=\"cta\">\n {ReportsConfigWidget.localization.getLocalizedString(\"ReportsConfigWidget:LetsAddSomeMappingsCTA\")}\n </Button>\n </div>\n </>\n </EmptyMessage>\n ) : (\n <div className=\"rcw-mapping-list\">\n {filteredReportMappings.map((mapping) => (\n <ReportMappingHorizontalTile\n key={mapping.mappingId}\n bulkExtractor={bulkExtractor}\n mapping={mapping}\n onClickDelete={() => {\n setShowDeleteModal(mapping);\n }}\n odataFeedUrl={odataFeedUrl}\n jobStartEvent={jobStartEvent}\n />\n ))}\n </div>\n )}\n </div>\n <AddMappingsModal\n show={showAddMapping}\n reportId={report.id}\n existingMappings={reportMappings}\n onClose={onAddMappingsModalClose}\n defaultIModelId={defaultIModelId}\n />\n <DeleteModal\n entityName={showDeleteModal?.mappingName ?? \"\"}\n onDelete={async () => {\n const accessToken = await getAccessToken();\n await reportsClient.deleteReportMapping(accessToken, report.id, showDeleteModal?.mappingId ?? \"\");\n }}\n refresh={refresh}\n onClose={() => setShowDeleteModal(undefined)}\n />\n <div className=\"rcw-action-panel\">\n {isLoading && <LoadingSpinner />}\n <Button\n disabled={isLoading || jobRunning || reportMappings.length === 0}\n styleType=\"high-visibility\"\n onClick={async () => {\n setJobRunning(true);\n const uniqueIModels = Array.from(new Set(reportMappings.map((x) => x.imodelId)));\n const iModelsAndMappings: ExtractionRequestDetails[] = uniqueIModels.map((iModelId) => {\n return {\n iModelId,\n mappings: reportMappings\n .filter((reportMapping) => reportMapping.imodelId === iModelId)\n .map((reportMappingForIModel) => ({\n id: reportMappingForIModel.mappingId,\n })),\n };\n });\n await bulkExtractor.runIModelExtractions(iModelsAndMappings);\n reportMappings.forEach((reportMapping) => {\n jobStartEvent.raiseEvent(reportMapping.imodelId);\n });\n }}\n >\n {ReportsConfigWidget.localization.getLocalizedString(\"ReportsConfigWidget:UpdateAllDatasets\")}\n </Button>\n <Button styleType=\"default\" type=\"button\" onClick={onClickClose} disabled={isLoading}>\n {ReportsConfigWidget.localization.getLocalizedString(\"ReportsConfigWidget:Close\")}\n </Button>\n </div>\n </>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"ReportMappings.js","sourceRoot":"","sources":["../../../../src/widget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QAAQ,EAAE,SAAS,IACjF,mBAAmB,CAAC,YAAY,CAAC,kBAAkB,CAAC,2BAA2B,CAAC,CAC1E,CACL,CACL,CACJ,CAAC;AACJ,CAAC,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 { SvgAdd, SvgCopy, SvgRefresh } from \"@itwin/itwinui-icons-react\";\nimport { Button, IconButton, LabeledInput, Text, toaster } from \"@itwin/itwinui-react\";\nimport React, { useCallback, useEffect, useMemo, useState } from \"react\";\nimport type { CreateTypeFromInterface } from \"./utils\";\nimport { EmptyMessage, handleError, LoadingOverlay, LoadingSpinner } from \"./utils\";\nimport \"./ReportMappings.scss\";\nimport DeleteModal from \"./DeleteModal\";\nimport type { ExtractionRequestDetails, IMappingsClient, IReportsClient, Report, ReportMapping } from \"@itwin/insights-client\";\nimport { AddMappingsModal } from \"./AddMappingsModal\";\nimport type { GetSingleIModelParams, IModelsClient } from \"@itwin/imodels-client-management\";\nimport { AccessTokenAdapter } from \"@itwin/imodels-access-frontend\";\nimport { SearchBar } from \"./SearchBar\";\nimport { useReportsConfigApi } from \"../context/ReportsConfigApiContext\";\nimport { ReportsConfigWidget } from \"../../ReportsConfigWidget\";\nimport { ReportMappingHorizontalTile } from \"./ReportMappingHorizontalTile\";\nimport type { AccessToken } from \"@itwin/core-bentley\";\nimport { BeEvent } from \"@itwin/core-bentley\";\nimport { useBulkExtractor } from \"../context/BulkExtractorContext\";\nexport type ReportMappingType = CreateTypeFromInterface<ReportMapping>;\n\nexport type ReportMappingAndMapping = ReportMappingType & {\n mappingName: string;\n mappingDescription: string;\n iModelName: string;\n};\n\nconst fetchReportMappings = async (\n setReportMappings: (mappings: ReportMappingAndMapping[]) => void,\n reportId: string,\n setIsLoading: (isLoading: boolean) => void,\n reportsClient: IReportsClient,\n mappingsClient: IMappingsClient,\n iModelsClient: IModelsClient,\n getAccessToken: () => Promise<AccessToken>,\n) => {\n try {\n setIsLoading(true);\n const accessToken = await getAccessToken();\n const reportMappings = await reportsClient.getReportMappings(accessToken, reportId);\n const authorization = AccessTokenAdapter.toAuthorizationCallback(accessToken);\n const iModelNames = new Map<string, string>();\n\n const reportMappingsAndMappings = [];\n for (const reportMapping of reportMappings) {\n const iModelId = reportMapping.imodelId;\n let iModelName = \"\";\n const mapping = await mappingsClient.getMapping(accessToken, reportMapping.mappingId);\n if (iModelNames.has(iModelId)) {\n iModelName = iModelNames.get(iModelId) ?? \"\";\n } else {\n const getSingleParams: GetSingleIModelParams = {\n authorization,\n iModelId,\n };\n const iModel = await iModelsClient.iModels.getSingle(getSingleParams);\n iModelName = iModel.displayName;\n iModelNames.set(iModelId, iModelName);\n }\n const reportMappingAndMapping: ReportMappingAndMapping = {\n ...reportMapping,\n iModelName,\n mappingName: mapping.mappingName,\n mappingDescription: mapping.description ?? \"\",\n };\n reportMappingsAndMappings.push(reportMappingAndMapping);\n }\n\n setReportMappings(reportMappingsAndMappings);\n } catch (error: any) {\n handleError(error.status);\n } finally {\n setIsLoading(false);\n }\n};\n\n/**\n * Props for the {@link ReportMappings} component.\n * @public\n */\nexport interface ReportMappingsProps {\n report: Report;\n onClickClose: () => void;\n defaultIModelId?: string;\n}\n\n/**\n * Component to display and manage report mappings.\n * @public\n */\nexport const ReportMappings = ({ report, onClickClose, defaultIModelId }: ReportMappingsProps) => {\n const { getAccessToken, reportsClient, iModelsClient, mappingsClient } = useReportsConfigApi();\n const [showDeleteModal, setShowDeleteModal] = useState<ReportMappingAndMapping | undefined>(undefined);\n const [showAddMapping, setShowAddMapping] = useState<boolean>(false);\n const { bulkExtractor } = useBulkExtractor();\n const [isLoading, setIsLoading] = useState<boolean>(true);\n const [searchValue, setSearchValue] = useState<string>(\"\");\n const [reportMappings, setReportMappings] = useState<ReportMappingAndMapping[]>([]);\n const [jobRunning, setJobRunning] = useState<boolean>(false);\n const jobStartEvent = useMemo(() => new BeEvent<(iModelId: string) => void>(), []);\n\n useEffect(() => {\n void fetchReportMappings(setReportMappings, report.id, setIsLoading, reportsClient, mappingsClient, iModelsClient, getAccessToken);\n }, [getAccessToken, iModelsClient, mappingsClient, report.id, reportsClient, setIsLoading]);\n\n useEffect(() => {\n if (!bulkExtractor) return;\n bulkExtractor.setHook(\n setJobRunning,\n reportMappings.map((x) => x.imodelId),\n );\n }, [bulkExtractor, reportMappings]);\n\n const refresh = useCallback(async () => {\n await fetchReportMappings(setReportMappings, report.id, setIsLoading, reportsClient, mappingsClient, iModelsClient, getAccessToken);\n }, [getAccessToken, iModelsClient, mappingsClient, report.id, reportsClient]);\n\n const addMapping = useCallback(() => {\n setShowAddMapping(true);\n }, []);\n\n const filteredReportMappings = useMemo(\n () => reportMappings.filter((x) => [x.iModelName, x.mappingName, x.mappingDescription].join(\" \").toLowerCase().includes(searchValue.toLowerCase())),\n [reportMappings, searchValue],\n );\n\n const onAddMappingsModalClose = useCallback(async () => {\n await refresh();\n setShowAddMapping(false);\n }, [refresh]);\n\n if (!bulkExtractor) return null;\n\n return (\n <>\n <div className=\"rcw-report-mappings-container\">\n <LabeledInput\n label={ReportsConfigWidget.localization.getLocalizedString(\"ReportsConfigWidget:ODataFeedURL\")}\n className=\"rcw-odata-url-input\"\n readOnly={true}\n value={report._links.odata.href}\n svgIcon={\n <IconButton\n title={ReportsConfigWidget.localization.getLocalizedString(\"ReportsConfigWidget:Copy\")}\n onClick={async (_) => {\n await navigator.clipboard.writeText(report._links.odata.href);\n toaster.positive(ReportsConfigWidget.localization.getLocalizedString(\"ReportsConfigWidget:CopiedToClipboard\"));\n }}\n >\n <SvgCopy />\n </IconButton>\n }\n iconDisplayStyle=\"inline\"\n />\n <div className=\"rcw-toolbar\">\n <Button startIcon={<SvgAdd />} onClick={() => addMapping()} styleType=\"high-visibility\">\n {ReportsConfigWidget.localization.getLocalizedString(\"ReportsConfigWidget:AddMapping\")}\n </Button>\n <div className=\"rcw-search-bar-container\" data-testid=\"rcw-search-bar\">\n <IconButton\n title={ReportsConfigWidget.localization.getLocalizedString(\"ReportsConfigWidget:Refresh\")}\n onClick={refresh}\n disabled={isLoading}\n styleType=\"borderless\"\n >\n <SvgRefresh />\n </IconButton>\n <SearchBar searchValue={searchValue} setSearchValue={setSearchValue} disabled={isLoading} />\n </div>\n </div>\n {isLoading ? (\n <LoadingOverlay />\n ) : reportMappings.length === 0 ? (\n <EmptyMessage>\n <>\n <Text>{ReportsConfigWidget.localization.getLocalizedString(\"ReportsConfigWidget:NoReportMappings\")}</Text>\n <div>\n <Button onClick={addMapping} styleType=\"cta\">\n {ReportsConfigWidget.localization.getLocalizedString(\"ReportsConfigWidget:LetsAddSomeMappingsCTA\")}\n </Button>\n </div>\n </>\n </EmptyMessage>\n ) : (\n <div className=\"rcw-mapping-list\">\n {filteredReportMappings.map((mapping) => (\n <ReportMappingHorizontalTile\n key={mapping.mappingId}\n bulkExtractor={bulkExtractor}\n mapping={mapping}\n onClickDelete={() => {\n setShowDeleteModal(mapping);\n }}\n odataFeedUrl={report._links.odata.href}\n jobStartEvent={jobStartEvent}\n />\n ))}\n </div>\n )}\n </div>\n <AddMappingsModal\n show={showAddMapping}\n reportId={report.id}\n existingMappings={reportMappings}\n onClose={onAddMappingsModalClose}\n defaultIModelId={defaultIModelId}\n />\n <DeleteModal\n entityName={showDeleteModal?.mappingName ?? \"\"}\n onDelete={async () => {\n const accessToken = await getAccessToken();\n await reportsClient.deleteReportMapping(accessToken, report.id, showDeleteModal?.mappingId ?? \"\");\n }}\n refresh={refresh}\n onClose={() => setShowDeleteModal(undefined)}\n />\n <div className=\"rcw-action-panel\">\n {isLoading && <LoadingSpinner />}\n <Button\n disabled={isLoading || jobRunning || reportMappings.length === 0}\n styleType=\"high-visibility\"\n onClick={async () => {\n setJobRunning(true);\n const uniqueIModels = Array.from(new Set(reportMappings.map((x) => x.imodelId)));\n const iModelsAndMappings: ExtractionRequestDetails[] = uniqueIModels.map((iModelId) => {\n return {\n iModelId,\n mappings: reportMappings\n .filter((reportMapping) => reportMapping.imodelId === iModelId)\n .map((reportMappingForIModel) => ({\n id: reportMappingForIModel.mappingId,\n })),\n };\n });\n await bulkExtractor.runIModelExtractions(iModelsAndMappings);\n reportMappings.forEach((reportMapping) => {\n jobStartEvent.raiseEvent(reportMapping.imodelId);\n });\n }}\n >\n {ReportsConfigWidget.localization.getLocalizedString(\"ReportsConfigWidget:UpdateAllDatasets\")}\n </Button>\n <Button styleType=\"default\" type=\"button\" onClick={onClickClose} disabled={isLoading}>\n {ReportsConfigWidget.localization.getLocalizedString(\"ReportsConfigWidget:Close\")}\n </Button>\n </div>\n </>\n );\n};\n"]}
|
|
@@ -31,12 +31,12 @@ export const ReportsConfigContext = (props) => {
|
|
|
31
31
|
baseUrl: reportsBaseUrl(),
|
|
32
32
|
iTwinId: props.iTwinId,
|
|
33
33
|
reportsClient: props.reportsClient ?? new ReportsClient(reportsBaseUrl()),
|
|
34
|
-
mappingsClient: props.mappingsClient ?? new MappingsClient(
|
|
34
|
+
mappingsClient: props.mappingsClient ?? new MappingsClient(groupingMappingBaseUrl()),
|
|
35
35
|
iModelsClient: props.iModelsClient ?? new IModelsClient(iModelClientOptions),
|
|
36
36
|
});
|
|
37
37
|
useEffect(() => {
|
|
38
38
|
if (!props.extractionClient) {
|
|
39
|
-
setExtractionClient(props.extractionClient ?? new ExtractionClient(
|
|
39
|
+
setExtractionClient(props.extractionClient ?? new ExtractionClient(groupingMappingBaseUrl()));
|
|
40
40
|
}
|
|
41
41
|
}, [groupingMappingBaseUrl, props.extractionClient]);
|
|
42
42
|
const successfulExtractionToast = (iModelName, odataFeedUrl) => {
|
|
@@ -55,7 +55,7 @@ export const ReportsConfigContext = (props) => {
|
|
|
55
55
|
baseUrl: props.baseUrl || REPORTS_CONFIG_BASE_URL,
|
|
56
56
|
iTwinId: props.iTwinId,
|
|
57
57
|
reportsClient: props.reportsClient ?? new ReportsClient(reportsBaseUrl()),
|
|
58
|
-
mappingsClient: props.mappingsClient ?? new MappingsClient(
|
|
58
|
+
mappingsClient: props.mappingsClient ?? new MappingsClient(groupingMappingBaseUrl()),
|
|
59
59
|
iModelsClient: props.iModelsClient ?? new IModelsClient(iModelClientOptions),
|
|
60
60
|
}));
|
|
61
61
|
}, [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReportsConfigContext.js","sourceRoot":"","sources":["../../../../src/widget/components/ReportsConfigContext.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAEjE,OAAO,EAAE,gBAAgB,EAAE,8BAA8B,EAAE,cAAc,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC9I,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAwCtC,MAAM,iCAAiC,GAAG,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,SAAS,CAAC,mBAAmB,EAAE,cAAc,EAAE,CAAC,IAAI,EAAE,CAAC;AAEpH;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAA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AC,QAAQ,IAAC,KAAK,EAAE,SAAS;QAChD,oBAAC,oBAAoB,CAAC,QAAQ,IAAC,KAAK,EAAE,aAAa,IAAG,KAAK,CAAC,QAAQ,CAAiC,CACpE,CACpC,CAAC;AACJ,CAAC,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 { IModelApp } from \"@itwin/core-frontend\";\nimport type { IModelsClientOptions } from \"@itwin/imodels-client-management\";\nimport { IModelsClient } from \"@itwin/imodels-client-management\";\nimport type { IExtractionClient, IMappingsClient, IReportsClient } from \"@itwin/insights-client\";\nimport { ExtractionClient, GROUPING_AND_MAPPING_BASE_PATH, MappingsClient, REPORTING_BASE_PATH, ReportsClient } from \"@itwin/insights-client\";\nimport { toaster } from \"@itwin/itwinui-react\";\nimport React, { useCallback, useEffect, useMemo, useState } from \"react\";\nimport { BulkExtractorContext } from \"../context/BulkExtractorContext\";\nimport type { GetAccessTokenFn, ReportsConfigApiProps } from \"../context/ReportsConfigApiContext\";\nimport { ReportsConfigApiContext } from \"../context/ReportsConfigApiContext\";\nimport { REPORTS_CONFIG_BASE_URL } from \"../ReportsConfigUiProvider\";\nimport { BulkExtractor } from \"./BulkExtractor\";\nimport { IMODELS_BASE_URL } from \"./Constants\";\nimport { FailedExtractionToast, SuccessfulExtractionToast } from \"./ExtractionToast\";\nimport { generateUrl } from \"./utils\";\n\n/**\n * Props for the {@link ReportsConfigContext} component.\n * @public\n */\nexport interface ReportsConfigContextProps {\n /**\n * A callback function that returns an access token for authenticating API requests.\n * If not specified, it defaults to the authorizationClient of the IModelApp.\n */\n getAccessToken?: GetAccessTokenFn;\n /**\n * The base URL for the API requests. Defaults to https://api.bentley.com.\n */\n baseUrl?: string;\n iTwinId: string;\n /**\n * The bulk extractor instance to use for extracting data. Internal use only.\n */\n bulkExtractor?: BulkExtractor;\n /**\n * A custom implementation of ReportsClient. If provided, baseUrl is ignored.\n */\n reportsClient?: IReportsClient;\n /**\n * A custom implementation of MappingsClient. If provided, baseUrl is ignored.\n */\n mappingsClient?: IMappingsClient;\n /**\n * A custom implementation of ExtractionClient. If provided, baseUrl is ignored.\n */\n extractionClient?: IExtractionClient;\n /**\n * A custom implementation of IModelsClient. If provided, baseUrl is ignored.\n */\n iModelsClient?: IModelsClient;\n children?: React.ReactNode;\n}\n\nconst authorizationClientGetAccessToken = async () => (await IModelApp.authorizationClient?.getAccessToken()) ?? \"\";\n\n/**\n * Reports Config context providers required for all components.\n * @public\n */\nexport const ReportsConfigContext = (props: ReportsConfigContextProps) => {\n const reportsBaseUrl = useCallback(() => generateUrl(REPORTING_BASE_PATH, props.baseUrl || REPORTS_CONFIG_BASE_URL), [props.baseUrl]);\n const groupingMappingBaseUrl = useCallback(() => generateUrl(GROUPING_AND_MAPPING_BASE_PATH, props.baseUrl || REPORTS_CONFIG_BASE_URL), [props.baseUrl]);\n const iModelClientOptions: IModelsClientOptions = useMemo(\n () => ({\n api: { baseUrl: generateUrl(IMODELS_BASE_URL, props.baseUrl ?? REPORTS_CONFIG_BASE_URL) },\n }),\n [props.baseUrl],\n );\n const [extractionClient, setExtractionClient] = useState<IExtractionClient>(props.extractionClient ?? new ExtractionClient(reportsBaseUrl()));\n\n const [apiConfig, setApiConfig] = useState<ReportsConfigApiProps>({\n getAccessToken: props.getAccessToken ?? authorizationClientGetAccessToken,\n baseUrl: reportsBaseUrl(),\n iTwinId: props.iTwinId,\n reportsClient: props.reportsClient ?? new ReportsClient(reportsBaseUrl()),\n mappingsClient: props.mappingsClient ?? new MappingsClient(groupingMappingBaseUrl()),\n iModelsClient: props.iModelsClient ?? new IModelsClient(iModelClientOptions),\n });\n\n useEffect(() => {\n if (!props.extractionClient) {\n setExtractionClient(props.extractionClient ?? new ExtractionClient(groupingMappingBaseUrl()));\n }\n }, [groupingMappingBaseUrl, props.extractionClient]);\n\n const successfulExtractionToast = (iModelName: string, odataFeedUrl: string) => {\n toaster.positive(<SuccessfulExtractionToast iModelName={iModelName} odataFeedUrl={odataFeedUrl} />);\n };\n\n const failedExtractionToast = (iModelName: string) => {\n toaster.negative(<FailedExtractionToast iModelName={iModelName} />);\n };\n\n const bulkExtractor = useMemo(\n () => ({\n bulkExtractor:\n props.bulkExtractor ??\n new BulkExtractor(apiConfig.reportsClient, extractionClient, apiConfig.getAccessToken, successfulExtractionToast, failedExtractionToast),\n }),\n [apiConfig.getAccessToken, apiConfig.reportsClient, extractionClient, props.bulkExtractor],\n );\n\n useEffect(() => {\n setApiConfig(() => ({\n getAccessToken: props.getAccessToken ?? authorizationClientGetAccessToken,\n baseUrl: props.baseUrl || REPORTS_CONFIG_BASE_URL,\n iTwinId: props.iTwinId,\n reportsClient: props.reportsClient ?? new ReportsClient(reportsBaseUrl()),\n mappingsClient: props.mappingsClient ?? new MappingsClient(groupingMappingBaseUrl()),\n iModelsClient: props.iModelsClient ?? new IModelsClient(iModelClientOptions),\n }));\n }, [\n props.getAccessToken,\n props.baseUrl,\n props.iTwinId,\n props.reportsClient,\n props.mappingsClient,\n props.iModelsClient,\n reportsBaseUrl,\n iModelClientOptions,\n groupingMappingBaseUrl,\n ]);\n\n return (\n <ReportsConfigApiContext.Provider value={apiConfig}>\n <BulkExtractorContext.Provider value={bulkExtractor}>{props.children}</BulkExtractorContext.Provider>\n </ReportsConfigApiContext.Provider>\n );\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/reports-config-widget-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "An iTwin.js 3D Viewer Widget that interfaces with the iTwin Reporting Platform.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Bentley",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"@itwin/imodels-access-common": "^4.1.4",
|
|
63
63
|
"@itwin/imodels-access-frontend": "^4.1.4",
|
|
64
64
|
"@itwin/imodels-client-management": "^4.2.3",
|
|
65
|
-
"@itwin/insights-client": "^0.
|
|
65
|
+
"@itwin/insights-client": "^0.15.1",
|
|
66
66
|
"@itwin/itwinui-icons-color-react": "^2.1.0",
|
|
67
67
|
"@itwin/itwinui-icons-react": "^2.4.0",
|
|
68
68
|
"@itwin/itwinui-react": "^2.11.0",
|
|
@@ -130,8 +130,8 @@
|
|
|
130
130
|
"@itwin/appui-react": "^4.0.0",
|
|
131
131
|
"@itwin/core-bentley": "^4.0.0",
|
|
132
132
|
"@itwin/core-frontend": "^4.0.0",
|
|
133
|
-
"react": "^17.0.2",
|
|
134
|
-
"react-dom": "^17.0.2",
|
|
133
|
+
"react": "^17.0.2 || ^18.0.0",
|
|
134
|
+
"react-dom": "^17.0.2 || ^18.0.0",
|
|
135
135
|
"react-redux": "^7.2.0"
|
|
136
136
|
}
|
|
137
137
|
}
|
|
@@ -53,6 +53,9 @@ const mockReport: Report = {
|
|
|
53
53
|
project: {
|
|
54
54
|
href: "",
|
|
55
55
|
},
|
|
56
|
+
odata: {
|
|
57
|
+
href: "mock-odata-feed-url",
|
|
58
|
+
},
|
|
56
59
|
},
|
|
57
60
|
};
|
|
58
61
|
|
|
@@ -297,7 +300,7 @@ describe("Report Mappings View", () => {
|
|
|
297
300
|
name: /odatafeedurl/i,
|
|
298
301
|
});
|
|
299
302
|
expect(urlTextbox).toBeInTheDocument();
|
|
300
|
-
expect(screen.getByDisplayValue(`
|
|
303
|
+
expect(screen.getByDisplayValue(`mock-odata-feed-url`)).toBeInTheDocument();
|
|
301
304
|
|
|
302
305
|
const copyButton = screen.getByRole("button", {
|
|
303
306
|
name: /copy/i,
|
|
@@ -6,11 +6,10 @@ import { SvgAdd, SvgCopy, SvgRefresh } from "@itwin/itwinui-icons-react";
|
|
|
6
6
|
import { Button, IconButton, LabeledInput, Text, toaster } from "@itwin/itwinui-react";
|
|
7
7
|
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
8
8
|
import type { CreateTypeFromInterface } from "./utils";
|
|
9
|
-
import { EmptyMessage,
|
|
9
|
+
import { EmptyMessage, handleError, LoadingOverlay, LoadingSpinner } from "./utils";
|
|
10
10
|
import "./ReportMappings.scss";
|
|
11
11
|
import DeleteModal from "./DeleteModal";
|
|
12
12
|
import type { ExtractionRequestDetails, IMappingsClient, IReportsClient, Report, ReportMapping } from "@itwin/insights-client";
|
|
13
|
-
import { REPORTING_BASE_PATH } from "@itwin/insights-client";
|
|
14
13
|
import { AddMappingsModal } from "./AddMappingsModal";
|
|
15
14
|
import type { GetSingleIModelParams, IModelsClient } from "@itwin/imodels-client-management";
|
|
16
15
|
import { AccessTokenAdapter } from "@itwin/imodels-access-frontend";
|
|
@@ -93,7 +92,7 @@ export interface ReportMappingsProps {
|
|
|
93
92
|
* @public
|
|
94
93
|
*/
|
|
95
94
|
export const ReportMappings = ({ report, onClickClose, defaultIModelId }: ReportMappingsProps) => {
|
|
96
|
-
const { getAccessToken, reportsClient, iModelsClient, mappingsClient
|
|
95
|
+
const { getAccessToken, reportsClient, iModelsClient, mappingsClient } = useReportsConfigApi();
|
|
97
96
|
const [showDeleteModal, setShowDeleteModal] = useState<ReportMappingAndMapping | undefined>(undefined);
|
|
98
97
|
const [showAddMapping, setShowAddMapping] = useState<boolean>(false);
|
|
99
98
|
const { bulkExtractor } = useBulkExtractor();
|
|
@@ -119,8 +118,6 @@ export const ReportMappings = ({ report, onClickClose, defaultIModelId }: Report
|
|
|
119
118
|
await fetchReportMappings(setReportMappings, report.id, setIsLoading, reportsClient, mappingsClient, iModelsClient, getAccessToken);
|
|
120
119
|
}, [getAccessToken, iModelsClient, mappingsClient, report.id, reportsClient]);
|
|
121
120
|
|
|
122
|
-
const odataFeedUrl = `${generateUrl(REPORTING_BASE_PATH, baseUrl)}/odata/${report.id}`;
|
|
123
|
-
|
|
124
121
|
const addMapping = useCallback(() => {
|
|
125
122
|
setShowAddMapping(true);
|
|
126
123
|
}, []);
|
|
@@ -144,12 +141,12 @@ export const ReportMappings = ({ report, onClickClose, defaultIModelId }: Report
|
|
|
144
141
|
label={ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:ODataFeedURL")}
|
|
145
142
|
className="rcw-odata-url-input"
|
|
146
143
|
readOnly={true}
|
|
147
|
-
value={
|
|
144
|
+
value={report._links.odata.href}
|
|
148
145
|
svgIcon={
|
|
149
146
|
<IconButton
|
|
150
147
|
title={ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:Copy")}
|
|
151
148
|
onClick={async (_) => {
|
|
152
|
-
await navigator.clipboard.writeText(
|
|
149
|
+
await navigator.clipboard.writeText(report._links.odata.href);
|
|
153
150
|
toaster.positive(ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:CopiedToClipboard"));
|
|
154
151
|
}}
|
|
155
152
|
>
|
|
@@ -197,7 +194,7 @@ export const ReportMappings = ({ report, onClickClose, defaultIModelId }: Report
|
|
|
197
194
|
onClickDelete={() => {
|
|
198
195
|
setShowDeleteModal(mapping);
|
|
199
196
|
}}
|
|
200
|
-
odataFeedUrl={
|
|
197
|
+
odataFeedUrl={report._links.odata.href}
|
|
201
198
|
jobStartEvent={jobStartEvent}
|
|
202
199
|
/>
|
|
203
200
|
))}
|
|
@@ -78,13 +78,13 @@ export const ReportsConfigContext = (props: ReportsConfigContextProps) => {
|
|
|
78
78
|
baseUrl: reportsBaseUrl(),
|
|
79
79
|
iTwinId: props.iTwinId,
|
|
80
80
|
reportsClient: props.reportsClient ?? new ReportsClient(reportsBaseUrl()),
|
|
81
|
-
mappingsClient: props.mappingsClient ?? new MappingsClient(
|
|
81
|
+
mappingsClient: props.mappingsClient ?? new MappingsClient(groupingMappingBaseUrl()),
|
|
82
82
|
iModelsClient: props.iModelsClient ?? new IModelsClient(iModelClientOptions),
|
|
83
83
|
});
|
|
84
84
|
|
|
85
85
|
useEffect(() => {
|
|
86
86
|
if (!props.extractionClient) {
|
|
87
|
-
setExtractionClient(props.extractionClient ?? new ExtractionClient(
|
|
87
|
+
setExtractionClient(props.extractionClient ?? new ExtractionClient(groupingMappingBaseUrl()));
|
|
88
88
|
}
|
|
89
89
|
}, [groupingMappingBaseUrl, props.extractionClient]);
|
|
90
90
|
|
|
@@ -111,7 +111,7 @@ export const ReportsConfigContext = (props: ReportsConfigContextProps) => {
|
|
|
111
111
|
baseUrl: props.baseUrl || REPORTS_CONFIG_BASE_URL,
|
|
112
112
|
iTwinId: props.iTwinId,
|
|
113
113
|
reportsClient: props.reportsClient ?? new ReportsClient(reportsBaseUrl()),
|
|
114
|
-
mappingsClient: props.mappingsClient ?? new MappingsClient(
|
|
114
|
+
mappingsClient: props.mappingsClient ?? new MappingsClient(groupingMappingBaseUrl()),
|
|
115
115
|
iModelsClient: props.iModelsClient ?? new IModelsClient(iModelClientOptions),
|
|
116
116
|
}));
|
|
117
117
|
}, [
|