@genesislcap/pbc-reporting-ui 14.396.4 → 14.397.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/dts/new/main/edit-config/datasource-config/datasource-config-item.d.ts +6 -2
- package/dist/dts/new/main/edit-config/datasource-config/datasource-config-item.d.ts.map +1 -1
- package/dist/dts/new/main/edit-config/datasource-config/datasource-config-item.styles.d.ts.map +1 -1
- package/dist/dts/new/main/edit-config/datasource-config/datasource-config-item.template.d.ts.map +1 -1
- package/dist/dts/new/main/edit-config/datasource-config/datasources-config-container.helpers.d.ts.map +1 -1
- package/dist/dts/new/main/edit-config/datasource-config/datasources-config-container.template.d.ts.map +1 -1
- package/dist/dts/new/main/edit-config/shared/datasource-data-base-component.helpers.ts.d.ts.map +1 -1
- package/dist/dts/new/store/slices/datasources-config.d.ts +19 -6
- package/dist/dts/new/store/slices/datasources-config.d.ts.map +1 -1
- package/dist/dts/new/store/slices/types.d.ts +19 -2
- package/dist/dts/new/store/slices/types.d.ts.map +1 -1
- package/dist/dts/new/store/store.d.ts +126 -35
- package/dist/dts/new/store/store.d.ts.map +1 -1
- package/dist/dts/new/types/misc.d.ts +4 -2
- package/dist/dts/new/types/misc.d.ts.map +1 -1
- package/dist/dts/new/utils/alias-generator.d.ts +8 -0
- package/dist/dts/new/utils/alias-generator.d.ts.map +1 -0
- package/dist/dts/new/utils/alias-generator.test.d.ts +2 -0
- package/dist/dts/new/utils/alias-generator.test.d.ts.map +1 -0
- package/dist/dts/new/utils/index.d.ts +1 -0
- package/dist/dts/new/utils/index.d.ts.map +1 -1
- package/dist/dts/new/utils/tooltip.d.ts +3 -0
- package/dist/dts/new/utils/tooltip.d.ts.map +1 -1
- package/dist/dts/new/utils/transformers.d.ts +1 -1
- package/dist/dts/new/utils/transformers.d.ts.map +1 -1
- package/dist/esm/new/main/edit-config/col-filters/col-filters-grid.helpers.test.js +39 -7
- package/dist/esm/new/main/edit-config/col-rename-alias/col-rename-alias-grid.helpers.test.js +32 -4
- package/dist/esm/new/main/edit-config/data-transforms-derived-fields/data-transforms.helpers.test.js +10 -2
- package/dist/esm/new/main/edit-config/datasource-config/datasource-config-item.js +100 -10
- package/dist/esm/new/main/edit-config/datasource-config/datasource-config-item.styles.js +6 -0
- package/dist/esm/new/main/edit-config/datasource-config/datasource-config-item.template.js +38 -3
- package/dist/esm/new/main/edit-config/datasource-config/datasources-config-container.helpers.js +11 -7
- package/dist/esm/new/main/edit-config/datasource-config/datasources-config-container.helpers.test.js +29 -22
- package/dist/esm/new/main/edit-config/datasource-config/datasources-config-container.template.js +3 -0
- package/dist/esm/new/main/edit-config/shared/datasource-data-base-component.helpers.ts.js +16 -8
- package/dist/esm/new/main/edit-config/shared/datasource-data-base-component.test.js +13 -2
- package/dist/esm/new/main/edit-config/tabbed-datasource-container/tabbed-datasource-container.template.js +1 -1
- package/dist/esm/new/store/slices/datasources-config.js +41 -5
- package/dist/esm/new/store/slices/types.js +1 -0
- package/dist/esm/new/utils/alias-generator.js +16 -0
- package/dist/esm/new/utils/alias-generator.test.js +36 -0
- package/dist/esm/new/utils/index.js +1 -0
- package/dist/esm/new/utils/tooltip.js +16 -0
- package/dist/esm/new/utils/transformers.js +20 -6
- package/dist/esm/new/utils/transformers.test.js +61 -11
- package/dist/esm/new/utils/validators.test.js +35 -21
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +22 -22
- package/src/new/main/edit-config/col-filters/col-filters-grid.helpers.test.ts +39 -7
- package/src/new/main/edit-config/col-rename-alias/col-rename-alias-grid.helpers.test.ts +32 -4
- package/src/new/main/edit-config/data-transforms-derived-fields/data-transforms.helpers.test.ts +10 -2
- package/src/new/main/edit-config/datasource-config/datasource-config-item.styles.ts +6 -0
- package/src/new/main/edit-config/datasource-config/datasource-config-item.template.ts +62 -3
- package/src/new/main/edit-config/datasource-config/datasource-config-item.ts +107 -8
- package/src/new/main/edit-config/datasource-config/datasources-config-container.helpers.test.ts +32 -23
- package/src/new/main/edit-config/datasource-config/datasources-config-container.helpers.ts +18 -10
- package/src/new/main/edit-config/datasource-config/datasources-config-container.template.ts +6 -0
- package/src/new/main/edit-config/shared/datasource-data-base-component.helpers.ts.ts +21 -11
- package/src/new/main/edit-config/shared/datasource-data-base-component.test.ts +14 -2
- package/src/new/main/edit-config/tabbed-datasource-container/tabbed-datasource-container.template.ts +1 -1
- package/src/new/store/slices/datasources-config.ts +58 -7
- package/src/new/store/slices/types.ts +22 -4
- package/src/new/types/misc.ts +9 -2
- package/src/new/utils/alias-generator.test.ts +44 -0
- package/src/new/utils/alias-generator.ts +18 -0
- package/src/new/utils/index.ts +1 -0
- package/src/new/utils/tooltip.ts +19 -0
- package/src/new/utils/transformers.test.ts +73 -11
- package/src/new/utils/transformers.ts +30 -6
- package/src/new/utils/validators.test.ts +35 -21
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../../src/new/utils/tooltip.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,GAAI,MAAM,MAAM,EAAE,OAAO,MAAM,6DAElD,CAAC;AAMF,eAAO,MAAM,eAAe,0DAA0C,CAAC;AAEvE,yBAAiB,OAAO,CAAC;IAChB,MAAM,UAAU,uJAGxB,CAAC;IAEO,MAAM,cAAc,+KAI5B,CAAC;IAEO,MAAM,eAAe,8IAG7B,CAAC;IAEO,MAAM,iBAAiB,2IAG/B,CAAC;IAEO,MAAM,eAAe,ybAQ7B,CAAC;IAEO,MAAM,mBAAmB,65BAQ/B,CAAC;IAEK,MAAM,gBAAgB,uWAI9B,CAAC;IAEO,MAAM,gBAAgB,mRAG9B,CAAC;IAEO,MAAM,iBAAiB,wFAG/B,CAAC;IAEO,MAAM,gBAAgB,qGAG9B,CAAC;CACD"}
|
|
1
|
+
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../../src/new/utils/tooltip.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,GAAI,MAAM,MAAM,EAAE,OAAO,MAAM,6DAElD,CAAC;AAMF,eAAO,MAAM,eAAe,0DAA0C,CAAC;AAEvE,yBAAiB,OAAO,CAAC;IAChB,MAAM,UAAU,uJAGxB,CAAC;IAEO,MAAM,cAAc,+KAI5B,CAAC;IAEO,MAAM,eAAe,8IAG7B,CAAC;IAEO,MAAM,iBAAiB,2IAG/B,CAAC;IAEO,MAAM,eAAe,ybAQ7B,CAAC;IAEO,MAAM,mBAAmB,65BAQ/B,CAAC;IAEK,MAAM,sBAAsB,sIAGpC,CAAC;IAEO,MAAM,gBAAgB,uWAI9B,CAAC;IAEO,MAAM,gBAAgB,mRAG9B,CAAC;IAEO,MAAM,6BAA6B,6dAO3C,CAAC;IAEO,MAAM,wBAAwB,6HAGtC,CAAC;IAEO,MAAM,iBAAiB,wFAG/B,CAAC;IAEO,MAAM,gBAAgB,qGAG9B,CAAC;CACD"}
|
|
@@ -5,5 +5,5 @@ export declare function transformToServerPayload(state: ReportingConfig): Genesi
|
|
|
5
5
|
export declare function transformFromServerPayload(payload: Genesis.ServerReportConfig, getSchema: (name: string) => Promise<JSONSchema7>): Promise<ReportingConfig>;
|
|
6
6
|
export declare function datasourceInputForDisplay(input: DatasourceInputTypes): Display.DatasourceInputTypes;
|
|
7
7
|
export declare function datasourceInputFromDisplay(display: Display.DatasourceInputTypes): DatasourceInputTypes;
|
|
8
|
-
export declare function buildDatasourceName(
|
|
8
|
+
export declare function buildDatasourceName(alias: string, resourceName: string, type: DatasourceInputTypes): DatasourceName;
|
|
9
9
|
//# sourceMappingURL=transformers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformers.d.ts","sourceRoot":"","sources":["../../../../src/new/utils/transformers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAc,oBAAoB,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAElG,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAE5C,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,
|
|
1
|
+
{"version":3,"file":"transformers.d.ts","sourceRoot":"","sources":["../../../../src/new/utils/transformers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAc,oBAAoB,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAElG,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAE5C,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAwB3F;AAiCD,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,OAAO,CAAC,kBAAkB,EACnC,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,GAChD,OAAO,CAAC,eAAe,CAAC,CAoF1B;AAED,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,oBAAoB,GAC1B,OAAO,CAAC,oBAAoB,CAI9B;AAED,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,OAAO,CAAC,oBAAoB,GACpC,oBAAoB,CAItB;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,oBAAoB,GACzB,cAAc,CAEhB"}
|
|
@@ -38,6 +38,8 @@ RowSelectionChangedHandler('should return early if filtered state matches select
|
|
|
38
38
|
TRANSFORMER_CONFIGURATION: {
|
|
39
39
|
COLUMN_FILTERS: ['testColumn'],
|
|
40
40
|
},
|
|
41
|
+
GROUPING_STRATEGY: 'NONE',
|
|
42
|
+
GROUP_KEY: null,
|
|
41
43
|
});
|
|
42
44
|
rowSelectionChangedHandler(mockEvent);
|
|
43
45
|
assert.equal(lookupStub.called, true);
|
|
@@ -66,6 +68,8 @@ RowSelectionChangedHandler('should return early if type is invalid', () => {
|
|
|
66
68
|
TRANSFORMER_CONFIGURATION: {
|
|
67
69
|
COLUMN_FILTERS: [],
|
|
68
70
|
},
|
|
71
|
+
GROUPING_STRATEGY: 'NONE',
|
|
72
|
+
GROUP_KEY: null,
|
|
69
73
|
});
|
|
70
74
|
rowSelectionChangedHandler(mockEvent);
|
|
71
75
|
assert.equal(lookupStub.called, true);
|
|
@@ -73,7 +77,7 @@ RowSelectionChangedHandler('should return early if type is invalid', () => {
|
|
|
73
77
|
});
|
|
74
78
|
RowSelectionChangedHandler('should update include and redraw when selection changes', () => {
|
|
75
79
|
const mockData = {
|
|
76
|
-
[GridColumnNames.Datasource]: '
|
|
80
|
+
[GridColumnNames.Datasource]: 'testAlias (Snapshot)',
|
|
77
81
|
[GridColumnNames.ColumnName]: 'testColumn',
|
|
78
82
|
[GridColumnNames.Type]: 'INT',
|
|
79
83
|
};
|
|
@@ -88,17 +92,30 @@ RowSelectionChangedHandler('should update include and redraw when selection chan
|
|
|
88
92
|
};
|
|
89
93
|
const setColumnIncludedStub = sinon.stub(actions.datasourceConfig, 'setColumnIncluded');
|
|
90
94
|
sinon.stub(selectors.datasourceConfig, 'getDatasource').returns({
|
|
91
|
-
KEY: '
|
|
92
|
-
NAME: '
|
|
95
|
+
KEY: 'testSource',
|
|
96
|
+
NAME: 'testAlias',
|
|
93
97
|
INPUT_TYPE: 'REQ_REP',
|
|
94
98
|
OUTPUT_TYPE: 'TABLE',
|
|
95
99
|
TRANSFORMER_CONFIGURATION: {
|
|
96
100
|
INCLUDE_COLUMNS: ['testColumn'],
|
|
97
101
|
},
|
|
102
|
+
GROUPING_STRATEGY: 'NONE',
|
|
103
|
+
GROUP_KEY: null,
|
|
104
|
+
});
|
|
105
|
+
sinon.stub(selectors.datasourceConfig, 'getAllConfigSet').returns({
|
|
106
|
+
REQ_REP_testSource_testAlias: {
|
|
107
|
+
KEY: 'testAlias',
|
|
108
|
+
NAME: 'testSource',
|
|
109
|
+
INPUT_TYPE: 'REQ_REP',
|
|
110
|
+
OUTPUT_TYPE: 'TABLE',
|
|
111
|
+
TRANSFORMER_CONFIGURATION: {},
|
|
112
|
+
GROUPING_STRATEGY: 'NONE',
|
|
113
|
+
GROUP_KEY: null,
|
|
114
|
+
},
|
|
98
115
|
});
|
|
99
116
|
rowSelectionChangedHandler(mockEvent);
|
|
100
117
|
assert.equal(setColumnIncludedStub.calledOnce, true);
|
|
101
|
-
assert.equal(setColumnIncludedStub.getCall(0).args[0].key, '
|
|
118
|
+
assert.equal(setColumnIncludedStub.getCall(0).args[0].key, 'REQ_REP_testSource_testAlias');
|
|
102
119
|
assert.equal(setColumnIncludedStub.getCall(0).args[0].column, 'testColumn');
|
|
103
120
|
assert.equal(setColumnIncludedStub.getCall(0).args[0].included, false);
|
|
104
121
|
assert.equal(setColumnIncludedStub.getCall(0).args[0].setDefaultFormat, true);
|
|
@@ -129,6 +146,8 @@ RowSelectionChangedHandler('should not set default format if output format is XL
|
|
|
129
146
|
TRANSFORMER_CONFIGURATION: {
|
|
130
147
|
INCLUDE_COLUMNS: ['testColumn'],
|
|
131
148
|
},
|
|
149
|
+
GROUPING_STRATEGY: 'NONE',
|
|
150
|
+
GROUP_KEY: null,
|
|
132
151
|
});
|
|
133
152
|
rowSelectionChangedHandler(mockEvent);
|
|
134
153
|
assert.equal(setColumnIncludedStub.calledOnce, true);
|
|
@@ -136,7 +155,7 @@ RowSelectionChangedHandler('should not set default format if output format is XL
|
|
|
136
155
|
});
|
|
137
156
|
RowSelectionChangedHandler('should handle undefined selection state', () => {
|
|
138
157
|
const mockData = {
|
|
139
|
-
[GridColumnNames.Datasource]: '
|
|
158
|
+
[GridColumnNames.Datasource]: 'testAlias (Snapshot)',
|
|
140
159
|
[GridColumnNames.ColumnName]: 'testColumn',
|
|
141
160
|
[GridColumnNames.Type]: 'INT',
|
|
142
161
|
};
|
|
@@ -151,13 +170,26 @@ RowSelectionChangedHandler('should handle undefined selection state', () => {
|
|
|
151
170
|
};
|
|
152
171
|
const setColumnIncludedStub = sinon.stub(actions.datasourceConfig, 'setColumnIncluded');
|
|
153
172
|
sinon.stub(selectors.datasourceConfig, 'getDatasource').returns({
|
|
154
|
-
KEY: '
|
|
155
|
-
NAME: '
|
|
173
|
+
KEY: 'testSource',
|
|
174
|
+
NAME: 'testAlias',
|
|
156
175
|
INPUT_TYPE: 'REQ_REP',
|
|
157
176
|
OUTPUT_TYPE: 'TABLE',
|
|
158
177
|
TRANSFORMER_CONFIGURATION: {
|
|
159
178
|
COLUMN_FILTERS: ['testColumn'],
|
|
160
179
|
},
|
|
180
|
+
GROUPING_STRATEGY: 'NONE',
|
|
181
|
+
GROUP_KEY: null,
|
|
182
|
+
});
|
|
183
|
+
sinon.stub(selectors.datasourceConfig, 'getAllConfigSet').returns({
|
|
184
|
+
REQ_REP_testSource_testAlias: {
|
|
185
|
+
KEY: 'testAlias',
|
|
186
|
+
NAME: 'testSource',
|
|
187
|
+
INPUT_TYPE: 'REQ_REP',
|
|
188
|
+
OUTPUT_TYPE: 'TABLE',
|
|
189
|
+
TRANSFORMER_CONFIGURATION: {},
|
|
190
|
+
GROUPING_STRATEGY: 'NONE',
|
|
191
|
+
GROUP_KEY: null,
|
|
192
|
+
},
|
|
161
193
|
});
|
|
162
194
|
rowSelectionChangedHandler(mockEvent);
|
|
163
195
|
assert.equal(setColumnIncludedStub.calledOnce, true);
|
package/dist/esm/new/main/edit-config/col-rename-alias/col-rename-alias-grid.helpers.test.js
CHANGED
|
@@ -21,6 +21,8 @@ LookupColumnRename('should return original data when no rename is found', () =>
|
|
|
21
21
|
INPUT_TYPE: 'REQ_REP',
|
|
22
22
|
OUTPUT_TYPE: 'TABLE',
|
|
23
23
|
TRANSFORMER_CONFIGURATION: { COLUMN_RENAMES: {} },
|
|
24
|
+
GROUPING_STRATEGY: 'NONE',
|
|
25
|
+
GROUP_KEY: null,
|
|
24
26
|
});
|
|
25
27
|
const result = lookupColumnRename(mockData);
|
|
26
28
|
assert.equal(result, mockData);
|
|
@@ -45,6 +47,8 @@ LookupColumnRename('should return data with renamed display name when rename exi
|
|
|
45
47
|
[originalColumn]: newDisplayName,
|
|
46
48
|
},
|
|
47
49
|
},
|
|
50
|
+
GROUPING_STRATEGY: 'NONE',
|
|
51
|
+
GROUP_KEY: null,
|
|
48
52
|
});
|
|
49
53
|
const result = lookupColumnRename(mockData);
|
|
50
54
|
assert.equal(result[GridColumnNames.DisplayName], newDisplayName);
|
|
@@ -66,6 +70,8 @@ LookupColumnRename('should handle undefined COLUMN_RENAMES', () => {
|
|
|
66
70
|
INPUT_TYPE: 'REQ_REP',
|
|
67
71
|
OUTPUT_TYPE: 'TABLE',
|
|
68
72
|
TRANSFORMER_CONFIGURATION: {},
|
|
73
|
+
GROUPING_STRATEGY: 'NONE',
|
|
74
|
+
GROUP_KEY: null,
|
|
69
75
|
});
|
|
70
76
|
const result = lookupColumnRename(mockData);
|
|
71
77
|
assert.equal(result, mockData);
|
|
@@ -80,17 +86,28 @@ DisplayNameOnChangeHandler('calls setColumnRename with correct parameters when v
|
|
|
80
86
|
const callback = sinon.spy();
|
|
81
87
|
const handler = displayNameOnChangeHandler(callback);
|
|
82
88
|
const mockData = {
|
|
83
|
-
[GridColumnNames.Datasource]: '
|
|
89
|
+
[GridColumnNames.Datasource]: 'testAlias (Snapshot)',
|
|
84
90
|
[GridColumnNames.ColumnName]: 'originalColumn',
|
|
85
91
|
[GridColumnNames.DisplayName]: 'Original Display',
|
|
86
92
|
[GridColumnNames.Type]: 'STRING',
|
|
87
93
|
};
|
|
88
94
|
const setColumnRenameStub = sinon.stub(actions.datasourceConfig, 'setColumnRename');
|
|
95
|
+
sinon.stub(selectors.datasourceConfig, 'getAllConfigSet').returns({
|
|
96
|
+
REQ_REP_testSource_testAlias: {
|
|
97
|
+
KEY: 'testAlias',
|
|
98
|
+
NAME: 'testSource',
|
|
99
|
+
INPUT_TYPE: 'REQ_REP',
|
|
100
|
+
OUTPUT_TYPE: 'TABLE',
|
|
101
|
+
TRANSFORMER_CONFIGURATION: {},
|
|
102
|
+
GROUPING_STRATEGY: 'NONE',
|
|
103
|
+
GROUP_KEY: null,
|
|
104
|
+
},
|
|
105
|
+
});
|
|
89
106
|
handler('newColumn', { data: mockData });
|
|
90
107
|
assert.equal(setColumnRenameStub.calledOnce, true);
|
|
91
108
|
// Check each property individually instead of using deepEqual
|
|
92
109
|
const firstCallArg = setColumnRenameStub.firstCall.args[0];
|
|
93
|
-
assert.equal(firstCallArg.key, '
|
|
110
|
+
assert.equal(firstCallArg.key, 'REQ_REP_testSource_testAlias');
|
|
94
111
|
assert.equal(firstCallArg.columnFrom, 'originalColumn');
|
|
95
112
|
assert.equal(firstCallArg.columnTo, 'newColumn');
|
|
96
113
|
assert.equal(callback.called, false);
|
|
@@ -99,17 +116,28 @@ DisplayNameOnChangeHandler('removes prohibited characters and calls callback', (
|
|
|
99
116
|
const callback = sinon.spy();
|
|
100
117
|
const handler = displayNameOnChangeHandler(callback);
|
|
101
118
|
const mockData = {
|
|
102
|
-
[GridColumnNames.Datasource]: '
|
|
119
|
+
[GridColumnNames.Datasource]: 'testAlias (Snapshot)',
|
|
103
120
|
[GridColumnNames.ColumnName]: 'originalColumn',
|
|
104
121
|
[GridColumnNames.DisplayName]: 'Original Display',
|
|
105
122
|
[GridColumnNames.Type]: 'STRING',
|
|
106
123
|
};
|
|
107
124
|
const setColumnRenameStub = sinon.stub(actions.datasourceConfig, 'setColumnRename');
|
|
125
|
+
sinon.stub(selectors.datasourceConfig, 'getAllConfigSet').returns({
|
|
126
|
+
REQ_REP_testSource_testAlias: {
|
|
127
|
+
KEY: 'testAlias',
|
|
128
|
+
NAME: 'testSource',
|
|
129
|
+
INPUT_TYPE: 'REQ_REP',
|
|
130
|
+
OUTPUT_TYPE: 'TABLE',
|
|
131
|
+
TRANSFORMER_CONFIGURATION: {},
|
|
132
|
+
GROUPING_STRATEGY: 'NONE',
|
|
133
|
+
GROUP_KEY: null,
|
|
134
|
+
},
|
|
135
|
+
});
|
|
108
136
|
handler('new@Column-=+test', { data: mockData });
|
|
109
137
|
assert.equal(setColumnRenameStub.calledOnce, true);
|
|
110
138
|
// Check each property individually instead of using deepEqual
|
|
111
139
|
const firstCallArg = setColumnRenameStub.firstCall.args[0];
|
|
112
|
-
assert.equal(firstCallArg.key, '
|
|
140
|
+
assert.equal(firstCallArg.key, 'REQ_REP_testSource_testAlias');
|
|
113
141
|
assert.equal(firstCallArg.columnFrom, 'originalColumn');
|
|
114
142
|
assert.equal(firstCallArg.columnTo, 'newColumntest');
|
|
115
143
|
assert.equal(callback.calledOnce, true);
|
package/dist/esm/new/main/edit-config/data-transforms-derived-fields/data-transforms.helpers.test.js
CHANGED
|
@@ -20,6 +20,8 @@ LookupColumnFormat('should return empty string when no format is found', () => {
|
|
|
20
20
|
INPUT_TYPE: 'REQ_REP',
|
|
21
21
|
OUTPUT_TYPE: 'TABLE',
|
|
22
22
|
TRANSFORMER_CONFIGURATION: { COLUMN_FORMATS: {} },
|
|
23
|
+
GROUPING_STRATEGY: 'NONE',
|
|
24
|
+
GROUP_KEY: null,
|
|
23
25
|
});
|
|
24
26
|
const result = lookupColumnFormat(mockData);
|
|
25
27
|
assert.equal(result[GridColumnNames.Format], ''); // No format found, returns empty string
|
|
@@ -44,6 +46,8 @@ LookupColumnFormat('should return data with format when format exists', () => {
|
|
|
44
46
|
[originalColumn]: newFormat,
|
|
45
47
|
},
|
|
46
48
|
},
|
|
49
|
+
GROUPING_STRATEGY: 'NONE',
|
|
50
|
+
GROUP_KEY: null,
|
|
47
51
|
});
|
|
48
52
|
const result = lookupColumnFormat(mockData);
|
|
49
53
|
assert.equal(result[GridColumnNames.Format], newFormat);
|
|
@@ -65,6 +69,8 @@ LookupColumnFormat('should handle undefined COLUMN_FORMATS', () => {
|
|
|
65
69
|
INPUT_TYPE: 'REQ_REP',
|
|
66
70
|
OUTPUT_TYPE: 'TABLE',
|
|
67
71
|
TRANSFORMER_CONFIGURATION: {},
|
|
72
|
+
GROUPING_STRATEGY: 'NONE',
|
|
73
|
+
GROUP_KEY: null,
|
|
68
74
|
});
|
|
69
75
|
const result = lookupColumnFormat(mockData);
|
|
70
76
|
assert.equal(result[GridColumnNames.Format], ''); // No format found, returns empty string
|
|
@@ -87,6 +93,8 @@ LookupColumnFormat('should return existing format when format exists', () => {
|
|
|
87
93
|
numericColumn: '#.##',
|
|
88
94
|
},
|
|
89
95
|
},
|
|
96
|
+
GROUPING_STRATEGY: 'NONE',
|
|
97
|
+
GROUP_KEY: null,
|
|
90
98
|
});
|
|
91
99
|
const result = lookupColumnFormat(mockData);
|
|
92
100
|
assert.equal(result[GridColumnNames.Format], '#.##'); // Existing format is returned
|
|
@@ -363,7 +371,7 @@ ValueExprCellRendereronChange.before.each(() => {
|
|
|
363
371
|
sinon.restore();
|
|
364
372
|
});
|
|
365
373
|
ValueExprCellRendereronChange('should call setColumnTransform when model exists', () => {
|
|
366
|
-
const datasourceKey = '
|
|
374
|
+
const datasourceKey = 'REQ_REP_RESOURCE_ALIAS';
|
|
367
375
|
const columnName = 'testColumn';
|
|
368
376
|
// Using type assertions to match the expected type
|
|
369
377
|
const mockExpression = {
|
|
@@ -403,7 +411,7 @@ ValueExprCellRendereronChange('should call setColumnTransform when model exists'
|
|
|
403
411
|
assert.equal(deleteColumnTransformStub.called, false);
|
|
404
412
|
});
|
|
405
413
|
ValueExprCellRendereronChange('should call deleteColumnTransform when model is null', () => {
|
|
406
|
-
const datasourceKey = '
|
|
414
|
+
const datasourceKey = 'REQ_REP_RESOURCE_ALIAS';
|
|
407
415
|
const columnName = 'testColumn';
|
|
408
416
|
const mockParams = {
|
|
409
417
|
data: {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { __awaiter, __decorate } from "tslib";
|
|
2
2
|
import { Connect } from '@genesislcap/foundation-comms';
|
|
3
3
|
import { attr, customElement, GenesisElement, observable } from '@genesislcap/web-core';
|
|
4
|
-
import { actions, } from '../../../store';
|
|
5
|
-
import { buildDatasourceName, datasourceInputFromDisplay, getDatasourceSchema, showNotificationToast, } from '../../../utils';
|
|
4
|
+
import { actions, selectors, } from '../../../store';
|
|
5
|
+
import { buildDatasourceName, datasourceInputFromDisplay, generateUniqueAlias, getDatasourceSchema, showNotificationToast, } from '../../../utils';
|
|
6
6
|
import { setDefaultFormatsForDatasource } from '../data-transforms-derived-fields/data-transforms.helpers';
|
|
7
7
|
import { styles } from './datasource-config-item.styles';
|
|
8
8
|
import { template } from './datasource-config-item.template';
|
|
@@ -12,10 +12,27 @@ let DatasourceConfigItem = class DatasourceConfigItem extends GenesisElement {
|
|
|
12
12
|
this.getSchema = getDatasourceSchema(this.connect);
|
|
13
13
|
this.datasourceName = null;
|
|
14
14
|
this.datasourceChoices = null;
|
|
15
|
+
this.groupingByFieldsNames = null;
|
|
15
16
|
this.canRemove = false;
|
|
16
17
|
this.position = 'below';
|
|
17
18
|
this.error = 'none';
|
|
18
19
|
}
|
|
20
|
+
connectedCallback() {
|
|
21
|
+
const _super = Object.create(null, {
|
|
22
|
+
connectedCallback: { get: () => super.connectedCallback }
|
|
23
|
+
});
|
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
_super.connectedCallback.call(this);
|
|
26
|
+
try {
|
|
27
|
+
const datasource = selectors.datasourceConfig.getDatasource(this.datasourceName);
|
|
28
|
+
const schema = yield this.getSchema(datasource.NAME);
|
|
29
|
+
this.groupingByFieldsNames = Object.keys(schema.properties);
|
|
30
|
+
}
|
|
31
|
+
catch (e) {
|
|
32
|
+
console.error(e);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
19
36
|
deleteDatasourceHandler() {
|
|
20
37
|
if (!this.canRemove)
|
|
21
38
|
throw new Error('Trying to remove final datasource!');
|
|
@@ -25,13 +42,28 @@ let DatasourceConfigItem = class DatasourceConfigItem extends GenesisElement {
|
|
|
25
42
|
key: this.datasourceName,
|
|
26
43
|
});
|
|
27
44
|
}
|
|
28
|
-
updateKeyHandler(
|
|
45
|
+
updateKeyHandler(newName, event) {
|
|
29
46
|
if (!this.datasourceName) {
|
|
30
47
|
throw new Error('updateKeyHandler - datasourceName unset');
|
|
31
48
|
}
|
|
32
|
-
|
|
49
|
+
const allDatasources = selectors.datasourceConfig.getAllConfigSet();
|
|
50
|
+
const nameExists = Object.entries(allDatasources)
|
|
51
|
+
.filter(([key]) => key !== this.datasourceName)
|
|
52
|
+
.some(([, ds]) => ds.KEY.toLowerCase() === newName.toLowerCase());
|
|
53
|
+
if (nameExists) {
|
|
54
|
+
showNotificationToast({
|
|
55
|
+
title: 'Reporting Config',
|
|
56
|
+
body: `Name '${newName}' is already in use by another datasource.`,
|
|
57
|
+
toast: { type: 'error' },
|
|
58
|
+
});
|
|
59
|
+
if (event) {
|
|
60
|
+
event.target.value = allDatasources[this.datasourceName].KEY;
|
|
61
|
+
}
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
actions.datasourceConfig.renameDatasource({
|
|
33
65
|
key: this.datasourceName,
|
|
34
|
-
|
|
66
|
+
newName,
|
|
35
67
|
});
|
|
36
68
|
}
|
|
37
69
|
updateOutputTypeHandler(newType) {
|
|
@@ -43,6 +75,45 @@ let DatasourceConfigItem = class DatasourceConfigItem extends GenesisElement {
|
|
|
43
75
|
newType,
|
|
44
76
|
});
|
|
45
77
|
}
|
|
78
|
+
updateGroupingStrategyHandler(value) {
|
|
79
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
80
|
+
try {
|
|
81
|
+
if (value === 'NONE') {
|
|
82
|
+
actions.datasourceConfig.deleteGrouping({ key: this.datasourceName });
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const dsResource = selectors.datasourceConfig.getDatasource(this.datasourceName).NAME;
|
|
86
|
+
const schema = yield this.getSchema(dsResource);
|
|
87
|
+
if (!schema.properties)
|
|
88
|
+
throw new Error(`schema properties for ${dsResource} undefined`);
|
|
89
|
+
const fields = Object.keys(schema.properties);
|
|
90
|
+
actions.datasourceConfig.setGrouping({
|
|
91
|
+
key: this.datasourceName,
|
|
92
|
+
grouping: { GROUPING_STRATEGY: value, GROUP_KEY: fields[0] },
|
|
93
|
+
});
|
|
94
|
+
this.groupingByFieldsNames = Object.keys(schema.properties);
|
|
95
|
+
}
|
|
96
|
+
catch (e) {
|
|
97
|
+
const errorMsg = e instanceof Error ? `\n\n${e.message}` : '';
|
|
98
|
+
showNotificationToast({
|
|
99
|
+
title: 'Reporting Config',
|
|
100
|
+
body: `Error fetching field data for datasource ${this.datasourceName}.${errorMsg}`,
|
|
101
|
+
toast: { type: 'critical' },
|
|
102
|
+
});
|
|
103
|
+
this.error = 'unknown';
|
|
104
|
+
console.error(e);
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
updateGroupingByHandler(value) {
|
|
109
|
+
const datasource = selectors.datasourceConfig.getDatasource(this.datasourceName);
|
|
110
|
+
if (datasource.GROUPING_STRATEGY === 'NONE')
|
|
111
|
+
throw new Error('Cannot set group by field when GROUPING_STRATEGY is NONE');
|
|
112
|
+
actions.datasourceConfig.setGrouping({
|
|
113
|
+
key: this.datasourceName,
|
|
114
|
+
grouping: { GROUPING_STRATEGY: datasource.GROUPING_STRATEGY, GROUP_KEY: value },
|
|
115
|
+
});
|
|
116
|
+
}
|
|
46
117
|
updateDatasourceSourceHandler(selectedOption) {
|
|
47
118
|
return __awaiter(this, void 0, void 0, function* () {
|
|
48
119
|
var _a;
|
|
@@ -54,7 +125,7 @@ let DatasourceConfigItem = class DatasourceConfigItem extends GenesisElement {
|
|
|
54
125
|
return;
|
|
55
126
|
}
|
|
56
127
|
const option = selectedOption.selectedOptions[0];
|
|
57
|
-
const
|
|
128
|
+
const RESOURCE_NAME = option.value;
|
|
58
129
|
const dataAttr = (option.getAttribute('data-bubble-content'));
|
|
59
130
|
if (!dataAttr)
|
|
60
131
|
throw new Error(`Unable to read datasource from attribute ${dataAttr}`);
|
|
@@ -62,21 +133,37 @@ let DatasourceConfigItem = class DatasourceConfigItem extends GenesisElement {
|
|
|
62
133
|
if (!this.datasourceName || !INPUT_TYPE) {
|
|
63
134
|
throw new Error('updateKeyHandler - datasourceName or INPUT_TYPE null');
|
|
64
135
|
}
|
|
65
|
-
const schema = yield this.getSchema(
|
|
136
|
+
const schema = yield this.getSchema(RESOURCE_NAME);
|
|
66
137
|
if (!schema.properties)
|
|
67
|
-
throw new Error(`schema properties for ${
|
|
138
|
+
throw new Error(`schema properties for ${RESOURCE_NAME} undefined`);
|
|
68
139
|
const fields = Object.keys(schema.properties);
|
|
140
|
+
// Check for duplicate aliases
|
|
141
|
+
const allDatasources = selectors.datasourceConfig.getAllConfigSet();
|
|
142
|
+
const existingAliases = new Set(Object.entries(allDatasources)
|
|
143
|
+
.filter(([key]) => key !== this.datasourceName)
|
|
144
|
+
.map(([, ds]) => ds.KEY));
|
|
145
|
+
const uniqueAlias = generateUniqueAlias(RESOURCE_NAME, existingAliases);
|
|
146
|
+
// Preserve index
|
|
147
|
+
const originalIndex = Object.keys(allDatasources).indexOf(this.datasourceName);
|
|
69
148
|
actions.datasourceConfig.deleteDatasource({ key: this.datasourceName });
|
|
70
149
|
actions.datasourceConfig.initDatasourceConfiguration({
|
|
71
150
|
base: {
|
|
72
|
-
KEY,
|
|
151
|
+
KEY: uniqueAlias,
|
|
152
|
+
NAME: RESOURCE_NAME,
|
|
73
153
|
INPUT_TYPE: INPUT_TYPE,
|
|
74
154
|
},
|
|
75
155
|
fields,
|
|
76
156
|
});
|
|
77
|
-
const datasourceName = buildDatasourceName(
|
|
157
|
+
const datasourceName = buildDatasourceName(uniqueAlias, RESOURCE_NAME, INPUT_TYPE);
|
|
158
|
+
if (originalIndex !== -1) {
|
|
159
|
+
actions.datasourceConfig.reorderDatasource({
|
|
160
|
+
key: datasourceName,
|
|
161
|
+
newIndex: originalIndex,
|
|
162
|
+
});
|
|
163
|
+
}
|
|
78
164
|
setDefaultFormatsForDatasource(datasourceName, schema);
|
|
79
165
|
this.error = 'none';
|
|
166
|
+
this.groupingByFieldsNames = Object.keys(schema.properties);
|
|
80
167
|
}
|
|
81
168
|
catch (e) {
|
|
82
169
|
const errorMsg = e instanceof Error ? `\n\n${e.message}` : '';
|
|
@@ -100,6 +187,9 @@ __decorate([
|
|
|
100
187
|
__decorate([
|
|
101
188
|
observable
|
|
102
189
|
], DatasourceConfigItem.prototype, "datasourceChoices", void 0);
|
|
190
|
+
__decorate([
|
|
191
|
+
observable
|
|
192
|
+
], DatasourceConfigItem.prototype, "groupingByFieldsNames", void 0);
|
|
103
193
|
__decorate([
|
|
104
194
|
attr({ mode: 'boolean', attribute: 'can-remove' })
|
|
105
195
|
], DatasourceConfigItem.prototype, "canRemove", void 0);
|
|
@@ -8,6 +8,12 @@ export const styles = css `
|
|
|
8
8
|
gap: calc(var(--design-unit) * 2px);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
div.split {
|
|
12
|
+
display: grid;
|
|
13
|
+
grid-template-columns: 1fr 1fr;
|
|
14
|
+
gap: calc(var(--design-unit) * 2px);
|
|
15
|
+
}
|
|
16
|
+
|
|
11
17
|
rapid-combobox.datasource {
|
|
12
18
|
margin-bottom: calc(var(--design-unit) * 2px);
|
|
13
19
|
}
|
|
@@ -1,15 +1,42 @@
|
|
|
1
1
|
import { classNames, html, repeat, when, whenElse } from '@genesislcap/web-core';
|
|
2
|
-
import { datasourceOutputs, selectors } from '../../../store';
|
|
2
|
+
import { datasourceGroupingStrategies, datasourceOutputs, selectors, } from '../../../store';
|
|
3
3
|
import { datasourceInputForDisplay, TOOLTIP, tooltip } from '../../../utils';
|
|
4
4
|
const datasourceAlias = html `
|
|
5
5
|
<div>
|
|
6
6
|
<p class="label">Name${tooltip(TOOLTIP.DATASOURCES_NAME)}</p>
|
|
7
7
|
<rapid-text-field
|
|
8
8
|
value=${(x) => selectors.datasourceConfig.getDatasource(x.datasourceName).KEY}
|
|
9
|
-
@change=${(x, ctx) => x.updateKeyHandler(ctx.event.target.value)}
|
|
9
|
+
@change=${(x, ctx) => x.updateKeyHandler(ctx.event.target.value, ctx.event)}
|
|
10
10
|
></rapid-text-field>
|
|
11
11
|
</div>
|
|
12
12
|
`;
|
|
13
|
+
const groupingType = html `
|
|
14
|
+
<div class="split">
|
|
15
|
+
<div>
|
|
16
|
+
<p class="label">Grouping Strategy${tooltip(TOOLTIP.DATASOURCES_GROUPING_STRATEGY)}</p>
|
|
17
|
+
<rapid-select
|
|
18
|
+
:value=${(x) => selectors.datasourceConfig.getDatasource(x.datasourceName).GROUPING_STRATEGY}
|
|
19
|
+
@change=${(x, ctx) => x.updateGroupingStrategyHandler(ctx.event.target.value)}
|
|
20
|
+
>
|
|
21
|
+
${repeat(() => datasourceGroupingStrategies, html `
|
|
22
|
+
<rapid-option>${(x) => x}</rapid-option>
|
|
23
|
+
`)}
|
|
24
|
+
</rapid-select>
|
|
25
|
+
</div>
|
|
26
|
+
<div>
|
|
27
|
+
<p class="label">Grouping Key${tooltip(TOOLTIP.DATASOURCES_GROUPING_KEY)}</p>
|
|
28
|
+
<rapid-select
|
|
29
|
+
:value=${(x) => selectors.datasourceConfig.getDatasource(x.datasourceName).GROUP_KEY}
|
|
30
|
+
@change=${(x, ctx) => x.updateGroupingByHandler(ctx.event.target.value)}
|
|
31
|
+
?disabled=${(x) => selectors.datasourceConfig.getDatasource(x.datasourceName).GROUPING_STRATEGY === 'NONE'}
|
|
32
|
+
>
|
|
33
|
+
${repeat((x) => { var _a; return (_a = x.groupingByFieldsNames) !== null && _a !== void 0 ? _a : []; }, html `
|
|
34
|
+
<rapid-option>${(x) => x}</rapid-option>
|
|
35
|
+
`)}
|
|
36
|
+
</rapid-select>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
`;
|
|
13
40
|
const processType = html `
|
|
14
41
|
<div>
|
|
15
42
|
<p class="label">Type${tooltip(TOOLTIP.DATASOURCES_TYPE)}</p>
|
|
@@ -33,6 +60,9 @@ const closeButton = html `
|
|
|
33
60
|
const component = html `
|
|
34
61
|
${when((x) => x.canRemove, closeButton)}
|
|
35
62
|
<div class="container">
|
|
63
|
+
<div class="${() => classNames(['split', Boolean(selectors.baseConfig.getConfig().DOCUMENT_TEMPLATE_ID)])}">
|
|
64
|
+
<div>
|
|
65
|
+
<p class="label">Datasource${tooltip(TOOLTIP.DATASOURCES_DATASOURCE)}</p>
|
|
36
66
|
<rapid-combobox
|
|
37
67
|
class="datasource ${(x) => classNames(['error', x.error !== 'none'])}"
|
|
38
68
|
autocomplete="both"
|
|
@@ -50,7 +80,12 @@ const component = html `
|
|
|
50
80
|
</rapid-option>
|
|
51
81
|
`)}
|
|
52
82
|
</rapid-combobox>
|
|
53
|
-
|
|
83
|
+
</div>
|
|
84
|
+
${when((_) => Boolean(selectors.baseConfig.getConfig().DOCUMENT_TEMPLATE_ID) ||
|
|
85
|
+
selectors.baseConfig.getConfig().OUTPUT_FORMAT !== 'CSV', datasourceAlias)}
|
|
86
|
+
</div>
|
|
87
|
+
</div>
|
|
88
|
+
${when((_) => Boolean(selectors.baseConfig.getConfig().DOCUMENT_TEMPLATE_ID), groupingType)}
|
|
54
89
|
<!-- ${when((_) => selectors.baseConfig.getConfig().OUTPUT_FORMAT === 'CSV', processType)} -->
|
|
55
90
|
</div>
|
|
56
91
|
`;
|
package/dist/esm/new/main/edit-config/datasource-config/datasources-config-container.helpers.js
CHANGED
|
@@ -1,28 +1,32 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
2
|
import { logger } from '@genesislcap/foundation-comms';
|
|
3
3
|
import { actions, selectors } from '../../../store';
|
|
4
|
-
import { buildDatasourceName } from '../../../utils';
|
|
4
|
+
import { buildDatasourceName, generateUniqueAlias } from '../../../utils';
|
|
5
5
|
import { setDefaultFormatsForDatasource } from '../data-transforms-derived-fields/data-transforms.helpers';
|
|
6
6
|
export const createNewDatasourceConfig = (getSchema) => (choices) => __awaiter(void 0, void 0, void 0, function* () {
|
|
7
7
|
var _a;
|
|
8
|
-
const
|
|
9
|
-
|
|
8
|
+
const allDatasources = selectors.datasourceConfig.getAllConfigSet();
|
|
9
|
+
const validDatasources = (_a = choices.filter((ds) => !(buildDatasourceName(ds.name, ds.name, ds.inputType) in allDatasources))) !== null && _a !== void 0 ? _a : [];
|
|
10
10
|
if ((validDatasources === null || validDatasources === void 0 ? void 0 : validDatasources.length) < 1) {
|
|
11
11
|
logger.error('No datasources available to create new config from');
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
14
|
const baseConfig = selectors.baseConfig.getConfig();
|
|
15
|
-
if (Object.keys(
|
|
15
|
+
if (Object.keys(allDatasources).length > 0 &&
|
|
16
16
|
baseConfig.OUTPUT_FORMAT === 'CSV' &&
|
|
17
17
|
!baseConfig.DOCUMENT_TEMPLATE_ID) {
|
|
18
18
|
logger.error('Cannot add multiple datasources when using csv file without a template');
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
|
-
const { KEY, INPUT_TYPE, schema } = yield findFirstValidDatasource(getSchema)(validDatasources);
|
|
22
|
-
|
|
21
|
+
const { KEY: RESOURCE_NAME, INPUT_TYPE, schema, } = yield findFirstValidDatasource(getSchema)(validDatasources);
|
|
22
|
+
// Check for duplicate aliases
|
|
23
|
+
const existingAliases = new Set(Object.values(allDatasources).map((ds) => ds.KEY));
|
|
24
|
+
const uniqueAlias = generateUniqueAlias(RESOURCE_NAME, existingAliases);
|
|
25
|
+
const datasourceName = buildDatasourceName(uniqueAlias, RESOURCE_NAME, INPUT_TYPE);
|
|
23
26
|
actions.datasourceConfig.initDatasourceConfiguration({
|
|
24
27
|
base: {
|
|
25
|
-
KEY,
|
|
28
|
+
KEY: uniqueAlias,
|
|
29
|
+
NAME: RESOURCE_NAME,
|
|
26
30
|
INPUT_TYPE,
|
|
27
31
|
},
|
|
28
32
|
fields: Object.keys(schema.properties), // Properties is valid as we check in findFirstValidDatasource
|