@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
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { Connect, logger } from '@genesislcap/foundation-comms';
|
|
2
|
-
import {
|
|
3
|
-
showNotificationDialog,
|
|
4
|
-
showNotificationToast,
|
|
5
|
-
} from '@genesislcap/foundation-notifications';
|
|
6
|
-
import {
|
|
7
|
-
customElement,
|
|
8
|
-
GenesisElement,
|
|
9
|
-
observable,
|
|
10
|
-
classNames,
|
|
11
|
-
volatile,
|
|
12
|
-
} from '@genesislcap/web-core';
|
|
13
|
-
import { actions, selectors } from '../../../store';
|
|
14
|
-
import { prioritySorter } from '../../../utils';
|
|
15
|
-
import { styles } from './scheduling.styles';
|
|
16
|
-
import { template } from './scheduling.template';
|
|
17
|
-
|
|
18
|
-
@customElement({
|
|
19
|
-
name: 'scheduling-config',
|
|
20
|
-
template,
|
|
21
|
-
styles,
|
|
22
|
-
})
|
|
23
|
-
export class Scheduling extends GenesisElement {
|
|
24
|
-
@Connect connect!: Connect;
|
|
25
|
-
|
|
26
|
-
@observable timeZones;
|
|
27
|
-
|
|
28
|
-
@volatile
|
|
29
|
-
get disabledClassNames(): string {
|
|
30
|
-
return classNames(['disabled', !selectors.baseConfig.getConfig().SCHEDULE]);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
@volatile
|
|
34
|
-
get enableSchedules(): boolean {
|
|
35
|
-
return selectors.baseConfig.getConfig().SCHEDULE !== undefined;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
connectedCallback() {
|
|
39
|
-
super.connectedCallback();
|
|
40
|
-
this.getTimeZones();
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
async getTimeZones(): Promise<void> {
|
|
44
|
-
const priorityTimezones = ['Europe/London', 'America/New_York'];
|
|
45
|
-
try {
|
|
46
|
-
const response = await this.connect.request('VALID_TIME_ZONE', {
|
|
47
|
-
REQUEST: {},
|
|
48
|
-
});
|
|
49
|
-
if (!response.REPLY || !Array.isArray(response.REPLY))
|
|
50
|
-
throw new Error('Invalid data returned for Timezones');
|
|
51
|
-
this.timeZones = response.REPLY.map((e) => e.ZONE_ID).sort(
|
|
52
|
-
prioritySorter(priorityTimezones, (x) => x),
|
|
53
|
-
);
|
|
54
|
-
} catch (e: unknown) {
|
|
55
|
-
showNotificationToast(
|
|
56
|
-
{
|
|
57
|
-
title: 'Edit Report Config',
|
|
58
|
-
body: `Unable to fetch timezones data.`,
|
|
59
|
-
toast: { type: 'critical' as any },
|
|
60
|
-
},
|
|
61
|
-
'rapid',
|
|
62
|
-
);
|
|
63
|
-
logger.error(e);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
toggleSchedule() {
|
|
68
|
-
if (this.enableSchedules) {
|
|
69
|
-
showNotificationDialog(
|
|
70
|
-
{
|
|
71
|
-
title: 'Reporting Config',
|
|
72
|
-
body: 'Disabling schedule will remove the current schedule. Do you want to continue?',
|
|
73
|
-
dialog: {
|
|
74
|
-
confirmingActions: [
|
|
75
|
-
{
|
|
76
|
-
label: 'Confirm',
|
|
77
|
-
action: () => {
|
|
78
|
-
actions.baseConfig.deleteSchedule();
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
],
|
|
82
|
-
dismissingAction: {
|
|
83
|
-
label: 'Dismiss',
|
|
84
|
-
action: () => console.log('Keep schedules'),
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
'rapid',
|
|
89
|
-
);
|
|
90
|
-
} else {
|
|
91
|
-
actions.baseConfig.updateState({
|
|
92
|
-
key: 'SCHEDULE',
|
|
93
|
-
value: {
|
|
94
|
-
TIME_ZONE:
|
|
95
|
-
this.timeZones.length > 0 ? Intl.DateTimeFormat().resolvedOptions().timeZone : '',
|
|
96
|
-
CRON_EXPRESSION: '0 0 0 * * ?',
|
|
97
|
-
},
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
import { CellClassParams, CellStyle } from '@ag-grid-community/core';
|
|
2
|
-
import type { JSONSchema7 } from 'json-schema';
|
|
3
|
-
import type { DatasourceInputTypes, DatasourceName } from '../../../store';
|
|
4
|
-
import { actions, selectors } from '../../../store';
|
|
5
|
-
import { Display, Genesis } from '../../../types';
|
|
6
|
-
import {
|
|
7
|
-
datasourceInputForDisplay,
|
|
8
|
-
datasourceInputFromDisplay,
|
|
9
|
-
showNotificationToast,
|
|
10
|
-
} from '../../../utils';
|
|
11
|
-
import {
|
|
12
|
-
GridColumnNames,
|
|
13
|
-
GridRowData,
|
|
14
|
-
INVALID_COLUMN_TYPES,
|
|
15
|
-
} from './datasource-data-base-component.types';
|
|
16
|
-
|
|
17
|
-
// Re-export GridColumnNames for use in other modules
|
|
18
|
-
export { GridColumnNames };
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Converts a string to path format used by the APIs
|
|
22
|
-
*/
|
|
23
|
-
export function convertToPathFormat(input: string): string {
|
|
24
|
-
return '/req-' + input.toLowerCase().replace(/_/g, '-');
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Maps schema properties to row data for grid display
|
|
29
|
-
*/
|
|
30
|
-
export function pathParameters(datasource: {
|
|
31
|
-
name: string;
|
|
32
|
-
spec: Genesis.JSONSchema7;
|
|
33
|
-
}): GridRowData[] {
|
|
34
|
-
if (!datasource.spec.properties)
|
|
35
|
-
throw new Error(`No properties on schema for datasource ${datasource.name}`);
|
|
36
|
-
|
|
37
|
-
// Extract enum values from a schema, handling both direct and oneOf patterns
|
|
38
|
-
const extractEnumValues = (schema: any, fieldName: string): string[] => {
|
|
39
|
-
if (schema.enum) {
|
|
40
|
-
// If there's a top-level enum property, use it
|
|
41
|
-
return schema.enum as string[];
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (schema.oneOf) {
|
|
45
|
-
// Look for enum values within the oneOf structure
|
|
46
|
-
const stringTypeSchema = schema.oneOf.find(
|
|
47
|
-
(s: any) => s.type === 'string' && Array.isArray(s.enum),
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
if (stringTypeSchema && stringTypeSchema.enum) {
|
|
51
|
-
return stringTypeSchema.enum as string[];
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
throw new Error(`Could not extract enum values for field '${fieldName}'`);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
return Object.entries(datasource.spec.properties).map(([name, schema]) => ({
|
|
59
|
-
[GridColumnNames.ColumnName]: name,
|
|
60
|
-
[GridColumnNames.DisplayName]: name,
|
|
61
|
-
[GridColumnNames.Type]: schema.genesisType,
|
|
62
|
-
[GridColumnNames.Datasource]: datasource.name,
|
|
63
|
-
...(schema.genesisType === 'ENUM'
|
|
64
|
-
? { [GridColumnNames.EnumValues]: extractEnumValues(schema, name) }
|
|
65
|
-
: {}),
|
|
66
|
-
}));
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Determines if a column should be disabled based on its type
|
|
71
|
-
*/
|
|
72
|
-
export function shouldDisableColumn(data: Pick<GridRowData, GridColumnNames.Type>): boolean {
|
|
73
|
-
return !data[GridColumnNames.Type] || INVALID_COLUMN_TYPES.includes(data[GridColumnNames.Type]);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Configures disabled columns by marking them as filtered
|
|
78
|
-
*/
|
|
79
|
-
export function configureDisabledColumns(
|
|
80
|
-
data: Pick<
|
|
81
|
-
GridRowData,
|
|
82
|
-
GridColumnNames.ColumnName | GridColumnNames.Datasource | GridColumnNames.Type
|
|
83
|
-
>,
|
|
84
|
-
): GridRowData {
|
|
85
|
-
const shouldDisable = shouldDisableColumn(data);
|
|
86
|
-
if (shouldDisable) {
|
|
87
|
-
actions.datasourceConfig.setColumnIncluded({
|
|
88
|
-
key: datasourceNameFromDisplay(data[GridColumnNames.Datasource]),
|
|
89
|
-
column: data[GridColumnNames.ColumnName],
|
|
90
|
-
included: false,
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
return data as GridRowData;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Checks if a column is filtered in the current configuration
|
|
98
|
-
*/
|
|
99
|
-
export function lookupColumnIsIncluded(
|
|
100
|
-
data: Pick<GridRowData, GridColumnNames.Datasource | GridColumnNames.ColumnName>,
|
|
101
|
-
): boolean {
|
|
102
|
-
return (
|
|
103
|
-
selectors.datasourceConfig.getDatasource(
|
|
104
|
-
datasourceNameFromDisplay(data[GridColumnNames.Datasource]),
|
|
105
|
-
).TRANSFORMER_CONFIGURATION.INCLUDE_COLUMNS ?? []
|
|
106
|
-
).includes(data[GridColumnNames.ColumnName]);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Checks if a column is filtered in the current configuration
|
|
111
|
-
*/
|
|
112
|
-
export function lookupColumnIsRenamed(
|
|
113
|
-
data: Pick<GridRowData, GridColumnNames.Datasource | GridColumnNames.ColumnName>,
|
|
114
|
-
): boolean {
|
|
115
|
-
return Object.keys(
|
|
116
|
-
selectors.datasourceConfig.getDatasource(
|
|
117
|
-
datasourceNameFromDisplay(data[GridColumnNames.Datasource]),
|
|
118
|
-
).TRANSFORMER_CONFIGURATION.COLUMN_RENAMES ?? {},
|
|
119
|
-
).includes(data[GridColumnNames.ColumnName]);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Converts display-formatted datasource name to internal key format
|
|
124
|
-
*/
|
|
125
|
-
export function datasourceNameFromDisplay(input: string): DatasourceName {
|
|
126
|
-
const parts = input
|
|
127
|
-
.replace(/[)]/g, '')
|
|
128
|
-
.split('(')
|
|
129
|
-
.map((x) => x.trim());
|
|
130
|
-
const type = datasourceInputFromDisplay(parts[1] as Display.DatasourceInputTypes);
|
|
131
|
-
const name = parts[0];
|
|
132
|
-
|
|
133
|
-
const match = Object.entries(selectors.datasourceConfig.getAllConfigSet()).find(
|
|
134
|
-
([_, ds]) => ds.KEY === name && ds.INPUT_TYPE === type,
|
|
135
|
-
);
|
|
136
|
-
|
|
137
|
-
if (!match) {
|
|
138
|
-
/**
|
|
139
|
-
* This can occur when the datasource is first being initialized and the name
|
|
140
|
-
* hasn't yet been persisted to the store.
|
|
141
|
-
*/
|
|
142
|
-
return `${type}_${name}_${name}` as DatasourceName;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
return match[0] as DatasourceName;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* Formats datasource name for display
|
|
150
|
-
*/
|
|
151
|
-
export function datasourceNameForDisplay(datasource: string, type: DatasourceInputTypes): string {
|
|
152
|
-
return `${datasource} (${datasourceInputForDisplay(type)})`;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Factory for creating cell styles based on filter status
|
|
157
|
-
*/
|
|
158
|
-
export function buildCellStyle<
|
|
159
|
-
T extends Pick<GridRowData, GridColumnNames.Datasource | GridColumnNames.ColumnName>,
|
|
160
|
-
>(rowDeselectedStyle: CellStyle, rowSelectedStyle: CellStyle = {}) {
|
|
161
|
-
return (params: CellClassParams<T>): CellStyle => {
|
|
162
|
-
if (params.data && lookupColumnIsIncluded(params.data as any)) {
|
|
163
|
-
return rowSelectedStyle;
|
|
164
|
-
}
|
|
165
|
-
return rowDeselectedStyle;
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Common error handler for grid components
|
|
171
|
-
*/
|
|
172
|
-
export function handleGridError(error: Error, body: string): void {
|
|
173
|
-
console.error(error);
|
|
174
|
-
console.trace();
|
|
175
|
-
showNotificationToast({
|
|
176
|
-
title: 'Reporting Config',
|
|
177
|
-
body,
|
|
178
|
-
toast: { type: 'critical' as any },
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Maps Genesis field types to renderer types
|
|
184
|
-
*/
|
|
185
|
-
export function mapTypeToRenderer(
|
|
186
|
-
type: Genesis.GenesisFieldTypes,
|
|
187
|
-
): 'string' | 'number' | 'boolean' | null {
|
|
188
|
-
if (['STRING', 'ENUM'].includes(type)) {
|
|
189
|
-
return 'string';
|
|
190
|
-
} else if (['INT', 'SHORT', 'DOUBLE', 'LONG', 'BIGDECIMAL'].includes(type)) {
|
|
191
|
-
return 'number';
|
|
192
|
-
} else if (['BOOLEAN'].includes(type)) {
|
|
193
|
-
return 'boolean';
|
|
194
|
-
} else {
|
|
195
|
-
console.warn(`No renderer available for type: ${type}`);
|
|
196
|
-
return null;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* Common implementation for fetching and processing datasource schemas
|
|
202
|
-
*/
|
|
203
|
-
export async function fetchDatasourceSpecs(
|
|
204
|
-
datasourceName: DatasourceName | null,
|
|
205
|
-
getSchema: (name: string) => Promise<JSONSchema7>,
|
|
206
|
-
onError: (error: Error, message: string) => void,
|
|
207
|
-
): Promise<{ name: string; spec: JSONSchema7 }[]> {
|
|
208
|
-
if (datasourceName === null) {
|
|
209
|
-
return [];
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
try {
|
|
213
|
-
return await Promise.all(
|
|
214
|
-
Object.entries(selectors.datasourceConfig.getAllConfigSet())
|
|
215
|
-
.filter(([key, ds]) => ds.INPUT_TYPE === 'REQ_REP' && key === datasourceName)
|
|
216
|
-
.map(async ([_, { KEY, NAME }]) => ({
|
|
217
|
-
spec: await getSchema(NAME), // Fetch schema by Resource Name
|
|
218
|
-
name: datasourceNameForDisplay(KEY, 'REQ_REP'), // Display Alias
|
|
219
|
-
})),
|
|
220
|
-
);
|
|
221
|
-
} catch (e) {
|
|
222
|
-
onError(e as Error, 'There were errors when requesting datasource metadata');
|
|
223
|
-
return [];
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* Orders rows using INCLUDE_COLUMNS from the store configuration.
|
|
229
|
-
*/
|
|
230
|
-
export function orderRowsByIncludeColumns(
|
|
231
|
-
rows: GridRowData[],
|
|
232
|
-
includeColumns?: string[],
|
|
233
|
-
): GridRowData[] {
|
|
234
|
-
if (!rows || rows.length === 0) return rows;
|
|
235
|
-
if (!Array.isArray(includeColumns) || includeColumns.length === 0) return rows;
|
|
236
|
-
|
|
237
|
-
const indexMap = new Map<string, number>(includeColumns.map((c, i) => [c, i]));
|
|
238
|
-
const present: GridRowData[] = [];
|
|
239
|
-
const absent: GridRowData[] = [];
|
|
240
|
-
for (const r of rows) {
|
|
241
|
-
if (indexMap.has(r[GridColumnNames.ColumnName] as string)) present.push(r);
|
|
242
|
-
else absent.push(r);
|
|
243
|
-
}
|
|
244
|
-
present.sort(
|
|
245
|
-
(a, b) =>
|
|
246
|
-
(indexMap.get(a[GridColumnNames.ColumnName] as string) ?? 0) -
|
|
247
|
-
(indexMap.get(b[GridColumnNames.ColumnName] as string) ?? 0),
|
|
248
|
-
);
|
|
249
|
-
return [...present, ...absent];
|
|
250
|
-
}
|