@itwin/reports-config-widget-react 0.1.0 → 0.2.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/.rush/temp/package-deps_rebuild.json +38 -34
- package/.rush/temp/shrinkwrap-deps.json +14 -6
- package/CHANGELOG.json +30 -0
- package/CHANGELOG.md +17 -1
- package/coverage/clover.xml +605 -610
- package/coverage/coverage-final.json +28 -27
- package/coverage/lcov-report/index.html +31 -31
- package/coverage/lcov-report/src/ReportsConfigWidget.ts.html +10 -10
- 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 +22 -22
- package/coverage/lcov-report/src/widget/ReportsConfigUiProvider.tsx.html +7 -7
- package/coverage/lcov-report/src/widget/components/ActionPanel.tsx.html +29 -41
- package/coverage/lcov-report/src/widget/components/AddMappingsModal.tsx.html +31 -37
- package/coverage/lcov-report/src/widget/components/BulkExtractor.ts.html +270 -162
- package/coverage/lcov-report/src/widget/components/Constants.ts.html +4 -4
- package/coverage/lcov-report/src/widget/components/DeleteModal.tsx.html +21 -21
- package/coverage/lcov-report/src/widget/components/ExtractionStates/FailedExtractionState.tsx.html +6 -6
- package/coverage/lcov-report/src/widget/components/ExtractionStates/QueuedExtractionState.tsx.html +14 -14
- package/coverage/lcov-report/src/widget/components/ExtractionStates/RunningExtractionState.tsx.html +15 -15
- package/coverage/lcov-report/src/widget/components/ExtractionStates/StartingExtractionState.tsx.html +14 -14
- package/coverage/lcov-report/src/widget/components/ExtractionStates/SucceededExtractionState.tsx.html +22 -19
- package/coverage/lcov-report/src/widget/components/ExtractionStates/index.html +43 -43
- package/coverage/lcov-report/src/widget/components/ExtractionStatus.tsx.html +57 -57
- package/coverage/lcov-report/src/widget/components/ExtractionToast.tsx.html +208 -0
- package/coverage/lcov-report/src/widget/components/HorizontalTile.tsx.html +8 -8
- package/coverage/lcov-report/src/widget/components/LocalizedTablePaginator.tsx.html +8 -8
- package/coverage/lcov-report/src/widget/components/ReportAction.tsx.html +14 -20
- package/coverage/lcov-report/src/widget/components/ReportHorizontalTile.tsx.html +30 -33
- package/coverage/lcov-report/src/widget/components/ReportMappingHorizontalTile.tsx.html +469 -0
- package/coverage/lcov-report/src/widget/components/ReportMappings.tsx.html +183 -231
- package/coverage/lcov-report/src/widget/components/Reports.tsx.html +73 -43
- package/coverage/lcov-report/src/widget/components/ReportsContainer.tsx.html +10 -10
- package/coverage/lcov-report/src/widget/components/SearchBar.tsx.html +10 -10
- package/coverage/lcov-report/src/widget/components/SelectIModel.tsx.html +31 -31
- package/coverage/lcov-report/src/widget/components/index.html +100 -85
- package/coverage/lcov-report/src/widget/components/utils.tsx.html +32 -32
- package/coverage/lcov-report/src/widget/context/ReportsApiConfigContext.tsx.html +8 -8
- 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 +7 -7
- package/coverage/lcov-report/src/widget/index.html +1 -1
- package/coverage/lcov.info +990 -1003
- package/jest.config.js +6 -0
- package/lib/cjs/test/AddMappingModal.test.d.ts +2 -0
- package/lib/cjs/test/AddMappingModal.test.d.ts.map +1 -0
- package/lib/cjs/test/AddMappingModal.test.js +277 -0
- package/lib/cjs/test/AddMappingModal.test.js.map +1 -0
- package/lib/cjs/test/BulkExtractor.test.d.ts +2 -0
- package/lib/cjs/test/BulkExtractor.test.d.ts.map +1 -0
- package/lib/cjs/test/BulkExtractor.test.js +182 -0
- package/lib/cjs/test/BulkExtractor.test.js.map +1 -0
- package/lib/cjs/test/DeleteModal.test.d.ts +2 -0
- package/lib/cjs/test/DeleteModal.test.d.ts.map +1 -0
- package/lib/cjs/test/DeleteModal.test.js +93 -0
- package/lib/cjs/test/DeleteModal.test.js.map +1 -0
- package/lib/cjs/test/ReportAction.test.js +2 -3
- package/lib/cjs/test/ReportAction.test.js.map +1 -1
- package/lib/cjs/test/ReportMappingHorizontalTile.test.d.ts +2 -0
- package/lib/cjs/test/ReportMappingHorizontalTile.test.d.ts.map +1 -0
- package/lib/cjs/test/ReportMappingHorizontalTile.test.js +340 -0
- package/lib/cjs/test/ReportMappingHorizontalTile.test.js.map +1 -0
- package/lib/cjs/test/ReportMappings.test.js +115 -267
- package/lib/cjs/test/ReportMappings.test.js.map +1 -1
- package/lib/cjs/test/Reports.test.js +1 -1
- package/lib/cjs/test/Reports.test.js.map +1 -1
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/cjs/widget/components/ActionPanel.d.ts.map +1 -1
- package/lib/cjs/widget/components/ActionPanel.js +4 -5
- package/lib/cjs/widget/components/ActionPanel.js.map +1 -1
- package/lib/cjs/widget/components/AddMappingsModal.d.ts +2 -2
- package/lib/cjs/widget/components/AddMappingsModal.d.ts.map +1 -1
- package/lib/cjs/widget/components/AddMappingsModal.js +5 -4
- package/lib/cjs/widget/components/AddMappingsModal.js.map +1 -1
- package/lib/cjs/widget/components/AddMappingsModal.scss +4 -3
- package/lib/cjs/widget/components/BulkExtractor.d.ts +18 -9
- package/lib/cjs/widget/components/BulkExtractor.d.ts.map +1 -1
- package/lib/cjs/widget/components/BulkExtractor.js +86 -57
- package/lib/cjs/widget/components/BulkExtractor.js.map +1 -1
- package/lib/cjs/widget/components/DeleteModal.js +1 -1
- package/lib/cjs/widget/components/DeleteModal.js.map +1 -1
- package/lib/cjs/widget/components/DeleteModal.scss +4 -3
- package/lib/cjs/widget/components/ExtractionStates/RunningExtractionState.js +1 -1
- package/lib/cjs/widget/components/ExtractionStates/RunningExtractionState.js.map +1 -1
- package/lib/cjs/widget/components/ExtractionStates/SucceededExtractionState.d.ts.map +1 -1
- package/lib/cjs/widget/components/ExtractionStates/SucceededExtractionState.js +1 -1
- package/lib/cjs/widget/components/ExtractionStates/SucceededExtractionState.js.map +1 -1
- package/lib/cjs/widget/components/ExtractionStatus.scss +15 -1
- package/lib/cjs/widget/components/ExtractionToast.d.ts +11 -0
- package/lib/cjs/widget/components/ExtractionToast.d.ts.map +1 -0
- package/lib/cjs/widget/components/ExtractionToast.js +33 -0
- package/lib/cjs/widget/components/ExtractionToast.js.map +1 -0
- package/lib/cjs/widget/components/HorizontalTile.scss +1 -1
- package/lib/cjs/widget/components/ReportAction.d.ts.map +1 -1
- package/lib/cjs/widget/components/ReportAction.js +3 -3
- package/lib/cjs/widget/components/ReportAction.js.map +1 -1
- package/lib/cjs/widget/components/ReportAction.scss +2 -2
- package/lib/cjs/widget/components/ReportHorizontalTile.d.ts.map +1 -1
- package/lib/cjs/widget/components/ReportHorizontalTile.js +1 -2
- package/lib/cjs/widget/components/ReportHorizontalTile.js.map +1 -1
- package/lib/cjs/widget/components/ReportMappingHorizontalTile.d.ts +13 -0
- package/lib/cjs/widget/components/ReportMappingHorizontalTile.d.ts.map +1 -0
- package/lib/cjs/widget/components/ReportMappingHorizontalTile.js +82 -0
- package/lib/cjs/widget/components/ReportMappingHorizontalTile.js.map +1 -0
- package/lib/cjs/widget/components/ReportMappings.d.ts +3 -1
- package/lib/cjs/widget/components/ReportMappings.d.ts.map +1 -1
- package/lib/cjs/widget/components/ReportMappings.js +39 -40
- package/lib/cjs/widget/components/ReportMappings.js.map +1 -1
- package/lib/cjs/widget/components/ReportMappings.scss +7 -7
- package/lib/cjs/widget/components/Reports.d.ts.map +1 -1
- package/lib/cjs/widget/components/Reports.js +13 -6
- package/lib/cjs/widget/components/Reports.js.map +1 -1
- package/lib/cjs/widget/components/Reports.scss +1 -1
- package/lib/cjs/widget/components/ReportsContainer.js +1 -1
- package/lib/cjs/widget/components/ReportsContainer.js.map +1 -1
- package/lib/cjs/widget/components/ReportsContainer.scss +2 -2
- package/lib/cjs/widget/components/SelectIModel.js +2 -2
- package/lib/cjs/widget/components/SelectIModel.js.map +1 -1
- package/lib/cjs/widget/components/SelectIModel.scss +4 -3
- package/lib/cjs/widget/components/utils.js +1 -1
- package/lib/cjs/widget/components/utils.js.map +1 -1
- package/lib/cjs/widget/components/utils.scss +2 -2
- package/lib/esm/test/AddMappingModal.test.d.ts +2 -0
- package/lib/esm/test/AddMappingModal.test.d.ts.map +1 -0
- package/lib/esm/test/AddMappingModal.test.js +253 -0
- package/lib/esm/test/AddMappingModal.test.js.map +1 -0
- package/lib/esm/test/BulkExtractor.test.d.ts +2 -0
- package/lib/esm/test/BulkExtractor.test.d.ts.map +1 -0
- package/lib/esm/test/BulkExtractor.test.js +158 -0
- package/lib/esm/test/BulkExtractor.test.js.map +1 -0
- package/lib/esm/test/DeleteModal.test.d.ts +2 -0
- package/lib/esm/test/DeleteModal.test.d.ts.map +1 -0
- package/lib/esm/test/DeleteModal.test.js +69 -0
- package/lib/esm/test/DeleteModal.test.js.map +1 -0
- package/lib/esm/test/ReportAction.test.js +2 -3
- package/lib/esm/test/ReportAction.test.js.map +1 -1
- package/lib/esm/test/ReportMappingHorizontalTile.test.d.ts +2 -0
- package/lib/esm/test/ReportMappingHorizontalTile.test.d.ts.map +1 -0
- package/lib/esm/test/ReportMappingHorizontalTile.test.js +316 -0
- package/lib/esm/test/ReportMappingHorizontalTile.test.js.map +1 -0
- package/lib/esm/test/ReportMappings.test.js +117 -269
- package/lib/esm/test/ReportMappings.test.js.map +1 -1
- package/lib/esm/test/Reports.test.js +1 -1
- package/lib/esm/test/Reports.test.js.map +1 -1
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/widget/components/ActionPanel.d.ts.map +1 -1
- package/lib/esm/widget/components/ActionPanel.js +4 -5
- package/lib/esm/widget/components/ActionPanel.js.map +1 -1
- package/lib/esm/widget/components/AddMappingsModal.d.ts +2 -2
- package/lib/esm/widget/components/AddMappingsModal.d.ts.map +1 -1
- package/lib/esm/widget/components/AddMappingsModal.js +4 -5
- package/lib/esm/widget/components/AddMappingsModal.js.map +1 -1
- package/lib/esm/widget/components/AddMappingsModal.scss +4 -3
- package/lib/esm/widget/components/BulkExtractor.d.ts +18 -9
- package/lib/esm/widget/components/BulkExtractor.d.ts.map +1 -1
- package/lib/esm/widget/components/BulkExtractor.js +86 -57
- package/lib/esm/widget/components/BulkExtractor.js.map +1 -1
- package/lib/esm/widget/components/DeleteModal.js +1 -1
- package/lib/esm/widget/components/DeleteModal.js.map +1 -1
- package/lib/esm/widget/components/DeleteModal.scss +4 -3
- package/lib/esm/widget/components/ExtractionStates/RunningExtractionState.js +1 -1
- package/lib/esm/widget/components/ExtractionStates/RunningExtractionState.js.map +1 -1
- package/lib/esm/widget/components/ExtractionStates/SucceededExtractionState.d.ts.map +1 -1
- package/lib/esm/widget/components/ExtractionStates/SucceededExtractionState.js +1 -1
- package/lib/esm/widget/components/ExtractionStates/SucceededExtractionState.js.map +1 -1
- package/lib/esm/widget/components/ExtractionStatus.scss +15 -1
- package/lib/esm/widget/components/ExtractionToast.d.ts +11 -0
- package/lib/esm/widget/components/ExtractionToast.d.ts.map +1 -0
- package/lib/esm/widget/components/ExtractionToast.js +25 -0
- package/lib/esm/widget/components/ExtractionToast.js.map +1 -0
- package/lib/esm/widget/components/HorizontalTile.scss +1 -1
- package/lib/esm/widget/components/ReportAction.d.ts.map +1 -1
- package/lib/esm/widget/components/ReportAction.js +3 -3
- package/lib/esm/widget/components/ReportAction.js.map +1 -1
- package/lib/esm/widget/components/ReportAction.scss +2 -2
- package/lib/esm/widget/components/ReportHorizontalTile.d.ts.map +1 -1
- package/lib/esm/widget/components/ReportHorizontalTile.js +1 -2
- package/lib/esm/widget/components/ReportHorizontalTile.js.map +1 -1
- package/lib/esm/widget/components/ReportMappingHorizontalTile.d.ts +13 -0
- package/lib/esm/widget/components/ReportMappingHorizontalTile.d.ts.map +1 -0
- package/lib/esm/widget/components/ReportMappingHorizontalTile.js +75 -0
- package/lib/esm/widget/components/ReportMappingHorizontalTile.js.map +1 -0
- package/lib/esm/widget/components/ReportMappings.d.ts +3 -1
- package/lib/esm/widget/components/ReportMappings.d.ts.map +1 -1
- package/lib/esm/widget/components/ReportMappings.js +40 -41
- package/lib/esm/widget/components/ReportMappings.js.map +1 -1
- package/lib/esm/widget/components/ReportMappings.scss +7 -7
- package/lib/esm/widget/components/Reports.d.ts.map +1 -1
- package/lib/esm/widget/components/Reports.js +15 -8
- package/lib/esm/widget/components/Reports.js.map +1 -1
- package/lib/esm/widget/components/Reports.scss +1 -1
- package/lib/esm/widget/components/ReportsContainer.js +1 -1
- package/lib/esm/widget/components/ReportsContainer.js.map +1 -1
- package/lib/esm/widget/components/ReportsContainer.scss +2 -2
- package/lib/esm/widget/components/SelectIModel.js +2 -2
- package/lib/esm/widget/components/SelectIModel.js.map +1 -1
- package/lib/esm/widget/components/SelectIModel.scss +4 -3
- package/lib/esm/widget/components/utils.js +1 -1
- package/lib/esm/widget/components/utils.js.map +1 -1
- package/lib/esm/widget/components/utils.scss +2 -2
- package/lib/public/locales/en/ReportsConfigWidget.json +5 -0
- package/package.json +7 -4
- package/public/locales/en/ReportsConfigWidget.json +5 -0
- package/reports-config-widget-react.build.error.log +10 -6
- package/reports-config-widget-react.build.log +51 -46
- package/src/test/AddMappingModal.test.tsx +315 -0
- package/src/test/BulkExtractor.test.ts +301 -0
- package/src/test/DeleteModal.test.tsx +118 -0
- package/src/test/ReportAction.test.tsx +2 -4
- package/src/test/ReportMappingHorizontalTile.test.tsx +451 -0
- package/src/test/ReportMappings.test.tsx +154 -549
- package/src/test/Reports.test.tsx +1 -1
- package/src/widget/components/ActionPanel.tsx +19 -23
- package/src/widget/components/AddMappingsModal.scss +4 -3
- package/src/widget/components/AddMappingsModal.tsx +4 -6
- package/src/widget/components/BulkExtractor.ts +97 -61
- package/src/widget/components/DeleteModal.scss +4 -3
- package/src/widget/components/DeleteModal.tsx +1 -1
- package/src/widget/components/ExtractionStates/RunningExtractionState.tsx +1 -1
- package/src/widget/components/ExtractionStates/SucceededExtractionState.tsx +1 -0
- package/src/widget/components/ExtractionStatus.scss +15 -1
- package/src/widget/components/ExtractionToast.tsx +41 -0
- package/src/widget/components/HorizontalTile.scss +1 -1
- package/src/widget/components/ReportAction.scss +2 -2
- package/src/widget/components/ReportAction.tsx +1 -3
- package/src/widget/components/ReportHorizontalTile.tsx +1 -2
- package/src/widget/components/ReportMappingHorizontalTile.tsx +128 -0
- package/src/widget/components/ReportMappings.scss +7 -7
- package/src/widget/components/ReportMappings.tsx +89 -105
- package/src/widget/components/Reports.scss +1 -1
- package/src/widget/components/Reports.tsx +18 -8
- package/src/widget/components/ReportsContainer.scss +2 -2
- package/src/widget/components/ReportsContainer.tsx +1 -1
- package/src/widget/components/SelectIModel.scss +4 -3
- package/src/widget/components/SelectIModel.tsx +2 -2
- package/src/widget/components/utils.scss +2 -2
- package/src/widget/components/utils.tsx +1 -1
- package/coverage/lcov-report/src/widget/components/Extraction.tsx.html +0 -1030
- package/lib/cjs/widget/components/Extraction.d.ts +0 -28
- package/lib/cjs/widget/components/Extraction.d.ts.map +0 -1
- package/lib/cjs/widget/components/Extraction.js +0 -190
- package/lib/cjs/widget/components/Extraction.js.map +0 -1
- package/lib/cjs/widget/components/Extraction.scss +0 -39
- package/lib/esm/widget/components/Extraction.d.ts +0 -28
- package/lib/esm/widget/components/Extraction.d.ts.map +0 -1
- package/lib/esm/widget/components/Extraction.js +0 -166
- package/lib/esm/widget/components/Extraction.js.map +0 -1
- package/lib/esm/widget/components/Extraction.scss +0 -39
- package/src/widget/components/Extraction.scss +0 -39
- package/src/widget/components/Extraction.tsx +0 -315
|
@@ -4,24 +4,24 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
@import "~@itwin/itwinui-css/scss/variables";
|
|
6
6
|
|
|
7
|
-
.report-mapping-misc {
|
|
7
|
+
.rcw-report-mapping-misc {
|
|
8
8
|
display: flex;
|
|
9
9
|
flex-direction: column;
|
|
10
10
|
gap: $iui-baseline;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
.report-mappings-container {
|
|
13
|
+
.rcw-report-mappings-container {
|
|
14
14
|
display: flex;
|
|
15
15
|
flex-direction: column;
|
|
16
16
|
flex-grow: 1;
|
|
17
17
|
padding: $iui-baseline $iui-m;
|
|
18
18
|
min-height: 0;
|
|
19
19
|
|
|
20
|
-
.odata-url-input {
|
|
20
|
+
.rcw-odata-url-input {
|
|
21
21
|
margin-bottom: $iui-baseline * 2;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
.toolbar {
|
|
24
|
+
.rcw-toolbar {
|
|
25
25
|
display: flex;
|
|
26
26
|
justify-content: space-between;
|
|
27
27
|
gap: $iui-s;
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
flex-wrap: wrap;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
.mapping-list {
|
|
33
|
+
.rcw-mapping-list {
|
|
34
34
|
display: flex;
|
|
35
35
|
flex-direction: column;
|
|
36
36
|
overflow-y: overlay;
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
margin-top: 7.5px;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
.search-bar-container {
|
|
41
|
+
.rcw-search-bar-container {
|
|
42
42
|
flex-basis: $iui-3xl;
|
|
43
43
|
flex-shrink: 1;
|
|
44
44
|
flex-grow: 1;
|
|
45
45
|
}
|
|
46
|
-
}
|
|
46
|
+
}
|
|
@@ -5,15 +5,11 @@
|
|
|
5
5
|
import {
|
|
6
6
|
SvgAdd,
|
|
7
7
|
SvgCopy,
|
|
8
|
-
SvgDelete,
|
|
9
|
-
SvgMore,
|
|
10
8
|
} from "@itwin/itwinui-icons-react";
|
|
11
9
|
import {
|
|
12
10
|
Button,
|
|
13
|
-
DropdownMenu,
|
|
14
11
|
IconButton,
|
|
15
12
|
LabeledInput,
|
|
16
|
-
MenuItem,
|
|
17
13
|
Surface,
|
|
18
14
|
Text,
|
|
19
15
|
toaster,
|
|
@@ -31,19 +27,21 @@ import "./ReportMappings.scss";
|
|
|
31
27
|
import DeleteModal from "./DeleteModal";
|
|
32
28
|
import type { Report, ReportMapping } from "@itwin/insights-client";
|
|
33
29
|
import { MappingsClient, REPORTING_BASE_PATH, ReportsClient } from "@itwin/insights-client";
|
|
34
|
-
import AddMappingsModal from "./AddMappingsModal";
|
|
30
|
+
import { AddMappingsModal } from "./AddMappingsModal";
|
|
35
31
|
import type {
|
|
36
32
|
GetSingleIModelParams,
|
|
37
33
|
IModelsClientOptions,
|
|
38
34
|
} from "@itwin/imodels-client-management";
|
|
39
35
|
import { Constants, IModelsClient } from "@itwin/imodels-client-management";
|
|
40
36
|
import { AccessTokenAdapter } from "@itwin/imodels-access-frontend";
|
|
41
|
-
import { HorizontalTile } from "./HorizontalTile";
|
|
42
|
-
import { Extraction, ExtractionStates, ExtractionStatus } from "./Extraction";
|
|
43
37
|
import { SearchBar } from "./SearchBar";
|
|
44
38
|
import type { ReportsApiConfig } from "../context/ReportsApiConfigContext";
|
|
45
39
|
import { useReportsApiConfig } from "../context/ReportsApiConfigContext";
|
|
46
40
|
import { ReportsConfigWidget } from "../../ReportsConfigWidget";
|
|
41
|
+
import { ReportMappingHorizontalTile } from "./ReportMappingHorizontalTile";
|
|
42
|
+
import type BulkExtractor from "./BulkExtractor";
|
|
43
|
+
import { BeEvent } from "@itwin/core-bentley";
|
|
44
|
+
import { LoadingSpinner } from "./utils";
|
|
47
45
|
|
|
48
46
|
export type ReportMappingType = CreateTypeFromInterface<ReportMapping>;
|
|
49
47
|
|
|
@@ -85,37 +83,37 @@ const fetchReportMappings = async (
|
|
|
85
83
|
const authorization =
|
|
86
84
|
AccessTokenAdapter.toAuthorizationCallback(accessToken);
|
|
87
85
|
const iModelNames = new Map<string, string>();
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
86
|
+
|
|
87
|
+
const reportMappingsAndMappings = [];
|
|
88
|
+
for (const reportMapping of reportMappings) {
|
|
89
|
+
const iModelId = reportMapping.imodelId;
|
|
90
|
+
let iModelName = "";
|
|
91
|
+
const mapping = await mappingsClientApi.getMapping(
|
|
92
|
+
accessToken,
|
|
93
|
+
iModelId,
|
|
94
|
+
reportMapping.mappingId
|
|
95
|
+
);
|
|
96
|
+
if (iModelNames.has(iModelId)) {
|
|
97
|
+
iModelName = iModelNames.get(iModelId) ?? "";
|
|
98
|
+
} else {
|
|
99
|
+
const getSingleParams: GetSingleIModelParams = {
|
|
100
|
+
authorization,
|
|
94
101
|
iModelId,
|
|
95
|
-
reportMapping.mappingId
|
|
96
|
-
);
|
|
97
|
-
if (iModelNames.has(iModelId)) {
|
|
98
|
-
iModelName = iModelNames.get(iModelId) ?? "";
|
|
99
|
-
} else {
|
|
100
|
-
const getSingleParams: GetSingleIModelParams = {
|
|
101
|
-
authorization,
|
|
102
|
-
iModelId,
|
|
103
|
-
};
|
|
104
|
-
const iModel = await iModelsClient.iModels.getSingle(getSingleParams);
|
|
105
|
-
iModelName = iModel.displayName;
|
|
106
|
-
iModelNames.set(iModelId, iModelName);
|
|
107
|
-
}
|
|
108
|
-
const reportMappingAndMapping: ReportMappingAndMapping = {
|
|
109
|
-
...reportMapping,
|
|
110
|
-
iModelName,
|
|
111
|
-
mappingName: mapping.mappingName,
|
|
112
|
-
mappingDescription: mapping.description ?? "",
|
|
113
102
|
};
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
103
|
+
const iModel = await iModelsClient.iModels.getSingle(getSingleParams);
|
|
104
|
+
iModelName = iModel.displayName;
|
|
105
|
+
iModelNames.set(iModelId, iModelName);
|
|
106
|
+
}
|
|
107
|
+
const reportMappingAndMapping: ReportMappingAndMapping = {
|
|
108
|
+
...reportMapping,
|
|
109
|
+
iModelName,
|
|
110
|
+
mappingName: mapping.mappingName,
|
|
111
|
+
mappingDescription: mapping.description ?? "",
|
|
112
|
+
};
|
|
113
|
+
reportMappingsAndMappings.push(reportMappingAndMapping);
|
|
114
|
+
}
|
|
117
115
|
|
|
118
|
-
setReportMappings(
|
|
116
|
+
setReportMappings(reportMappingsAndMappings);
|
|
119
117
|
} catch (error: any) {
|
|
120
118
|
handleError(error.status);
|
|
121
119
|
} finally {
|
|
@@ -125,23 +123,25 @@ const fetchReportMappings = async (
|
|
|
125
123
|
|
|
126
124
|
interface ReportMappingsProps {
|
|
127
125
|
report: Report;
|
|
126
|
+
bulkExtractor: BulkExtractor;
|
|
128
127
|
goBack: () => Promise<void>;
|
|
129
128
|
}
|
|
130
129
|
|
|
131
|
-
export const ReportMappings = ({ report, goBack }: ReportMappingsProps) => {
|
|
130
|
+
export const ReportMappings = ({ report, bulkExtractor, goBack }: ReportMappingsProps) => {
|
|
132
131
|
const apiConfig = useReportsApiConfig();
|
|
133
132
|
const [reportMappingsView, setReportMappingsView] =
|
|
134
133
|
useState<ReportMappingsView>(ReportMappingsView.REPORTMAPPINGS);
|
|
135
134
|
const [selectedReportMapping, setSelectedReportMapping] = useState<ReportMappingAndMapping | undefined>(undefined);
|
|
136
135
|
const [showDeleteModal, setShowDeleteModal] = useState<boolean>(false);
|
|
137
136
|
const [isLoading, setIsLoading] = useState<boolean>(true);
|
|
138
|
-
|
|
139
|
-
const [extractionState, setExtractionState] = useState<ExtractionStates>(
|
|
140
|
-
ExtractionStates.None
|
|
141
|
-
);
|
|
142
|
-
const [runningIModelId, setRunningIModelId] = useState<string>("");
|
|
143
137
|
const [searchValue, setSearchValue] = useState<string>("");
|
|
144
138
|
const [reportMappings, setReportMappings] = useState<ReportMappingAndMapping[]>([]);
|
|
139
|
+
const [jobRunning, setJobRunning] = useState<boolean>(false);
|
|
140
|
+
|
|
141
|
+
const jobStartEvent = useMemo(
|
|
142
|
+
() => new BeEvent<(iModelId: string) => void>(),
|
|
143
|
+
[]
|
|
144
|
+
);
|
|
145
145
|
|
|
146
146
|
useEffect(() => {
|
|
147
147
|
void fetchReportMappings(
|
|
@@ -152,6 +152,10 @@ export const ReportMappings = ({ report, goBack }: ReportMappingsProps) => {
|
|
|
152
152
|
);
|
|
153
153
|
}, [apiConfig, report.id, setIsLoading]);
|
|
154
154
|
|
|
155
|
+
useEffect(() => {
|
|
156
|
+
bulkExtractor.setHook(setJobRunning, reportMappings.map((x) => x.imodelId));
|
|
157
|
+
}, [bulkExtractor, reportMappings]);
|
|
158
|
+
|
|
155
159
|
const refresh = useCallback(async () => {
|
|
156
160
|
setReportMappingsView(ReportMappingsView.REPORTMAPPINGS);
|
|
157
161
|
await fetchReportMappings(
|
|
@@ -166,17 +170,6 @@ export const ReportMappings = ({ report, goBack }: ReportMappingsProps) => {
|
|
|
166
170
|
setReportMappingsView(ReportMappingsView.ADDING);
|
|
167
171
|
};
|
|
168
172
|
|
|
169
|
-
const uniqueIModels = useMemo(
|
|
170
|
-
() =>
|
|
171
|
-
new Map(
|
|
172
|
-
reportMappings.map((mapping) => [
|
|
173
|
-
mapping.imodelId,
|
|
174
|
-
mapping.iModelName,
|
|
175
|
-
])
|
|
176
|
-
),
|
|
177
|
-
[reportMappings]
|
|
178
|
-
);
|
|
179
|
-
|
|
180
173
|
const odataFeedUrl = `${generateUrl(
|
|
181
174
|
REPORTING_BASE_PATH,
|
|
182
175
|
apiConfig.baseUrl
|
|
@@ -196,12 +189,12 @@ export const ReportMappings = ({ report, goBack }: ReportMappingsProps) => {
|
|
|
196
189
|
return (
|
|
197
190
|
<>
|
|
198
191
|
<WidgetHeader title={report.displayName} returnFn={goBack} />
|
|
199
|
-
<div className="report-mapping-misc">
|
|
192
|
+
<div className="rcw-report-mapping-misc">
|
|
200
193
|
<LabeledInput
|
|
201
194
|
label={ReportsConfigWidget.localization.getLocalizedString(
|
|
202
195
|
"ReportsConfigWidget:ODataFeedURL"
|
|
203
196
|
)}
|
|
204
|
-
className="odata-url-input"
|
|
197
|
+
className="rcw-odata-url-input"
|
|
205
198
|
readOnly={true}
|
|
206
199
|
value={odataFeedUrl}
|
|
207
200
|
svgIcon={
|
|
@@ -224,16 +217,9 @@ export const ReportMappings = ({ report, goBack }: ReportMappingsProps) => {
|
|
|
224
217
|
}
|
|
225
218
|
iconDisplayStyle="inline"
|
|
226
219
|
/>
|
|
227
|
-
<Extraction
|
|
228
|
-
iModels={uniqueIModels}
|
|
229
|
-
extractionState={extractionState}
|
|
230
|
-
setExtractionState={setExtractionState}
|
|
231
|
-
setExtractingIModelId={setRunningIModelId}
|
|
232
|
-
isLoading={isLoading}
|
|
233
|
-
/>
|
|
234
220
|
</div>
|
|
235
|
-
<Surface className="report-mappings-container">
|
|
236
|
-
<div className="toolbar">
|
|
221
|
+
<Surface className="rcw-report-mappings-container">
|
|
222
|
+
<div className="rcw-toolbar">
|
|
237
223
|
<Button
|
|
238
224
|
startIcon={<SvgAdd />}
|
|
239
225
|
onClick={() => addMapping()}
|
|
@@ -243,7 +229,7 @@ export const ReportMappings = ({ report, goBack }: ReportMappingsProps) => {
|
|
|
243
229
|
"ReportsConfigWidget:AddMapping"
|
|
244
230
|
)}
|
|
245
231
|
</Button>
|
|
246
|
-
<div className="search-bar-container" data-testid="search-bar">
|
|
232
|
+
<div className="rcw-search-bar-container" data-testid="rcw-search-bar">
|
|
247
233
|
<SearchBar
|
|
248
234
|
searchValue={searchValue}
|
|
249
235
|
setSearchValue={setSearchValue}
|
|
@@ -271,49 +257,18 @@ export const ReportMappings = ({ report, goBack }: ReportMappingsProps) => {
|
|
|
271
257
|
</>
|
|
272
258
|
</EmptyMessage>
|
|
273
259
|
) : (
|
|
274
|
-
<div className="mapping-list">
|
|
260
|
+
<div className="rcw-mapping-list">
|
|
275
261
|
{filteredReportMappings.map((mapping) => (
|
|
276
|
-
<
|
|
262
|
+
<ReportMappingHorizontalTile
|
|
277
263
|
key={mapping.mappingId}
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
: ExtractionStates.None
|
|
287
|
-
}
|
|
288
|
-
>
|
|
289
|
-
<DropdownMenu
|
|
290
|
-
menuItems={(close: () => void) => [
|
|
291
|
-
<MenuItem
|
|
292
|
-
key={0}
|
|
293
|
-
onClick={() => {
|
|
294
|
-
setSelectedReportMapping(mapping);
|
|
295
|
-
setShowDeleteModal(true);
|
|
296
|
-
close();
|
|
297
|
-
}}
|
|
298
|
-
icon={<SvgDelete />}
|
|
299
|
-
>
|
|
300
|
-
{ReportsConfigWidget.localization.getLocalizedString(
|
|
301
|
-
"ReportsConfigWidget:Remove"
|
|
302
|
-
)}
|
|
303
|
-
</MenuItem>,
|
|
304
|
-
]}
|
|
305
|
-
>
|
|
306
|
-
<IconButton styleType="borderless">
|
|
307
|
-
<SvgMore
|
|
308
|
-
style={{
|
|
309
|
-
width: "16px",
|
|
310
|
-
height: "16px",
|
|
311
|
-
}}
|
|
312
|
-
/>
|
|
313
|
-
</IconButton>
|
|
314
|
-
</DropdownMenu>
|
|
315
|
-
</ExtractionStatus>
|
|
316
|
-
}
|
|
264
|
+
bulkExtractor={bulkExtractor}
|
|
265
|
+
mapping={mapping}
|
|
266
|
+
onClickDelete={() => {
|
|
267
|
+
setSelectedReportMapping(mapping);
|
|
268
|
+
setShowDeleteModal(true);
|
|
269
|
+
}}
|
|
270
|
+
odataFeedUrl={odataFeedUrl}
|
|
271
|
+
jobStartEvent={jobStartEvent}
|
|
317
272
|
/>
|
|
318
273
|
))}
|
|
319
274
|
</div>
|
|
@@ -342,6 +297,35 @@ export const ReportMappings = ({ report, goBack }: ReportMappingsProps) => {
|
|
|
342
297
|
}}
|
|
343
298
|
refresh={refresh}
|
|
344
299
|
/>
|
|
300
|
+
<div className="rcw-action-panel">
|
|
301
|
+
{isLoading && <LoadingSpinner />}
|
|
302
|
+
<Button
|
|
303
|
+
disabled={isLoading || jobRunning || reportMappings.length === 0}
|
|
304
|
+
styleType="high-visibility"
|
|
305
|
+
onClick={async () => {
|
|
306
|
+
setJobRunning(true);
|
|
307
|
+
const uniqueIModels = Array.from(new Set(reportMappings.map((x) => x.imodelId)));
|
|
308
|
+
await bulkExtractor.runIModelExtractions(uniqueIModels);
|
|
309
|
+
reportMappings.forEach((reportMapping) => {
|
|
310
|
+
jobStartEvent.raiseEvent(reportMapping.imodelId);
|
|
311
|
+
});
|
|
312
|
+
}}
|
|
313
|
+
>
|
|
314
|
+
{ReportsConfigWidget.localization.getLocalizedString(
|
|
315
|
+
"ReportsConfigWidget:UpdateAllDatasets"
|
|
316
|
+
)}
|
|
317
|
+
</Button>
|
|
318
|
+
<Button
|
|
319
|
+
styleType="default"
|
|
320
|
+
type="button"
|
|
321
|
+
onClick={goBack}
|
|
322
|
+
disabled={isLoading}
|
|
323
|
+
>
|
|
324
|
+
{ReportsConfigWidget.localization.getLocalizedString(
|
|
325
|
+
"ReportsConfigWidget:Close"
|
|
326
|
+
)}
|
|
327
|
+
</Button>
|
|
328
|
+
</div>
|
|
345
329
|
</>
|
|
346
330
|
);
|
|
347
331
|
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
@import "~@itwin/itwinui-css/scss/variables";
|
|
6
6
|
|
|
7
|
-
.reports-list-container {
|
|
7
|
+
.rcw-reports-list-container {
|
|
8
8
|
display: flex;
|
|
9
9
|
flex-direction: column;
|
|
10
10
|
flex-grow: 1;
|
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import {
|
|
6
6
|
SvgAdd,
|
|
7
|
-
|
|
7
|
+
SvgPlay,
|
|
8
8
|
} from "@itwin/itwinui-icons-react";
|
|
9
9
|
import {
|
|
10
10
|
Button,
|
|
11
11
|
IconButton,
|
|
12
12
|
Surface,
|
|
13
|
+
toaster,
|
|
13
14
|
} from "@itwin/itwinui-react";
|
|
14
15
|
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
15
16
|
import type { CreateTypeFromInterface } from "./utils";
|
|
@@ -34,6 +35,7 @@ import { ReportsConfigWidget } from "../../ReportsConfigWidget";
|
|
|
34
35
|
import { useActiveIModelConnection } from "@itwin/appui-react";
|
|
35
36
|
import BulkExtractor from "./BulkExtractor";
|
|
36
37
|
import { BeEvent } from "@itwin/core-bentley";
|
|
38
|
+
import { FailedExtractionToast, SuccessfulExtractionToast } from "./ExtractionToast";
|
|
37
39
|
|
|
38
40
|
export type ReportType = CreateTypeFromInterface<Report>;
|
|
39
41
|
|
|
@@ -67,6 +69,14 @@ const fetchReports = async (
|
|
|
67
69
|
};
|
|
68
70
|
|
|
69
71
|
export const Reports = () => {
|
|
72
|
+
const successfulExtractionToast = (iModelName: string, odataFeedUrl: string) => {
|
|
73
|
+
toaster.positive(<SuccessfulExtractionToast iModelName={iModelName} odataFeedUrl={odataFeedUrl} />);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const failedExtractionToast = (iModelName: string) => {
|
|
77
|
+
toaster.negative(<FailedExtractionToast iModelName={iModelName} />);
|
|
78
|
+
};
|
|
79
|
+
|
|
70
80
|
const iTwinId = useActiveIModelConnection()?.iTwinId ?? "";
|
|
71
81
|
const apiConfig = useReportsApiConfig();
|
|
72
82
|
const [selectedReportIds, setSelectedReportIds] = useState<string[]>([]);
|
|
@@ -81,8 +91,8 @@ export const Reports = () => {
|
|
|
81
91
|
const [searchValue, setSearchValue] = useState<string>("");
|
|
82
92
|
const [reports, setReports] = useState<Report[]>([]);
|
|
83
93
|
const bulkExtractor = useMemo(
|
|
84
|
-
() => new BulkExtractor(apiConfig,
|
|
85
|
-
[apiConfig
|
|
94
|
+
() => new BulkExtractor(apiConfig, successfulExtractionToast, failedExtractionToast),
|
|
95
|
+
[apiConfig]
|
|
86
96
|
);
|
|
87
97
|
const jobStartEvent = useMemo(
|
|
88
98
|
() => new BeEvent<(reportId: string) => void>(),
|
|
@@ -128,9 +138,9 @@ export const Reports = () => {
|
|
|
128
138
|
};
|
|
129
139
|
|
|
130
140
|
const updateDatasets = useCallback(async () => {
|
|
141
|
+
await bulkExtractor.runReportExtractions(selectedReportIds);
|
|
131
142
|
selectedReportIds.map((reportId) => jobStartEvent.raiseEvent(reportId));
|
|
132
143
|
setSelectedReportIds([]);
|
|
133
|
-
await bulkExtractor.startJobs(selectedReportIds);
|
|
134
144
|
}, [selectedReportIds, jobStartEvent, bulkExtractor]);
|
|
135
145
|
|
|
136
146
|
switch (reportsView) {
|
|
@@ -148,7 +158,7 @@ export const Reports = () => {
|
|
|
148
158
|
) : null;
|
|
149
159
|
case ReportsView.REPORTSMAPPING:
|
|
150
160
|
return selectedReport ? (
|
|
151
|
-
<ReportMappings report={selectedReport} goBack={refresh} />
|
|
161
|
+
<ReportMappings report={selectedReport} bulkExtractor={bulkExtractor} goBack={refresh} />
|
|
152
162
|
) : null;
|
|
153
163
|
default:
|
|
154
164
|
return (
|
|
@@ -158,7 +168,7 @@ export const Reports = () => {
|
|
|
158
168
|
"ReportsConfigWidget:ITwinReports"
|
|
159
169
|
)}
|
|
160
170
|
/>
|
|
161
|
-
<Surface className="reports-list-container">
|
|
171
|
+
<Surface className="rcw-reports-list-container">
|
|
162
172
|
<div className="rcw-toolbar">
|
|
163
173
|
<Button
|
|
164
174
|
startIcon={<SvgAdd />}
|
|
@@ -176,9 +186,9 @@ export const Reports = () => {
|
|
|
176
186
|
onClick={updateDatasets}
|
|
177
187
|
disabled={selectedReportIds.length === 0}
|
|
178
188
|
>
|
|
179
|
-
<
|
|
189
|
+
<SvgPlay />
|
|
180
190
|
</IconButton>
|
|
181
|
-
<div className="rcw-search-bar-container" data-testid="search-bar">
|
|
191
|
+
<div className="rcw-search-bar-container" data-testid="rcw-search-bar">
|
|
182
192
|
<div className="rcw-search-button">
|
|
183
193
|
<SearchBar
|
|
184
194
|
searchValue={searchValue}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
@import "~@itwin/itwinui-css/scss/variables";
|
|
6
6
|
|
|
7
|
-
.reports-container {
|
|
7
|
+
.rcw-reports-container {
|
|
8
8
|
position: absolute;
|
|
9
9
|
right: 0;
|
|
10
10
|
left: 0;
|
|
@@ -15,4 +15,4 @@
|
|
|
15
15
|
height: 100%;
|
|
16
16
|
overflow: auto;
|
|
17
17
|
gap: $iui-baseline;
|
|
18
|
-
}
|
|
18
|
+
}
|
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
@import "~@itwin/itwinui-css/scss/variables";
|
|
6
6
|
|
|
7
|
-
.
|
|
7
|
+
.rcw-select-imodel {
|
|
8
8
|
position: relative;
|
|
9
9
|
margin-bottom: $iui-baseline * 2;
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
.rcw-combobox {
|
|
11
12
|
display: flex;
|
|
12
13
|
gap: $iui-s;
|
|
13
14
|
width: 100%;
|
|
14
15
|
}
|
|
15
|
-
}
|
|
16
|
+
}
|
|
@@ -78,13 +78,13 @@ export const SelectIModel = ({
|
|
|
78
78
|
}, [iModels]);
|
|
79
79
|
|
|
80
80
|
return (
|
|
81
|
-
<div className="
|
|
81
|
+
<div className="rcw-select-imodel">
|
|
82
82
|
<Label htmlFor="combo-input">
|
|
83
83
|
{ReportsConfigWidget.localization.getLocalizedString(
|
|
84
84
|
"ReportsConfigWidget:SelectIModel"
|
|
85
85
|
)}
|
|
86
86
|
</Label>
|
|
87
|
-
<div className="combobox">
|
|
87
|
+
<div className="rcw-combobox">
|
|
88
88
|
<ComboBox<string>
|
|
89
89
|
options={iModelOptions}
|
|
90
90
|
value={selectedIModelId}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
margin-bottom: $iui-baseline;
|
|
12
12
|
align-items: center;
|
|
13
13
|
|
|
14
|
-
.title {
|
|
14
|
+
.rcw-title {
|
|
15
15
|
overflow: hidden;
|
|
16
16
|
white-space: nowrap;
|
|
17
17
|
text-overflow: ellipsis;
|
|
@@ -36,4 +36,4 @@
|
|
|
36
36
|
.rcw-skeleton-block {
|
|
37
37
|
height: $iui-baseline * 3;
|
|
38
38
|
width: 100%;
|
|
39
|
-
}
|
|
39
|
+
}
|