@itwin/reports-config-widget-react 0.0.4 → 0.0.7
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 +12 -12
- package/.rush/temp/shrinkwrap-deps.json +8 -3
- package/CHANGELOG.json +36 -0
- package/CHANGELOG.md +22 -1
- package/coverage/clover.xml +103 -102
- package/coverage/coverage-final.json +12 -12
- package/coverage/lcov-report/index.html +19 -19
- 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 +2 -2
- 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 +9 -9
- package/coverage/lcov-report/src/widget/components/DeleteModal.tsx.html +4 -4
- package/coverage/lcov-report/src/widget/components/Extraction.tsx.html +13 -13
- 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 +5 -5
- package/coverage/lcov-report/src/widget/components/ReportMappings.tsx.html +35 -26
- package/coverage/lcov-report/src/widget/components/Reports.tsx.html +34 -34
- package/coverage/lcov-report/src/widget/components/ReportsContainer.tsx.html +1 -1
- package/coverage/lcov-report/src/widget/components/SearchBar.tsx.html +4 -4
- package/coverage/lcov-report/src/widget/components/SelectIModel.tsx.html +1 -1
- package/coverage/lcov-report/src/widget/components/index.html +38 -38
- package/coverage/lcov-report/src/widget/components/utils.tsx.html +30 -30
- 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 +238 -317
- package/lib/cjs/test/ReportMappings.test.js +42 -31
- package/lib/cjs/test/ReportMappings.test.js.map +1 -1
- package/lib/cjs/test/Reports.test.js +12 -7
- package/lib/cjs/test/Reports.test.js.map +1 -1
- package/lib/cjs/test/test-utils.js.map +1 -1
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/cjs/widget/components/AddMappingsModal.js +5 -6
- package/lib/cjs/widget/components/AddMappingsModal.js.map +1 -1
- package/lib/cjs/widget/components/Extraction.js +9 -11
- package/lib/cjs/widget/components/Extraction.js.map +1 -1
- package/lib/cjs/widget/components/ReportAction.js +3 -3
- package/lib/cjs/widget/components/ReportAction.js.map +1 -1
- package/lib/cjs/widget/components/ReportMappings.d.ts.map +1 -1
- package/lib/cjs/widget/components/ReportMappings.js +23 -27
- package/lib/cjs/widget/components/ReportMappings.js.map +1 -1
- package/lib/cjs/widget/components/Reports.js +6 -6
- package/lib/cjs/widget/components/Reports.js.map +1 -1
- package/lib/esm/test/ReportMappings.test.js +42 -31
- package/lib/esm/test/ReportMappings.test.js.map +1 -1
- package/lib/esm/test/Reports.test.js +12 -7
- package/lib/esm/test/Reports.test.js.map +1 -1
- package/lib/esm/test/test-utils.js.map +1 -1
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/widget/components/AddMappingsModal.js +6 -7
- package/lib/esm/widget/components/AddMappingsModal.js.map +1 -1
- package/lib/esm/widget/components/Extraction.js +10 -12
- package/lib/esm/widget/components/Extraction.js.map +1 -1
- package/lib/esm/widget/components/ReportAction.js +4 -4
- package/lib/esm/widget/components/ReportAction.js.map +1 -1
- package/lib/esm/widget/components/ReportMappings.d.ts.map +1 -1
- package/lib/esm/widget/components/ReportMappings.js +24 -28
- package/lib/esm/widget/components/ReportMappings.js.map +1 -1
- package/lib/esm/widget/components/Reports.js +7 -7
- package/lib/esm/widget/components/Reports.js.map +1 -1
- package/package.json +5 -4
- package/reports-config-widget-react.build.error.log +3 -3
- package/reports-config-widget-react.build.log +11 -11
- package/src/test/ReportMappings.test.tsx +44 -24
- package/src/test/Reports.test.tsx +18 -13
- package/src/test/test-utils.tsx +1 -1
- package/src/widget/components/AddMappingsModal.tsx +6 -6
- package/src/widget/components/Extraction.tsx +10 -10
- package/src/widget/components/ReportAction.tsx +4 -4
- package/src/widget/components/ReportMappings.tsx +21 -18
- package/src/widget/components/Reports.tsx +6 -6
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
import "./ReportMappings.scss";
|
|
31
31
|
import DeleteModal from "./DeleteModal";
|
|
32
32
|
import type { Report, ReportMapping } from "@itwin/insights-client";
|
|
33
|
-
import { REPORTING_BASE_PATH,
|
|
33
|
+
import { MappingsClient, REPORTING_BASE_PATH, ReportsClient } from "@itwin/insights-client";
|
|
34
34
|
import AddMappingsModal from "./AddMappingsModal";
|
|
35
35
|
import type {
|
|
36
36
|
GetSingleIModelParams,
|
|
@@ -68,11 +68,14 @@ const fetchReportMappings = async (
|
|
|
68
68
|
) => {
|
|
69
69
|
try {
|
|
70
70
|
setIsLoading(true);
|
|
71
|
-
const
|
|
71
|
+
const reportsClientApi = new ReportsClient(
|
|
72
|
+
generateUrl(REPORTING_BASE_PATH, apiContext.baseUrl)
|
|
73
|
+
);
|
|
74
|
+
const mappingsClientApi = new MappingsClient(
|
|
72
75
|
generateUrl(REPORTING_BASE_PATH, apiContext.baseUrl)
|
|
73
76
|
);
|
|
74
77
|
const accessToken = await apiContext.getAccessToken();
|
|
75
|
-
const reportMappings = await
|
|
78
|
+
const reportMappings = await reportsClientApi.getReportMappings(
|
|
76
79
|
accessToken,
|
|
77
80
|
reportId
|
|
78
81
|
);
|
|
@@ -85,13 +88,13 @@ const fetchReportMappings = async (
|
|
|
85
88
|
AccessTokenAdapter.toAuthorizationCallback(accessToken);
|
|
86
89
|
const iModelNames = new Map<string, string>();
|
|
87
90
|
const reportMappingsAndMapping = await Promise.all(
|
|
88
|
-
reportMappings
|
|
89
|
-
const iModelId = reportMapping.imodelId
|
|
91
|
+
reportMappings.map(async (reportMapping) => {
|
|
92
|
+
const iModelId = reportMapping.imodelId;
|
|
90
93
|
let iModelName = "";
|
|
91
|
-
const mapping = await
|
|
94
|
+
const mapping = await mappingsClientApi.getMapping(
|
|
92
95
|
accessToken,
|
|
93
|
-
|
|
94
|
-
|
|
96
|
+
iModelId,
|
|
97
|
+
reportMapping.mappingId
|
|
95
98
|
);
|
|
96
99
|
if (iModelNames.has(iModelId)) {
|
|
97
100
|
iModelName = iModelNames.get(iModelId) ?? "";
|
|
@@ -107,8 +110,8 @@ const fetchReportMappings = async (
|
|
|
107
110
|
const reportMappingAndMapping: ReportMappingAndMapping = {
|
|
108
111
|
...reportMapping,
|
|
109
112
|
iModelName,
|
|
110
|
-
mappingName: mapping.
|
|
111
|
-
mappingDescription: mapping.
|
|
113
|
+
mappingName: mapping.mappingName,
|
|
114
|
+
mappingDescription: mapping.description ?? "",
|
|
112
115
|
};
|
|
113
116
|
return reportMappingAndMapping;
|
|
114
117
|
}) ?? []
|
|
@@ -149,7 +152,7 @@ export const ReportMappings = ({ report, goBack }: ReportMappingsProps) => {
|
|
|
149
152
|
useEffect(() => {
|
|
150
153
|
void fetchReportMappings(
|
|
151
154
|
setReportMappings,
|
|
152
|
-
report.id
|
|
155
|
+
report.id,
|
|
153
156
|
setIsLoading,
|
|
154
157
|
apiConfig
|
|
155
158
|
);
|
|
@@ -159,7 +162,7 @@ export const ReportMappings = ({ report, goBack }: ReportMappingsProps) => {
|
|
|
159
162
|
setReportMappingsView(ReportMappingsView.REPORTMAPPINGS);
|
|
160
163
|
await fetchReportMappings(
|
|
161
164
|
setReportMappings,
|
|
162
|
-
report.id
|
|
165
|
+
report.id,
|
|
163
166
|
setIsLoading,
|
|
164
167
|
apiConfig
|
|
165
168
|
);
|
|
@@ -173,7 +176,7 @@ export const ReportMappings = ({ report, goBack }: ReportMappingsProps) => {
|
|
|
173
176
|
() =>
|
|
174
177
|
new Map(
|
|
175
178
|
reportMappings.map((mapping) => [
|
|
176
|
-
mapping.imodelId
|
|
179
|
+
mapping.imodelId,
|
|
177
180
|
mapping.iModelName,
|
|
178
181
|
])
|
|
179
182
|
),
|
|
@@ -198,7 +201,7 @@ export const ReportMappings = ({ report, goBack }: ReportMappingsProps) => {
|
|
|
198
201
|
|
|
199
202
|
return (
|
|
200
203
|
<>
|
|
201
|
-
<WidgetHeader title={report.displayName
|
|
204
|
+
<WidgetHeader title={report.displayName} returnFn={goBack} />
|
|
202
205
|
<div className="report-mapping-misc">
|
|
203
206
|
<LabeledInput
|
|
204
207
|
label={ReportsConfigWidget.localization.getLocalizedString(
|
|
@@ -324,7 +327,7 @@ export const ReportMappings = ({ report, goBack }: ReportMappingsProps) => {
|
|
|
324
327
|
</Surface>
|
|
325
328
|
<AddMappingsModal
|
|
326
329
|
show={reportMappingsView === ReportMappingsView.ADDING}
|
|
327
|
-
reportId={report.id
|
|
330
|
+
reportId={report.id}
|
|
328
331
|
existingMappings={reportMappings}
|
|
329
332
|
returnFn={refresh}
|
|
330
333
|
/>
|
|
@@ -333,13 +336,13 @@ export const ReportMappings = ({ report, goBack }: ReportMappingsProps) => {
|
|
|
333
336
|
show={showDeleteModal}
|
|
334
337
|
setShow={setShowDeleteModal}
|
|
335
338
|
onDelete={async () => {
|
|
336
|
-
const
|
|
339
|
+
const reportsClientApi = new ReportsClient(
|
|
337
340
|
generateUrl(REPORTING_BASE_PATH, apiConfig.baseUrl)
|
|
338
341
|
);
|
|
339
342
|
const accessToken = await apiConfig.getAccessToken();
|
|
340
|
-
await
|
|
343
|
+
await reportsClientApi.deleteReportMapping(
|
|
341
344
|
accessToken,
|
|
342
|
-
report.id
|
|
345
|
+
report.id,
|
|
343
346
|
selectedReportMapping?.mappingId ?? ""
|
|
344
347
|
);
|
|
345
348
|
}}
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
import "./Reports.scss";
|
|
28
28
|
import DeleteModal from "./DeleteModal";
|
|
29
29
|
import type { Report } from "@itwin/insights-client";
|
|
30
|
-
import { REPORTING_BASE_PATH,
|
|
30
|
+
import { REPORTING_BASE_PATH, ReportsClient } from "@itwin/insights-client";
|
|
31
31
|
import ReportAction from "./ReportAction";
|
|
32
32
|
import { ReportMappings } from "./ReportMappings";
|
|
33
33
|
import { HorizontalTile } from "./HorizontalTile";
|
|
@@ -55,11 +55,11 @@ const fetchReports = async (
|
|
|
55
55
|
try {
|
|
56
56
|
if (!iTwinId) return;
|
|
57
57
|
setIsLoading(true);
|
|
58
|
-
const
|
|
58
|
+
const reportsClientApi = new ReportsClient(
|
|
59
59
|
generateUrl(REPORTING_BASE_PATH, apiContext.baseUrl)
|
|
60
60
|
);
|
|
61
61
|
const accessToken = await apiContext.getAccessToken();
|
|
62
|
-
const reports = await
|
|
62
|
+
const reports = await reportsClientApi.getReports(accessToken, iTwinId);
|
|
63
63
|
setReports(reports ?? []);
|
|
64
64
|
} catch (error: any) {
|
|
65
65
|
handleError(error.status);
|
|
@@ -173,7 +173,7 @@ export const Reports = () => {
|
|
|
173
173
|
{filteredReports.map((report) => (
|
|
174
174
|
<HorizontalTile
|
|
175
175
|
key={report.id}
|
|
176
|
-
title={report.displayName
|
|
176
|
+
title={report.displayName}
|
|
177
177
|
subText={report.description ?? ""}
|
|
178
178
|
subtextToolTip={report.description ?? ""}
|
|
179
179
|
titleTooltip={report.displayName}
|
|
@@ -231,11 +231,11 @@ export const Reports = () => {
|
|
|
231
231
|
show={showDeleteModal}
|
|
232
232
|
setShow={setShowDeleteModal}
|
|
233
233
|
onDelete={async () => {
|
|
234
|
-
const
|
|
234
|
+
const reportsClientApi = new ReportsClient(
|
|
235
235
|
generateUrl(REPORTING_BASE_PATH, apiConfig.baseUrl)
|
|
236
236
|
);
|
|
237
237
|
const accessToken = await apiConfig.getAccessToken();
|
|
238
|
-
await
|
|
238
|
+
await reportsClientApi.deleteReport(
|
|
239
239
|
accessToken,
|
|
240
240
|
selectedReport?.id ?? ""
|
|
241
241
|
);
|