@itwin/reports-config-widget-react 0.0.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 +48 -0
- package/.rush/temp/shrinkwrap-deps.json +868 -0
- package/CHANGELOG.json +17 -0
- package/CHANGELOG.md +11 -0
- package/LICENSE.md +9 -0
- package/README.md +38 -0
- package/__mocks__/fileMock.js +5 -0
- package/coverage/clover.xml +612 -0
- package/coverage/coverage-final.json +19 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +191 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +196 -0
- package/coverage/lcov-report/src/ReportsConfigWidget.ts.html +193 -0
- package/coverage/lcov-report/src/index.html +116 -0
- package/coverage/lcov-report/src/test/index.html +116 -0
- package/coverage/lcov-report/src/test/test-utils.tsx.html +316 -0
- package/coverage/lcov-report/src/widget/ReportsConfigUiProvider.tsx.html +286 -0
- package/coverage/lcov-report/src/widget/components/ActionPanel.tsx.html +253 -0
- package/coverage/lcov-report/src/widget/components/AddMappingsModal.tsx.html +610 -0
- package/coverage/lcov-report/src/widget/components/DeleteModal.tsx.html +385 -0
- package/coverage/lcov-report/src/widget/components/Extraction.tsx.html +1030 -0
- package/coverage/lcov-report/src/widget/components/HorizontalTile.tsx.html +256 -0
- package/coverage/lcov-report/src/widget/components/LocalizedTablePaginator.tsx.html +262 -0
- package/coverage/lcov-report/src/widget/components/ReportAction.tsx.html +523 -0
- package/coverage/lcov-report/src/widget/components/ReportMappings.tsx.html +1135 -0
- package/coverage/lcov-report/src/widget/components/Reports.tsx.html +829 -0
- package/coverage/lcov-report/src/widget/components/ReportsContainer.tsx.html +193 -0
- package/coverage/lcov-report/src/widget/components/SearchBar.tsx.html +271 -0
- package/coverage/lcov-report/src/widget/components/SelectIModel.tsx.html +391 -0
- package/coverage/lcov-report/src/widget/components/index.html +296 -0
- package/coverage/lcov-report/src/widget/components/utils.tsx.html +562 -0
- package/coverage/lcov-report/src/widget/context/ReportsApiConfigContext.tsx.html +166 -0
- package/coverage/lcov-report/src/widget/context/index.html +116 -0
- package/coverage/lcov-report/src/widget/hooks/index.html +116 -0
- package/coverage/lcov-report/src/widget/hooks/useValidator.ts.html +295 -0
- package/coverage/lcov-report/src/widget/index.html +116 -0
- package/coverage/lcov.info +1260 -0
- package/jest.config.js +19 -0
- package/lib/cjs/ReportsConfigWidget.d.ts +10 -0
- package/lib/cjs/ReportsConfigWidget.d.ts.map +1 -0
- package/lib/cjs/ReportsConfigWidget.js +24 -0
- package/lib/cjs/ReportsConfigWidget.js.map +1 -0
- package/lib/cjs/reports-config-widget-react.d.ts +4 -0
- package/lib/cjs/reports-config-widget-react.d.ts.map +1 -0
- package/lib/cjs/reports-config-widget-react.js +20 -0
- package/lib/cjs/reports-config-widget-react.js.map +1 -0
- package/lib/cjs/test/ReportAction.test.d.ts +2 -0
- package/lib/cjs/test/ReportAction.test.d.ts.map +1 -0
- package/lib/cjs/test/ReportAction.test.js +194 -0
- package/lib/cjs/test/ReportAction.test.js.map +1 -0
- package/lib/cjs/test/ReportMappings.test.d.ts +2 -0
- package/lib/cjs/test/ReportMappings.test.d.ts.map +1 -0
- package/lib/cjs/test/ReportMappings.test.js +530 -0
- package/lib/cjs/test/ReportMappings.test.js.map +1 -0
- package/lib/cjs/test/Reports.test.d.ts +2 -0
- package/lib/cjs/test/Reports.test.d.ts.map +1 -0
- package/lib/cjs/test/Reports.test.js +232 -0
- package/lib/cjs/test/Reports.test.js.map +1 -0
- package/lib/cjs/test/WidgetHeader.test.d.ts +2 -0
- package/lib/cjs/test/WidgetHeader.test.d.ts.map +1 -0
- package/lib/cjs/test/WidgetHeader.test.js +30 -0
- package/lib/cjs/test/WidgetHeader.test.js.map +1 -0
- package/lib/cjs/test/test-utils.d.ts +69 -0
- package/lib/cjs/test/test-utils.d.ts.map +1 -0
- package/lib/cjs/test/test-utils.js +77 -0
- package/lib/cjs/test/test-utils.js.map +1 -0
- package/lib/cjs/tsconfig.tsbuildinfo +1 -0
- package/lib/cjs/widget/ReportsConfigUiProvider.d.ts +12 -0
- package/lib/cjs/widget/ReportsConfigUiProvider.d.ts.map +1 -0
- package/lib/cjs/widget/ReportsConfigUiProvider.js +55 -0
- package/lib/cjs/widget/ReportsConfigUiProvider.js.map +1 -0
- package/lib/cjs/widget/components/ActionPanel.d.ts +13 -0
- package/lib/cjs/widget/components/ActionPanel.d.ts.map +1 -0
- package/lib/cjs/widget/components/ActionPanel.js +39 -0
- package/lib/cjs/widget/components/ActionPanel.js.map +1 -0
- package/lib/cjs/widget/components/ActionPanel.scss +12 -0
- package/lib/cjs/widget/components/AddMappingsModal.d.ts +15 -0
- package/lib/cjs/widget/components/AddMappingsModal.d.ts.map +1 -0
- package/lib/cjs/widget/components/AddMappingsModal.js +118 -0
- package/lib/cjs/widget/components/AddMappingsModal.js.map +1 -0
- package/lib/cjs/widget/components/AddMappingsModal.scss +18 -0
- package/lib/cjs/widget/components/DeleteModal.d.ts +12 -0
- package/lib/cjs/widget/components/DeleteModal.d.ts.map +1 -0
- package/lib/cjs/widget/components/DeleteModal.js +65 -0
- package/lib/cjs/widget/components/DeleteModal.js.map +1 -0
- package/lib/cjs/widget/components/DeleteModal.scss +18 -0
- package/lib/cjs/widget/components/Extraction.d.ts +28 -0
- package/lib/cjs/widget/components/Extraction.d.ts.map +1 -0
- package/lib/cjs/widget/components/Extraction.js +193 -0
- package/lib/cjs/widget/components/Extraction.js.map +1 -0
- package/lib/cjs/widget/components/Extraction.scss +39 -0
- package/lib/cjs/widget/components/HorizontalTile.d.ts +13 -0
- package/lib/cjs/widget/components/HorizontalTile.d.ts.map +1 -0
- package/lib/cjs/widget/components/HorizontalTile.js +18 -0
- package/lib/cjs/widget/components/HorizontalTile.js.map +1 -0
- package/lib/cjs/widget/components/HorizontalTile.scss +32 -0
- package/lib/cjs/widget/components/LocalizedTablePaginator.d.ts +4 -0
- package/lib/cjs/widget/components/LocalizedTablePaginator.d.ts.map +1 -0
- package/lib/cjs/widget/components/LocalizedTablePaginator.js +41 -0
- package/lib/cjs/widget/components/LocalizedTablePaginator.js.map +1 -0
- package/lib/cjs/widget/components/ReportAction.d.ts +11 -0
- package/lib/cjs/widget/components/ReportAction.d.ts.map +1 -0
- package/lib/cjs/widget/components/ReportAction.js +101 -0
- package/lib/cjs/widget/components/ReportAction.js.map +1 -0
- package/lib/cjs/widget/components/ReportAction.scss +16 -0
- package/lib/cjs/widget/components/ReportMappings.d.ts +17 -0
- package/lib/cjs/widget/components/ReportMappings.d.ts.map +1 -0
- package/lib/cjs/widget/components/ReportMappings.js +174 -0
- package/lib/cjs/widget/components/ReportMappings.js.map +1 -0
- package/lib/cjs/widget/components/ReportMappings.scss +46 -0
- package/lib/cjs/widget/components/Reports.d.ts +7 -0
- package/lib/cjs/widget/components/Reports.d.ts.map +1 -0
- package/lib/cjs/widget/components/Reports.js +143 -0
- package/lib/cjs/widget/components/Reports.js.map +1 -0
- package/lib/cjs/widget/components/Reports.scss +36 -0
- package/lib/cjs/widget/components/ReportsContainer.d.ts +10 -0
- package/lib/cjs/widget/components/ReportsContainer.d.ts.map +1 -0
- package/lib/cjs/widget/components/ReportsContainer.js +34 -0
- package/lib/cjs/widget/components/ReportsContainer.js.map +1 -0
- package/lib/cjs/widget/components/ReportsContainer.scss +15 -0
- package/lib/cjs/widget/components/SearchBar.d.ts +10 -0
- package/lib/cjs/widget/components/SearchBar.d.ts.map +1 -0
- package/lib/cjs/widget/components/SearchBar.js +50 -0
- package/lib/cjs/widget/components/SearchBar.js.map +1 -0
- package/lib/cjs/widget/components/SearchBar.scss +27 -0
- package/lib/cjs/widget/components/SelectIModel.d.ts +9 -0
- package/lib/cjs/widget/components/SelectIModel.d.ts.map +1 -0
- package/lib/cjs/widget/components/SelectIModel.js +82 -0
- package/lib/cjs/widget/components/SelectIModel.js.map +1 -0
- package/lib/cjs/widget/components/SelectIModel.scss +15 -0
- package/lib/cjs/widget/components/utils.d.ts +23 -0
- package/lib/cjs/widget/components/utils.d.ts.map +1 -0
- package/lib/cjs/widget/components/utils.js +87 -0
- package/lib/cjs/widget/components/utils.js.map +1 -0
- package/lib/cjs/widget/components/utils.scss +39 -0
- package/lib/cjs/widget/context/ReportsApiConfigContext.d.ts +9 -0
- package/lib/cjs/widget/context/ReportsApiConfigContext.d.ts.map +1 -0
- package/lib/cjs/widget/context/ReportsApiConfigContext.js +37 -0
- package/lib/cjs/widget/context/ReportsApiConfigContext.js.map +1 -0
- package/lib/cjs/widget/hooks/useValidator.d.ts +8 -0
- package/lib/cjs/widget/hooks/useValidator.d.ts.map +1 -0
- package/lib/cjs/widget/hooks/useValidator.js +56 -0
- package/lib/cjs/widget/hooks/useValidator.js.map +1 -0
- package/lib/esm/ReportsConfigWidget.d.ts +10 -0
- package/lib/esm/ReportsConfigWidget.d.ts.map +1 -0
- package/lib/esm/ReportsConfigWidget.js +20 -0
- package/lib/esm/ReportsConfigWidget.js.map +1 -0
- package/lib/esm/reports-config-widget-react.d.ts +4 -0
- package/lib/esm/reports-config-widget-react.d.ts.map +1 -0
- package/lib/esm/reports-config-widget-react.js +8 -0
- package/lib/esm/reports-config-widget-react.js.map +1 -0
- package/lib/esm/test/ReportAction.test.d.ts +2 -0
- package/lib/esm/test/ReportAction.test.d.ts.map +1 -0
- package/lib/esm/test/ReportAction.test.js +170 -0
- package/lib/esm/test/ReportAction.test.js.map +1 -0
- package/lib/esm/test/ReportMappings.test.d.ts +2 -0
- package/lib/esm/test/ReportMappings.test.d.ts.map +1 -0
- package/lib/esm/test/ReportMappings.test.js +506 -0
- package/lib/esm/test/ReportMappings.test.js.map +1 -0
- package/lib/esm/test/Reports.test.d.ts +2 -0
- package/lib/esm/test/Reports.test.d.ts.map +1 -0
- package/lib/esm/test/Reports.test.js +208 -0
- package/lib/esm/test/Reports.test.js.map +1 -0
- package/lib/esm/test/WidgetHeader.test.d.ts +2 -0
- package/lib/esm/test/WidgetHeader.test.d.ts.map +1 -0
- package/lib/esm/test/WidgetHeader.test.js +25 -0
- package/lib/esm/test/WidgetHeader.test.js.map +1 -0
- package/lib/esm/test/test-utils.d.ts +69 -0
- package/lib/esm/test/test-utils.d.ts.map +1 -0
- package/lib/esm/test/test-utils.js +48 -0
- package/lib/esm/test/test-utils.js.map +1 -0
- package/lib/esm/tsconfig.tsbuildinfo +1 -0
- package/lib/esm/widget/ReportsConfigUiProvider.d.ts +12 -0
- package/lib/esm/widget/ReportsConfigUiProvider.d.ts.map +1 -0
- package/lib/esm/widget/ReportsConfigUiProvider.js +29 -0
- package/lib/esm/widget/ReportsConfigUiProvider.js.map +1 -0
- package/lib/esm/widget/components/ActionPanel.d.ts +13 -0
- package/lib/esm/widget/components/ActionPanel.d.ts.map +1 -0
- package/lib/esm/widget/components/ActionPanel.js +18 -0
- package/lib/esm/widget/components/ActionPanel.js.map +1 -0
- package/lib/esm/widget/components/ActionPanel.scss +12 -0
- package/lib/esm/widget/components/AddMappingsModal.d.ts +15 -0
- package/lib/esm/widget/components/AddMappingsModal.d.ts.map +1 -0
- package/lib/esm/widget/components/AddMappingsModal.js +94 -0
- package/lib/esm/widget/components/AddMappingsModal.js.map +1 -0
- package/lib/esm/widget/components/AddMappingsModal.scss +18 -0
- package/lib/esm/widget/components/DeleteModal.d.ts +12 -0
- package/lib/esm/widget/components/DeleteModal.d.ts.map +1 -0
- package/lib/esm/widget/components/DeleteModal.js +42 -0
- package/lib/esm/widget/components/DeleteModal.js.map +1 -0
- package/lib/esm/widget/components/DeleteModal.scss +18 -0
- package/lib/esm/widget/components/Extraction.d.ts +28 -0
- package/lib/esm/widget/components/Extraction.d.ts.map +1 -0
- package/lib/esm/widget/components/Extraction.js +169 -0
- package/lib/esm/widget/components/Extraction.js.map +1 -0
- package/lib/esm/widget/components/Extraction.scss +39 -0
- package/lib/esm/widget/components/HorizontalTile.d.ts +13 -0
- package/lib/esm/widget/components/HorizontalTile.d.ts.map +1 -0
- package/lib/esm/widget/components/HorizontalTile.js +11 -0
- package/lib/esm/widget/components/HorizontalTile.js.map +1 -0
- package/lib/esm/widget/components/HorizontalTile.scss +32 -0
- package/lib/esm/widget/components/LocalizedTablePaginator.d.ts +4 -0
- package/lib/esm/widget/components/LocalizedTablePaginator.d.ts.map +1 -0
- package/lib/esm/widget/components/LocalizedTablePaginator.js +18 -0
- package/lib/esm/widget/components/LocalizedTablePaginator.js.map +1 -0
- package/lib/esm/widget/components/ReportAction.d.ts +11 -0
- package/lib/esm/widget/components/ReportAction.d.ts.map +1 -0
- package/lib/esm/widget/components/ReportAction.js +77 -0
- package/lib/esm/widget/components/ReportAction.js.map +1 -0
- package/lib/esm/widget/components/ReportAction.scss +16 -0
- package/lib/esm/widget/components/ReportMappings.d.ts +17 -0
- package/lib/esm/widget/components/ReportMappings.d.ts.map +1 -0
- package/lib/esm/widget/components/ReportMappings.js +148 -0
- package/lib/esm/widget/components/ReportMappings.js.map +1 -0
- package/lib/esm/widget/components/ReportMappings.scss +46 -0
- package/lib/esm/widget/components/Reports.d.ts +7 -0
- package/lib/esm/widget/components/Reports.d.ts.map +1 -0
- package/lib/esm/widget/components/Reports.js +117 -0
- package/lib/esm/widget/components/Reports.js.map +1 -0
- package/lib/esm/widget/components/Reports.scss +36 -0
- package/lib/esm/widget/components/ReportsContainer.d.ts +10 -0
- package/lib/esm/widget/components/ReportsContainer.d.ts.map +1 -0
- package/lib/esm/widget/components/ReportsContainer.js +13 -0
- package/lib/esm/widget/components/ReportsContainer.js.map +1 -0
- package/lib/esm/widget/components/ReportsContainer.scss +15 -0
- package/lib/esm/widget/components/SearchBar.d.ts +10 -0
- package/lib/esm/widget/components/SearchBar.d.ts.map +1 -0
- package/lib/esm/widget/components/SearchBar.js +27 -0
- package/lib/esm/widget/components/SearchBar.js.map +1 -0
- package/lib/esm/widget/components/SearchBar.scss +27 -0
- package/lib/esm/widget/components/SelectIModel.d.ts +9 -0
- package/lib/esm/widget/components/SelectIModel.d.ts.map +1 -0
- package/lib/esm/widget/components/SelectIModel.js +59 -0
- package/lib/esm/widget/components/SelectIModel.js.map +1 -0
- package/lib/esm/widget/components/SelectIModel.scss +15 -0
- package/lib/esm/widget/components/utils.d.ts +23 -0
- package/lib/esm/widget/components/utils.d.ts.map +1 -0
- package/lib/esm/widget/components/utils.js +73 -0
- package/lib/esm/widget/components/utils.js.map +1 -0
- package/lib/esm/widget/components/utils.scss +39 -0
- package/lib/esm/widget/context/ReportsApiConfigContext.d.ts +9 -0
- package/lib/esm/widget/context/ReportsApiConfigContext.d.ts.map +1 -0
- package/lib/esm/widget/context/ReportsApiConfigContext.js +14 -0
- package/lib/esm/widget/context/ReportsApiConfigContext.js.map +1 -0
- package/lib/esm/widget/hooks/useValidator.d.ts +8 -0
- package/lib/esm/widget/hooks/useValidator.d.ts.map +1 -0
- package/lib/esm/widget/hooks/useValidator.js +50 -0
- package/lib/esm/widget/hooks/useValidator.js.map +1 -0
- package/lib/public/locales/en/ReportsConfigWidget.json +76 -0
- package/package.json +124 -0
- package/public/locales/en/ReportsConfigWidget.json +76 -0
- package/reports-config-widget-react.build.error.log +10 -0
- package/reports-config-widget-react.build.log +45 -0
- package/src/ReportsConfigWidget.ts +36 -0
- package/src/reports-config-widget-react.ts +7 -0
- package/src/test/ReportAction.test.tsx +258 -0
- package/src/test/ReportMappings.test.tsx +882 -0
- package/src/test/Reports.test.tsx +365 -0
- package/src/test/WidgetHeader.test.tsx +29 -0
- package/src/test/test-utils.tsx +77 -0
- package/src/widget/ReportsConfigUiProvider.tsx +67 -0
- package/src/widget/components/ActionPanel.scss +12 -0
- package/src/widget/components/ActionPanel.tsx +56 -0
- package/src/widget/components/AddMappingsModal.scss +18 -0
- package/src/widget/components/AddMappingsModal.tsx +175 -0
- package/src/widget/components/DeleteModal.scss +18 -0
- package/src/widget/components/DeleteModal.tsx +100 -0
- package/src/widget/components/Extraction.scss +39 -0
- package/src/widget/components/Extraction.tsx +315 -0
- package/src/widget/components/HorizontalTile.scss +32 -0
- package/src/widget/components/HorizontalTile.tsx +57 -0
- package/src/widget/components/LocalizedTablePaginator.tsx +59 -0
- package/src/widget/components/ReportAction.scss +16 -0
- package/src/widget/components/ReportAction.tsx +146 -0
- package/src/widget/components/ReportMappings.scss +46 -0
- package/src/widget/components/ReportMappings.tsx +350 -0
- package/src/widget/components/Reports.scss +36 -0
- package/src/widget/components/Reports.tsx +248 -0
- package/src/widget/components/ReportsContainer.scss +15 -0
- package/src/widget/components/ReportsContainer.tsx +36 -0
- package/src/widget/components/SearchBar.scss +27 -0
- package/src/widget/components/SearchBar.tsx +62 -0
- package/src/widget/components/SelectIModel.scss +15 -0
- package/src/widget/components/SelectIModel.tsx +102 -0
- package/src/widget/components/utils.scss +39 -0
- package/src/widget/components/utils.tsx +159 -0
- package/src/widget/context/ReportsApiConfigContext.tsx +27 -0
- package/src/widget/hooks/useValidator.ts +70 -0
- package/tsconfig.json +11 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.ReportMappings = void 0;
|
|
26
|
+
/*---------------------------------------------------------------------------------------------
|
|
27
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
28
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
29
|
+
*--------------------------------------------------------------------------------------------*/
|
|
30
|
+
const itwinui_icons_react_1 = require("@itwin/itwinui-icons-react");
|
|
31
|
+
const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
32
|
+
const react_1 = __importStar(require("react"));
|
|
33
|
+
const utils_1 = require("./utils");
|
|
34
|
+
require("./ReportMappings.scss");
|
|
35
|
+
const DeleteModal_1 = __importDefault(require("./DeleteModal"));
|
|
36
|
+
const insights_client_1 = require("@itwin/insights-client");
|
|
37
|
+
const AddMappingsModal_1 = __importDefault(require("./AddMappingsModal"));
|
|
38
|
+
const imodels_client_management_1 = require("@itwin/imodels-client-management");
|
|
39
|
+
const imodels_access_frontend_1 = require("@itwin/imodels-access-frontend");
|
|
40
|
+
const HorizontalTile_1 = require("./HorizontalTile");
|
|
41
|
+
const Extraction_1 = require("./Extraction");
|
|
42
|
+
const SearchBar_1 = require("./SearchBar");
|
|
43
|
+
const ReportsApiConfigContext_1 = require("../context/ReportsApiConfigContext");
|
|
44
|
+
const ReportsConfigWidget_1 = require("../../ReportsConfigWidget");
|
|
45
|
+
var ReportMappingsView;
|
|
46
|
+
(function (ReportMappingsView) {
|
|
47
|
+
ReportMappingsView["REPORTMAPPINGS"] = "reportmappings";
|
|
48
|
+
ReportMappingsView["ADDING"] = "adding";
|
|
49
|
+
})(ReportMappingsView || (ReportMappingsView = {}));
|
|
50
|
+
const fetchReportMappings = async (setReportMappings, reportId, setIsLoading, apiContext) => {
|
|
51
|
+
var _a;
|
|
52
|
+
try {
|
|
53
|
+
setIsLoading(true);
|
|
54
|
+
const reportingClientApi = new insights_client_1.ReportingClient(utils_1.generateUrl(insights_client_1.REPORTING_BASE_PATH, apiContext.baseUrl));
|
|
55
|
+
const accessToken = await apiContext.getAccessToken();
|
|
56
|
+
const reportMappings = await reportingClientApi.getReportMappings(accessToken, reportId);
|
|
57
|
+
const iModelClientOptions = {
|
|
58
|
+
api: { baseUrl: utils_1.generateUrl(imodels_client_management_1.Constants.api.baseUrl, apiContext.baseUrl) },
|
|
59
|
+
};
|
|
60
|
+
const iModelsClient = new imodels_client_management_1.IModelsClient(iModelClientOptions);
|
|
61
|
+
const authorization = imodels_access_frontend_1.AccessTokenAdapter.toAuthorizationCallback(accessToken);
|
|
62
|
+
const iModelNames = new Map();
|
|
63
|
+
const reportMappingsAndMapping = await Promise.all((_a = reportMappings === null || reportMappings === void 0 ? void 0 : reportMappings.map(async (reportMapping) => {
|
|
64
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
65
|
+
const iModelId = (_a = reportMapping.imodelId) !== null && _a !== void 0 ? _a : "";
|
|
66
|
+
let iModelName = "";
|
|
67
|
+
const mapping = await reportingClientApi.getMapping(accessToken, (_b = reportMapping.mappingId) !== null && _b !== void 0 ? _b : "", iModelId);
|
|
68
|
+
if (iModelNames.has(iModelId)) {
|
|
69
|
+
iModelName = (_c = iModelNames.get(iModelId)) !== null && _c !== void 0 ? _c : "";
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
const getSingleParams = {
|
|
73
|
+
authorization,
|
|
74
|
+
iModelId,
|
|
75
|
+
};
|
|
76
|
+
const iModel = await iModelsClient.iModels.getSingle(getSingleParams);
|
|
77
|
+
iModelName = iModel.displayName;
|
|
78
|
+
iModelNames.set(iModelId, iModelName);
|
|
79
|
+
}
|
|
80
|
+
const reportMappingAndMapping = {
|
|
81
|
+
...reportMapping,
|
|
82
|
+
iModelName,
|
|
83
|
+
mappingName: (_e = (_d = mapping.mapping) === null || _d === void 0 ? void 0 : _d.mappingName) !== null && _e !== void 0 ? _e : "",
|
|
84
|
+
mappingDescription: (_g = (_f = mapping.mapping) === null || _f === void 0 ? void 0 : _f.description) !== null && _g !== void 0 ? _g : "",
|
|
85
|
+
};
|
|
86
|
+
return reportMappingAndMapping;
|
|
87
|
+
})) !== null && _a !== void 0 ? _a : []);
|
|
88
|
+
setReportMappings(reportMappingsAndMapping);
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
utils_1.handleError(error.status);
|
|
92
|
+
}
|
|
93
|
+
finally {
|
|
94
|
+
setIsLoading(false);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
const ReportMappings = ({ report, goBack }) => {
|
|
98
|
+
var _a, _b, _c;
|
|
99
|
+
const apiConfig = ReportsApiConfigContext_1.useReportsApiConfig();
|
|
100
|
+
const [reportMappingsView, setReportMappingsView] = react_1.useState(ReportMappingsView.REPORTMAPPINGS);
|
|
101
|
+
const [selectedReportMapping, setSelectedReportMapping] = react_1.useState(undefined);
|
|
102
|
+
const [showDeleteModal, setShowDeleteModal] = react_1.useState(false);
|
|
103
|
+
const [isLoading, setIsLoading] = react_1.useState(true);
|
|
104
|
+
const [extractionState, setExtractionState] = react_1.useState(Extraction_1.ExtractionStates.None);
|
|
105
|
+
const [runningIModelId, setRunningIModelId] = react_1.useState("");
|
|
106
|
+
const [searchValue, setSearchValue] = react_1.useState("");
|
|
107
|
+
const [reportMappings, setReportMappings] = react_1.useState([]);
|
|
108
|
+
react_1.useEffect(() => {
|
|
109
|
+
var _a;
|
|
110
|
+
void fetchReportMappings(setReportMappings, (_a = report.id) !== null && _a !== void 0 ? _a : "", setIsLoading, apiConfig);
|
|
111
|
+
}, [apiConfig, report.id, setIsLoading]);
|
|
112
|
+
const refresh = react_1.useCallback(async () => {
|
|
113
|
+
var _a;
|
|
114
|
+
setReportMappingsView(ReportMappingsView.REPORTMAPPINGS);
|
|
115
|
+
await fetchReportMappings(setReportMappings, (_a = report.id) !== null && _a !== void 0 ? _a : "", setIsLoading, apiConfig);
|
|
116
|
+
}, [apiConfig, report.id, setReportMappings]);
|
|
117
|
+
const addMapping = () => {
|
|
118
|
+
setReportMappingsView(ReportMappingsView.ADDING);
|
|
119
|
+
};
|
|
120
|
+
const uniqueIModels = react_1.useMemo(() => new Map(reportMappings.map((mapping) => {
|
|
121
|
+
var _a;
|
|
122
|
+
return [
|
|
123
|
+
(_a = mapping.imodelId) !== null && _a !== void 0 ? _a : "",
|
|
124
|
+
mapping.iModelName,
|
|
125
|
+
];
|
|
126
|
+
})), [reportMappings]);
|
|
127
|
+
const odataFeedUrl = `${utils_1.generateUrl(insights_client_1.REPORTING_BASE_PATH, apiConfig.baseUrl)}/odata/${report.id}`;
|
|
128
|
+
const filteredReportMappings = react_1.useMemo(() => reportMappings.filter((x) => [x.iModelName, x.mappingName, x.mappingDescription]
|
|
129
|
+
.join(" ")
|
|
130
|
+
.toLowerCase()
|
|
131
|
+
.includes(searchValue.toLowerCase())), [reportMappings, searchValue]);
|
|
132
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
133
|
+
react_1.default.createElement(utils_1.WidgetHeader, { title: (_a = report.displayName) !== null && _a !== void 0 ? _a : "", returnFn: goBack }),
|
|
134
|
+
react_1.default.createElement("div", { className: "report-mapping-misc" },
|
|
135
|
+
react_1.default.createElement(itwinui_react_1.LabeledInput, { label: ReportsConfigWidget_1.ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:ODataFeedURL"), className: "odata-url-input", readOnly: true, value: odataFeedUrl, svgIcon: react_1.default.createElement(itwinui_react_1.IconButton, { title: ReportsConfigWidget_1.ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:Copy"), styleType: "borderless", onClick: async (_) => {
|
|
136
|
+
await navigator.clipboard.writeText(odataFeedUrl);
|
|
137
|
+
itwinui_react_1.toaster.positive(ReportsConfigWidget_1.ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:CopiedToClipboard"));
|
|
138
|
+
} },
|
|
139
|
+
react_1.default.createElement(itwinui_icons_react_1.SvgCopy, null)), iconDisplayStyle: "inline" }),
|
|
140
|
+
react_1.default.createElement(Extraction_1.Extraction, { iModels: uniqueIModels, extractionState: extractionState, setExtractionState: setExtractionState, setExtractingIModelId: setRunningIModelId, isLoading: isLoading })),
|
|
141
|
+
react_1.default.createElement(itwinui_react_1.Surface, { className: "report-mappings-container" },
|
|
142
|
+
react_1.default.createElement("div", { className: "toolbar" },
|
|
143
|
+
react_1.default.createElement(itwinui_react_1.Button, { startIcon: react_1.default.createElement(itwinui_icons_react_1.SvgAdd, null), onClick: () => addMapping(), styleType: "high-visibility" }, ReportsConfigWidget_1.ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:AddMapping")),
|
|
144
|
+
react_1.default.createElement("div", { className: "search-bar-container", "data-testid": "search-bar" },
|
|
145
|
+
react_1.default.createElement(SearchBar_1.SearchBar, { searchValue: searchValue, setSearchValue: setSearchValue, disabled: isLoading }))),
|
|
146
|
+
isLoading ? (react_1.default.createElement(utils_1.LoadingOverlay, null)) : reportMappings.length === 0 ? (react_1.default.createElement(utils_1.EmptyMessage, null,
|
|
147
|
+
react_1.default.createElement(react_1.default.Fragment, null,
|
|
148
|
+
react_1.default.createElement(itwinui_react_1.Text, null, ReportsConfigWidget_1.ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:NoReportMappings")),
|
|
149
|
+
react_1.default.createElement("div", null,
|
|
150
|
+
react_1.default.createElement(itwinui_react_1.Button, { onClick: () => addMapping(), styleType: "cta" }, ReportsConfigWidget_1.ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:LetsAddSomeMappingsCTA")))))) : (react_1.default.createElement("div", { className: "mapping-list" }, filteredReportMappings.map((mapping) => (react_1.default.createElement(HorizontalTile_1.HorizontalTile, { key: mapping.mappingId, title: mapping.mappingName, subText: mapping.iModelName, titleTooltip: mapping.mappingDescription, button: react_1.default.createElement(Extraction_1.ExtractionStatus, { state: mapping.imodelId === runningIModelId
|
|
151
|
+
? extractionState
|
|
152
|
+
: Extraction_1.ExtractionStates.None },
|
|
153
|
+
react_1.default.createElement(itwinui_react_1.DropdownMenu, { menuItems: (close) => [
|
|
154
|
+
react_1.default.createElement(itwinui_react_1.MenuItem, { key: 0, onClick: () => {
|
|
155
|
+
setSelectedReportMapping(mapping);
|
|
156
|
+
setShowDeleteModal(true);
|
|
157
|
+
close();
|
|
158
|
+
}, icon: react_1.default.createElement(itwinui_icons_react_1.SvgDelete, null) }, ReportsConfigWidget_1.ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:Remove")),
|
|
159
|
+
] },
|
|
160
|
+
react_1.default.createElement(itwinui_react_1.IconButton, { styleType: "borderless" },
|
|
161
|
+
react_1.default.createElement(itwinui_icons_react_1.SvgMore, { style: {
|
|
162
|
+
width: "16px",
|
|
163
|
+
height: "16px",
|
|
164
|
+
} })))) })))))),
|
|
165
|
+
react_1.default.createElement(AddMappingsModal_1.default, { show: reportMappingsView === ReportMappingsView.ADDING, reportId: (_b = report.id) !== null && _b !== void 0 ? _b : "", existingMappings: reportMappings, returnFn: refresh }),
|
|
166
|
+
react_1.default.createElement(DeleteModal_1.default, { entityName: (_c = selectedReportMapping === null || selectedReportMapping === void 0 ? void 0 : selectedReportMapping.mappingName) !== null && _c !== void 0 ? _c : "", show: showDeleteModal, setShow: setShowDeleteModal, onDelete: async () => {
|
|
167
|
+
var _a, _b;
|
|
168
|
+
const reportingClientApi = new insights_client_1.ReportingClient(utils_1.generateUrl(insights_client_1.REPORTING_BASE_PATH, apiConfig.baseUrl));
|
|
169
|
+
const accessToken = await apiConfig.getAccessToken();
|
|
170
|
+
await reportingClientApi.deleteReportMapping(accessToken, (_a = report.id) !== null && _a !== void 0 ? _a : "", (_b = selectedReportMapping === null || selectedReportMapping === void 0 ? void 0 : selectedReportMapping.mappingId) !== null && _b !== void 0 ? _b : "");
|
|
171
|
+
}, refresh: refresh })));
|
|
172
|
+
};
|
|
173
|
+
exports.ReportMappings = ReportMappings;
|
|
174
|
+
//# sourceMappingURL=ReportMappings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReportMappings.js","sourceRoot":"","sources":["../../../../src/widget/components/ReportMappings.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,oEAKoC;AACpC,wDAS8B;AAC9B,+CAAyE;AAEzE,mCAMiB;AACjB,iCAA+B;AAC/B,gEAAwC;AAExC,4DAA8E;AAC9E,0EAAkD;AAKlD,gFAA4E;AAC5E,4EAAoE;AACpE,qDAAkD;AAClD,6CAA8E;AAC9E,2CAAwC;AAExC,gFAAyE;AACzE,mEAAgE;AAUhE,IAAK,kBAGJ;AAHD,WAAK,kBAAkB;IACrB,uDAAiC,CAAA;IACjC,uCAAiB,CAAA;AACnB,CAAC,EAHI,kBAAkB,KAAlB,kBAAkB,QAGtB;AAED,MAAM,mBAAmB,GAAG,KAAK,EAC/B,iBAEC,EACD,QAAgB,EAChB,YAA2D,EAC3D,UAA4B,EAC5B,EAAE;;IACF,IAAI;QACF,YAAY,CAAC,IAAI,CAAC,CAAC;QACnB,MAAM,kBAAkB,GAAG,IAAI,iCAAe,CAC5C,mBAAW,CAAC,qCAAmB,EAAE,UAAU,CAAC,OAAO,CAAC,CACrD,CAAC;QACF,MAAM,WAAW,GAAG,MAAM,UAAU,CAAC,cAAc,EAAE,CAAC;QACtD,MAAM,cAAc,GAAG,MAAM,kBAAkB,CAAC,iBAAiB,CAC/D,WAAW,EACX,QAAQ,CACT,CAAC;QACF,MAAM,mBAAmB,GAAyB;YAChD,GAAG,EAAE,EAAE,OAAO,EAAE,mBAAW,CAAC,qCAAS,CAAC,GA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gCACV,CAAC,EACD,IAAI,EAAE,8BAAC,+BAAS,OAAG,IAElB,yCAAmB,CAAC,YAAY,CAAC,kBAAkB,CAClD,4BAA4B,CAC7B,CACQ;yBACZ;wBAED,8BAAC,0BAAU,IAAC,SAAS,EAAC,YAAY;4BAChC,8BAAC,6BAAO,IACN,KAAK,EAAE;oCACL,KAAK,EAAE,MAAM;oCACb,MAAM,EAAE,MAAM;iCACf,GACD,CACS,CACA,CACE,GAErB,CACH,CAAC,CACE,CACP,CACO;QACV,8BAAC,0BAAgB,IACf,IAAI,EAAE,kBAAkB,KAAK,kBAAkB,CAAC,MAAM,EACtD,QAAQ,EAAE,MAAA,MAAM,CAAC,EAAE,mCAAI,EAAE,EACzB,gBAAgB,EAAE,cAAc,EAChC,QAAQ,EAAE,OAAO,GACjB;QACF,8BAAC,qBAAW,IACV,UAAU,EAAE,MAAA,qBAAqB,aAArB,qBAAqB,uBAArB,qBAAqB,CAAE,WAAW,mCAAI,EAAE,EACpD,IAAI,EAAE,eAAe,EACrB,OAAO,EAAE,kBAAkB,EAC3B,QAAQ,EAAE,KAAK,IAAI,EAAE;;gBACnB,MAAM,kBAAkB,GAAG,IAAI,iCAAe,CAC5C,mBAAW,CAAC,qCAAmB,EAAE,SAAS,CAAC,OAAO,CAAC,CACpD,CAAC;gBACF,MAAM,WAAW,GAAG,MAAM,SAAS,CAAC,cAAc,EAAE,CAAC;gBACrD,MAAM,kBAAkB,CAAC,mBAAmB,CAC1C,WAAW,EACX,MAAA,MAAM,CAAC,EAAE,mCAAI,EAAE,EACf,MAAA,qBAAqB,aAArB,qBAAqB,uBAArB,qBAAqB,CAAE,SAAS,mCAAI,EAAE,CACvC,CAAC;YACJ,CAAC,EACD,OAAO,EAAE,OAAO,GAChB,CACD,CACJ,CAAC;AACJ,CAAC,CAAC;AA5NW,QAAA,cAAc,kBA4NzB","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 {\n SvgAdd,\n SvgCopy,\n SvgDelete,\n SvgMore,\n} from \"@itwin/itwinui-icons-react\";\nimport {\n Button,\n DropdownMenu,\n IconButton,\n LabeledInput,\n MenuItem,\n Surface,\n Text,\n toaster,\n} from \"@itwin/itwinui-react\";\nimport React, { useCallback, useEffect, useMemo, useState } from \"react\";\nimport type { CreateTypeFromInterface } from \"./utils\";\nimport {\n EmptyMessage,\n generateUrl,\n handleError,\n LoadingOverlay,\n WidgetHeader,\n} from \"./utils\";\nimport \"./ReportMappings.scss\";\nimport DeleteModal from \"./DeleteModal\";\nimport type { Report, ReportMapping } from \"@itwin/insights-client\";\nimport { REPORTING_BASE_PATH, ReportingClient } from \"@itwin/insights-client\";\nimport AddMappingsModal from \"./AddMappingsModal\";\nimport type {\n GetSingleIModelParams,\n IModelsClientOptions,\n} from \"@itwin/imodels-client-management\";\nimport { Constants, IModelsClient } from \"@itwin/imodels-client-management\";\nimport { AccessTokenAdapter } from \"@itwin/imodels-access-frontend\";\nimport { HorizontalTile } from \"./HorizontalTile\";\nimport { Extraction, ExtractionStates, ExtractionStatus } from \"./Extraction\";\nimport { SearchBar } from \"./SearchBar\";\nimport type { ReportsApiConfig } from \"../context/ReportsApiConfigContext\";\nimport { useReportsApiConfig } from \"../context/ReportsApiConfigContext\";\nimport { ReportsConfigWidget } from \"../../ReportsConfigWidget\";\n\nexport type ReportMappingType = CreateTypeFromInterface<ReportMapping>;\n\nexport type ReportMappingAndMapping = ReportMappingType & {\n mappingName: string;\n mappingDescription: string;\n iModelName: string;\n};\n\nenum ReportMappingsView {\n REPORTMAPPINGS = \"reportmappings\",\n ADDING = \"adding\",\n}\n\nconst fetchReportMappings = async (\n setReportMappings: React.Dispatch<\n React.SetStateAction<ReportMappingAndMapping[]>\n >,\n reportId: string,\n setIsLoading: React.Dispatch<React.SetStateAction<boolean>>,\n apiContext: ReportsApiConfig\n) => {\n try {\n setIsLoading(true);\n const reportingClientApi = new ReportingClient(\n generateUrl(REPORTING_BASE_PATH, apiContext.baseUrl)\n );\n const accessToken = await apiContext.getAccessToken();\n const reportMappings = await reportingClientApi.getReportMappings(\n accessToken,\n reportId\n );\n const iModelClientOptions: IModelsClientOptions = {\n api: { baseUrl: generateUrl(Constants.api.baseUrl, apiContext.baseUrl) },\n };\n\n const iModelsClient: IModelsClient = new IModelsClient(iModelClientOptions);\n const authorization =\n AccessTokenAdapter.toAuthorizationCallback(accessToken);\n const iModelNames = new Map<string, string>();\n const reportMappingsAndMapping = await Promise.all(\n reportMappings?.map(async (reportMapping) => {\n const iModelId = reportMapping.imodelId ?? \"\";\n let iModelName = \"\";\n const mapping = await reportingClientApi.getMapping(\n accessToken,\n reportMapping.mappingId ?? \"\",\n iModelId\n );\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.mapping?.mappingName ?? \"\",\n mappingDescription: mapping.mapping?.description ?? \"\",\n };\n return reportMappingAndMapping;\n }) ?? []\n );\n\n setReportMappings(reportMappingsAndMapping);\n } catch (error: any) {\n handleError(error.status);\n } finally {\n setIsLoading(false);\n }\n};\n\ninterface ReportMappingsProps {\n report: Report;\n goBack: () => Promise<void>;\n}\n\nexport const ReportMappings = ({ report, goBack }: ReportMappingsProps) => {\n const apiConfig = useReportsApiConfig();\n const [reportMappingsView, setReportMappingsView] =\n useState<ReportMappingsView>(ReportMappingsView.REPORTMAPPINGS);\n const [selectedReportMapping, setSelectedReportMapping] = useState<\n ReportMappingAndMapping | undefined\n >(undefined);\n const [showDeleteModal, setShowDeleteModal] = useState<boolean>(false);\n const [isLoading, setIsLoading] = useState<boolean>(true);\n\n const [extractionState, setExtractionState] = useState<ExtractionStates>(\n ExtractionStates.None\n );\n const [runningIModelId, setRunningIModelId] = useState<string>(\"\");\n const [searchValue, setSearchValue] = useState<string>(\"\");\n const [reportMappings, setReportMappings] = useState<\n ReportMappingAndMapping[]\n >([]);\n\n useEffect(() => {\n void fetchReportMappings(\n setReportMappings,\n report.id ?? \"\",\n setIsLoading,\n apiConfig\n );\n }, [apiConfig, report.id, setIsLoading]);\n\n const refresh = useCallback(async () => {\n setReportMappingsView(ReportMappingsView.REPORTMAPPINGS);\n await fetchReportMappings(\n setReportMappings,\n report.id ?? \"\",\n setIsLoading,\n apiConfig\n );\n }, [apiConfig, report.id, setReportMappings]);\n\n const addMapping = () => {\n setReportMappingsView(ReportMappingsView.ADDING);\n };\n\n const uniqueIModels = useMemo(\n () =>\n new Map(\n reportMappings.map((mapping) => [\n mapping.imodelId ?? \"\",\n mapping.iModelName,\n ])\n ),\n [reportMappings]\n );\n\n const odataFeedUrl = `${generateUrl(\n REPORTING_BASE_PATH,\n apiConfig.baseUrl\n )}/odata/${report.id}`;\n\n const filteredReportMappings = useMemo(\n () =>\n reportMappings.filter((x) =>\n [x.iModelName, x.mappingName, x.mappingDescription]\n .join(\" \")\n .toLowerCase()\n .includes(searchValue.toLowerCase())\n ),\n [reportMappings, searchValue]\n );\n\n return (\n <>\n <WidgetHeader title={report.displayName ?? \"\"} returnFn={goBack} />\n <div className=\"report-mapping-misc\">\n <LabeledInput\n label={ReportsConfigWidget.localization.getLocalizedString(\n \"ReportsConfigWidget:ODataFeedURL\"\n )}\n className=\"odata-url-input\"\n readOnly={true}\n value={odataFeedUrl}\n svgIcon={\n <IconButton\n title={ReportsConfigWidget.localization.getLocalizedString(\n \"ReportsConfigWidget:Copy\"\n )}\n styleType=\"borderless\"\n onClick={async (_) => {\n await navigator.clipboard.writeText(odataFeedUrl);\n toaster.positive(\n ReportsConfigWidget.localization.getLocalizedString(\n \"ReportsConfigWidget:CopiedToClipboard\"\n )\n );\n }}\n >\n <SvgCopy />\n </IconButton>\n }\n iconDisplayStyle=\"inline\"\n />\n <Extraction\n iModels={uniqueIModels}\n extractionState={extractionState}\n setExtractionState={setExtractionState}\n setExtractingIModelId={setRunningIModelId}\n isLoading={isLoading}\n />\n </div>\n <Surface className=\"report-mappings-container\">\n <div className=\"toolbar\">\n <Button\n startIcon={<SvgAdd />}\n onClick={() => addMapping()}\n styleType=\"high-visibility\"\n >\n {ReportsConfigWidget.localization.getLocalizedString(\n \"ReportsConfigWidget:AddMapping\"\n )}\n </Button>\n <div className=\"search-bar-container\" data-testid=\"search-bar\">\n <SearchBar\n searchValue={searchValue}\n setSearchValue={setSearchValue}\n disabled={isLoading}\n />\n </div>\n </div>\n {isLoading ? (\n <LoadingOverlay />\n ) : reportMappings.length === 0 ? (\n <EmptyMessage>\n <>\n <Text>\n {ReportsConfigWidget.localization.getLocalizedString(\n \"ReportsConfigWidget:NoReportMappings\"\n )}\n </Text>\n <div>\n <Button onClick={() => addMapping()} styleType=\"cta\">\n {ReportsConfigWidget.localization.getLocalizedString(\n \"ReportsConfigWidget:LetsAddSomeMappingsCTA\"\n )}\n </Button>\n </div>\n </>\n </EmptyMessage>\n ) : (\n <div className=\"mapping-list\">\n {filteredReportMappings.map((mapping) => (\n <HorizontalTile\n key={mapping.mappingId}\n title={mapping.mappingName}\n subText={mapping.iModelName}\n titleTooltip={mapping.mappingDescription}\n button={\n <ExtractionStatus\n state={\n mapping.imodelId === runningIModelId\n ? extractionState\n : ExtractionStates.None\n }\n >\n <DropdownMenu\n menuItems={(close: () => void) => [\n <MenuItem\n key={0}\n onClick={() => {\n setSelectedReportMapping(mapping);\n setShowDeleteModal(true);\n close();\n }}\n icon={<SvgDelete />}\n >\n {ReportsConfigWidget.localization.getLocalizedString(\n \"ReportsConfigWidget:Remove\"\n )}\n </MenuItem>,\n ]}\n >\n <IconButton styleType=\"borderless\">\n <SvgMore\n style={{\n width: \"16px\",\n height: \"16px\",\n }}\n />\n </IconButton>\n </DropdownMenu>\n </ExtractionStatus>\n }\n />\n ))}\n </div>\n )}\n </Surface>\n <AddMappingsModal\n show={reportMappingsView === ReportMappingsView.ADDING}\n reportId={report.id ?? \"\"}\n existingMappings={reportMappings}\n returnFn={refresh}\n />\n <DeleteModal\n entityName={selectedReportMapping?.mappingName ?? \"\"}\n show={showDeleteModal}\n setShow={setShowDeleteModal}\n onDelete={async () => {\n const reportingClientApi = new ReportingClient(\n generateUrl(REPORTING_BASE_PATH, apiConfig.baseUrl)\n );\n const accessToken = await apiConfig.getAccessToken();\n await reportingClientApi.deleteReportMapping(\n accessToken,\n report.id ?? \"\",\n selectedReportMapping?.mappingId ?? \"\"\n );\n }}\n refresh={refresh}\n />\n </>\n );\n};\n"]}
|
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
.report-mapping-misc {
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
gap: $iui-baseline;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.report-mappings-container {
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
flex-grow: 1;
|
|
17
|
+
padding: $iui-baseline $iui-m;
|
|
18
|
+
min-height: 0;
|
|
19
|
+
|
|
20
|
+
.odata-url-input {
|
|
21
|
+
margin-bottom: $iui-baseline * 2;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.toolbar {
|
|
25
|
+
display: flex;
|
|
26
|
+
justify-content: space-between;
|
|
27
|
+
gap: $iui-s;
|
|
28
|
+
border-bottom: 1px solid var(--iui-color-background-4);
|
|
29
|
+
padding-bottom: $iui-baseline;
|
|
30
|
+
flex-wrap: wrap;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.mapping-list {
|
|
34
|
+
display: flex;
|
|
35
|
+
flex-direction: column;
|
|
36
|
+
overflow-y: overlay;
|
|
37
|
+
gap: 7.5px;
|
|
38
|
+
margin-top: 7.5px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.search-bar-container {
|
|
42
|
+
flex-basis: $iui-3xl;
|
|
43
|
+
flex-shrink: 1;
|
|
44
|
+
flex-grow: 1;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { CreateTypeFromInterface } from "./utils";
|
|
3
|
+
import "./Reports.scss";
|
|
4
|
+
import type { Report } from "@itwin/insights-client";
|
|
5
|
+
export declare type ReportType = CreateTypeFromInterface<Report>;
|
|
6
|
+
export declare const Reports: () => JSX.Element | null;
|
|
7
|
+
//# sourceMappingURL=Reports.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Reports.d.ts","sourceRoot":"","sources":["../../../../src/widget/components/Reports.tsx"],"names":[],"mappings":";AAkBA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAQvD,OAAO,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAWrD,oBAAY,UAAU,GAAG,uBAAuB,CAAC,MAAM,CAAC,CAAC;AA+BzD,eAAO,MAAM,OAAO,0BAiLnB,CAAC"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.Reports = void 0;
|
|
26
|
+
/*---------------------------------------------------------------------------------------------
|
|
27
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
28
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
29
|
+
*--------------------------------------------------------------------------------------------*/
|
|
30
|
+
const itwinui_icons_react_1 = require("@itwin/itwinui-icons-react");
|
|
31
|
+
const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
32
|
+
const react_1 = __importStar(require("react"));
|
|
33
|
+
const utils_1 = require("./utils");
|
|
34
|
+
require("./Reports.scss");
|
|
35
|
+
const DeleteModal_1 = __importDefault(require("./DeleteModal"));
|
|
36
|
+
const insights_client_1 = require("@itwin/insights-client");
|
|
37
|
+
const ReportAction_1 = __importDefault(require("./ReportAction"));
|
|
38
|
+
const ReportMappings_1 = require("./ReportMappings");
|
|
39
|
+
const HorizontalTile_1 = require("./HorizontalTile");
|
|
40
|
+
const SearchBar_1 = require("./SearchBar");
|
|
41
|
+
const ReportsApiConfigContext_1 = require("../context/ReportsApiConfigContext");
|
|
42
|
+
const ReportsConfigWidget_1 = require("../../ReportsConfigWidget");
|
|
43
|
+
const appui_react_1 = require("@itwin/appui-react");
|
|
44
|
+
var ReportsView;
|
|
45
|
+
(function (ReportsView) {
|
|
46
|
+
ReportsView["REPORTS"] = "reports";
|
|
47
|
+
ReportsView["REPORTSMAPPING"] = "reportsmapping";
|
|
48
|
+
ReportsView["ADDING"] = "adding";
|
|
49
|
+
ReportsView["MODIFYING"] = "modifying";
|
|
50
|
+
})(ReportsView || (ReportsView = {}));
|
|
51
|
+
const fetchReports = async (setReports, iTwinId, setIsLoading, apiContext) => {
|
|
52
|
+
try {
|
|
53
|
+
if (!iTwinId)
|
|
54
|
+
return;
|
|
55
|
+
setIsLoading(true);
|
|
56
|
+
const reportingClientApi = new insights_client_1.ReportingClient(utils_1.generateUrl(insights_client_1.REPORTING_BASE_PATH, apiContext.baseUrl));
|
|
57
|
+
const accessToken = await apiContext.getAccessToken();
|
|
58
|
+
const reports = await reportingClientApi.getReports(accessToken, iTwinId);
|
|
59
|
+
setReports(reports !== null && reports !== void 0 ? reports : []);
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
utils_1.handleError(error.status);
|
|
63
|
+
}
|
|
64
|
+
finally {
|
|
65
|
+
setIsLoading(false);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
const Reports = () => {
|
|
69
|
+
var _a, _b, _c;
|
|
70
|
+
const iTwinId = (_b = (_a = appui_react_1.useActiveIModelConnection()) === null || _a === void 0 ? void 0 : _a.iTwinId) !== null && _b !== void 0 ? _b : "";
|
|
71
|
+
const apiConfig = ReportsApiConfigContext_1.useReportsApiConfig();
|
|
72
|
+
const [showDeleteModal, setShowDeleteModal] = react_1.useState(false);
|
|
73
|
+
const [reportsView, setReportsView] = react_1.useState(ReportsView.REPORTS);
|
|
74
|
+
const [selectedReport, setSelectedReport] = react_1.useState(undefined);
|
|
75
|
+
const [isLoading, setIsLoading] = react_1.useState(true);
|
|
76
|
+
const [searchValue, setSearchValue] = react_1.useState("");
|
|
77
|
+
const [reports, setReports] = react_1.useState([]);
|
|
78
|
+
react_1.useEffect(() => {
|
|
79
|
+
void fetchReports(setReports, iTwinId, setIsLoading, apiConfig);
|
|
80
|
+
}, [apiConfig, iTwinId, setIsLoading]);
|
|
81
|
+
const refresh = react_1.useCallback(async () => {
|
|
82
|
+
setReportsView(ReportsView.REPORTS);
|
|
83
|
+
setSelectedReport(undefined);
|
|
84
|
+
await fetchReports(setReports, iTwinId, setIsLoading, apiConfig);
|
|
85
|
+
}, [apiConfig, iTwinId, setReports]);
|
|
86
|
+
const addReport = () => {
|
|
87
|
+
setReportsView(ReportsView.ADDING);
|
|
88
|
+
};
|
|
89
|
+
const filteredReports = react_1.useMemo(() => reports.filter((x) => [x.displayName, x.description]
|
|
90
|
+
.join(" ")
|
|
91
|
+
.toLowerCase()
|
|
92
|
+
.includes(searchValue.toLowerCase())), [reports, searchValue]);
|
|
93
|
+
switch (reportsView) {
|
|
94
|
+
case ReportsView.ADDING:
|
|
95
|
+
return iTwinId ? (react_1.default.createElement(ReportAction_1.default, { iTwinId: iTwinId !== null && iTwinId !== void 0 ? iTwinId : "", returnFn: refresh })) : null;
|
|
96
|
+
case ReportsView.MODIFYING:
|
|
97
|
+
return iTwinId ? (react_1.default.createElement(ReportAction_1.default, { iTwinId: iTwinId, report: selectedReport, returnFn: refresh })) : null;
|
|
98
|
+
case ReportsView.REPORTSMAPPING:
|
|
99
|
+
return selectedReport ? (react_1.default.createElement(ReportMappings_1.ReportMappings, { report: selectedReport, goBack: refresh })) : null;
|
|
100
|
+
default:
|
|
101
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
102
|
+
react_1.default.createElement(utils_1.WidgetHeader, { title: ReportsConfigWidget_1.ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:ITwinReports") }),
|
|
103
|
+
react_1.default.createElement(itwinui_react_1.Surface, { className: "reports-list-container" },
|
|
104
|
+
react_1.default.createElement("div", { className: "toolbar" },
|
|
105
|
+
react_1.default.createElement(itwinui_react_1.Button, { startIcon: react_1.default.createElement(itwinui_icons_react_1.SvgAdd, null), onClick: () => addReport(), styleType: "high-visibility" }, ReportsConfigWidget_1.ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:New")),
|
|
106
|
+
react_1.default.createElement("div", { className: "search-bar-container", "data-testid": "search-bar" },
|
|
107
|
+
react_1.default.createElement(SearchBar_1.SearchBar, { searchValue: searchValue, setSearchValue: setSearchValue, disabled: isLoading }))),
|
|
108
|
+
isLoading ? (react_1.default.createElement(utils_1.LoadingOverlay, null)) : reports.length === 0 ? (react_1.default.createElement(utils_1.EmptyMessage, null,
|
|
109
|
+
react_1.default.createElement(react_1.default.Fragment, null,
|
|
110
|
+
ReportsConfigWidget_1.ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:NoReports"),
|
|
111
|
+
react_1.default.createElement("div", null,
|
|
112
|
+
react_1.default.createElement(itwinui_react_1.Button, { onClick: () => addReport(), styleType: "cta" }, ReportsConfigWidget_1.ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:CreateOneReportCTA")))))) : (react_1.default.createElement("div", { className: "reports-list" }, filteredReports.map((report) => {
|
|
113
|
+
var _a, _b, _c;
|
|
114
|
+
return (react_1.default.createElement(HorizontalTile_1.HorizontalTile, { key: report.id, title: (_a = report.displayName) !== null && _a !== void 0 ? _a : "", subText: (_b = report.description) !== null && _b !== void 0 ? _b : "", subtextToolTip: (_c = report.description) !== null && _c !== void 0 ? _c : "", titleTooltip: report.displayName, onClickTitle: () => {
|
|
115
|
+
setSelectedReport(report);
|
|
116
|
+
setReportsView(ReportsView.REPORTSMAPPING);
|
|
117
|
+
}, button: react_1.default.createElement(itwinui_react_1.DropdownMenu, { menuItems: (close) => [
|
|
118
|
+
react_1.default.createElement(itwinui_react_1.MenuItem, { key: 0, onClick: () => {
|
|
119
|
+
setSelectedReport(report);
|
|
120
|
+
setReportsView(ReportsView.MODIFYING);
|
|
121
|
+
}, icon: react_1.default.createElement(itwinui_icons_react_1.SvgEdit, null) }, ReportsConfigWidget_1.ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:Modify")),
|
|
122
|
+
react_1.default.createElement(itwinui_react_1.MenuItem, { key: 1, onClick: () => {
|
|
123
|
+
setSelectedReport(report);
|
|
124
|
+
setShowDeleteModal(true);
|
|
125
|
+
close();
|
|
126
|
+
}, icon: react_1.default.createElement(itwinui_icons_react_1.SvgDelete, null) }, ReportsConfigWidget_1.ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:Remove")),
|
|
127
|
+
] },
|
|
128
|
+
react_1.default.createElement(itwinui_react_1.IconButton, { styleType: "borderless" },
|
|
129
|
+
react_1.default.createElement(itwinui_icons_react_1.SvgMore, { style: {
|
|
130
|
+
width: "16px",
|
|
131
|
+
height: "16px",
|
|
132
|
+
} }))) }));
|
|
133
|
+
})))),
|
|
134
|
+
react_1.default.createElement(DeleteModal_1.default, { entityName: (_c = selectedReport === null || selectedReport === void 0 ? void 0 : selectedReport.displayName) !== null && _c !== void 0 ? _c : "", show: showDeleteModal, setShow: setShowDeleteModal, onDelete: async () => {
|
|
135
|
+
var _a;
|
|
136
|
+
const reportingClientApi = new insights_client_1.ReportingClient(utils_1.generateUrl(insights_client_1.REPORTING_BASE_PATH, apiConfig.baseUrl));
|
|
137
|
+
const accessToken = await apiConfig.getAccessToken();
|
|
138
|
+
await reportingClientApi.deleteReport(accessToken, (_a = selectedReport === null || selectedReport === void 0 ? void 0 : selectedReport.id) !== null && _a !== void 0 ? _a : "");
|
|
139
|
+
}, refresh: refresh })));
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
exports.Reports = Reports;
|
|
143
|
+
//# sourceMappingURL=Reports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Reports.js","sourceRoot":"","sources":["../../../../src/widget/components/Reports.tsx"],"names":[],"mappings":";;;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AA,OAAO,WAiLlB","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 {\n SvgAdd,\n SvgDelete,\n SvgEdit,\n SvgMore,\n} from \"@itwin/itwinui-icons-react\";\nimport {\n Button,\n DropdownMenu,\n IconButton,\n MenuItem,\n Surface,\n} from \"@itwin/itwinui-react\";\nimport React, { useCallback, useEffect, useMemo, useState } from \"react\";\nimport type { CreateTypeFromInterface } from \"./utils\";\nimport {\n EmptyMessage,\n generateUrl,\n handleError,\n LoadingOverlay,\n WidgetHeader,\n} from \"./utils\";\nimport \"./Reports.scss\";\nimport DeleteModal from \"./DeleteModal\";\nimport type { Report } from \"@itwin/insights-client\";\nimport { REPORTING_BASE_PATH, ReportingClient } from \"@itwin/insights-client\";\nimport ReportAction from \"./ReportAction\";\nimport { ReportMappings } from \"./ReportMappings\";\nimport { HorizontalTile } from \"./HorizontalTile\";\nimport { SearchBar } from \"./SearchBar\";\nimport type { ReportsApiConfig } from \"../context/ReportsApiConfigContext\";\nimport { useReportsApiConfig } from \"../context/ReportsApiConfigContext\";\nimport { ReportsConfigWidget } from \"../../ReportsConfigWidget\";\nimport { useActiveIModelConnection } from \"@itwin/appui-react\";\n\nexport type ReportType = CreateTypeFromInterface<Report>;\n\nenum ReportsView {\n REPORTS = \"reports\",\n REPORTSMAPPING = \"reportsmapping\",\n ADDING = \"adding\",\n MODIFYING = \"modifying\",\n}\n\nconst fetchReports = async (\n setReports: React.Dispatch<React.SetStateAction<Report[]>>,\n iTwinId: string | undefined,\n setIsLoading: React.Dispatch<React.SetStateAction<boolean>>,\n apiContext: ReportsApiConfig\n) => {\n try {\n if (!iTwinId) return;\n setIsLoading(true);\n const reportingClientApi = new ReportingClient(\n generateUrl(REPORTING_BASE_PATH, apiContext.baseUrl)\n );\n const accessToken = await apiContext.getAccessToken();\n const reports = await reportingClientApi.getReports(accessToken, iTwinId);\n setReports(reports ?? []);\n } catch (error: any) {\n handleError(error.status);\n } finally {\n setIsLoading(false);\n }\n};\n\nexport const Reports = () => {\n const iTwinId = useActiveIModelConnection()?.iTwinId ?? \"\";\n const apiConfig = useReportsApiConfig();\n const [showDeleteModal, setShowDeleteModal] = useState<boolean>(false);\n const [reportsView, setReportsView] = useState<ReportsView>(\n ReportsView.REPORTS\n );\n const [selectedReport, setSelectedReport] = useState<Report | undefined>(\n undefined\n );\n const [isLoading, setIsLoading] = useState<boolean>(true);\n const [searchValue, setSearchValue] = useState<string>(\"\");\n const [reports, setReports] = useState<Report[]>([]);\n\n useEffect(() => {\n void fetchReports(setReports, iTwinId, setIsLoading, apiConfig);\n }, [apiConfig, iTwinId, setIsLoading]);\n\n const refresh = useCallback(async () => {\n setReportsView(ReportsView.REPORTS);\n setSelectedReport(undefined);\n await fetchReports(setReports, iTwinId, setIsLoading, apiConfig);\n }, [apiConfig, iTwinId, setReports]);\n\n const addReport = () => {\n setReportsView(ReportsView.ADDING);\n };\n\n const filteredReports = useMemo(\n () =>\n reports.filter((x) =>\n [x.displayName, x.description]\n .join(\" \")\n .toLowerCase()\n .includes(searchValue.toLowerCase())\n ),\n [reports, searchValue]\n );\n\n switch (reportsView) {\n case ReportsView.ADDING:\n return iTwinId ? (\n <ReportAction iTwinId={iTwinId ?? \"\"} returnFn={refresh} />\n ) : null;\n case ReportsView.MODIFYING:\n return iTwinId ? (\n <ReportAction\n iTwinId={iTwinId}\n report={selectedReport}\n returnFn={refresh}\n />\n ) : null;\n case ReportsView.REPORTSMAPPING:\n return selectedReport ? (\n <ReportMappings report={selectedReport} goBack={refresh} />\n ) : null;\n default:\n return (\n <>\n <WidgetHeader\n title={ReportsConfigWidget.localization.getLocalizedString(\n \"ReportsConfigWidget:ITwinReports\"\n )}\n />\n <Surface className=\"reports-list-container\">\n <div className=\"toolbar\">\n <Button\n startIcon={<SvgAdd />}\n onClick={() => addReport()}\n styleType=\"high-visibility\"\n >\n {ReportsConfigWidget.localization.getLocalizedString(\n \"ReportsConfigWidget:New\"\n )}\n </Button>\n <div className=\"search-bar-container\" data-testid=\"search-bar\">\n <SearchBar\n searchValue={searchValue}\n setSearchValue={setSearchValue}\n disabled={isLoading}\n />\n </div>\n </div>\n {isLoading ? (\n <LoadingOverlay />\n ) : reports.length === 0 ? (\n <EmptyMessage>\n <>\n {ReportsConfigWidget.localization.getLocalizedString(\n \"ReportsConfigWidget:NoReports\"\n )}\n <div>\n <Button onClick={() => addReport()} styleType=\"cta\">\n {ReportsConfigWidget.localization.getLocalizedString(\n \"ReportsConfigWidget:CreateOneReportCTA\"\n )}\n </Button>\n </div>\n </>\n </EmptyMessage>\n ) : (\n <div className=\"reports-list\">\n {filteredReports.map((report) => (\n <HorizontalTile\n key={report.id}\n title={report.displayName ?? \"\"}\n subText={report.description ?? \"\"}\n subtextToolTip={report.description ?? \"\"}\n titleTooltip={report.displayName}\n onClickTitle={() => {\n setSelectedReport(report);\n setReportsView(ReportsView.REPORTSMAPPING);\n }}\n button={\n <DropdownMenu\n menuItems={(close: () => void) => [\n <MenuItem\n key={0}\n onClick={() => {\n setSelectedReport(report);\n setReportsView(ReportsView.MODIFYING);\n }}\n icon={<SvgEdit />}\n >\n {ReportsConfigWidget.localization.getLocalizedString(\n \"ReportsConfigWidget:Modify\"\n )}\n </MenuItem>,\n <MenuItem\n key={1}\n onClick={() => {\n setSelectedReport(report);\n setShowDeleteModal(true);\n close();\n }}\n icon={<SvgDelete />}\n >\n {ReportsConfigWidget.localization.getLocalizedString(\n \"ReportsConfigWidget:Remove\"\n )}\n </MenuItem>,\n ]}\n >\n <IconButton styleType=\"borderless\">\n <SvgMore\n style={{\n width: \"16px\",\n height: \"16px\",\n }}\n />\n </IconButton>\n </DropdownMenu>\n }\n />\n ))}\n </div>\n )}\n </Surface>\n <DeleteModal\n entityName={selectedReport?.displayName ?? \"\"}\n show={showDeleteModal}\n setShow={setShowDeleteModal}\n onDelete={async () => {\n const reportingClientApi = new ReportingClient(\n generateUrl(REPORTING_BASE_PATH, apiConfig.baseUrl)\n );\n const accessToken = await apiConfig.getAccessToken();\n await reportingClientApi.deleteReport(\n accessToken,\n selectedReport?.id ?? \"\"\n );\n }}\n refresh={refresh}\n />\n </>\n );\n }\n};\n"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
.reports-list-container {
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
flex-grow: 1;
|
|
11
|
+
padding: $iui-baseline $iui-m;
|
|
12
|
+
min-height: 0;
|
|
13
|
+
|
|
14
|
+
.toolbar {
|
|
15
|
+
display: flex;
|
|
16
|
+
justify-content: space-between;
|
|
17
|
+
gap: $iui-s;
|
|
18
|
+
border-bottom: 1px solid var(--iui-color-background-4);
|
|
19
|
+
padding-bottom: $iui-baseline;
|
|
20
|
+
flex-wrap: wrap;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.search-bar-container {
|
|
24
|
+
flex-basis: $iui-3xl;
|
|
25
|
+
flex-shrink: 1;
|
|
26
|
+
flex-grow: 1;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.reports-list {
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-direction: column;
|
|
32
|
+
overflow-y: overlay;
|
|
33
|
+
gap: 7.5px;
|
|
34
|
+
margin-top: 7.5px;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { AccessToken } from "@itwin/core-bentley";
|
|
3
|
+
import "./ReportsContainer.scss";
|
|
4
|
+
interface ReportsContainerProps {
|
|
5
|
+
getAccessToken?: () => Promise<AccessToken>;
|
|
6
|
+
baseUrl: string;
|
|
7
|
+
}
|
|
8
|
+
declare const ReportsContainer: ({ getAccessToken, baseUrl, }: ReportsContainerProps) => JSX.Element;
|
|
9
|
+
export default ReportsContainer;
|
|
10
|
+
//# sourceMappingURL=ReportsContainer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReportsContainer.d.ts","sourceRoot":"","sources":["../../../../src/widget/components/ReportsContainer.tsx"],"names":[],"mappings":";AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAKvD,OAAO,yBAAyB,CAAC;AAEjC,UAAU,qBAAqB;IAC7B,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC;IAC5C,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,QAAA,MAAM,gBAAgB,iCAGnB,qBAAqB,gBAcvB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
const core_frontend_1 = require("@itwin/core-frontend");
|
|
23
|
+
const React = __importStar(require("react"));
|
|
24
|
+
const Reports_1 = require("../components/Reports");
|
|
25
|
+
const ReportsApiConfigContext_1 = require("../context/ReportsApiConfigContext");
|
|
26
|
+
require("./ReportsContainer.scss");
|
|
27
|
+
const ReportsContainer = ({ getAccessToken, baseUrl, }) => (React.createElement(ReportsApiConfigContext_1.ReportsApiConfigContext.Provider, { value: {
|
|
28
|
+
getAccessToken: getAccessToken !== null && getAccessToken !== void 0 ? getAccessToken : (async () => { var _a, _b; return (_b = (await ((_a = core_frontend_1.IModelApp.authorizationClient) === null || _a === void 0 ? void 0 : _a.getAccessToken()))) !== null && _b !== void 0 ? _b : ""; }),
|
|
29
|
+
baseUrl,
|
|
30
|
+
} },
|
|
31
|
+
React.createElement("div", { className: "reports-container" },
|
|
32
|
+
React.createElement(Reports_1.Reports, null))));
|
|
33
|
+
exports.default = ReportsContainer;
|
|
34
|
+
//# sourceMappingURL=ReportsContainer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReportsContainer.js","sourceRoot":"","sources":["../../../../src/widget/components/ReportsContainer.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAKA,wDAAiD;AACjD,6CAA+B;AAC/B,mDAAgD;AAChD,gFAA6E;AAC7E,mCAAiC;AAOjC,MAAM,gBAAgB,GAAG,CAAC,EACxB,cAAc,EACd,OAAO,GACe,EAAE,EAAE,CAAC,CAC3B,oBAAC,iDAAuB,CAAC,QAAQ,IAC/B,KAAK,EAAE;QACL,cAAc,EACZ,cAAc,aAAd,cAAc,cAAd,cAAc,GACd,CAAC,KAAK,IAAI,EAAE,eACV,OAAA,MAAA,CAAC,MAAM,CAAA,MAAA,yBAAS,CAAC,mBAAmB,0CAAE,cAAc,EAAE,CAAA,CAAC,mCAAI,EAAE,CAAA,EAAA,CAAC;QAClE,OAAO;KACR;IAED,6BAAK,SAAS,EAAC,mBAAmB;QAChC,oBAAC,iBAAO,OAAG,CACP,CAC2B,CACpC,CAAC;AAEF,kBAAe,gBAAgB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport type { AccessToken } from \"@itwin/core-bentley\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport * as React from \"react\";\nimport { Reports } from \"../components/Reports\";\nimport { ReportsApiConfigContext } from \"../context/ReportsApiConfigContext\";\nimport \"./ReportsContainer.scss\";\n\ninterface ReportsContainerProps {\n getAccessToken?: () => Promise<AccessToken>;\n baseUrl: string;\n}\n\nconst ReportsContainer = ({\n getAccessToken,\n baseUrl,\n}: ReportsContainerProps) => (\n <ReportsApiConfigContext.Provider\n value={{\n getAccessToken:\n getAccessToken ??\n (async () =>\n (await IModelApp.authorizationClient?.getAccessToken()) ?? \"\"),\n baseUrl,\n }}\n >\n <div className=\"reports-container\">\n <Reports />\n </div>\n </ReportsApiConfigContext.Provider>\n);\n\nexport default ReportsContainer;\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
.reports-container {
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
padding: $iui-baseline $iui-m;
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
height: 100%;
|
|
13
|
+
overflow: auto;
|
|
14
|
+
gap: $iui-baseline;
|
|
15
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./SearchBar.scss";
|
|
3
|
+
interface SearchBarProps {
|
|
4
|
+
searchValue: string;
|
|
5
|
+
setSearchValue: React.Dispatch<React.SetStateAction<string>>;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const SearchBar: ({ searchValue, setSearchValue, disabled, }: SearchBarProps) => JSX.Element;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=SearchBar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SearchBar.d.ts","sourceRoot":"","sources":["../../../../src/widget/components/SearchBar.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,kBAAkB,CAAC;AAE1B,UAAU,cAAc;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;IAC7D,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAM,SAAS,+CAInB,cAAc,gBAyChB,CAAC"}
|