@genesislcap/pbc-reporting-ui 15.19.0 → 15.19.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/dist/custom-elements.json +4247 -5382
- package/dist/dts/react.d.ts +44 -44
- package/dist/react.cjs +65 -65
- package/dist/react.mjs +57 -57
- package/package.json +22 -23
- package/.env +0 -3
- package/api-extractor.json +0 -4
- package/dist/dts/new/main/edit-config/col-filters/col-filters-grid.helpers.test.d.ts +0 -2
- package/dist/dts/new/main/edit-config/col-filters/col-filters-grid.helpers.test.d.ts.map +0 -1
- package/dist/dts/new/main/edit-config/col-rename-alias/col-rename-alias-grid.helpers.test.d.ts +0 -2
- package/dist/dts/new/main/edit-config/col-rename-alias/col-rename-alias-grid.helpers.test.d.ts.map +0 -1
- package/dist/dts/new/main/edit-config/data-transforms-derived-fields/data-transforms.helpers.test.d.ts +0 -2
- package/dist/dts/new/main/edit-config/data-transforms-derived-fields/data-transforms.helpers.test.d.ts.map +0 -1
- package/dist/dts/new/main/edit-config/datasource-config/datasources-config-container.helpers.test.d.ts +0 -2
- package/dist/dts/new/main/edit-config/datasource-config/datasources-config-container.helpers.test.d.ts.map +0 -1
- package/dist/dts/new/main/edit-config/row-filters/row-filters.helpers.test.d.ts +0 -2
- package/dist/dts/new/main/edit-config/row-filters/row-filters.helpers.test.d.ts.map +0 -1
- package/dist/dts/new/main/edit-config/shared/datasource-data-base-component.test.d.ts +0 -5
- package/dist/dts/new/main/edit-config/shared/datasource-data-base-component.test.d.ts.map +0 -1
- package/dist/dts/new/utils/alias-generator.test.d.ts +0 -2
- package/dist/dts/new/utils/alias-generator.test.d.ts.map +0 -1
- package/dist/dts/new/utils/endpoint.test.d.ts +0 -2
- package/dist/dts/new/utils/endpoint.test.d.ts.map +0 -1
- package/dist/dts/new/utils/transformers.test.d.ts +0 -2
- package/dist/dts/new/utils/transformers.test.d.ts.map +0 -1
- package/dist/dts/new/utils/validators.test.d.ts +0 -2
- package/dist/dts/new/utils/validators.test.d.ts.map +0 -1
- package/dist/dts/old/main/main.test.d.ts +0 -2
- package/dist/dts/old/main/main.test.d.ts.map +0 -1
- package/dist/dts/old/utils/filterObjectArray.test.d.ts +0 -2
- package/dist/dts/old/utils/filterObjectArray.test.d.ts.map +0 -1
- package/dist/esm/new/main/edit-config/col-filters/col-filters-grid.helpers.test.js +0 -200
- package/dist/esm/new/main/edit-config/col-rename-alias/col-rename-alias-grid.helpers.test.js +0 -152
- package/dist/esm/new/main/edit-config/data-transforms-derived-fields/data-transforms.helpers.test.js +0 -629
- package/dist/esm/new/main/edit-config/datasource-config/datasources-config-container.helpers.test.js +0 -268
- package/dist/esm/new/main/edit-config/row-filters/row-filters.helpers.test.js +0 -1
- package/dist/esm/new/main/edit-config/shared/datasource-data-base-component.test.js +0 -426
- package/dist/esm/new/utils/alias-generator.test.js +0 -36
- package/dist/esm/new/utils/endpoint.test.js +0 -162
- package/dist/esm/new/utils/transformers.test.js +0 -469
- package/dist/esm/new/utils/validators.test.js +0 -139
- package/dist/esm/old/main/main.test.js +0 -5
- package/dist/esm/old/utils/filterObjectArray.test.js +0 -46
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/src/globals.d.ts +0 -7
- package/src/index.federated.ts +0 -1
- package/src/index.ts +0 -8
- package/src/new/components/clone-report-config-modal/clone-report-config-modal.styles.ts +0 -47
- package/src/new/components/clone-report-config-modal/clone-report-config-modal.template.ts +0 -55
- package/src/new/components/clone-report-config-modal/clone-report-config-modal.ts +0 -173
- package/src/new/components/components.ts +0 -118
- package/src/new/components/renderers/data-transform-renderer.ts +0 -111
- package/src/new/components/reporting-configurations/reporting-configurations.styles.ts +0 -42
- package/src/new/components/reporting-configurations/reporting-configurations.template.ts +0 -59
- package/src/new/components/reporting-configurations/reporting-configurations.ts +0 -366
- package/src/new/components/shared/file-template-picker.template.ts +0 -45
- package/src/new/lib/redux-store/README.md +0 -55
- package/src/new/lib/redux-store/index.ts +0 -2
- package/src/new/lib/redux-store/state-utils.ts +0 -1
- package/src/new/lib/redux-store/store.ts +0 -135
- package/src/new/main/edit-config/base-config/base-config.styles.ts +0 -26
- package/src/new/main/edit-config/base-config/base-config.template.ts +0 -71
- package/src/new/main/edit-config/base-config/base-config.ts +0 -116
- package/src/new/main/edit-config/col-filters/col-filters-grid.helpers.test.ts +0 -232
- package/src/new/main/edit-config/col-filters/col-filters-grid.helpers.ts +0 -35
- package/src/new/main/edit-config/col-filters/col-filters-grid.styles.ts +0 -22
- package/src/new/main/edit-config/col-filters/col-filters-grid.ts +0 -150
- package/src/new/main/edit-config/col-filters/col-filters-grid.types.ts +0 -7
- package/src/new/main/edit-config/col-filters/col-filters-tutorial.ts +0 -25
- package/src/new/main/edit-config/col-filters/col-fitlers-grid.template.ts +0 -15
- package/src/new/main/edit-config/col-rename-alias/col-rename-alias-grid.helpers.test.ts +0 -187
- package/src/new/main/edit-config/col-rename-alias/col-rename-alias-grid.helpers.ts +0 -89
- package/src/new/main/edit-config/col-rename-alias/col-rename-alias-grid.styles.ts +0 -22
- package/src/new/main/edit-config/col-rename-alias/col-rename-alias-grid.template.ts +0 -14
- package/src/new/main/edit-config/col-rename-alias/col-rename-alias-grid.ts +0 -119
- package/src/new/main/edit-config/col-rename-alias/col-rename-alias-grid.types.ts +0 -10
- package/src/new/main/edit-config/col-rename-alias/col-rename-alias-tutorial.ts +0 -33
- package/src/new/main/edit-config/config-journey-orchestrator.styles.ts +0 -120
- package/src/new/main/edit-config/config-journey-orchestrator.template.ts +0 -149
- package/src/new/main/edit-config/config-journey-orchestrator.ts +0 -92
- package/src/new/main/edit-config/data-transforms-derived-fields/data-transforms-tutorial.ts +0 -127
- package/src/new/main/edit-config/data-transforms-derived-fields/data-transforms.helpers.test.ts +0 -799
- package/src/new/main/edit-config/data-transforms-derived-fields/data-transforms.helpers.ts +0 -371
- package/src/new/main/edit-config/data-transforms-derived-fields/data-transforms.styles.ts +0 -22
- package/src/new/main/edit-config/data-transforms-derived-fields/data-transforms.template.ts +0 -21
- package/src/new/main/edit-config/data-transforms-derived-fields/data-transforms.ts +0 -162
- package/src/new/main/edit-config/data-transforms-derived-fields/data-transforms.types.ts +0 -211
- package/src/new/main/edit-config/data-transforms-derived-fields/date-format-modal/date-format-modal.styles.ts +0 -79
- package/src/new/main/edit-config/data-transforms-derived-fields/date-format-modal/date-format-modal.template.ts +0 -217
- package/src/new/main/edit-config/data-transforms-derived-fields/date-format-modal/date-format-modal.ts +0 -280
- package/src/new/main/edit-config/data-transforms-derived-fields/date-format-modal/index.ts +0 -1
- package/src/new/main/edit-config/data-transforms-derived-fields/format-warning.ts +0 -43
- package/src/new/main/edit-config/data-transforms-derived-fields/number-format-modal/index.ts +0 -1
- package/src/new/main/edit-config/data-transforms-derived-fields/number-format-modal/number-format-modal.styles.ts +0 -68
- package/src/new/main/edit-config/data-transforms-derived-fields/number-format-modal/number-format-modal.template.ts +0 -93
- package/src/new/main/edit-config/data-transforms-derived-fields/number-format-modal/number-format-modal.ts +0 -152
- package/src/new/main/edit-config/datasource-config/datasource-config-container.styles.ts +0 -22
- package/src/new/main/edit-config/datasource-config/datasource-config-item.styles.ts +0 -76
- package/src/new/main/edit-config/datasource-config/datasource-config-item.template.ts +0 -141
- package/src/new/main/edit-config/datasource-config/datasource-config-item.ts +0 -212
- package/src/new/main/edit-config/datasource-config/datasources-config-container.helpers.test.ts +0 -341
- package/src/new/main/edit-config/datasource-config/datasources-config-container.helpers.ts +0 -99
- package/src/new/main/edit-config/datasource-config/datasources-config-container.template.ts +0 -68
- package/src/new/main/edit-config/datasource-config/datasources-config-container.ts +0 -55
- package/src/new/main/edit-config/datasource-config/types.ts +0 -6
- package/src/new/main/edit-config/outputs-config/outputs-config.style.ts +0 -11
- package/src/new/main/edit-config/outputs-config/outputs-config.template.ts +0 -66
- package/src/new/main/edit-config/outputs-config/outputs-config.ts +0 -66
- package/src/new/main/edit-config/row-filters/row-filters-tutorial.styles.ts +0 -16
- package/src/new/main/edit-config/row-filters/row-filters-tutorial.template.ts +0 -229
- package/src/new/main/edit-config/row-filters/row-filters-tutorial.ts +0 -15
- package/src/new/main/edit-config/row-filters/row-filters.helpers.test.ts +0 -2
- package/src/new/main/edit-config/row-filters/row-filters.helpers.ts +0 -53
- package/src/new/main/edit-config/row-filters/row-filters.styles.ts +0 -23
- package/src/new/main/edit-config/row-filters/row-filters.template.ts +0 -15
- package/src/new/main/edit-config/row-filters/row-filters.ts +0 -58
- package/src/new/main/edit-config/row-filters/row-filters.types.ts +0 -14
- package/src/new/main/edit-config/scheduling/scheduling.styles.ts +0 -59
- package/src/new/main/edit-config/scheduling/scheduling.template.ts +0 -80
- package/src/new/main/edit-config/scheduling/scheduling.ts +0 -101
- package/src/new/main/edit-config/shared/datasource-data-base-component.helpers.ts.ts +0 -250
- package/src/new/main/edit-config/shared/datasource-data-base-component.test.ts +0 -568
- package/src/new/main/edit-config/shared/datasource-data-base-component.ts +0 -65
- package/src/new/main/edit-config/shared/datasource-data-base-component.types.ts +0 -55
- package/src/new/main/edit-config/shared/index.ts +0 -3
- package/src/new/main/edit-config/tabbed-datasource-container/index.ts +0 -2
- package/src/new/main/edit-config/tabbed-datasource-container/tabbed-datasource-container.styles.ts +0 -12
- package/src/new/main/edit-config/tabbed-datasource-container/tabbed-datasource-container.template.ts +0 -29
- package/src/new/main/edit-config/tabbed-datasource-container/tabbed-datasource-container.ts +0 -69
- package/src/new/main/edit-config/tabbed-datasource-container/tabbed-datasource-container.types.ts +0 -7
- package/src/new/main/generated-reports/generated-reports.styles.ts +0 -15
- package/src/new/main/generated-reports/generated-reports.template.ts +0 -29
- package/src/new/main/generated-reports/generated-reports.ts +0 -270
- package/src/new/main/index.ts +0 -3
- package/src/new/main/main.styles.ts +0 -31
- package/src/new/main/main.template.ts +0 -92
- package/src/new/main/main.ts +0 -117
- package/src/new/main/report-destinations/report-destinations.template.ts +0 -39
- package/src/new/main/report-destinations/report-destinations.ts +0 -63
- package/src/new/store/index.ts +0 -3
- package/src/new/store/slices/base-config.ts +0 -50
- package/src/new/store/slices/datasources-config.ts +0 -297
- package/src/new/store/slices/index.ts +0 -3
- package/src/new/store/slices/types.ts +0 -90
- package/src/new/store/store.ts +0 -36
- package/src/new/store/types.ts +0 -10
- package/src/new/styles/constraints.styles.ts +0 -32
- package/src/new/styles/forms.styles.ts +0 -38
- package/src/new/styles/index.ts +0 -3
- package/src/new/styles/misc.styles.ts +0 -25
- package/src/new/types/display.ts +0 -4
- package/src/new/types/index.ts +0 -4
- package/src/new/types/misc.ts +0 -73
- package/src/new/types/redux.ts +0 -73
- package/src/new/types/rights.ts +0 -28
- package/src/new/utils/alias-generator.test.ts +0 -44
- package/src/new/utils/alias-generator.ts +0 -18
- package/src/new/utils/date-filter-params.ts +0 -28
- package/src/new/utils/endpoint.test.ts +0 -193
- package/src/new/utils/endpoint.ts +0 -62
- package/src/new/utils/event-map.ts +0 -11
- package/src/new/utils/format-utils.ts +0 -22
- package/src/new/utils/formatters.ts +0 -36
- package/src/new/utils/index.ts +0 -10
- package/src/new/utils/notifications.ts +0 -9
- package/src/new/utils/renderer.ts +0 -38
- package/src/new/utils/rights.ts +0 -66
- package/src/new/utils/sorter.ts +0 -19
- package/src/new/utils/tooltip.ts +0 -94
- package/src/new/utils/transformers.test.ts +0 -549
- package/src/new/utils/transformers.ts +0 -174
- package/src/new/utils/validators.test.ts +0 -165
- package/src/new/utils/validators.ts +0 -81
- package/src/old/assets/images/index.ts +0 -69
- package/src/old/components/create-edit/create-edit.styles.ts +0 -16
- package/src/old/components/create-edit/create-edit.template.ts +0 -15
- package/src/old/components/create-edit/create-edit.ts +0 -70
- package/src/old/components/create-edit/index.ts +0 -3
- package/src/old/components/list/columns.ts +0 -175
- package/src/old/components/list/index.ts +0 -3
- package/src/old/components/list/list.styles.ts +0 -9
- package/src/old/components/list/list.template.ts +0 -40
- package/src/old/components/list/list.ts +0 -109
- package/src/old/components/preview/columns.ts +0 -58
- package/src/old/components/preview/index.ts +0 -3
- package/src/old/components/preview/preview.styles.ts +0 -22
- package/src/old/components/preview/preview.template.ts +0 -33
- package/src/old/components/preview/preview.ts +0 -143
- package/src/old/components/rapid-components.ts +0 -64
- package/src/old/components/renderers/custom-header-component.ts +0 -92
- package/src/old/components/renderers/filter-value-renderer.ts +0 -237
- package/src/old/components/renderers/row-select.renderer.ts +0 -148
- package/src/old/components/select-fields/columns.ts +0 -83
- package/src/old/components/select-fields/data.ts +0 -218
- package/src/old/components/select-fields/index.ts +0 -3
- package/src/old/components/select-fields/select-fields.styles.ts +0 -22
- package/src/old/components/select-fields/select-fields.template.ts +0 -58
- package/src/old/components/select-fields/select-fields.ts +0 -218
- package/src/old/components/select-filters/columns.ts +0 -78
- package/src/old/components/select-filters/index.ts +0 -3
- package/src/old/components/select-filters/select-filters.styles.ts +0 -21
- package/src/old/components/select-filters/select-filters.template.ts +0 -58
- package/src/old/components/select-filters/select-filters.ts +0 -255
- package/src/old/components/wizard/debug.ts +0 -35
- package/src/old/components/wizard/index.ts +0 -2
- package/src/old/components/wizard/steps/filters.ts +0 -13
- package/src/old/components/wizard/steps/index.ts +0 -4
- package/src/old/components/wizard/steps/name.ts +0 -72
- package/src/old/components/wizard/steps/run.ts +0 -14
- package/src/old/components/wizard/steps/select.ts +0 -14
- package/src/old/components/wizard/wizard.styles.ts +0 -198
- package/src/old/components/wizard/wizard.template.ts +0 -147
- package/src/old/components/wizard/wizard.ts +0 -398
- package/src/old/components/wizard/wizard.types.ts +0 -43
- package/src/old/components/zero-components.ts +0 -61
- package/src/old/config/config.ts +0 -59
- package/src/old/config/configure.ts +0 -66
- package/src/old/config/index.ts +0 -2
- package/src/old/config/templates.ts +0 -59
- package/src/old/constants/grid-config.ts +0 -19
- package/src/old/layouts/default.ts +0 -30
- package/src/old/layouts/index.ts +0 -2
- package/src/old/layouts/two-pane-horizontal.ts +0 -81
- package/src/old/main/index.ts +0 -3
- package/src/old/main/main.styles.ts +0 -69
- package/src/old/main/main.template.ts +0 -127
- package/src/old/main/main.test.ts +0 -7
- package/src/old/main/main.ts +0 -250
- package/src/old/main/types.ts +0 -29
- package/src/old/styles/colors.ts +0 -16
- package/src/old/styles/helpers.ts +0 -181
- package/src/old/styles/index.ts +0 -4
- package/src/old/styles/normalize.ts +0 -14
- package/src/old/styles/styles.ts +0 -24
- package/src/old/tags/index.ts +0 -1
- package/src/old/tags/tags.ts +0 -79
- package/src/old/tsconfig.json +0 -10
- package/src/old/utils/filterObjectArray.test.ts +0 -110
- package/src/old/utils/filterObjectArray.ts +0 -23
- package/src/old/utils/getFiltersByType.ts +0 -92
- package/src/old/utils/getSelectedFields.ts +0 -16
- package/src/old/utils/index.ts +0 -4
- package/src/old/utils/logger.ts +0 -3
- package/src/sandbox.ts +0 -51
- package/src/tsconfig.base.json +0 -24
- package/src/typings.d.ts +0 -1
- package/tsconfig.json +0 -9
package/src/new/main/edit-config/datasource-config/datasources-config-container.helpers.test.ts
DELETED
|
@@ -1,341 +0,0 @@
|
|
|
1
|
-
import { Connect, logger } from '@genesislcap/foundation-comms';
|
|
2
|
-
import { assert, sinon, suite } from '@genesislcap/foundation-testing';
|
|
3
|
-
import { actions, DatasourceInputTypes, selectors } from '../../../store';
|
|
4
|
-
import {
|
|
5
|
-
createNewDatasourceConfig,
|
|
6
|
-
findFirstValidDatasource,
|
|
7
|
-
getDatasources,
|
|
8
|
-
} from './datasources-config-container.helpers';
|
|
9
|
-
import { DatasourceChoice } from './types';
|
|
10
|
-
|
|
11
|
-
const GetDatasources = suite('getDatasources()');
|
|
12
|
-
|
|
13
|
-
GetDatasources.before.each(() => {
|
|
14
|
-
sinon.restore();
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
// GetDatasources('should combine REQ_REP and DATA_PIPELINE datasources', async () => {
|
|
18
|
-
// const mockConnect = {
|
|
19
|
-
// request: sinon.stub(),
|
|
20
|
-
// };
|
|
21
|
-
//
|
|
22
|
-
// // Stub the REQ_REP response
|
|
23
|
-
// mockConnect.request.withArgs('ALL_REPORT_DATASOURCES', { REQUEST: {} }).resolves({
|
|
24
|
-
// REPLY: [{ DATASOURCE_NAME: 'ReqRep1' }, { DATASOURCE_NAME: 'ReqRep2' }],
|
|
25
|
-
// });
|
|
26
|
-
//
|
|
27
|
-
// // Stub the DATA_PIPELINE response
|
|
28
|
-
// mockConnect.request.withArgs('REPORTING_DATA_PIPELINES', { REQUEST: {} }).resolves({
|
|
29
|
-
// REPLY: [{ NAME: 'Pipeline1' }, { NAME: 'Pipeline2' }],
|
|
30
|
-
// });
|
|
31
|
-
//
|
|
32
|
-
// const result = await getDatasources(mockConnect as Connect);
|
|
33
|
-
//
|
|
34
|
-
// assert.equal(result.length, 4);
|
|
35
|
-
// assert.equal(result[0], { name: 'ReqRep1', inputType: 'REQ_REP' });
|
|
36
|
-
// assert.equal(result[1], { name: 'ReqRep2', inputType: 'REQ_REP' });
|
|
37
|
-
// assert.equal(result[2], { name: 'Pipeline1', inputType: 'DATA_PIPELINE' });
|
|
38
|
-
// assert.equal(result[3], { name: 'Pipeline2', inputType: 'DATA_PIPELINE' });
|
|
39
|
-
// assert.ok(mockConnect.request.calledTwice);
|
|
40
|
-
// });
|
|
41
|
-
|
|
42
|
-
GetDatasources('should throw error when REQ_REP request fails', async () => {
|
|
43
|
-
const mockConnect = {
|
|
44
|
-
request: sinon.stub(),
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
mockConnect.request.withArgs('ALL_REPORT_DATASOURCES', { REQUEST: {} }).resolves({
|
|
48
|
-
REPLY: null,
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
try {
|
|
52
|
-
await getDatasources(mockConnect as unknown as Connect);
|
|
53
|
-
assert.unreachable('Should have thrown an error');
|
|
54
|
-
} catch (error) {
|
|
55
|
-
assert.instance(error, Error);
|
|
56
|
-
assert.is(error.message, 'REQ_REP request');
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
// GetDatasources('should throw error when DATA_PIPELINE request fails', async () => {
|
|
61
|
-
// const mockConnect = {
|
|
62
|
-
// request: sinon.stub(),
|
|
63
|
-
// };
|
|
64
|
-
//
|
|
65
|
-
// mockConnect.request.withArgs('ALL_REPORT_DATASOURCES', { REQUEST: {} }).resolves({
|
|
66
|
-
// REPLY: [{ DATASOURCE_NAME: 'ReqRep1' }],
|
|
67
|
-
// });
|
|
68
|
-
//
|
|
69
|
-
// mockConnect.request.withArgs('REPORTING_DATA_PIPELINES', { REQUEST: {} }).resolves({
|
|
70
|
-
// REPLY: null,
|
|
71
|
-
// });
|
|
72
|
-
//
|
|
73
|
-
// try {
|
|
74
|
-
// await getDatasources(mockConnect as Connect);
|
|
75
|
-
// assert.unreachable('Should have thrown an error');
|
|
76
|
-
// } catch (error) {
|
|
77
|
-
// assert.instance(error, Error);
|
|
78
|
-
// assert.is(error.message, 'DATA_PIPELINE request');
|
|
79
|
-
// }
|
|
80
|
-
// });
|
|
81
|
-
|
|
82
|
-
GetDatasources('should handle empty responses', async () => {
|
|
83
|
-
const mockConnect = {
|
|
84
|
-
request: sinon.stub(),
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
mockConnect.request.withArgs('ALL_REPORT_DATASOURCES', { REQUEST: {} }).resolves({
|
|
88
|
-
REPLY: [],
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
// mockConnect.request.withArgs('REPORTING_DATA_PIPELINES', { REQUEST: {} }).resolves({
|
|
92
|
-
// REPLY: [],
|
|
93
|
-
// });
|
|
94
|
-
//
|
|
95
|
-
const result = await getDatasources(mockConnect as unknown as Connect);
|
|
96
|
-
|
|
97
|
-
assert.equal(result.length, 0);
|
|
98
|
-
// assert.ok(mockConnect.request.calledTwice);
|
|
99
|
-
assert.ok(mockConnect.request.calledOnce);
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
GetDatasources.run();
|
|
103
|
-
|
|
104
|
-
const FindFirstValidDatasource = suite('findFirstValidDatasource()');
|
|
105
|
-
|
|
106
|
-
FindFirstValidDatasource.before.each(() => {
|
|
107
|
-
sinon.restore();
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
FindFirstValidDatasource('should return first valid datasource with schema', async () => {
|
|
111
|
-
const mockSchema = { properties: { someProperty: 'value' } };
|
|
112
|
-
const getSchemaStub = sinon.stub().resolves(mockSchema);
|
|
113
|
-
|
|
114
|
-
const validDatasources: DatasourceChoice[] = [
|
|
115
|
-
{ name: 'TEST_SOURCE', inputType: 'REQ_REP' as DatasourceInputTypes },
|
|
116
|
-
];
|
|
117
|
-
|
|
118
|
-
const result = await findFirstValidDatasource(getSchemaStub)(validDatasources);
|
|
119
|
-
|
|
120
|
-
assert.equal(result.KEY, 'TEST_SOURCE');
|
|
121
|
-
assert.equal(result.INPUT_TYPE, 'REQ_REP');
|
|
122
|
-
assert.equal(result.schema, mockSchema);
|
|
123
|
-
assert.ok(getSchemaStub.calledOnce);
|
|
124
|
-
assert.ok(getSchemaStub.calledWith('TEST_SOURCE'));
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
FindFirstValidDatasource('should try next datasource if first fails', async () => {
|
|
128
|
-
const mockSchema = { properties: { someProperty: 'value' } };
|
|
129
|
-
const getSchemaStub = sinon.stub();
|
|
130
|
-
getSchemaStub.onFirstCall().rejects(new Error('Failed'));
|
|
131
|
-
getSchemaStub.onSecondCall().resolves(mockSchema);
|
|
132
|
-
|
|
133
|
-
const validDatasources: DatasourceChoice[] = [
|
|
134
|
-
{ name: 'FAILED_SOURCE', inputType: 'REQ_REP' as DatasourceInputTypes },
|
|
135
|
-
{ name: 'VALID_SOURCE', inputType: 'DATA_PIPELINE' as DatasourceInputTypes },
|
|
136
|
-
];
|
|
137
|
-
|
|
138
|
-
const result = await findFirstValidDatasource(getSchemaStub)(validDatasources);
|
|
139
|
-
|
|
140
|
-
assert.equal(result.KEY, 'VALID_SOURCE');
|
|
141
|
-
assert.equal(result.INPUT_TYPE, 'DATA_PIPELINE');
|
|
142
|
-
assert.equal(result.schema, mockSchema);
|
|
143
|
-
assert.ok(getSchemaStub.calledTwice);
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
FindFirstValidDatasource('should throw error if no valid datasources found', async () => {
|
|
147
|
-
const getSchemaStub = sinon.stub().rejects(new Error('Failed'));
|
|
148
|
-
|
|
149
|
-
const validDatasources: DatasourceChoice[] = [
|
|
150
|
-
{ name: 'FAILED_SOURCE', inputType: 'REQ_REP' as DatasourceInputTypes },
|
|
151
|
-
];
|
|
152
|
-
|
|
153
|
-
try {
|
|
154
|
-
await findFirstValidDatasource(getSchemaStub)(validDatasources);
|
|
155
|
-
assert.unreachable('Should have thrown an error');
|
|
156
|
-
} catch (error) {
|
|
157
|
-
assert.instance(error, Error);
|
|
158
|
-
assert.equal((error as Error).message, 'No valid datasources found');
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
assert.ok(getSchemaStub.calledOnce);
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
FindFirstValidDatasource('should skip schema without properties', async () => {
|
|
165
|
-
const invalidSchema = { properties: null };
|
|
166
|
-
const validSchema = { properties: { someProperty: 'value' } };
|
|
167
|
-
const getSchemaStub = sinon.stub();
|
|
168
|
-
getSchemaStub.onFirstCall().resolves(invalidSchema);
|
|
169
|
-
getSchemaStub.onSecondCall().resolves(validSchema);
|
|
170
|
-
|
|
171
|
-
const validDatasources: DatasourceChoice[] = [
|
|
172
|
-
{ name: 'INVALID_SCHEMA', inputType: 'REQ_REP' as DatasourceInputTypes },
|
|
173
|
-
{ name: 'VALID_SCHEMA', inputType: 'DATA_PIPELINE' as DatasourceInputTypes },
|
|
174
|
-
];
|
|
175
|
-
|
|
176
|
-
const result = await findFirstValidDatasource(getSchemaStub)(validDatasources);
|
|
177
|
-
|
|
178
|
-
assert.equal(result.KEY, 'VALID_SCHEMA');
|
|
179
|
-
assert.equal(result.INPUT_TYPE, 'DATA_PIPELINE');
|
|
180
|
-
assert.equal(result.schema, validSchema);
|
|
181
|
-
assert.ok(getSchemaStub.calledTwice);
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
FindFirstValidDatasource.run();
|
|
185
|
-
|
|
186
|
-
const CreateNewDatasourceConfig = suite('createNewDatasourceConfig()');
|
|
187
|
-
|
|
188
|
-
CreateNewDatasourceConfig.before.each(() => {
|
|
189
|
-
sinon.restore();
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
CreateNewDatasourceConfig('should exit when no valid datasources are available', async () => {
|
|
193
|
-
const mockChoices = [{ name: 'testSource', inputType: 'REQ_REP' as DatasourceInputTypes }];
|
|
194
|
-
|
|
195
|
-
const getAllConfigSetStub = sinon.stub(selectors.datasourceConfig, 'getAllConfigSet').returns({
|
|
196
|
-
REQ_REP_testSource_testSource: {
|
|
197
|
-
KEY: 'testSource',
|
|
198
|
-
NAME: 'testSource',
|
|
199
|
-
INPUT_TYPE: 'REQ_REP' as const,
|
|
200
|
-
OUTPUT_TYPE: 'TABLE' as const,
|
|
201
|
-
TRANSFORMER_CONFIGURATION: { INCLUDE_COLUMNS: [] },
|
|
202
|
-
GROUPING_STRATEGY: 'NONE',
|
|
203
|
-
GROUP_KEY: null,
|
|
204
|
-
},
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
const loggerStub = sinon.stub(logger, 'error');
|
|
208
|
-
const getSchemaStub = sinon.stub().resolves({});
|
|
209
|
-
|
|
210
|
-
await createNewDatasourceConfig(getSchemaStub)(mockChoices);
|
|
211
|
-
|
|
212
|
-
assert.ok(getAllConfigSetStub.calledOnce);
|
|
213
|
-
assert.ok(loggerStub.calledWith('No datasources available to create new config from'));
|
|
214
|
-
assert.ok(!getSchemaStub.called);
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
CreateNewDatasourceConfig(
|
|
218
|
-
'should exit when trying to add multiple datasources with CSV format',
|
|
219
|
-
async () => {
|
|
220
|
-
const mockChoices = [{ name: 'testSource', inputType: 'REQ_REP' as DatasourceInputTypes }];
|
|
221
|
-
|
|
222
|
-
const getAllConfigSetStub = sinon.stub(selectors.datasourceConfig, 'getAllConfigSet').returns({
|
|
223
|
-
REQ_REP_existingSource_existingAlias: {
|
|
224
|
-
KEY: 'existingAlias',
|
|
225
|
-
NAME: 'existingSource',
|
|
226
|
-
INPUT_TYPE: 'REQ_REP' as const,
|
|
227
|
-
OUTPUT_TYPE: 'TABLE' as const,
|
|
228
|
-
TRANSFORMER_CONFIGURATION: { INCLUDE_COLUMNS: [] },
|
|
229
|
-
GROUPING_STRATEGY: 'NONE' as const,
|
|
230
|
-
GROUP_KEY: null,
|
|
231
|
-
},
|
|
232
|
-
});
|
|
233
|
-
|
|
234
|
-
const getConfigStub = sinon.stub(selectors.baseConfig, 'getConfig').returns({
|
|
235
|
-
DESTINATION_IDS: [],
|
|
236
|
-
OUTPUT_DIRECTORY: '/reports',
|
|
237
|
-
OUTPUT_FORMAT: 'CSV',
|
|
238
|
-
});
|
|
239
|
-
|
|
240
|
-
const loggerStub = sinon.stub(logger, 'error');
|
|
241
|
-
const getSchemaStub = sinon.stub().resolves({});
|
|
242
|
-
|
|
243
|
-
await createNewDatasourceConfig(getSchemaStub)(mockChoices);
|
|
244
|
-
|
|
245
|
-
assert.equal(getAllConfigSetStub.callCount, 1, 'getAllConfigSetStub should be called once');
|
|
246
|
-
assert.equal(getConfigStub.callCount, 1, 'getConfigStub should be called once');
|
|
247
|
-
// assert.ok(loggerStub.calledWith('Cannot add multiple datasources when using csv file without a template'));
|
|
248
|
-
if (loggerStub.args.length > 0) {
|
|
249
|
-
assert.equal(
|
|
250
|
-
loggerStub.args[0][0],
|
|
251
|
-
'Cannot add multiple datasources when using csv file without a template',
|
|
252
|
-
);
|
|
253
|
-
} else {
|
|
254
|
-
assert.unreachable('Logger was not called');
|
|
255
|
-
}
|
|
256
|
-
assert.equal(getSchemaStub.callCount, 0, 'getSchemaStub should not be called');
|
|
257
|
-
},
|
|
258
|
-
);
|
|
259
|
-
|
|
260
|
-
CreateNewDatasourceConfig(
|
|
261
|
-
'should allow adding multiple datasources with CSV format IF template is selected',
|
|
262
|
-
async () => {
|
|
263
|
-
const mockChoices = [{ name: 'testSource', inputType: 'REQ_REP' as DatasourceInputTypes }];
|
|
264
|
-
|
|
265
|
-
const getAllConfigSetStub = sinon.stub(selectors.datasourceConfig, 'getAllConfigSet').returns({
|
|
266
|
-
REQ_REP_existingSource_existingAlias: {
|
|
267
|
-
KEY: 'existingAlias',
|
|
268
|
-
NAME: 'existingSource',
|
|
269
|
-
INPUT_TYPE: 'REQ_REP' as const,
|
|
270
|
-
OUTPUT_TYPE: 'TABLE' as const,
|
|
271
|
-
TRANSFORMER_CONFIGURATION: { INCLUDE_COLUMNS: [] },
|
|
272
|
-
GROUPING_STRATEGY: 'NONE' as const,
|
|
273
|
-
GROUP_KEY: null,
|
|
274
|
-
},
|
|
275
|
-
});
|
|
276
|
-
|
|
277
|
-
sinon.stub(selectors.baseConfig, 'getConfig').returns({
|
|
278
|
-
DESTINATION_IDS: [],
|
|
279
|
-
OUTPUT_DIRECTORY: '/reports',
|
|
280
|
-
OUTPUT_FORMAT: 'CSV',
|
|
281
|
-
DOCUMENT_TEMPLATE_ID: 'some-template-id',
|
|
282
|
-
});
|
|
283
|
-
|
|
284
|
-
const mockSchema = {
|
|
285
|
-
properties: {
|
|
286
|
-
field1: {},
|
|
287
|
-
field2: {},
|
|
288
|
-
},
|
|
289
|
-
};
|
|
290
|
-
|
|
291
|
-
const getSchemaStub = sinon.stub().resolves(mockSchema);
|
|
292
|
-
const initConfigStub = sinon.stub(actions.datasourceConfig, 'initDatasourceConfiguration');
|
|
293
|
-
|
|
294
|
-
await createNewDatasourceConfig(getSchemaStub)(mockChoices);
|
|
295
|
-
|
|
296
|
-
assert.ok(getAllConfigSetStub.calledOnce);
|
|
297
|
-
assert.ok(getSchemaStub.calledOnce);
|
|
298
|
-
assert.ok(initConfigStub.called);
|
|
299
|
-
},
|
|
300
|
-
);
|
|
301
|
-
|
|
302
|
-
CreateNewDatasourceConfig('should successfully create new datasource configuration', async () => {
|
|
303
|
-
const mockChoices = [{ name: 'testSource', inputType: 'REQ_REP' as DatasourceInputTypes }];
|
|
304
|
-
|
|
305
|
-
const getAllConfigSetStub = sinon.stub(selectors.datasourceConfig, 'getAllConfigSet').returns({});
|
|
306
|
-
|
|
307
|
-
sinon.stub(selectors.baseConfig, 'getConfig').returns({
|
|
308
|
-
DESTINATION_IDS: [],
|
|
309
|
-
OUTPUT_DIRECTORY: '/reports',
|
|
310
|
-
OUTPUT_FORMAT: 'XLSX',
|
|
311
|
-
});
|
|
312
|
-
|
|
313
|
-
const mockSchema = {
|
|
314
|
-
properties: {
|
|
315
|
-
field1: {},
|
|
316
|
-
field2: {},
|
|
317
|
-
},
|
|
318
|
-
};
|
|
319
|
-
|
|
320
|
-
const getSchemaStub = sinon.stub().resolves(mockSchema);
|
|
321
|
-
const initConfigStub = sinon.stub(actions.datasourceConfig, 'initDatasourceConfiguration');
|
|
322
|
-
|
|
323
|
-
await createNewDatasourceConfig(getSchemaStub)(mockChoices);
|
|
324
|
-
|
|
325
|
-
assert.ok(getAllConfigSetStub.calledOnce);
|
|
326
|
-
assert.ok(getSchemaStub.calledOnce);
|
|
327
|
-
assert.ok(
|
|
328
|
-
initConfigStub.calledWith(
|
|
329
|
-
sinon.match({
|
|
330
|
-
base: sinon.match({
|
|
331
|
-
KEY: 'testSource',
|
|
332
|
-
NAME: 'testSource',
|
|
333
|
-
INPUT_TYPE: 'REQ_REP',
|
|
334
|
-
}),
|
|
335
|
-
fields: sinon.match.array.deepEquals(['field1', 'field2']),
|
|
336
|
-
}),
|
|
337
|
-
),
|
|
338
|
-
);
|
|
339
|
-
});
|
|
340
|
-
|
|
341
|
-
CreateNewDatasourceConfig.run();
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { Connect, logger } from '@genesislcap/foundation-comms';
|
|
2
|
-
import { actions, selectors } from '../../../store';
|
|
3
|
-
import { Genesis } from '../../../types';
|
|
4
|
-
import { buildDatasourceName, generateUniqueAlias } from '../../../utils';
|
|
5
|
-
import { setDefaultFormatsForDatasource } from '../data-transforms-derived-fields/data-transforms.helpers';
|
|
6
|
-
import { DatasourceChoice } from './types';
|
|
7
|
-
|
|
8
|
-
export type GetGenesisSchema = (resource: string) => Promise<Genesis.JSONSchema7>;
|
|
9
|
-
|
|
10
|
-
export const createNewDatasourceConfig =
|
|
11
|
-
(getSchema: GetGenesisSchema) =>
|
|
12
|
-
async (choices: DatasourceChoice[]): Promise<void> => {
|
|
13
|
-
const allDatasources = selectors.datasourceConfig.getAllConfigSet();
|
|
14
|
-
const validDatasources =
|
|
15
|
-
choices.filter(
|
|
16
|
-
(ds) => !(buildDatasourceName(ds.name, ds.name, ds.inputType) in allDatasources),
|
|
17
|
-
) ?? [];
|
|
18
|
-
|
|
19
|
-
if (validDatasources?.length < 1) {
|
|
20
|
-
logger.error('No datasources available to create new config from');
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
const baseConfig = selectors.baseConfig.getConfig();
|
|
24
|
-
if (
|
|
25
|
-
Object.keys(allDatasources).length > 0 &&
|
|
26
|
-
baseConfig.OUTPUT_FORMAT === 'CSV' &&
|
|
27
|
-
!baseConfig.DOCUMENT_TEMPLATE_ID
|
|
28
|
-
) {
|
|
29
|
-
logger.error('Cannot add multiple datasources when using csv file without a template');
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const {
|
|
34
|
-
KEY: RESOURCE_NAME,
|
|
35
|
-
INPUT_TYPE,
|
|
36
|
-
schema,
|
|
37
|
-
} = await findFirstValidDatasource(getSchema)(validDatasources);
|
|
38
|
-
|
|
39
|
-
// Check for duplicate aliases
|
|
40
|
-
const existingAliases = new Set(Object.values(allDatasources).map((ds) => ds.KEY));
|
|
41
|
-
|
|
42
|
-
const uniqueAlias = generateUniqueAlias(RESOURCE_NAME, existingAliases);
|
|
43
|
-
|
|
44
|
-
const datasourceName = buildDatasourceName(uniqueAlias, RESOURCE_NAME, INPUT_TYPE);
|
|
45
|
-
|
|
46
|
-
actions.datasourceConfig.initDatasourceConfiguration({
|
|
47
|
-
base: {
|
|
48
|
-
KEY: uniqueAlias,
|
|
49
|
-
NAME: RESOURCE_NAME,
|
|
50
|
-
INPUT_TYPE,
|
|
51
|
-
},
|
|
52
|
-
fields: Object.keys(schema.properties!), // Properties is valid as we check in findFirstValidDatasource
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
setDefaultFormatsForDatasource(datasourceName, schema);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export const findFirstValidDatasource =
|
|
59
|
-
(getSchema: GetGenesisSchema) => async (validDatasources: DatasourceChoice[]) => {
|
|
60
|
-
/* oxlint-disable no-await-in-loop -- try datasources until one resolves */
|
|
61
|
-
for (const { name: KEY, inputType: INPUT_TYPE } of validDatasources) {
|
|
62
|
-
try {
|
|
63
|
-
const schema = await getSchema(KEY);
|
|
64
|
-
if (schema.properties)
|
|
65
|
-
return {
|
|
66
|
-
KEY,
|
|
67
|
-
INPUT_TYPE,
|
|
68
|
-
schema,
|
|
69
|
-
};
|
|
70
|
-
} catch (_) {}
|
|
71
|
-
}
|
|
72
|
-
/* oxlint-enable no-await-in-loop */
|
|
73
|
-
throw new Error(`No valid datasources found`);
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
// TODO: temporarily removing data pipelines until later requested
|
|
77
|
-
export const getDatasources = async (connect: Connect): Promise<DatasourceChoice[]> => {
|
|
78
|
-
const reqRepResponse = await connect.request('ALL_REPORT_DATASOURCES', {
|
|
79
|
-
REQUEST: {},
|
|
80
|
-
});
|
|
81
|
-
if (!reqRepResponse?.REPLY) throw new Error('REQ_REP request');
|
|
82
|
-
|
|
83
|
-
// const dataPipelineResponse = await connect.request('REPORTING_DATA_PIPELINES', {
|
|
84
|
-
// REQUEST: {},
|
|
85
|
-
// });
|
|
86
|
-
// if (!dataPipelineResponse?.REPLY) throw new Error('DATA_PIPELINE request');
|
|
87
|
-
|
|
88
|
-
return reqRepResponse.REPLY.map(
|
|
89
|
-
({ DATASOURCE_NAME }) =>
|
|
90
|
-
<DatasourceChoice>{
|
|
91
|
-
name: DATASOURCE_NAME,
|
|
92
|
-
inputType: 'REQ_REP',
|
|
93
|
-
},
|
|
94
|
-
).sort((a, b) => a.name.localeCompare(b.name)); // .concat(
|
|
95
|
-
// dataPipelineResponse.REPLY.map(
|
|
96
|
-
// ({ NAME }) => <DatasourceChoice>{ name: NAME, inputType: 'DATA_PIPELINE' },
|
|
97
|
-
// ),
|
|
98
|
-
// );
|
|
99
|
-
};
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { html, repeat, when, whenElse } from '@genesislcap/web-core';
|
|
2
|
-
import { selectors } from '../../../store';
|
|
3
|
-
import { DatasourceConfigItem } from './datasource-config-item';
|
|
4
|
-
import type { DatasourcesConfigContainer } from './datasources-config-container';
|
|
5
|
-
|
|
6
|
-
DatasourceConfigItem;
|
|
7
|
-
|
|
8
|
-
const addDatasourceControl = html<DatasourcesConfigContainer>`
|
|
9
|
-
<rapid-button class="add" @click=${(x) => x.createNewDatasourceConfig()}>
|
|
10
|
-
<rapid-icon name="add" size="md"></rapid-icon>
|
|
11
|
-
</rapid-button>
|
|
12
|
-
`;
|
|
13
|
-
|
|
14
|
-
const container = html<DatasourcesConfigContainer>`
|
|
15
|
-
<div class="container">
|
|
16
|
-
<h1>Datasources</h1>
|
|
17
|
-
${when(
|
|
18
|
-
(_) =>
|
|
19
|
-
selectors.baseConfig.getConfig().OUTPUT_FORMAT &&
|
|
20
|
-
(selectors.baseConfig.getConfig().OUTPUT_FORMAT !== 'CSV' ||
|
|
21
|
-
!!selectors.baseConfig.getConfig().DOCUMENT_TEMPLATE_ID),
|
|
22
|
-
addDatasourceControl,
|
|
23
|
-
)}
|
|
24
|
-
</div>
|
|
25
|
-
<p>Here you can select the datasource(s) you want to use in the generated report.</p>
|
|
26
|
-
<p>
|
|
27
|
-
CSV reports may only have a single data source unless a template is selected. XLSX and PDF
|
|
28
|
-
reports may contain one or more datasources. If a template file is used, you must configure the
|
|
29
|
-
"Name" of each datasource to correspond with your template data references. Use the + button in
|
|
30
|
-
the top right to add any additional data sources.
|
|
31
|
-
</p>
|
|
32
|
-
<p>
|
|
33
|
-
Changing the data source will remove any datasource related configurations previously set up for
|
|
34
|
-
this report (for example column visibility, column renames).
|
|
35
|
-
</p>
|
|
36
|
-
<div>
|
|
37
|
-
${repeat(
|
|
38
|
-
(_) => Object.keys(selectors.datasourceConfig.getAllConfigSet()),
|
|
39
|
-
html<string, DatasourcesConfigContainer>`
|
|
40
|
-
${when(
|
|
41
|
-
(_, ctx) => !ctx.isFirst,
|
|
42
|
-
html`
|
|
43
|
-
<rapid-divider></rapid-divider>
|
|
44
|
-
`,
|
|
45
|
-
)}
|
|
46
|
-
<datasource-config-item
|
|
47
|
-
:datasourceName=${(x) => x}
|
|
48
|
-
:datasourceChoices=${(_, c) => c.parent.datasourceChoices}
|
|
49
|
-
?can-remove=${(_, ctx) => !ctx.isFirst}
|
|
50
|
-
position="${(_, c) => (c.index > 1 ? 'above' : 'below')}"
|
|
51
|
-
></datasource-config-item>
|
|
52
|
-
`,
|
|
53
|
-
{ recycle: false, positioning: true },
|
|
54
|
-
)}
|
|
55
|
-
</div>
|
|
56
|
-
`;
|
|
57
|
-
|
|
58
|
-
export const template = html<DatasourcesConfigContainer>`
|
|
59
|
-
<template>
|
|
60
|
-
${whenElse(
|
|
61
|
-
(x) => !x.datasourceChoices,
|
|
62
|
-
html`
|
|
63
|
-
Unable to load datasources
|
|
64
|
-
`,
|
|
65
|
-
container,
|
|
66
|
-
)}
|
|
67
|
-
</template>
|
|
68
|
-
`;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { Connect } from '@genesislcap/foundation-comms';
|
|
2
|
-
import { logger } from '@genesislcap/foundation-utils';
|
|
3
|
-
import { customElement, GenesisElement, observable } from '@genesislcap/web-core';
|
|
4
|
-
import { selectors } from '../../../store';
|
|
5
|
-
import { getDatasourceSchema, showNotificationToast } from '../../../utils';
|
|
6
|
-
import { styles } from './datasource-config-container.styles';
|
|
7
|
-
import { createNewDatasourceConfig, getDatasources } from './datasources-config-container.helpers';
|
|
8
|
-
import { template } from './datasources-config-container.template';
|
|
9
|
-
import { DatasourceChoice } from './types';
|
|
10
|
-
|
|
11
|
-
@customElement({
|
|
12
|
-
name: 'datasource-config-container',
|
|
13
|
-
template,
|
|
14
|
-
styles,
|
|
15
|
-
})
|
|
16
|
-
export class DatasourcesConfigContainer extends GenesisElement {
|
|
17
|
-
@Connect connect!: Connect;
|
|
18
|
-
private getSchema = getDatasourceSchema(this.connect);
|
|
19
|
-
private initDatasource = createNewDatasourceConfig(this.getSchema);
|
|
20
|
-
|
|
21
|
-
@observable datasourceChoices: DatasourceChoice[] | null = null;
|
|
22
|
-
|
|
23
|
-
async connectedCallback() {
|
|
24
|
-
super.connectedCallback();
|
|
25
|
-
await this.getDatasources();
|
|
26
|
-
|
|
27
|
-
if (Object.keys(selectors.datasourceConfig.getAllConfigSet()).length === 0) {
|
|
28
|
-
this.createNewDatasourceConfig();
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
async createNewDatasourceConfig(): Promise<void> {
|
|
33
|
-
if (!this.datasourceChoices) {
|
|
34
|
-
console.error('No datasourceChoices!');
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
this.initDatasource(this.datasourceChoices);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Fetch a list of datasources
|
|
42
|
-
*/
|
|
43
|
-
private async getDatasources(): Promise<void> {
|
|
44
|
-
try {
|
|
45
|
-
this.datasourceChoices = await getDatasources(this.connect);
|
|
46
|
-
} catch (err) {
|
|
47
|
-
logger.error(err);
|
|
48
|
-
showNotificationToast({
|
|
49
|
-
title: 'Reporting Config',
|
|
50
|
-
body: 'There were errors when loading the available datasources',
|
|
51
|
-
toast: { type: 'critical' as any },
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { css } from '@genesislcap/web-core';
|
|
2
|
-
import { formLabel, optionMessageBubble } from '../../../styles';
|
|
3
|
-
|
|
4
|
-
export const styles = css`
|
|
5
|
-
:host {
|
|
6
|
-
display: flex;
|
|
7
|
-
flex-direction: column;
|
|
8
|
-
}
|
|
9
|
-
${formLabel}
|
|
10
|
-
${optionMessageBubble('data-option-label-text')}
|
|
11
|
-
`;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { MultiselectOption } from '@genesislcap/rapid-design-system';
|
|
2
|
-
import { html, ref, whenElse } from '@genesislcap/web-core';
|
|
3
|
-
import { selectors } from '../../../store';
|
|
4
|
-
import { Permissions } from '../../../types';
|
|
5
|
-
import { permissionTemplateGuard, TOOLTIP, tooltip } from '../../../utils';
|
|
6
|
-
import type { OutputsConfig } from './outputs-config';
|
|
7
|
-
|
|
8
|
-
export type OutputChoice = {
|
|
9
|
-
id: string;
|
|
10
|
-
name: string;
|
|
11
|
-
topic: string;
|
|
12
|
-
type: 'NOTIFY' | 'SMTP';
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const container = html<OutputsConfig>`
|
|
16
|
-
<label class="label">Outputs ${tooltip(TOOLTIP.DELIVERY_OUTPUTS)}</label>
|
|
17
|
-
<rapid-multiselect
|
|
18
|
-
data-test-id="output-multiselect"
|
|
19
|
-
${ref('multiselect')}
|
|
20
|
-
@selectionChange=${(x) => x.updateOutputDestinationHandler()}
|
|
21
|
-
:selectedOptions=${() => selectors.baseConfig.getConfig().DESTINATION_IDS || []}
|
|
22
|
-
:options=${(x) =>
|
|
23
|
-
x.outputChoices?.map(
|
|
24
|
-
({ type, topic, name, id }) =>
|
|
25
|
-
<MultiselectOption>{
|
|
26
|
-
value: id,
|
|
27
|
-
label: `${topic}/${name}`,
|
|
28
|
-
optionLabelText: type,
|
|
29
|
-
},
|
|
30
|
-
)}
|
|
31
|
-
></rapid-multiselect>
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
</div>
|
|
35
|
-
`;
|
|
36
|
-
|
|
37
|
-
const dataSwitchTemplate = html<OutputsConfig>`
|
|
38
|
-
<template>
|
|
39
|
-
${whenElse(
|
|
40
|
-
(x) => !x.outputChoices,
|
|
41
|
-
html`
|
|
42
|
-
Unable to load outputs
|
|
43
|
-
`,
|
|
44
|
-
container,
|
|
45
|
-
)}
|
|
46
|
-
</template>
|
|
47
|
-
`;
|
|
48
|
-
|
|
49
|
-
export const template = html<OutputsConfig>`
|
|
50
|
-
${(x) =>
|
|
51
|
-
permissionTemplateGuard(
|
|
52
|
-
x,
|
|
53
|
-
Permissions.ReportDestinationView,
|
|
54
|
-
dataSwitchTemplate,
|
|
55
|
-
html`
|
|
56
|
-
<not-permitted>
|
|
57
|
-
<p
|
|
58
|
-
style="border-color: var(--error-color); border-radius: 7px; border-style: solid; border-width: 4px; padding: 5px;"
|
|
59
|
-
>
|
|
60
|
-
You do not have permission to access this part of the application, please contact your
|
|
61
|
-
administrator
|
|
62
|
-
</p>
|
|
63
|
-
</not-permitted>
|
|
64
|
-
`,
|
|
65
|
-
)}
|
|
66
|
-
`;
|