@itwin/reports-config-widget-react 0.0.8 → 0.1.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/.rush/temp/package-deps_rebuild.json +23 -13
- package/.rush/temp/shrinkwrap-deps.json +1 -1
- package/CHANGELOG.json +12 -0
- package/CHANGELOG.md +8 -1
- package/coverage/clover.xml +354 -128
- package/coverage/coverage-final.json +17 -8
- package/coverage/lcov-report/index.html +36 -21
- 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 +553 -0
- package/coverage/lcov-report/src/widget/components/Constants.ts.html +106 -0
- package/coverage/lcov-report/src/widget/components/DeleteModal.tsx.html +4 -4
- package/coverage/lcov-report/src/widget/components/Extraction.tsx.html +1 -1
- package/coverage/lcov-report/src/widget/components/ExtractionStates/FailedExtractionState.tsx.html +187 -0
- package/coverage/lcov-report/src/widget/components/ExtractionStates/QueuedExtractionState.tsx.html +145 -0
- package/coverage/lcov-report/src/widget/components/ExtractionStates/RunningExtractionState.tsx.html +139 -0
- package/coverage/lcov-report/src/widget/components/ExtractionStates/StartingExtractionState.tsx.html +151 -0
- package/coverage/lcov-report/src/widget/components/ExtractionStates/SucceededExtractionState.tsx.html +187 -0
- package/coverage/lcov-report/src/widget/components/ExtractionStates/index.html +176 -0
- package/coverage/lcov-report/src/widget/components/ExtractionStatus.tsx.html +295 -0
- package/coverage/lcov-report/src/widget/components/HorizontalTile.tsx.html +73 -40
- 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 +478 -0
- package/coverage/lcov-report/src/widget/components/ReportMappings.tsx.html +6 -24
- package/coverage/lcov-report/src/widget/components/Reports.tsx.html +129 -111
- package/coverage/lcov-report/src/widget/components/ReportsContainer.tsx.html +1 -1
- package/coverage/lcov-report/src/widget/components/SearchBar.tsx.html +5 -5
- package/coverage/lcov-report/src/widget/components/SelectIModel.tsx.html +1 -1
- package/coverage/lcov-report/src/widget/components/index.html +83 -23
- package/coverage/lcov-report/src/widget/components/utils.tsx.html +3 -3
- package/coverage/lcov-report/src/widget/context/ReportsApiConfigContext.tsx.html +4 -4
- 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 +699 -287
- package/jest.config.js +1 -0
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/cjs/widget/components/BulkExtractor.d.ts +28 -0
- package/lib/cjs/widget/components/BulkExtractor.d.ts.map +1 -0
- package/lib/cjs/widget/components/BulkExtractor.js +126 -0
- package/lib/cjs/widget/components/BulkExtractor.js.map +1 -0
- package/lib/cjs/widget/components/Constants.d.ts +4 -0
- package/lib/cjs/widget/components/Constants.d.ts.map +1 -0
- package/lib/cjs/widget/components/Constants.js +11 -0
- package/lib/cjs/widget/components/Constants.js.map +1 -0
- package/lib/cjs/widget/components/ExtractionStates/FailedExtractionState.d.ts +8 -0
- package/lib/cjs/widget/components/ExtractionStates/FailedExtractionState.d.ts.map +1 -0
- package/lib/cjs/widget/components/ExtractionStates/FailedExtractionState.js +23 -0
- package/lib/cjs/widget/components/ExtractionStates/FailedExtractionState.js.map +1 -0
- package/lib/cjs/widget/components/ExtractionStates/QueuedExtractionState.d.ts +3 -0
- package/lib/cjs/widget/components/ExtractionStates/QueuedExtractionState.d.ts.map +1 -0
- package/lib/cjs/widget/components/ExtractionStates/QueuedExtractionState.js +18 -0
- package/lib/cjs/widget/components/ExtractionStates/QueuedExtractionState.js.map +1 -0
- package/lib/cjs/widget/components/ExtractionStates/RunningExtractionState.d.ts +3 -0
- package/lib/cjs/widget/components/ExtractionStates/RunningExtractionState.d.ts.map +1 -0
- package/lib/cjs/widget/components/ExtractionStates/RunningExtractionState.js +17 -0
- package/lib/cjs/widget/components/ExtractionStates/RunningExtractionState.js.map +1 -0
- package/lib/cjs/widget/components/ExtractionStates/StartingExtractionState.d.ts +3 -0
- package/lib/cjs/widget/components/ExtractionStates/StartingExtractionState.d.ts.map +1 -0
- package/lib/cjs/widget/components/ExtractionStates/StartingExtractionState.js +18 -0
- package/lib/cjs/widget/components/ExtractionStates/StartingExtractionState.js.map +1 -0
- package/lib/cjs/widget/components/ExtractionStates/SucceededExtractionState.d.ts +8 -0
- package/lib/cjs/widget/components/ExtractionStates/SucceededExtractionState.d.ts.map +1 -0
- package/lib/cjs/widget/components/ExtractionStates/SucceededExtractionState.js +23 -0
- package/lib/cjs/widget/components/ExtractionStates/SucceededExtractionState.js.map +1 -0
- package/lib/cjs/widget/components/ExtractionStatus.d.ts +17 -0
- package/lib/cjs/widget/components/ExtractionStatus.d.ts.map +1 -0
- package/lib/cjs/widget/components/ExtractionStatus.js +76 -0
- package/lib/cjs/widget/components/ExtractionStatus.js.map +1 -0
- package/lib/cjs/widget/components/ExtractionStatus.scss +27 -0
- package/lib/cjs/widget/components/HorizontalTile.d.ts +8 -7
- package/lib/cjs/widget/components/HorizontalTile.d.ts.map +1 -1
- package/lib/cjs/widget/components/HorizontalTile.js +10 -6
- package/lib/cjs/widget/components/HorizontalTile.js.map +1 -1
- package/lib/cjs/widget/components/HorizontalTile.scss +42 -22
- package/lib/cjs/widget/components/ReportHorizontalTile.d.ts +16 -0
- package/lib/cjs/widget/components/ReportHorizontalTile.d.ts.map +1 -0
- package/lib/cjs/widget/components/ReportHorizontalTile.js +72 -0
- package/lib/cjs/widget/components/ReportHorizontalTile.js.map +1 -0
- package/lib/cjs/widget/components/ReportMappings.d.ts.map +1 -1
- package/lib/cjs/widget/components/ReportMappings.js +1 -1
- package/lib/cjs/widget/components/ReportMappings.js.map +1 -1
- package/lib/cjs/widget/components/Reports.d.ts.map +1 -1
- package/lib/cjs/widget/components/Reports.js +34 -26
- package/lib/cjs/widget/components/Reports.js.map +1 -1
- package/lib/cjs/widget/components/Reports.scss +7 -3
- package/lib/cjs/widget/components/SearchBar.js +1 -1
- package/lib/cjs/widget/components/SearchBar.js.map +1 -1
- package/lib/cjs/widget/components/SearchBar.scss +6 -0
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/widget/components/BulkExtractor.d.ts +28 -0
- package/lib/esm/widget/components/BulkExtractor.d.ts.map +1 -0
- package/lib/esm/widget/components/BulkExtractor.js +123 -0
- package/lib/esm/widget/components/BulkExtractor.js.map +1 -0
- package/lib/esm/widget/components/Constants.d.ts +4 -0
- package/lib/esm/widget/components/Constants.d.ts.map +1 -0
- package/lib/esm/widget/components/Constants.js +8 -0
- package/lib/esm/widget/components/Constants.js.map +1 -0
- package/lib/esm/widget/components/ExtractionStates/FailedExtractionState.d.ts +8 -0
- package/lib/esm/widget/components/ExtractionStates/FailedExtractionState.d.ts.map +1 -0
- package/lib/esm/widget/components/ExtractionStates/FailedExtractionState.js +16 -0
- package/lib/esm/widget/components/ExtractionStates/FailedExtractionState.js.map +1 -0
- package/lib/esm/widget/components/ExtractionStates/QueuedExtractionState.d.ts +3 -0
- package/lib/esm/widget/components/ExtractionStates/QueuedExtractionState.d.ts.map +1 -0
- package/lib/esm/widget/components/ExtractionStates/QueuedExtractionState.js +11 -0
- package/lib/esm/widget/components/ExtractionStates/QueuedExtractionState.js.map +1 -0
- package/lib/esm/widget/components/ExtractionStates/RunningExtractionState.d.ts +3 -0
- package/lib/esm/widget/components/ExtractionStates/RunningExtractionState.d.ts.map +1 -0
- package/lib/esm/widget/components/ExtractionStates/RunningExtractionState.js +10 -0
- package/lib/esm/widget/components/ExtractionStates/RunningExtractionState.js.map +1 -0
- package/lib/esm/widget/components/ExtractionStates/StartingExtractionState.d.ts +3 -0
- package/lib/esm/widget/components/ExtractionStates/StartingExtractionState.d.ts.map +1 -0
- package/lib/esm/widget/components/ExtractionStates/StartingExtractionState.js +11 -0
- package/lib/esm/widget/components/ExtractionStates/StartingExtractionState.js.map +1 -0
- package/lib/esm/widget/components/ExtractionStates/SucceededExtractionState.d.ts +8 -0
- package/lib/esm/widget/components/ExtractionStates/SucceededExtractionState.d.ts.map +1 -0
- package/lib/esm/widget/components/ExtractionStates/SucceededExtractionState.js +16 -0
- package/lib/esm/widget/components/ExtractionStates/SucceededExtractionState.js.map +1 -0
- package/lib/esm/widget/components/ExtractionStatus.d.ts +17 -0
- package/lib/esm/widget/components/ExtractionStatus.d.ts.map +1 -0
- package/lib/esm/widget/components/ExtractionStatus.js +53 -0
- package/lib/esm/widget/components/ExtractionStatus.js.map +1 -0
- package/lib/esm/widget/components/ExtractionStatus.scss +27 -0
- package/lib/esm/widget/components/HorizontalTile.d.ts +8 -7
- package/lib/esm/widget/components/HorizontalTile.d.ts.map +1 -1
- package/lib/esm/widget/components/HorizontalTile.js +10 -6
- package/lib/esm/widget/components/HorizontalTile.js.map +1 -1
- package/lib/esm/widget/components/HorizontalTile.scss +42 -22
- package/lib/esm/widget/components/ReportHorizontalTile.d.ts +16 -0
- package/lib/esm/widget/components/ReportHorizontalTile.d.ts.map +1 -0
- package/lib/esm/widget/components/ReportHorizontalTile.js +65 -0
- package/lib/esm/widget/components/ReportHorizontalTile.js.map +1 -0
- package/lib/esm/widget/components/ReportMappings.d.ts.map +1 -1
- package/lib/esm/widget/components/ReportMappings.js +1 -1
- package/lib/esm/widget/components/ReportMappings.js.map +1 -1
- package/lib/esm/widget/components/Reports.d.ts.map +1 -1
- package/lib/esm/widget/components/Reports.js +36 -28
- package/lib/esm/widget/components/Reports.js.map +1 -1
- package/lib/esm/widget/components/Reports.scss +7 -3
- package/lib/esm/widget/components/SearchBar.js +1 -1
- package/lib/esm/widget/components/SearchBar.js.map +1 -1
- package/lib/esm/widget/components/SearchBar.scss +6 -0
- package/lib/public/locales/en/ReportsConfigWidget.json +2 -1
- package/package.json +5 -2
- package/public/locales/en/ReportsConfigWidget.json +2 -1
- package/reports-config-widget-react.build.error.log +4 -4
- package/reports-config-widget-react.build.log +44 -34
- package/src/widget/components/BulkExtractor.ts +156 -0
- package/src/widget/components/Constants.ts +7 -0
- package/src/widget/components/ExtractionStates/FailedExtractionState.tsx +34 -0
- package/src/widget/components/ExtractionStates/QueuedExtractionState.tsx +20 -0
- package/src/widget/components/ExtractionStates/RunningExtractionState.tsx +18 -0
- package/src/widget/components/ExtractionStates/StartingExtractionState.tsx +22 -0
- package/src/widget/components/ExtractionStates/SucceededExtractionState.tsx +34 -0
- package/src/widget/components/ExtractionStatus.scss +27 -0
- package/src/widget/components/ExtractionStatus.tsx +70 -0
- package/src/widget/components/HorizontalTile.scss +42 -22
- package/src/widget/components/HorizontalTile.tsx +45 -34
- package/src/widget/components/ReportHorizontalTile.tsx +131 -0
- package/src/widget/components/ReportMappings.tsx +4 -10
- package/src/widget/components/Reports.scss +7 -3
- package/src/widget/components/Reports.tsx +66 -60
- package/src/widget/components/SearchBar.scss +6 -0
- package/src/widget/components/SearchBar.tsx +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/reports-config-widget-react",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "An iTwin.js 3D Viewer Widget that interfaces with the iTwin Reporting Platform.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Bentley",
|
|
@@ -30,7 +30,9 @@
|
|
|
30
30
|
"rules": {
|
|
31
31
|
"no-duplicate-imports": "off",
|
|
32
32
|
"@typescript-eslint/consistent-type-imports": "error",
|
|
33
|
-
"deprecation/deprecation": "off"
|
|
33
|
+
"deprecation/deprecation": "off",
|
|
34
|
+
"jsx-a11y/no-static-element-interactions": "off",
|
|
35
|
+
"jsx-a11y/click-events-have-key-events": "off"
|
|
34
36
|
}
|
|
35
37
|
},
|
|
36
38
|
"dependencies": {
|
|
@@ -40,6 +42,7 @@
|
|
|
40
42
|
"@itwin/itwinui-icons-color-react": "^1.0.1",
|
|
41
43
|
"@itwin/itwinui-icons-react": "^1.7.0",
|
|
42
44
|
"@itwin/itwinui-react": "~1.42.0",
|
|
45
|
+
"classnames": "^2.3.1",
|
|
43
46
|
"simple-react-validator": "^1.6.1"
|
|
44
47
|
},
|
|
45
48
|
"devDependencies": {
|
|
@@ -65,6 +65,7 @@
|
|
|
65
65
|
"RowsPerPage": "Rows per page"
|
|
66
66
|
},
|
|
67
67
|
"UpdateDataset": "Update your dataset",
|
|
68
|
+
"UpdateDatasets": "Update your datasets for selected reports",
|
|
68
69
|
"UpdateInProgress": "Update in progress...",
|
|
69
70
|
"Validators": {
|
|
70
71
|
"NoDuplicateUnderscore": "Remove duplicate \"_\"",
|
|
@@ -73,4 +74,4 @@
|
|
|
73
74
|
"CharLimit": "There is an 128 character limit.",
|
|
74
75
|
"ThisFieldIsRequired": "This field is required"
|
|
75
76
|
}
|
|
76
|
-
}
|
|
77
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
PASS src/test/ReportMappings.test.tsx (
|
|
2
|
-
PASS src/test/Reports.test.tsx (
|
|
3
|
-
PASS src/test/ReportAction.test.tsx (6.
|
|
1
|
+
PASS src/test/ReportMappings.test.tsx (44.264 s)
|
|
2
|
+
PASS src/test/Reports.test.tsx (10.883 s)
|
|
3
|
+
PASS src/test/ReportAction.test.tsx (6.943 s)
|
|
4
4
|
PASS src/test/WidgetHeader.test.tsx
|
|
5
5
|
|
|
6
6
|
Test Suites: 4 passed, 4 total
|
|
7
7
|
Tests: 22 passed, 22 total
|
|
8
8
|
Snapshots: 0 total
|
|
9
|
-
Time:
|
|
9
|
+
Time: 67.274 s
|
|
10
10
|
Ran all test suites.
|
|
@@ -1,45 +1,55 @@
|
|
|
1
1
|
Invoking: npm test -- --coverage
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
> @itwin/reports-config-widget-react@0.0.
|
|
4
|
+
> @itwin/reports-config-widget-react@0.0.8 test /home/vsts/work/1/s/packages/itwin/reports-config-widget
|
|
5
5
|
> jest "--coverage"
|
|
6
6
|
|
|
7
|
-
PASS src/test/ReportMappings.test.tsx (
|
|
8
|
-
PASS src/test/Reports.test.tsx (
|
|
9
|
-
PASS src/test/ReportAction.test.tsx (6.
|
|
7
|
+
PASS src/test/ReportMappings.test.tsx (44.264 s)
|
|
8
|
+
PASS src/test/Reports.test.tsx (10.883 s)
|
|
9
|
+
PASS src/test/ReportAction.test.tsx (6.943 s)
|
|
10
10
|
PASS src/test/WidgetHeader.test.tsx
|
|
11
|
-
|
|
12
|
-
File
|
|
13
|
-
|
|
14
|
-
All files
|
|
15
|
-
src
|
|
16
|
-
ReportsConfigWidget.ts
|
|
17
|
-
src/test
|
|
18
|
-
test-utils.tsx
|
|
19
|
-
src/widget
|
|
20
|
-
ReportsConfigUiProvider.tsx
|
|
21
|
-
src/widget/components
|
|
22
|
-
ActionPanel.tsx
|
|
23
|
-
AddMappingsModal.tsx
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
11
|
+
----------------------------------------|---------|----------|---------|---------|-------------------------------
|
|
12
|
+
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
|
|
13
|
+
----------------------------------------|---------|----------|---------|---------|-------------------------------
|
|
14
|
+
All files | 77.63 | 62.45 | 70.73 | 77.55 |
|
|
15
|
+
src | 100 | 75 | 100 | 100 |
|
|
16
|
+
ReportsConfigWidget.ts | 100 | 75 | 100 | 100 | 21
|
|
17
|
+
src/test | 100 | 66.66 | 100 | 100 |
|
|
18
|
+
test-utils.tsx | 100 | 66.66 | 100 | 100 | 56
|
|
19
|
+
src/widget | 40 | 0 | 0 | 40 |
|
|
20
|
+
ReportsConfigUiProvider.tsx | 40 | 0 | 0 | 40 | 23-65
|
|
21
|
+
src/widget/components | 76.48 | 64.31 | 71.94 | 76.6 |
|
|
22
|
+
ActionPanel.tsx | 100 | 77.77 | 100 | 100 | 25-26
|
|
23
|
+
AddMappingsModal.tsx | 91.66 | 83.33 | 88.88 | 93.47 | 40,120,134
|
|
24
|
+
BulkExtractor.ts | 16.45 | 0 | 6.66 | 16.66 | 36-154
|
|
25
|
+
Constants.ts | 100 | 100 | 100 | 100 |
|
|
26
|
+
DeleteModal.tsx | 85 | 100 | 50 | 84.21 | 42,56-87
|
|
27
|
+
Extraction.tsx | 85.41 | 79.48 | 85.71 | 85.71 | 51-53,138,200-203,226-229,295
|
|
28
|
+
ExtractionStatus.tsx | 51.42 | 20 | 16.66 | 53.12 | 33-68
|
|
29
|
+
HorizontalTile.tsx | 100 | 100 | 100 | 100 |
|
|
30
|
+
LocalizedTablePaginator.tsx | 100 | 50 | 100 | 100 | 25
|
|
31
|
+
ReportAction.tsx | 94.28 | 81.48 | 100 | 94.28 | 59-60
|
|
32
|
+
ReportHorizontalTile.tsx | 70.73 | 56 | 72.72 | 69.23 | 43-45,57-63,124-125
|
|
33
|
+
ReportMappings.tsx | 96.34 | 73.68 | 94.44 | 96.29 | 98,120,265
|
|
34
|
+
Reports.tsx | 92.04 | 78.84 | 83.33 | 95.18 | 124,131-133
|
|
35
|
+
ReportsContainer.tsx | 57.14 | 0 | 0 | 61.53 | 19,25-37
|
|
36
|
+
SearchBar.tsx | 70.58 | 71.42 | 60 | 68.75 | 31-45
|
|
37
|
+
SelectIModel.tsx | 97.05 | 81.81 | 85.71 | 96.87 | 92
|
|
38
|
+
utils.tsx | 64.7 | 30.76 | 100 | 58.13 | 51-94
|
|
39
|
+
src/widget/components/ExtractionStates | 84.37 | 0 | 0 | 81.48 |
|
|
40
|
+
FailedExtractionState.tsx | 85.71 | 0 | 0 | 83.33 | 16
|
|
41
|
+
QueuedExtractionState.tsx | 83.33 | 100 | 0 | 80 | 10
|
|
42
|
+
RunningExtractionState.tsx | 83.33 | 100 | 0 | 80 | 10
|
|
43
|
+
StartingExtractionState.tsx | 83.33 | 100 | 0 | 80 | 10
|
|
44
|
+
SucceededExtractionState.tsx | 85.71 | 0 | 0 | 83.33 | 16
|
|
45
|
+
src/widget/context | 80 | 0 | 50 | 77.77 |
|
|
46
|
+
ReportsApiConfigContext.tsx | 80 | 0 | 50 | 77.77 | 15,22
|
|
47
|
+
src/widget/hooks | 100 | 100 | 100 | 100 |
|
|
48
|
+
useValidator.ts | 100 | 100 | 100 | 100 |
|
|
49
|
+
----------------------------------------|---------|----------|---------|---------|-------------------------------
|
|
40
50
|
|
|
41
51
|
Test Suites: 4 passed, 4 total
|
|
42
52
|
Tests: 22 passed, 22 total
|
|
43
53
|
Snapshots: 0 total
|
|
44
|
-
Time:
|
|
54
|
+
Time: 67.274 s
|
|
45
55
|
Ran all test suites.
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { ExtractionClient, ExtractorState, REPORTING_BASE_PATH, ReportsClient } from "@itwin/insights-client";
|
|
6
|
+
import type { ReportMapping } from "@itwin/insights-client";
|
|
7
|
+
import { generateUrl, handleError } from "./utils";
|
|
8
|
+
import type { ReportsApiConfig } from "../context/ReportsApiConfigContext";
|
|
9
|
+
import { ExtractionStates } from "./ExtractionStatus";
|
|
10
|
+
import { STATUS_CHECK_INTERVAL } from "./Constants";
|
|
11
|
+
|
|
12
|
+
export type ReportMappingAndMapping = ReportMapping & {
|
|
13
|
+
mappingName: string;
|
|
14
|
+
mappingDescription: string;
|
|
15
|
+
iModelName: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default class BulkExtractor {
|
|
19
|
+
private _reportRunIds = new Map<string, string[]>();
|
|
20
|
+
private _reportsClientApi: ReportsClient;
|
|
21
|
+
private _extractionClientApi: ExtractionClient;
|
|
22
|
+
private _accessToken: () => Promise<string>;
|
|
23
|
+
private _reportStates = new Map<string, ExtractionStates>();
|
|
24
|
+
private _timeFetched = new Date();
|
|
25
|
+
private _reportIds: string[];
|
|
26
|
+
|
|
27
|
+
constructor(apiConfig: ReportsApiConfig, reportIds: string[]) {
|
|
28
|
+
const url = generateUrl(REPORTING_BASE_PATH, apiConfig.baseUrl);
|
|
29
|
+
this._reportsClientApi = new ReportsClient(url);
|
|
30
|
+
this._extractionClientApi = new ExtractionClient(url);
|
|
31
|
+
this._accessToken = apiConfig.getAccessToken;
|
|
32
|
+
this._reportIds = reportIds;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
private async getStates(reportIds: string[]): Promise<Map<string, ExtractionStates>> {
|
|
36
|
+
const stateByReportId = new Map<string, ExtractionStates>();
|
|
37
|
+
const stateByRunId = new Map<string, ExtractorState>();
|
|
38
|
+
|
|
39
|
+
for (const reportId of reportIds) {
|
|
40
|
+
const runs = this._reportRunIds.get(reportId);
|
|
41
|
+
if (!runs) {
|
|
42
|
+
stateByReportId.set(reportId, ExtractionStates.None);
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const states: ExtractorState[] = [];
|
|
47
|
+
for (const runId of runs) {
|
|
48
|
+
const state = stateByRunId.get(runId);
|
|
49
|
+
if (state) {
|
|
50
|
+
states.push(state);
|
|
51
|
+
} else {
|
|
52
|
+
const runState = await this.getSingleState(runId, await this._accessToken());
|
|
53
|
+
states.push(runState);
|
|
54
|
+
stateByRunId.set(runId, runState);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const finalState = BulkExtractor.getFinalState(states);
|
|
58
|
+
stateByReportId.set(reportId, finalState);
|
|
59
|
+
}
|
|
60
|
+
return stateByReportId;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
private async fetchStates(): Promise<void> {
|
|
64
|
+
this._reportStates = await this.getStates(this._reportIds);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
public getState(reportId: string): ExtractionStates {
|
|
68
|
+
if ((new Date().getTime() - this._timeFetched.getTime()) > STATUS_CHECK_INTERVAL) {
|
|
69
|
+
this._timeFetched = new Date();
|
|
70
|
+
this.fetchStates().catch((e) =>
|
|
71
|
+
/* eslint-disable no-console */
|
|
72
|
+
console.error(e)
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
return this._reportStates.get(reportId) ?? ExtractionStates.None;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
public clearJob(reportId: string): void {
|
|
79
|
+
this._reportRunIds.delete(reportId);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
private static getFinalState(states: ExtractorState[]): ExtractionStates {
|
|
83
|
+
if (states.includes(ExtractorState.Failed))
|
|
84
|
+
return ExtractionStates.Failed;
|
|
85
|
+
|
|
86
|
+
if (states.includes(ExtractorState.Queued))
|
|
87
|
+
return ExtractionStates.Queued;
|
|
88
|
+
|
|
89
|
+
if (states.includes(ExtractorState.Running))
|
|
90
|
+
return ExtractionStates.Running;
|
|
91
|
+
|
|
92
|
+
if (states.includes(ExtractorState.Succeeded))
|
|
93
|
+
return ExtractionStates.Succeeded;
|
|
94
|
+
|
|
95
|
+
return ExtractionStates.Failed;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
private async getSingleState(runId: string, accessToken: string): Promise<ExtractorState> {
|
|
99
|
+
try {
|
|
100
|
+
const response = await this._extractionClientApi.getExtractionStatus(accessToken, runId);
|
|
101
|
+
return response.state;
|
|
102
|
+
} catch (error: any) {
|
|
103
|
+
handleError(error.status);
|
|
104
|
+
}
|
|
105
|
+
return ExtractorState.Failed;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
public async startJobs(reportIds: string[]): Promise<void> {
|
|
109
|
+
const reportIModelIds = new Map<string, string[]>();
|
|
110
|
+
for (const reportId of reportIds) {
|
|
111
|
+
const reportIModels = await this.fetchReportIModels(reportId);
|
|
112
|
+
reportIModelIds.set(reportId, reportIModels);
|
|
113
|
+
this._reportStates.set(reportId, ExtractionStates.Starting);
|
|
114
|
+
}
|
|
115
|
+
const iModels = new Set(Array.from(reportIModelIds.values()).flat());
|
|
116
|
+
const extractionMapPromise =
|
|
117
|
+
Array.from(iModels).map(async (iModel): Promise<[string, string | undefined]> => {
|
|
118
|
+
const run = await this.runExtraction(iModel);
|
|
119
|
+
return [iModel, run];
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
const extractionMap = await Promise.all(extractionMapPromise);
|
|
123
|
+
const extractionByIModel = new Map<string, string | undefined>(extractionMap);
|
|
124
|
+
reportIds.forEach((reportId) => {
|
|
125
|
+
const reportIModels = reportIModelIds.get(reportId)!;
|
|
126
|
+
const runs: string[] = [];
|
|
127
|
+
reportIModels.forEach((iModelId) => {
|
|
128
|
+
const runId = extractionByIModel.get(iModelId);
|
|
129
|
+
if (runId)
|
|
130
|
+
runs.push(runId);
|
|
131
|
+
});
|
|
132
|
+
this._reportRunIds.set(reportId, runs);
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
private async runExtraction(iModelId: string): Promise<string | undefined> {
|
|
137
|
+
try {
|
|
138
|
+
const response = await this._extractionClientApi.runExtraction(
|
|
139
|
+
await this._accessToken(),
|
|
140
|
+
iModelId
|
|
141
|
+
);
|
|
142
|
+
return response.id;
|
|
143
|
+
} catch (error: any) {
|
|
144
|
+
handleError(error.status);
|
|
145
|
+
}
|
|
146
|
+
return undefined;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
private async fetchReportIModels(reportId: string): Promise<string[]> {
|
|
150
|
+
const reportMappings = await this._reportsClientApi.getReportMappings(
|
|
151
|
+
await this._accessToken(),
|
|
152
|
+
reportId
|
|
153
|
+
);
|
|
154
|
+
return reportMappings.map((x) => x.imodelId);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
export const STATUS_CHECK_INTERVAL = 5000;
|
|
6
|
+
export const ANIMATION_DELAY = "5s";
|
|
7
|
+
export const ANIMATION_DURATION = "1s";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import React from "react";
|
|
6
|
+
import { SvgStatusError } from "@itwin/itwinui-icons-color-react";
|
|
7
|
+
import { ReportsConfigWidget } from "../../../ReportsConfigWidget";
|
|
8
|
+
import { ANIMATION_DELAY, ANIMATION_DURATION } from "../Constants";
|
|
9
|
+
|
|
10
|
+
interface ExtractionStateProps {
|
|
11
|
+
animation: boolean;
|
|
12
|
+
onAnimationEnd: () => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const FailedExtractionState = ({ animation, onAnimationEnd }: ExtractionStateProps) => (
|
|
16
|
+
<div
|
|
17
|
+
title={ReportsConfigWidget.localization.getLocalizedString(
|
|
18
|
+
"ReportsConfigWidget:Failed"
|
|
19
|
+
)}
|
|
20
|
+
className="rcw-extraction-status"
|
|
21
|
+
>
|
|
22
|
+
<div
|
|
23
|
+
className={`rcw-status-icon`}
|
|
24
|
+
style={{
|
|
25
|
+
animationName: animation ? "rcw-fade-out" : "",
|
|
26
|
+
animationDelay: ANIMATION_DELAY,
|
|
27
|
+
animationDuration: ANIMATION_DURATION,
|
|
28
|
+
}}
|
|
29
|
+
onAnimationEnd={onAnimationEnd}
|
|
30
|
+
>
|
|
31
|
+
<SvgStatusError />
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import React from "react";
|
|
6
|
+
import { SvgStatusPending } from "@itwin/itwinui-icons-color-react";
|
|
7
|
+
import { ReportsConfigWidget } from "../../../ReportsConfigWidget";
|
|
8
|
+
|
|
9
|
+
export const QueuedExtractionState = () => (
|
|
10
|
+
<div
|
|
11
|
+
title={ReportsConfigWidget.localization.getLocalizedString(
|
|
12
|
+
"ReportsConfigWidget:Queued"
|
|
13
|
+
)}
|
|
14
|
+
className="rcw-extraction-status"
|
|
15
|
+
>
|
|
16
|
+
<div className="rcw-status-icon">
|
|
17
|
+
<SvgStatusPending />
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import React from "react";
|
|
6
|
+
import { ProgressRadial } from "@itwin/itwinui-react";
|
|
7
|
+
import { ReportsConfigWidget } from "../../../ReportsConfigWidget";
|
|
8
|
+
|
|
9
|
+
export const RunningExtractionState = () => (
|
|
10
|
+
<div
|
|
11
|
+
title={ReportsConfigWidget.localization.getLocalizedString(
|
|
12
|
+
"ReportsConfigWidget:Running"
|
|
13
|
+
)}
|
|
14
|
+
className="rcw-extraction-status"
|
|
15
|
+
>
|
|
16
|
+
<ProgressRadial size="x-small" indeterminate />
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import React from "react";
|
|
6
|
+
import { SvgStatusPendingHollow } from "@itwin/itwinui-icons-color-react";
|
|
7
|
+
import { ReportsConfigWidget } from "../../../ReportsConfigWidget";
|
|
8
|
+
|
|
9
|
+
export const StartingExtractionState = () => (
|
|
10
|
+
<div
|
|
11
|
+
title={
|
|
12
|
+
ReportsConfigWidget.localization.getLocalizedString(
|
|
13
|
+
"ReportsConfigWidget:Starting"
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
className="rcw-extraction-status"
|
|
17
|
+
>
|
|
18
|
+
<div className="rcw-status-icon">
|
|
19
|
+
<SvgStatusPendingHollow />
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import React from "react";
|
|
6
|
+
import { SvgStatusSuccess } from "@itwin/itwinui-icons-color-react";
|
|
7
|
+
import { ReportsConfigWidget } from "../../../ReportsConfigWidget";
|
|
8
|
+
import { ANIMATION_DELAY, ANIMATION_DURATION } from "../Constants";
|
|
9
|
+
|
|
10
|
+
interface ExtractionStateProps {
|
|
11
|
+
animation: boolean;
|
|
12
|
+
onAnimationEnd: () => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const SucceededExtractionState = ({ animation, onAnimationEnd }: ExtractionStateProps) => (
|
|
16
|
+
<div
|
|
17
|
+
title={ReportsConfigWidget.localization.getLocalizedString(
|
|
18
|
+
"ReportsConfigWidget:Success"
|
|
19
|
+
)}
|
|
20
|
+
className="rcw-extraction-status"
|
|
21
|
+
>
|
|
22
|
+
<div
|
|
23
|
+
className={`rcw-status-icon`}
|
|
24
|
+
style={{
|
|
25
|
+
animationName: animation ? "rcw-fade-out" : "",
|
|
26
|
+
animationDelay: ANIMATION_DELAY,
|
|
27
|
+
animationDuration: ANIMATION_DURATION,
|
|
28
|
+
}}
|
|
29
|
+
onAnimationEnd={onAnimationEnd}
|
|
30
|
+
>
|
|
31
|
+
<SvgStatusSuccess />
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
@import "~@itwin/itwinui-css/scss/variables";
|
|
6
|
+
|
|
7
|
+
.rcw-extraction-status {
|
|
8
|
+
align-items: center;
|
|
9
|
+
margin: auto $iui-s * 2;
|
|
10
|
+
height: 38px;
|
|
11
|
+
display: flex;
|
|
12
|
+
|
|
13
|
+
.rcw-status-icon {
|
|
14
|
+
width: $iui-icons-default;
|
|
15
|
+
height: $iui-icons-default;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@keyframes rcw-fade-out {
|
|
20
|
+
0% {
|
|
21
|
+
opacity: 1;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
100% {
|
|
25
|
+
opacity: 0;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { useEffect, useState } from "react";
|
|
7
|
+
import "./ExtractionStatus.scss";
|
|
8
|
+
import { STATUS_CHECK_INTERVAL } from "./Constants";
|
|
9
|
+
import { StartingExtractionState } from "./ExtractionStates/StartingExtractionState";
|
|
10
|
+
import { RunningExtractionState } from "./ExtractionStates/RunningExtractionState";
|
|
11
|
+
import { FailedExtractionState } from "./ExtractionStates/FailedExtractionState";
|
|
12
|
+
import { QueuedExtractionState } from "./ExtractionStates/QueuedExtractionState";
|
|
13
|
+
import { SucceededExtractionState } from "./ExtractionStates/SucceededExtractionState";
|
|
14
|
+
|
|
15
|
+
export enum ExtractionStates {
|
|
16
|
+
None,
|
|
17
|
+
Starting,
|
|
18
|
+
Queued,
|
|
19
|
+
Running,
|
|
20
|
+
Succeeded,
|
|
21
|
+
Failed,
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface ExtractionStatusProps {
|
|
25
|
+
state: ExtractionStates;
|
|
26
|
+
clearExtractionState: () => void;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const ExtractionStatus = ({
|
|
30
|
+
state,
|
|
31
|
+
clearExtractionState,
|
|
32
|
+
}: ExtractionStatusProps) => {
|
|
33
|
+
const [fadeOut, setFadeOut] = useState<boolean>(false);
|
|
34
|
+
|
|
35
|
+
const onAnimationEnd = () => {
|
|
36
|
+
clearExtractionState();
|
|
37
|
+
setFadeOut(false);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
let timer: number;
|
|
42
|
+
switch (state) {
|
|
43
|
+
case ExtractionStates.Succeeded:
|
|
44
|
+
case ExtractionStates.Failed:
|
|
45
|
+
timer = window.setTimeout(() => setFadeOut(true), STATUS_CHECK_INTERVAL);
|
|
46
|
+
}
|
|
47
|
+
return () => window.clearTimeout(timer);
|
|
48
|
+
}, [state]);
|
|
49
|
+
|
|
50
|
+
switch (state) {
|
|
51
|
+
case ExtractionStates.Starting:
|
|
52
|
+
return (<StartingExtractionState />);
|
|
53
|
+
case ExtractionStates.Queued:
|
|
54
|
+
return (<QueuedExtractionState />);
|
|
55
|
+
case ExtractionStates.Running:
|
|
56
|
+
return (<RunningExtractionState />);
|
|
57
|
+
case ExtractionStates.Succeeded:
|
|
58
|
+
return (<SucceededExtractionState
|
|
59
|
+
animation={fadeOut}
|
|
60
|
+
onAnimationEnd={onAnimationEnd}
|
|
61
|
+
/>);
|
|
62
|
+
case ExtractionStates.Failed:
|
|
63
|
+
return (<FailedExtractionState
|
|
64
|
+
animation={fadeOut}
|
|
65
|
+
onAnimationEnd={onAnimationEnd}
|
|
66
|
+
/>);
|
|
67
|
+
default:
|
|
68
|
+
return <></>;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
@@ -3,30 +3,50 @@
|
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
@import "~@itwin/itwinui-css/scss/variables";
|
|
6
|
+
@import "~@itwin/itwinui-css/scss/icon/index";
|
|
6
7
|
|
|
7
|
-
.rcw-horizontal-tile
|
|
8
|
-
|
|
9
|
-
justify-content: space-between;
|
|
10
|
-
border-radius: 5px;
|
|
11
|
-
background-color: var(--iui-color-background-2);
|
|
12
|
-
height: $iui-baseline * 4;
|
|
13
|
-
padding: 5.5px $iui-s;
|
|
14
|
-
.body {
|
|
8
|
+
.rcw-horizontal-tile {
|
|
9
|
+
&-container {
|
|
15
10
|
display: flex;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
11
|
+
justify-content: space-between;
|
|
12
|
+
border-radius: 5px;
|
|
13
|
+
background-color: var(--iui-color-background-2);
|
|
14
|
+
height: $iui-baseline * 4;
|
|
15
|
+
padding: 5.5px $iui-s;
|
|
16
|
+
|
|
17
|
+
.rcw-body-container {
|
|
18
|
+
display: flex;
|
|
19
|
+
min-width: 0;
|
|
20
|
+
|
|
21
|
+
.rcw-body {
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
min-width: 0;
|
|
25
|
+
justify-content: center;
|
|
26
|
+
|
|
27
|
+
&-text {
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
white-space: nowrap;
|
|
30
|
+
text-overflow: ellipsis;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.rcw-action-button {
|
|
36
|
+
margin-left: 0;
|
|
37
|
+
align-self: center;
|
|
38
|
+
min-width: 36px;
|
|
39
|
+
margin-right: $iui-xs;
|
|
40
|
+
flex-shrink: 0;
|
|
23
41
|
}
|
|
24
42
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
43
|
+
|
|
44
|
+
&-selected {
|
|
45
|
+
@include themed {
|
|
46
|
+
border: 1px solid t(iui-color-foreground-primary);
|
|
47
|
+
background: linear-gradient(rgba(t(iui-color-foreground-primary-rgb), t(iui-opacity-6)),
|
|
48
|
+
rgba(t(iui-color-foreground-primary-rgb), t(iui-opacity-6))),
|
|
49
|
+
linear-gradient(t(iui-color-background-1), t(iui-color-background-1));
|
|
50
|
+
}
|
|
31
51
|
}
|
|
32
|
-
}
|
|
52
|
+
}
|