@itwin/reports-config-widget-react 0.0.1 → 0.0.2
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 +8 -6
- package/.rush/temp/shrinkwrap-deps.json +45 -48
- package/CHANGELOG.json +18 -0
- package/CHANGELOG.md +10 -1
- package/README.md +3 -3
- package/coverage/clover.xml +99 -99
- package/coverage/coverage-final.json +13 -13
- package/coverage/lcov-report/index.html +1 -1
- 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 +2 -2
- package/coverage/lcov-report/src/widget/components/AddMappingsModal.tsx.html +10 -10
- package/coverage/lcov-report/src/widget/components/DeleteModal.tsx.html +4 -4
- package/coverage/lcov-report/src/widget/components/Extraction.tsx.html +15 -15
- package/coverage/lcov-report/src/widget/components/HorizontalTile.tsx.html +2 -2
- package/coverage/lcov-report/src/widget/components/LocalizedTablePaginator.tsx.html +1 -1
- package/coverage/lcov-report/src/widget/components/ReportAction.tsx.html +10 -10
- package/coverage/lcov-report/src/widget/components/ReportMappings.tsx.html +21 -21
- package/coverage/lcov-report/src/widget/components/Reports.tsx.html +19 -19
- 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 +1 -1
- package/coverage/lcov-report/src/widget/components/utils.tsx.html +5 -5
- 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 +11 -11
- package/coverage/lcov-report/src/widget/index.html +1 -1
- package/coverage/lcov.info +202 -202
- package/lib/cjs/test/ReportAction.test.js +3 -3
- package/lib/cjs/test/ReportAction.test.js.map +1 -1
- package/lib/cjs/test/ReportMappings.test.js +14 -13
- package/lib/cjs/test/ReportMappings.test.js.map +1 -1
- package/lib/cjs/test/Reports.test.js +3 -3
- package/lib/cjs/test/Reports.test.js.map +1 -1
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/test/ReportAction.test.js +3 -3
- package/lib/esm/test/ReportAction.test.js.map +1 -1
- package/lib/esm/test/ReportMappings.test.js +14 -13
- package/lib/esm/test/ReportMappings.test.js.map +1 -1
- package/lib/esm/test/Reports.test.js +3 -3
- package/lib/esm/test/Reports.test.js.map +1 -1
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/reports-config-widget-react.build.error.log +4 -4
- package/reports-config-widget-react.build.log +5 -5
- package/src/test/ReportAction.test.tsx +3 -3
- package/src/test/ReportMappings.test.tsx +14 -13
- package/src/test/Reports.test.tsx +3 -3
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.0.2",
|
|
4
4
|
"description": "An iTwin.js 3D Viewer Widget that interfaces with the iTwin Reporting Platform.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Bentley",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
],
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
|
15
|
-
"url": "https://github.com/imodeljs/viewer-components-react/tree/master/packages/itwin/reports-config-widget
|
|
15
|
+
"url": "https://github.com/imodeljs/viewer-components-react/tree/master/packages/itwin/reports-config-widget"
|
|
16
16
|
},
|
|
17
17
|
"license": "MIT",
|
|
18
18
|
"author": {
|
|
@@ -120,5 +120,5 @@
|
|
|
120
120
|
"test": "jest",
|
|
121
121
|
"test:watch": "jest --watch "
|
|
122
122
|
},
|
|
123
|
-
"readme": "# @itwin/reports-config-widget-react\r\n\r\nCopyright © Bentley Systems, Incorporated. All rights reserved.\r\nThe Reports Config widget is a UI component for iTwin Viewer applications that simplifies how users (and developers) interface with the [Reporting Platform APIs](https://developer.bentley.com/apis/insights/overview/).\r\nThe reports-config-widget package provides a UiProvider class - `ReportsConfigProvider` - which can be passed into the `uiProviders` prop of the iTwin Viewer's `<Viewer />` component.\r\n\r\n## Getting Started\r\n\r\nThis is not a standalone UI and requires a parent iTwin Viewer application to work as intended.\r\nA guide on how to create a basic iTwin Viewer application can be found here: <https://www.itwinjs.org/learning/tutorials/develop-web-viewer/>.\r\nThis package provides a viewer 'widget'. Documentation on how to add a widget to your application can be found here: <https://developer.bentley.com/tutorials/itwin-viewer-hello-world/#2-your-first-ui-widget>.\r\n\r\n## Permissions and Scopes\r\n\r\nThe SPA client used by your iTwin viewer must have these additional scopes:\r\n\r\n- `insights:read`\r\n- `insights:modify`\r\n- `projects:read`\r\n\r\nIn addition, users must have the `imodels_read` and `imodels_write` [permissions](https://developer.bentley.com/apis/insights/operations/create-mapping/#authorization) assigned at either the Project or iModel level. Further instruction on how to create roles and assign permissions can be found in the [iTwin Platform Projects API documentation](https://developer.bentley.com/apis/projects/tutorials/).\r\n\r\n## Sample usage\r\n\r\n### Call ReportsConfigWidget.initialize() **_before_** making use of the provider\r\n\r\n```ts\r\nimport { ReportsConfigWidget } from '@itwin/reports-config-widget-react'\r\n\r\n...\r\n\r\nawait ReportsConfigWidget.initialize(IModelApp.localization);\r\n\r\n<Viewer\r\n ...\r\n uiProviders={[new ReportsConfigProvider()]}\r\n/>\r\n```\r\n"
|
|
123
|
+
"readme": "# @itwin/reports-config-widget-react\r\n\r\nCopyright © Bentley Systems, Incorporated. All rights reserved.\r\nThe Reports Config widget is a UI component for iTwin Viewer applications that simplifies how users (and developers) interface with the [Reporting Platform APIs](https://developer.bentley.com/apis/insights/overview/). This widget is one piece of the Reporting story that focuses on the configuration of Reports and the extraction thereof. It complements the [Grouping & Mapping Widget](https://www.npmjs.com/package/@itwin/grouping-mapping-widget).\r\nThe reports-config-widget-react package provides a UiProvider class - `ReportsConfigProvider` - which can be passed into the `uiProviders` prop of the iTwin Viewer's `<Viewer />` component.\r\n\r\n## Getting Started\r\n\r\nThis is not a standalone UI and requires a parent iTwin Viewer application to work as intended.\r\nA guide on how to create a basic iTwin Viewer application can be found here: <https://www.itwinjs.org/learning/tutorials/develop-web-viewer/>.\r\nThis package provides a viewer 'widget'. Documentation on how to add a widget to your application can be found here: <https://developer.bentley.com/tutorials/itwin-viewer-hello-world/#2-your-first-ui-widget>.\r\n\r\n## Permissions and Scopes\r\n\r\nThe SPA client used by your iTwin viewer must have these additional scopes:\r\n\r\n- `insights:read`\r\n- `insights:modify`\r\n- `projects:read`\r\n\r\nIn addition, users must have the `imodels_read` and `imodels_write` [permissions](https://developer.bentley.com/apis/insights/operations/create-mapping/#authorization) assigned at either the Project or iModel level. Further instruction on how to create roles and assign permissions can be found in the [iTwin Platform Projects API documentation](https://developer.bentley.com/apis/projects/tutorials/).\r\n\r\n## Sample usage\r\n\r\n### Call ReportsConfigWidget.initialize() **_before_** making use of the provider\r\n\r\n```ts\r\nimport { ReportsConfigProvider, ReportsConfigWidget } from '@itwin/reports-config-widget-react'\r\n\r\n...\r\n\r\nawait ReportsConfigWidget.initialize(IModelApp.localization);\r\n\r\n<Viewer\r\n ...\r\n uiProviders={[new ReportsConfigProvider()]}\r\n/>\r\n```\r\n"
|
|
124
124
|
}
|
|
@@ -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
|
|
1
|
+
PASS src/test/ReportMappings.test.tsx (33.661 s)
|
|
2
|
+
PASS src/test/Reports.test.tsx (7.992 s)
|
|
3
|
+
PASS src/test/ReportAction.test.tsx
|
|
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: 49.631 s
|
|
10
10
|
Ran all test suites.
|
|
@@ -1,12 +1,12 @@
|
|
|
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.1 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
|
|
7
|
+
PASS src/test/ReportMappings.test.tsx (33.661 s)
|
|
8
|
+
PASS src/test/Reports.test.tsx (7.992 s)
|
|
9
|
+
PASS src/test/ReportAction.test.tsx
|
|
10
10
|
PASS src/test/WidgetHeader.test.tsx
|
|
11
11
|
------------------------------|---------|----------|---------|---------|-------------------------------
|
|
12
12
|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
|
|
@@ -41,5 +41,5 @@ All files | 87.72 | 70.3 | 86.32 | 87.64 |
|
|
|
41
41
|
Test Suites: 4 passed, 4 total
|
|
42
42
|
Tests: 22 passed, 22 total
|
|
43
43
|
Snapshots: 0 total
|
|
44
|
-
Time:
|
|
44
|
+
Time: 49.631 s
|
|
45
45
|
Ran all test suites.
|
|
@@ -113,7 +113,7 @@ describe("Reports Action", () => {
|
|
|
113
113
|
it("should be able to add report", async () => {
|
|
114
114
|
const mockReport: Report = {
|
|
115
115
|
id: faker.datatype.uuid(),
|
|
116
|
-
displayName:
|
|
116
|
+
displayName: "mOcKRePoRt1",
|
|
117
117
|
description: "",
|
|
118
118
|
deleted: false,
|
|
119
119
|
_links: {
|
|
@@ -150,8 +150,8 @@ describe("Reports Action", () => {
|
|
|
150
150
|
name: /description/i,
|
|
151
151
|
});
|
|
152
152
|
|
|
153
|
-
await userEvent.type(nameInput,
|
|
154
|
-
await userEvent.type(descriptionInput,
|
|
153
|
+
await userEvent.type(nameInput, "mOcKTeXt");
|
|
154
|
+
await userEvent.type(descriptionInput, "moCk DeScRiPtIoN");
|
|
155
155
|
expect(cancelButton).toBeEnabled();
|
|
156
156
|
expect(addButton).toBeEnabled();
|
|
157
157
|
|
|
@@ -60,9 +60,9 @@ const mockIModelsResponse = [
|
|
|
60
60
|
{
|
|
61
61
|
iModel: {
|
|
62
62
|
id: mockIModelId1,
|
|
63
|
-
displayName:
|
|
64
|
-
name:
|
|
65
|
-
description:
|
|
63
|
+
displayName: "rAnDoMdIsPlAynAmE1",
|
|
64
|
+
name: "rAnDomName1",
|
|
65
|
+
description: "rAnDoMDeScRiPtIoN1",
|
|
66
66
|
createdDateTime: "2021-10-04T22:13:50.397Z",
|
|
67
67
|
state: IModelState.Initialized,
|
|
68
68
|
projectId: mockITwinId,
|
|
@@ -83,9 +83,9 @@ const mockIModelsResponse = [
|
|
|
83
83
|
{
|
|
84
84
|
iModel: {
|
|
85
85
|
id: mockIModelId2,
|
|
86
|
-
displayName:
|
|
87
|
-
name:
|
|
88
|
-
description:
|
|
86
|
+
displayName: "rAnDoMdIsPlAynAmE2",
|
|
87
|
+
name: "rAnDomName2",
|
|
88
|
+
description: "rAnDoMDeScRiPtIoN2",
|
|
89
89
|
createdDateTime: "2021-10-04T22:13:50.397Z",
|
|
90
90
|
state: IModelState.Initialized,
|
|
91
91
|
projectId: mockITwinId,
|
|
@@ -121,8 +121,8 @@ const mockProjectIModels = {
|
|
|
121
121
|
|
|
122
122
|
const mockReport: Report = {
|
|
123
123
|
id: mockReportId,
|
|
124
|
-
displayName:
|
|
125
|
-
description:
|
|
124
|
+
displayName: "mOcKRePoRt1",
|
|
125
|
+
description: "mOcKRePoRtDeScRiPtIoN1",
|
|
126
126
|
deleted: false,
|
|
127
127
|
_links: {
|
|
128
128
|
project: {
|
|
@@ -180,11 +180,11 @@ const mockMappingsFactory = (
|
|
|
180
180
|
mockReportMappings: ReportMappingCollection
|
|
181
181
|
): [MappingSingle[], RequestHandler[]] => {
|
|
182
182
|
const mockMappings: MappingSingle[] = mockReportMappings.mappings!.map(
|
|
183
|
-
(mapping) => ({
|
|
183
|
+
(mapping, index) => ({
|
|
184
184
|
mapping: {
|
|
185
185
|
id: mapping.mappingId,
|
|
186
|
-
mappingName:
|
|
187
|
-
description:
|
|
186
|
+
mappingName: `mOcKMaPpIngNaMe${index}`,
|
|
187
|
+
description: `mOcKmApPInGDeScRiPtIoN${index}`,
|
|
188
188
|
extractionEnabled: false,
|
|
189
189
|
createdOn: "",
|
|
190
190
|
createdBy: "",
|
|
@@ -509,13 +509,14 @@ describe("Report Mappings View", () => {
|
|
|
509
509
|
|
|
510
510
|
// Adding an extra unmapped mapping.
|
|
511
511
|
const extraMappingId = faker.datatype.uuid();
|
|
512
|
-
const extraMappingName =
|
|
512
|
+
const extraMappingName = "mOcKNaMeExTrA";
|
|
513
|
+
const extraMappingDescription = "mOcKDeScRiPtIoNeXtRa";
|
|
513
514
|
|
|
514
515
|
mockMappings.push({
|
|
515
516
|
mapping: {
|
|
516
517
|
id: extraMappingId,
|
|
517
518
|
mappingName: extraMappingName,
|
|
518
|
-
description:
|
|
519
|
+
description: extraMappingDescription,
|
|
519
520
|
extractionEnabled: false,
|
|
520
521
|
createdOn: "",
|
|
521
522
|
createdBy: "",
|
|
@@ -42,10 +42,10 @@ const mockIModelId = faker.datatype.uuid();
|
|
|
42
42
|
const reportsFactory = (): ReportCollection => ({
|
|
43
43
|
reports: Array.from(
|
|
44
44
|
{ length: faker.datatype.number({ min: 3, max: 5 }) },
|
|
45
|
-
() => ({
|
|
45
|
+
(_, index) => ({
|
|
46
46
|
id: `${faker.datatype.uuid()}`,
|
|
47
|
-
displayName:
|
|
48
|
-
description:
|
|
47
|
+
displayName: `mOcKRePoRT${index}`,
|
|
48
|
+
description: `mOcKRePoRTDeScRiPtIoN${index}`,
|
|
49
49
|
})
|
|
50
50
|
),
|
|
51
51
|
_links: {
|