@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,568 +0,0 @@
|
|
|
1
|
-
import { assert, sinon, suite } from '@genesislcap/foundation-testing';
|
|
2
|
-
import { SelectRenderer } from '@genesislcap/rapid-grid-pro';
|
|
3
|
-
import { DatasourceInputTypes, actions, selectors } from '../../../store';
|
|
4
|
-
import { Genesis } from '../../../types';
|
|
5
|
-
import {
|
|
6
|
-
convertToPathFormat,
|
|
7
|
-
datasourceNameForDisplay,
|
|
8
|
-
datasourceNameFromDisplay,
|
|
9
|
-
lookupColumnIsIncluded,
|
|
10
|
-
mapTypeToRenderer,
|
|
11
|
-
pathParameters,
|
|
12
|
-
shouldDisableColumn,
|
|
13
|
-
configureDisabledColumns,
|
|
14
|
-
} from './datasource-data-base-component.helpers.ts';
|
|
15
|
-
import { GridColumnNames, GridRowData } from './datasource-data-base-component.types';
|
|
16
|
-
|
|
17
|
-
type TestData = Pick<
|
|
18
|
-
GridRowData,
|
|
19
|
-
| GridColumnNames.ColumnName
|
|
20
|
-
| GridColumnNames.DisplayName
|
|
21
|
-
| GridColumnNames.Type
|
|
22
|
-
| GridColumnNames.Datasource
|
|
23
|
-
>;
|
|
24
|
-
|
|
25
|
-
// Helper function to create consistent test data
|
|
26
|
-
function createTestRowData(overrides: Partial<TestData> = {}): TestData {
|
|
27
|
-
const result: TestData = {
|
|
28
|
-
[GridColumnNames.ColumnName]: 'testColumn',
|
|
29
|
-
[GridColumnNames.DisplayName]: 'Test Column',
|
|
30
|
-
[GridColumnNames.Type]: 'STRING',
|
|
31
|
-
[GridColumnNames.Datasource]: 'Test (Snapshot)',
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
// Apply overrides properly
|
|
35
|
-
return { ...result, ...overrides };
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Type for SelectRendererParams
|
|
39
|
-
const FIRST_PARAM = 0 as const;
|
|
40
|
-
export type SelectRendererParams = Parameters<SelectRenderer['init']>[typeof FIRST_PARAM];
|
|
41
|
-
|
|
42
|
-
// DatasourceNameFromDisplay tests
|
|
43
|
-
const DatasourceNameFromDisplayTests = suite('datasourceNameFromDisplay()');
|
|
44
|
-
|
|
45
|
-
DatasourceNameFromDisplayTests.before.each(() => {
|
|
46
|
-
sinon.restore();
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
DatasourceNameFromDisplayTests(
|
|
50
|
-
'Correctly builds datasource key from Snapshot (REQ_REP) input',
|
|
51
|
-
() => {
|
|
52
|
-
const input = 'myService (Snapshot)';
|
|
53
|
-
const expected = 'REQ_REP_myService_myService';
|
|
54
|
-
assert.equal(datasourceNameFromDisplay(input), expected);
|
|
55
|
-
},
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
DatasourceNameFromDisplayTests(
|
|
59
|
-
'Correctly builds datasource key from Data Pipeline (DATA_PIPELINE) input',
|
|
60
|
-
() => {
|
|
61
|
-
const input = 'dataFlow (Data Pipeline)';
|
|
62
|
-
const expected = 'DATA_PIPELINE_dataFlow_dataFlow';
|
|
63
|
-
assert.equal(datasourceNameFromDisplay(input), expected);
|
|
64
|
-
},
|
|
65
|
-
);
|
|
66
|
-
|
|
67
|
-
DatasourceNameFromDisplayTests.run();
|
|
68
|
-
|
|
69
|
-
// datasourceNameForDisplay tests
|
|
70
|
-
const DatasourceNameForDisplayTests = suite('datasourceNameForDisplay()');
|
|
71
|
-
|
|
72
|
-
DatasourceNameForDisplayTests('Correctly formats REQ_REP datasource for display', () => {
|
|
73
|
-
const datasource = 'myService';
|
|
74
|
-
const type = 'REQ_REP' as DatasourceInputTypes;
|
|
75
|
-
const expected = 'myService (Snapshot)';
|
|
76
|
-
assert.equal(datasourceNameForDisplay(datasource, type), expected);
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
DatasourceNameForDisplayTests('Correctly formats DATA_PIPELINE datasource for display', () => {
|
|
80
|
-
const datasource = 'dataFlow';
|
|
81
|
-
const type = 'DATA_PIPELINE' as DatasourceInputTypes;
|
|
82
|
-
const expected = 'dataFlow (Data Pipeline)';
|
|
83
|
-
assert.equal(datasourceNameForDisplay(datasource, type), expected);
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
DatasourceNameForDisplayTests.run();
|
|
87
|
-
|
|
88
|
-
// LookupColumnIsFiltered tests
|
|
89
|
-
const LookupColumnIsIncluded = suite('lookupColumnIsIncluded');
|
|
90
|
-
|
|
91
|
-
LookupColumnIsIncluded.before.each(() => {
|
|
92
|
-
sinon.restore();
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
LookupColumnIsIncluded('returns true when column is in included', () => {
|
|
96
|
-
const mockData: TestData = {
|
|
97
|
-
[GridColumnNames.Datasource]: 'testSource (Snapshot)',
|
|
98
|
-
[GridColumnNames.ColumnName]: 'testColumn',
|
|
99
|
-
[GridColumnNames.DisplayName]: 'testColumn',
|
|
100
|
-
[GridColumnNames.Type]: 'STRING',
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
const mockDatasource = {
|
|
104
|
-
KEY: 'test',
|
|
105
|
-
NAME: 'Test Datasource',
|
|
106
|
-
INPUT_TYPE: 'REQ_REP' as const,
|
|
107
|
-
OUTPUT_TYPE: 'TABLE' as const,
|
|
108
|
-
GROUPING_STRATEGY: 'NONE' as const,
|
|
109
|
-
GROUP_KEY: null,
|
|
110
|
-
TRANSFORMER_CONFIGURATION: { INCLUDE_COLUMNS: ['testColumn', 'otherColumn'] },
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
sinon.stub(selectors.datasourceConfig, 'getDatasource').returns(mockDatasource);
|
|
114
|
-
const result = lookupColumnIsIncluded(mockData);
|
|
115
|
-
assert.equal(result, true);
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
LookupColumnIsIncluded('returns false when column is not in filters', () => {
|
|
119
|
-
const mockData: TestData = {
|
|
120
|
-
[GridColumnNames.Datasource]: 'testSource (Snapshot)',
|
|
121
|
-
[GridColumnNames.ColumnName]: 'nonFilteredColumn',
|
|
122
|
-
[GridColumnNames.DisplayName]: 'nonFilteredColumn',
|
|
123
|
-
[GridColumnNames.Type]: 'STRING',
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
const mockDatasource = {
|
|
127
|
-
KEY: 'test',
|
|
128
|
-
NAME: 'Test Datasource',
|
|
129
|
-
INPUT_TYPE: 'REQ_REP' as const,
|
|
130
|
-
OUTPUT_TYPE: 'TABLE' as const,
|
|
131
|
-
GROUPING_STRATEGY: 'NONE' as const,
|
|
132
|
-
GROUP_KEY: null,
|
|
133
|
-
TRANSFORMER_CONFIGURATION: { INCLUDE_COLUMNS: ['testColumn', 'otherColumn'] },
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
sinon.stub(selectors.datasourceConfig, 'getDatasource').returns(mockDatasource);
|
|
137
|
-
const result = lookupColumnIsIncluded(mockData);
|
|
138
|
-
assert.equal(result, false);
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
LookupColumnIsIncluded('returns false when INCLUDE_COLUMNS is undefined', () => {
|
|
142
|
-
const mockData: TestData = {
|
|
143
|
-
[GridColumnNames.Datasource]: 'testSource (Snapshot)',
|
|
144
|
-
[GridColumnNames.ColumnName]: 'testColumn',
|
|
145
|
-
[GridColumnNames.DisplayName]: 'testColumn',
|
|
146
|
-
[GridColumnNames.Type]: 'STRING',
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
const mockDatasource = {
|
|
150
|
-
KEY: 'test',
|
|
151
|
-
NAME: 'Test Datasource',
|
|
152
|
-
INPUT_TYPE: 'REQ_REP' as const,
|
|
153
|
-
OUTPUT_TYPE: 'TABLE' as const,
|
|
154
|
-
GROUPING_STRATEGY: 'NONE' as const,
|
|
155
|
-
GROUP_KEY: null,
|
|
156
|
-
TRANSFORMER_CONFIGURATION: { INCLUDE_COLUMNS: undefined },
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
sinon.stub(selectors.datasourceConfig, 'getDatasource').returns(mockDatasource);
|
|
160
|
-
const result = lookupColumnIsIncluded(mockData);
|
|
161
|
-
assert.equal(result, false);
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
LookupColumnIsIncluded('returns false when INCLUDE_COLUMNS is empty array', () => {
|
|
165
|
-
const mockData: TestData = {
|
|
166
|
-
[GridColumnNames.Datasource]: 'testSource (Snapshot)',
|
|
167
|
-
[GridColumnNames.ColumnName]: 'testColumn',
|
|
168
|
-
[GridColumnNames.DisplayName]: 'testColumn',
|
|
169
|
-
[GridColumnNames.Type]: 'STRING',
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
const mockDatasource = {
|
|
173
|
-
KEY: 'test',
|
|
174
|
-
NAME: 'Test Datasource',
|
|
175
|
-
INPUT_TYPE: 'REQ_REP' as const,
|
|
176
|
-
OUTPUT_TYPE: 'TABLE' as const,
|
|
177
|
-
GROUPING_STRATEGY: 'NONE' as const,
|
|
178
|
-
GROUP_KEY: null,
|
|
179
|
-
TRANSFORMER_CONFIGURATION: { INCLUDE_COLUMNS: [] },
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
sinon.stub(selectors.datasourceConfig, 'getDatasource').returns(mockDatasource);
|
|
183
|
-
const result = lookupColumnIsIncluded(mockData);
|
|
184
|
-
assert.equal(result, false);
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
LookupColumnIsIncluded.run();
|
|
188
|
-
|
|
189
|
-
// PathParametersTests tests
|
|
190
|
-
const PathParametersTests = suite('pathParameters()');
|
|
191
|
-
|
|
192
|
-
// Helper function to build JSON schema for testing
|
|
193
|
-
function buildJsonSchema(properties: any): Genesis.JSONSchema7 {
|
|
194
|
-
return {
|
|
195
|
-
type: 'object',
|
|
196
|
-
properties: properties,
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
PathParametersTests('Should convert simple schema properties to grid row data', () => {
|
|
201
|
-
const datasource: Parameters<typeof pathParameters>[0] = {
|
|
202
|
-
name: 'TestDatasource',
|
|
203
|
-
spec: <Genesis.JSONSchema7>{
|
|
204
|
-
properties: {
|
|
205
|
-
field1: {
|
|
206
|
-
genesisType: 'STRING',
|
|
207
|
-
},
|
|
208
|
-
field2: {
|
|
209
|
-
genesisType: 'INT',
|
|
210
|
-
},
|
|
211
|
-
field3: {
|
|
212
|
-
genesisType: 'BOOLEAN',
|
|
213
|
-
},
|
|
214
|
-
},
|
|
215
|
-
},
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
const result = pathParameters(datasource);
|
|
219
|
-
|
|
220
|
-
assert.equal(result.length, 3);
|
|
221
|
-
assert.equal(result[0][GridColumnNames.ColumnName], 'field1');
|
|
222
|
-
assert.equal(result[0][GridColumnNames.DisplayName], 'field1');
|
|
223
|
-
assert.equal(result[0][GridColumnNames.Type], 'STRING');
|
|
224
|
-
assert.equal(result[0][GridColumnNames.Datasource], 'TestDatasource');
|
|
225
|
-
|
|
226
|
-
assert.equal(result[1][GridColumnNames.ColumnName], 'field2');
|
|
227
|
-
assert.equal(result[1][GridColumnNames.Type], 'INT');
|
|
228
|
-
|
|
229
|
-
assert.equal(result[2][GridColumnNames.ColumnName], 'field3');
|
|
230
|
-
assert.equal(result[2][GridColumnNames.Type], 'BOOLEAN');
|
|
231
|
-
});
|
|
232
|
-
|
|
233
|
-
PathParametersTests('Should handle nullable enum types and extract enum values correctly', () => {
|
|
234
|
-
// Schema with nullable enum field to test the handling of enum values
|
|
235
|
-
const datasource: Parameters<typeof pathParameters>[0] = {
|
|
236
|
-
name: 'TradesData',
|
|
237
|
-
spec: <Genesis.JSONSchema7>{
|
|
238
|
-
properties: {
|
|
239
|
-
TRADE_ID: {
|
|
240
|
-
type: 'integer',
|
|
241
|
-
description: '',
|
|
242
|
-
genesisType: 'LONG',
|
|
243
|
-
},
|
|
244
|
-
DIRECTION: {
|
|
245
|
-
oneOf: [
|
|
246
|
-
{
|
|
247
|
-
type: 'null',
|
|
248
|
-
},
|
|
249
|
-
{
|
|
250
|
-
type: 'string',
|
|
251
|
-
enum: ['SELL', 'SHORT_SELL', 'BUY'],
|
|
252
|
-
},
|
|
253
|
-
],
|
|
254
|
-
description: '',
|
|
255
|
-
genesisType: 'ENUM',
|
|
256
|
-
// No top-level enum property - matches server payload
|
|
257
|
-
},
|
|
258
|
-
INSTRUMENT_ID: {
|
|
259
|
-
oneOf: [
|
|
260
|
-
{
|
|
261
|
-
type: 'null',
|
|
262
|
-
},
|
|
263
|
-
{
|
|
264
|
-
type: 'integer',
|
|
265
|
-
},
|
|
266
|
-
],
|
|
267
|
-
description: '',
|
|
268
|
-
genesisType: 'LONG',
|
|
269
|
-
},
|
|
270
|
-
},
|
|
271
|
-
additionalProperties: false,
|
|
272
|
-
required: [],
|
|
273
|
-
},
|
|
274
|
-
};
|
|
275
|
-
|
|
276
|
-
const result = pathParameters(datasource);
|
|
277
|
-
|
|
278
|
-
// Find the DIRECTION field result
|
|
279
|
-
const directionField = result.find((row) => row[GridColumnNames.ColumnName] === 'DIRECTION');
|
|
280
|
-
|
|
281
|
-
assert.ok(directionField, 'DIRECTION field should be in the results');
|
|
282
|
-
assert.equal(directionField![GridColumnNames.Type], 'ENUM', 'Type should be ENUM');
|
|
283
|
-
|
|
284
|
-
// Check that EnumValues array exists and contains the expected values
|
|
285
|
-
assert.ok(
|
|
286
|
-
Array.isArray(directionField![GridColumnNames.EnumValues]),
|
|
287
|
-
'EnumValues should be an array',
|
|
288
|
-
);
|
|
289
|
-
assert.equal(
|
|
290
|
-
directionField![GridColumnNames.EnumValues].length,
|
|
291
|
-
3,
|
|
292
|
-
'EnumValues should have 3 items',
|
|
293
|
-
);
|
|
294
|
-
assert.equal(directionField![GridColumnNames.EnumValues][0], 'SELL');
|
|
295
|
-
assert.equal(directionField![GridColumnNames.EnumValues][1], 'SHORT_SELL');
|
|
296
|
-
assert.equal(directionField![GridColumnNames.EnumValues][2], 'BUY');
|
|
297
|
-
});
|
|
298
|
-
|
|
299
|
-
PathParametersTests('Should handle non-nullable enum types with top-level enum property', () => {
|
|
300
|
-
// Schema with non-nullable enum field (direct enum property)
|
|
301
|
-
const datasource: Parameters<typeof pathParameters>[0] = {
|
|
302
|
-
name: 'StatusData',
|
|
303
|
-
spec: <Genesis.JSONSchema7>{
|
|
304
|
-
properties: {
|
|
305
|
-
STATUS: {
|
|
306
|
-
type: 'string',
|
|
307
|
-
enum: ['ACTIVE', 'PENDING', 'COMPLETED', 'CANCELLED'],
|
|
308
|
-
description: 'Status field',
|
|
309
|
-
genesisType: 'ENUM',
|
|
310
|
-
},
|
|
311
|
-
},
|
|
312
|
-
additionalProperties: false,
|
|
313
|
-
required: [],
|
|
314
|
-
},
|
|
315
|
-
};
|
|
316
|
-
|
|
317
|
-
const result = pathParameters(datasource);
|
|
318
|
-
|
|
319
|
-
// Find the STATUS field result
|
|
320
|
-
const statusField = result.find((row) => row[GridColumnNames.ColumnName] === 'STATUS');
|
|
321
|
-
|
|
322
|
-
assert.ok(statusField, 'STATUS field should be in the results');
|
|
323
|
-
assert.equal(statusField![GridColumnNames.Type], 'ENUM', 'Type should be ENUM');
|
|
324
|
-
|
|
325
|
-
// Check that EnumValues array exists and contains the expected values
|
|
326
|
-
assert.ok(
|
|
327
|
-
Array.isArray(statusField![GridColumnNames.EnumValues]),
|
|
328
|
-
'EnumValues should be an array',
|
|
329
|
-
);
|
|
330
|
-
assert.equal(
|
|
331
|
-
statusField![GridColumnNames.EnumValues].length,
|
|
332
|
-
4,
|
|
333
|
-
'EnumValues should have 4 items',
|
|
334
|
-
);
|
|
335
|
-
assert.equal(statusField![GridColumnNames.EnumValues][0], 'ACTIVE');
|
|
336
|
-
assert.equal(statusField![GridColumnNames.EnumValues][1], 'PENDING');
|
|
337
|
-
assert.equal(statusField![GridColumnNames.EnumValues][2], 'COMPLETED');
|
|
338
|
-
assert.equal(statusField![GridColumnNames.EnumValues][3], 'CANCELLED');
|
|
339
|
-
});
|
|
340
|
-
|
|
341
|
-
PathParametersTests('Should throw error for malformed enum schema without enum values', () => {
|
|
342
|
-
// Schema with malformed enum field (no enum values available)
|
|
343
|
-
const datasource: Parameters<typeof pathParameters>[0] = {
|
|
344
|
-
name: 'MalformedData',
|
|
345
|
-
spec: <Genesis.JSONSchema7>{
|
|
346
|
-
properties: {
|
|
347
|
-
BROKEN_ENUM: {
|
|
348
|
-
description: 'Malformed enum without values',
|
|
349
|
-
genesisType: 'ENUM',
|
|
350
|
-
// Missing enum and oneOf - should cause an error
|
|
351
|
-
},
|
|
352
|
-
},
|
|
353
|
-
additionalProperties: false,
|
|
354
|
-
required: [],
|
|
355
|
-
},
|
|
356
|
-
};
|
|
357
|
-
|
|
358
|
-
// Should throw an error with specific message
|
|
359
|
-
assert.throws(
|
|
360
|
-
() => pathParameters(datasource),
|
|
361
|
-
Error,
|
|
362
|
-
"Could not extract enum values for field 'BROKEN_ENUM'",
|
|
363
|
-
);
|
|
364
|
-
});
|
|
365
|
-
|
|
366
|
-
PathParametersTests('Should throw error when no properties exist', () => {
|
|
367
|
-
const datasource = {
|
|
368
|
-
name: 'TestDatasource',
|
|
369
|
-
spec: { type: 'object' } as Genesis.JSONSchema7, // Schema without properties
|
|
370
|
-
};
|
|
371
|
-
|
|
372
|
-
assert.throws(
|
|
373
|
-
() => pathParameters(datasource),
|
|
374
|
-
Error,
|
|
375
|
-
'No properties on schema for datasource TestDatasource',
|
|
376
|
-
);
|
|
377
|
-
});
|
|
378
|
-
|
|
379
|
-
PathParametersTests('Should handle empty properties object', () => {
|
|
380
|
-
const datasource = {
|
|
381
|
-
name: 'TestDatasource',
|
|
382
|
-
spec: buildJsonSchema({}),
|
|
383
|
-
};
|
|
384
|
-
|
|
385
|
-
assert.equal(pathParameters(datasource), []);
|
|
386
|
-
});
|
|
387
|
-
|
|
388
|
-
PathParametersTests.run();
|
|
389
|
-
|
|
390
|
-
// ConvertToPathFormat tests
|
|
391
|
-
const ConvertToPathFormat = suite('convertToPathFormat()');
|
|
392
|
-
|
|
393
|
-
ConvertToPathFormat('Converts basic string to path format', () => {
|
|
394
|
-
assert.equal(convertToPathFormat('hello'), '/req-hello');
|
|
395
|
-
});
|
|
396
|
-
|
|
397
|
-
ConvertToPathFormat('Converts uppercase string to lowercase path format', () => {
|
|
398
|
-
assert.equal(convertToPathFormat('HELLO'), '/req-hello');
|
|
399
|
-
});
|
|
400
|
-
|
|
401
|
-
ConvertToPathFormat('Converts string with underscores to dashes', () => {
|
|
402
|
-
assert.equal(convertToPathFormat('hello_world'), '/req-hello-world');
|
|
403
|
-
});
|
|
404
|
-
|
|
405
|
-
ConvertToPathFormat('Converts mixed case string with multiple underscores', () => {
|
|
406
|
-
assert.equal(convertToPathFormat('HELLO_World_TEST'), '/req-hello-world-test');
|
|
407
|
-
});
|
|
408
|
-
|
|
409
|
-
ConvertToPathFormat('Handles empty string', () => {
|
|
410
|
-
assert.equal(convertToPathFormat(''), '/req-');
|
|
411
|
-
});
|
|
412
|
-
|
|
413
|
-
ConvertToPathFormat.run();
|
|
414
|
-
|
|
415
|
-
// MapTypeToRenderer tests
|
|
416
|
-
const MapTypeToRendererTests = suite('mapTypeToRenderer');
|
|
417
|
-
|
|
418
|
-
MapTypeToRendererTests('returns "boolean" for boolean type', () => {
|
|
419
|
-
const result = mapTypeToRenderer('BOOLEAN');
|
|
420
|
-
assert.equal(result, 'boolean');
|
|
421
|
-
});
|
|
422
|
-
|
|
423
|
-
MapTypeToRendererTests('returns "string" for string type', () => {
|
|
424
|
-
const result = mapTypeToRenderer('STRING');
|
|
425
|
-
assert.equal(result, 'string');
|
|
426
|
-
});
|
|
427
|
-
|
|
428
|
-
MapTypeToRendererTests('returns "string" for enum type', () => {
|
|
429
|
-
const result = mapTypeToRenderer('ENUM');
|
|
430
|
-
assert.equal(result, 'string');
|
|
431
|
-
});
|
|
432
|
-
|
|
433
|
-
MapTypeToRendererTests('returns "number" for number type', () => {
|
|
434
|
-
const result = mapTypeToRenderer('LONG');
|
|
435
|
-
assert.equal(result, 'number');
|
|
436
|
-
});
|
|
437
|
-
|
|
438
|
-
MapTypeToRendererTests('returns "number" for integer type', () => {
|
|
439
|
-
const result = mapTypeToRenderer('INT');
|
|
440
|
-
assert.equal(result, 'number');
|
|
441
|
-
});
|
|
442
|
-
|
|
443
|
-
MapTypeToRendererTests('returns "number" for DOUBLE type', () => {
|
|
444
|
-
const result = mapTypeToRenderer('DOUBLE');
|
|
445
|
-
assert.equal(result, 'number');
|
|
446
|
-
});
|
|
447
|
-
|
|
448
|
-
MapTypeToRendererTests('returns "number" for SHORT type', () => {
|
|
449
|
-
const result = mapTypeToRenderer('SHORT');
|
|
450
|
-
assert.equal(result, 'number');
|
|
451
|
-
});
|
|
452
|
-
|
|
453
|
-
MapTypeToRendererTests('returns "number" for BIGDECIMAL type', () => {
|
|
454
|
-
const result = mapTypeToRenderer('BIGDECIMAL');
|
|
455
|
-
assert.equal(result, 'number');
|
|
456
|
-
});
|
|
457
|
-
|
|
458
|
-
MapTypeToRendererTests('returns null for unsupported type', () => {
|
|
459
|
-
const result = mapTypeToRenderer('UNSUPPORTED_TYPE' as any);
|
|
460
|
-
assert.equal(result, null);
|
|
461
|
-
});
|
|
462
|
-
|
|
463
|
-
MapTypeToRendererTests.run();
|
|
464
|
-
|
|
465
|
-
// ShouldDisableColumn tests
|
|
466
|
-
const ShouldDisableColumnTests = suite('shouldDisableColumn()');
|
|
467
|
-
|
|
468
|
-
ShouldDisableColumnTests.before.each(() => {
|
|
469
|
-
sinon.restore();
|
|
470
|
-
});
|
|
471
|
-
|
|
472
|
-
ShouldDisableColumnTests('should return true when Type is undefined', () => {
|
|
473
|
-
const mockData: Pick<GridRowData, GridColumnNames.Type> = {
|
|
474
|
-
[GridColumnNames.Type]: undefined as any,
|
|
475
|
-
};
|
|
476
|
-
|
|
477
|
-
const result = shouldDisableColumn(mockData);
|
|
478
|
-
assert.equal(result, true);
|
|
479
|
-
});
|
|
480
|
-
|
|
481
|
-
ShouldDisableColumnTests('should return true when Type is RAW', () => {
|
|
482
|
-
const mockData: Pick<GridRowData, GridColumnNames.Type> = {
|
|
483
|
-
[GridColumnNames.Type]: 'RAW',
|
|
484
|
-
};
|
|
485
|
-
|
|
486
|
-
const result = shouldDisableColumn(mockData);
|
|
487
|
-
assert.equal(result, true);
|
|
488
|
-
});
|
|
489
|
-
|
|
490
|
-
ShouldDisableColumnTests('should return false when Type is valid', () => {
|
|
491
|
-
const mockData: Pick<GridRowData, GridColumnNames.Type> = {
|
|
492
|
-
[GridColumnNames.Type]: 'STRING',
|
|
493
|
-
};
|
|
494
|
-
|
|
495
|
-
const result = shouldDisableColumn(mockData);
|
|
496
|
-
assert.equal(result, false);
|
|
497
|
-
});
|
|
498
|
-
|
|
499
|
-
ShouldDisableColumnTests.run();
|
|
500
|
-
|
|
501
|
-
// ConfigureDisabledColumns tests
|
|
502
|
-
const ConfigureDisabledColumnsTests = suite('configureDisabledColumns()');
|
|
503
|
-
|
|
504
|
-
ConfigureDisabledColumnsTests.before.each(() => {
|
|
505
|
-
sinon.restore();
|
|
506
|
-
});
|
|
507
|
-
|
|
508
|
-
ConfigureDisabledColumnsTests('should not set column filter when column type is valid', () => {
|
|
509
|
-
// Using enum keys now that imports are fixed
|
|
510
|
-
const mockData: TestData = {
|
|
511
|
-
[GridColumnNames.ColumnName]: 'testColumn',
|
|
512
|
-
[GridColumnNames.DisplayName]: 'Test Column',
|
|
513
|
-
[GridColumnNames.Type]: 'STRING',
|
|
514
|
-
[GridColumnNames.Datasource]: 'Test (Snapshot)',
|
|
515
|
-
};
|
|
516
|
-
|
|
517
|
-
const setColumnIncludedStub = sinon.stub(actions.datasourceConfig, 'setColumnIncluded');
|
|
518
|
-
const result = configureDisabledColumns(mockData);
|
|
519
|
-
|
|
520
|
-
assert.equal(result, mockData);
|
|
521
|
-
assert.ok(setColumnIncludedStub.notCalled);
|
|
522
|
-
});
|
|
523
|
-
|
|
524
|
-
ConfigureDisabledColumnsTests('should set column filter when column type is RAW', () => {
|
|
525
|
-
const mockData: TestData = {
|
|
526
|
-
[GridColumnNames.ColumnName]: 'testColumn',
|
|
527
|
-
[GridColumnNames.DisplayName]: 'Test Column',
|
|
528
|
-
[GridColumnNames.Type]: 'RAW',
|
|
529
|
-
[GridColumnNames.Datasource]: 'Test (Snapshot)',
|
|
530
|
-
};
|
|
531
|
-
|
|
532
|
-
const setColumnIncludedStub = sinon.stub(actions.datasourceConfig, 'setColumnIncluded');
|
|
533
|
-
const result = configureDisabledColumns(mockData);
|
|
534
|
-
|
|
535
|
-
assert.equal(result, mockData);
|
|
536
|
-
assert.ok(setColumnIncludedStub.calledOnce);
|
|
537
|
-
assert.ok(
|
|
538
|
-
setColumnIncludedStub.calledWith({
|
|
539
|
-
key: datasourceNameFromDisplay(mockData[GridColumnNames.Datasource]),
|
|
540
|
-
column: mockData[GridColumnNames.ColumnName],
|
|
541
|
-
included: false,
|
|
542
|
-
}),
|
|
543
|
-
);
|
|
544
|
-
});
|
|
545
|
-
|
|
546
|
-
ConfigureDisabledColumnsTests('should set column filter when column type is undefined', () => {
|
|
547
|
-
const mockData: TestData = {
|
|
548
|
-
[GridColumnNames.ColumnName]: 'testColumn',
|
|
549
|
-
[GridColumnNames.DisplayName]: 'Test Column',
|
|
550
|
-
[GridColumnNames.Type]: undefined as any,
|
|
551
|
-
[GridColumnNames.Datasource]: 'Test (Snapshot)',
|
|
552
|
-
};
|
|
553
|
-
|
|
554
|
-
const setColumnIncludedStub = sinon.stub(actions.datasourceConfig, 'setColumnIncluded');
|
|
555
|
-
const result = configureDisabledColumns(mockData);
|
|
556
|
-
|
|
557
|
-
assert.equal(result, mockData);
|
|
558
|
-
assert.ok(setColumnIncludedStub.calledOnce);
|
|
559
|
-
assert.ok(
|
|
560
|
-
setColumnIncludedStub.calledWith({
|
|
561
|
-
key: datasourceNameFromDisplay(mockData[GridColumnNames.Datasource]),
|
|
562
|
-
column: mockData[GridColumnNames.ColumnName],
|
|
563
|
-
included: false,
|
|
564
|
-
}),
|
|
565
|
-
);
|
|
566
|
-
});
|
|
567
|
-
|
|
568
|
-
ConfigureDisabledColumnsTests.run();
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { Connect } from '@genesislcap/foundation-comms';
|
|
2
|
-
import { GenesisElement, observable } from '@genesislcap/web-core';
|
|
3
|
-
import type { JSONSchema7 } from 'json-schema';
|
|
4
|
-
import { getDatasourceSchema } from '../../../utils';
|
|
5
|
-
import { MultiDatasourceHandler } from '../tabbed-datasource-container';
|
|
6
|
-
import { fetchDatasourceSpecs, handleGridError } from './datasource-data-base-component.helpers.ts';
|
|
7
|
-
import { GridRowData } from './datasource-data-base-component.types';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Base abstract class for datasource components that handle datasource fields
|
|
11
|
-
* Provides common functionality for data management
|
|
12
|
-
*/
|
|
13
|
-
export abstract class DatasourceDataBaseComponent
|
|
14
|
-
extends GenesisElement
|
|
15
|
-
implements MultiDatasourceHandler
|
|
16
|
-
{
|
|
17
|
-
@Connect connect!: Connect;
|
|
18
|
-
|
|
19
|
-
@observable fieldData: GridRowData[] = [];
|
|
20
|
-
@observable dataError = false;
|
|
21
|
-
|
|
22
|
-
protected getSchema = getDatasourceSchema(this.connect);
|
|
23
|
-
protected datasourceSpec: { name: string; spec: JSONSchema7 }[] = [];
|
|
24
|
-
|
|
25
|
-
@observable datasourceName: MultiDatasourceHandler['datasourceName'];
|
|
26
|
-
|
|
27
|
-
datasourceNameChanged() {
|
|
28
|
-
this.handleUpdatedDatasources();
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Updates the datasource specifications based on the selected datasource key
|
|
33
|
-
*/
|
|
34
|
-
protected async handleUpdatedDatasources() {
|
|
35
|
-
if (this.datasourceName === null) {
|
|
36
|
-
this.fieldData = [];
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
this.datasourceSpec = await fetchDatasourceSpecs(
|
|
41
|
-
this.datasourceName,
|
|
42
|
-
this.getSchema,
|
|
43
|
-
(error, message) => {
|
|
44
|
-
this.handleError(error, message);
|
|
45
|
-
},
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
this.updateDataFields();
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Transforms the datasource specifications into grid data
|
|
53
|
-
* Override this method to provide component-specific data transformation
|
|
54
|
-
*/
|
|
55
|
-
protected abstract updateDataFields(): Promise<void>;
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Common error handler
|
|
59
|
-
*/
|
|
60
|
-
protected handleError(error: Error, body: string) {
|
|
61
|
-
handleGridError(error, body);
|
|
62
|
-
this.dataError = true;
|
|
63
|
-
this.fieldData = [];
|
|
64
|
-
}
|
|
65
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { ExpressionBuilderTypes, RuleExpression } from '@genesislcap/foundation-ui';
|
|
2
|
-
import { Genesis } from '../../../types';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Comprehensive column names used across all grid components
|
|
6
|
-
*/
|
|
7
|
-
export enum GridColumnNames {
|
|
8
|
-
ColumnName = 'Column Name',
|
|
9
|
-
DisplayName = 'Display Name',
|
|
10
|
-
Type = 'Type',
|
|
11
|
-
Datasource = 'Datasource',
|
|
12
|
-
Filter = 'Filter',
|
|
13
|
-
EnumValues = 'Enum Values',
|
|
14
|
-
DataTransform = 'Data Transform',
|
|
15
|
-
Format = 'Format',
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Type for filter values from various sources
|
|
20
|
-
*/
|
|
21
|
-
export type FilterValue = (
|
|
22
|
-
| RuleExpression.StringValue
|
|
23
|
-
| RuleExpression.BooleanValue
|
|
24
|
-
| RuleExpression.NumericValue
|
|
25
|
-
)['VALUE'];
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Comprehensive row data that encompasses all properties across grid components
|
|
29
|
-
* Individual components should use Pick<GridRowData, ...> to select needed fields
|
|
30
|
-
*/
|
|
31
|
-
export interface GridRowData {
|
|
32
|
-
[GridColumnNames.ColumnName]: string;
|
|
33
|
-
[GridColumnNames.DisplayName]: string;
|
|
34
|
-
[GridColumnNames.Type]: Genesis.GenesisFieldTypes;
|
|
35
|
-
[GridColumnNames.Datasource]: string;
|
|
36
|
-
[GridColumnNames.Filter]?: RuleExpression.Expression['PredicateExpression'];
|
|
37
|
-
[GridColumnNames.EnumValues]?: string[];
|
|
38
|
-
[GridColumnNames.DataTransform]?: ExpressionBuilderTypes.ValueConfig;
|
|
39
|
-
[GridColumnNames.Format]?: string;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Invalid column types that should be disabled or filtered
|
|
44
|
-
*/
|
|
45
|
-
export const INVALID_COLUMN_TYPES: Genesis.GenesisFieldTypes[] = ['RAW'];
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Common filter options for row filters
|
|
49
|
-
*/
|
|
50
|
-
export const ROW_FILTER_OPERATIONS: RuleExpression.Operation[] = ['NOT_EQUALS', 'EQUALS'];
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Value for select dropdown that indicates no selection
|
|
54
|
-
*/
|
|
55
|
-
export const BLANK_SELECT_OPTION = 'Select option';
|