@finos/legend-query-builder 3.1.0 → 3.2.1
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/__lib__/QueryBuilderColorTheme.d.ts +23 -0
- package/lib/__lib__/QueryBuilderColorTheme.d.ts.map +1 -0
- package/lib/__lib__/QueryBuilderColorTheme.js +24 -0
- package/lib/__lib__/QueryBuilderColorTheme.js.map +1 -0
- package/lib/__lib__/QueryBuilderTelemetryHelper.d.ts +20 -20
- package/lib/__lib__/QueryBuilderTelemetryHelper.d.ts.map +1 -1
- package/lib/__lib__/QueryBuilderTelemetryHelper.js +40 -40
- package/lib/__lib__/QueryBuilderTelemetryHelper.js.map +1 -1
- package/lib/components/QueryBuilder.d.ts.map +1 -1
- package/lib/components/QueryBuilder.js +17 -15
- package/lib/components/QueryBuilder.js.map +1 -1
- package/lib/components/QueryBuilder_LegendApplicationPlugin.d.ts.map +1 -1
- package/lib/components/QueryBuilder_LegendApplicationPlugin.js +3 -0
- package/lib/components/QueryBuilder_LegendApplicationPlugin.js.map +1 -1
- package/lib/components/QueryLoader.d.ts +30 -0
- package/lib/components/QueryLoader.d.ts.map +1 -0
- package/lib/components/QueryLoader.js +164 -0
- package/lib/components/QueryLoader.js.map +1 -0
- package/lib/components/data-access/DataAccessOverview.d.ts +23 -0
- package/lib/components/data-access/DataAccessOverview.d.ts.map +1 -0
- package/lib/components/data-access/DataAccessOverview.js +146 -0
- package/lib/components/data-access/DataAccessOverview.js.map +1 -0
- package/lib/components/execution-plan/ExecutionPlanViewer.d.ts.map +1 -1
- package/lib/components/execution-plan/ExecutionPlanViewer.js +3 -3
- package/lib/components/execution-plan/ExecutionPlanViewer.js.map +1 -1
- package/lib/components/execution-plan/SQLExecutionNodeViewer.js +1 -1
- package/lib/components/execution-plan/SQLExecutionNodeViewer.js.map +1 -1
- package/lib/components/explorer/QueryBuilderPropertySearchPanel.js +1 -1
- package/lib/components/explorer/QueryBuilderPropertySearchPanel.js.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderTDSPanel.d.ts +0 -18
- package/lib/components/fetch-structure/QueryBuilderTDSPanel.d.ts.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderTDSPanel.js +34 -36
- package/lib/components/fetch-structure/QueryBuilderTDSPanel.js.map +1 -1
- package/lib/components/shared/LambdaEditor.d.ts.map +1 -1
- package/lib/components/shared/LambdaEditor.js +7 -19
- package/lib/components/shared/LambdaEditor.js.map +1 -1
- package/lib/components/shared/QueryBuilderPanelIssueCountBadge.d.ts.map +1 -1
- package/lib/components/shared/QueryBuilderPanelIssueCountBadge.js +2 -1
- package/lib/components/shared/QueryBuilderPanelIssueCountBadge.js.map +1 -1
- package/lib/index.css +1 -17
- package/lib/index.css.map +1 -1
- package/lib/index.d.ts +5 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +5 -0
- package/lib/index.js.map +1 -1
- package/lib/package.json +4 -2
- package/lib/stores/QueryBuilderState.d.ts +3 -3
- package/lib/stores/QueryBuilderState.d.ts.map +1 -1
- package/lib/stores/QueryBuilderState.js +34 -18
- package/lib/stores/QueryBuilderState.js.map +1 -1
- package/lib/stores/QueryBuilder_LegendApplicationPlugin_Extension.d.ts +39 -0
- package/lib/stores/QueryBuilder_LegendApplicationPlugin_Extension.d.ts.map +1 -0
- package/lib/stores/QueryBuilder_LegendApplicationPlugin_Extension.js +17 -0
- package/lib/stores/QueryBuilder_LegendApplicationPlugin_Extension.js.map +1 -0
- package/lib/stores/QueryLoaderState.d.ts +67 -0
- package/lib/stores/QueryLoaderState.d.ts.map +1 -0
- package/lib/stores/QueryLoaderState.js +205 -0
- package/lib/stores/QueryLoaderState.js.map +1 -0
- package/lib/stores/data-access/DataAccessState.d.ts +56 -0
- package/lib/stores/data-access/DataAccessState.d.ts.map +1 -0
- package/lib/stores/data-access/DataAccessState.js +212 -0
- package/lib/stores/data-access/DataAccessState.js.map +1 -0
- package/lib/stores/entitlements/QueryBuilderCheckEntitlementsState.d.ts +4 -2
- package/lib/stores/entitlements/QueryBuilderCheckEntitlementsState.d.ts.map +1 -1
- package/lib/stores/entitlements/QueryBuilderCheckEntitlementsState.js +20 -6
- package/lib/stores/entitlements/QueryBuilderCheckEntitlementsState.js.map +1 -1
- package/lib/stores/shared/ValueSpecificationEditorHelper.d.ts +3 -1
- package/lib/stores/shared/ValueSpecificationEditorHelper.d.ts.map +1 -1
- package/lib/stores/shared/ValueSpecificationEditorHelper.js +7 -1
- package/lib/stores/shared/ValueSpecificationEditorHelper.js.map +1 -1
- package/package.json +12 -10
- package/src/__lib__/QueryBuilderColorTheme.ts +23 -0
- package/src/__lib__/QueryBuilderTelemetryHelper.ts +40 -59
- package/src/components/QueryBuilder.tsx +63 -47
- package/src/components/QueryBuilder_LegendApplicationPlugin.ts +4 -0
- package/src/components/QueryLoader.tsx +504 -0
- package/src/components/data-access/DataAccessOverview.tsx +308 -0
- package/src/components/execution-plan/ExecutionPlanViewer.tsx +1 -3
- package/src/components/execution-plan/SQLExecutionNodeViewer.tsx +1 -1
- package/src/components/explorer/QueryBuilderPropertySearchPanel.tsx +1 -1
- package/src/components/fetch-structure/QueryBuilderTDSPanel.tsx +99 -102
- package/src/components/shared/LambdaEditor.tsx +4 -21
- package/src/components/shared/QueryBuilderPanelIssueCountBadge.tsx +2 -1
- package/src/index.ts +7 -0
- package/src/stores/QueryBuilderState.ts +65 -19
- package/src/stores/QueryBuilder_LegendApplicationPlugin_Extension.ts +46 -0
- package/src/stores/QueryLoaderState.ts +298 -0
- package/src/stores/data-access/DataAccessState.ts +322 -0
- package/src/stores/entitlements/QueryBuilderCheckEntitlementsState.ts +53 -6
- package/src/stores/shared/ValueSpecificationEditorHelper.ts +39 -2
- package/tsconfig.json +6 -0
@@ -0,0 +1,322 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2020-present, Goldman Sachs
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
16
|
+
|
17
|
+
import type { GenericLegendApplicationStore } from '@finos/legend-application';
|
18
|
+
import {
|
19
|
+
DatasetEntitlementAccessGrantedReport,
|
20
|
+
type BasicGraphManagerState,
|
21
|
+
type DatasetEntitlementReport,
|
22
|
+
type DatasetSpecification,
|
23
|
+
DatasetEntitlementAccessApprovedReport,
|
24
|
+
DatasetEntitlementAccessRequestedReport,
|
25
|
+
DatasetEntitlementAccessNotGrantedReport,
|
26
|
+
DatasetEntitlementUnsupportedReport,
|
27
|
+
} from '@finos/legend-graph';
|
28
|
+
import {
|
29
|
+
ActionState,
|
30
|
+
assertErrorThrown,
|
31
|
+
uuid,
|
32
|
+
type GeneratorFn,
|
33
|
+
getNonNullableEntry,
|
34
|
+
} from '@finos/legend-shared';
|
35
|
+
import {
|
36
|
+
action,
|
37
|
+
computed,
|
38
|
+
flow,
|
39
|
+
flowResult,
|
40
|
+
makeObservable,
|
41
|
+
observable,
|
42
|
+
} from 'mobx';
|
43
|
+
import { QUERY_BUILDER_COLOR_THEME_KEY } from '../../__lib__/QueryBuilderColorTheme.js';
|
44
|
+
|
45
|
+
export class DatasetAccessInfo {
|
46
|
+
readonly uuid = uuid();
|
47
|
+
readonly specification!: DatasetSpecification;
|
48
|
+
|
49
|
+
entitlementReport?: DatasetEntitlementReport | undefined;
|
50
|
+
|
51
|
+
constructor(specification: DatasetSpecification) {
|
52
|
+
makeObservable(this, {
|
53
|
+
entitlementReport: observable,
|
54
|
+
setEntitlementReport: action,
|
55
|
+
});
|
56
|
+
|
57
|
+
this.specification = specification;
|
58
|
+
}
|
59
|
+
|
60
|
+
setEntitlementReport(val: DatasetEntitlementReport | undefined): void {
|
61
|
+
this.entitlementReport = val;
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
type EntitlementCheckInfo = {
|
66
|
+
total: number;
|
67
|
+
data: { label: string; count: number; percentage: number; color: string }[];
|
68
|
+
};
|
69
|
+
|
70
|
+
export class DataAccessState {
|
71
|
+
readonly applicationStore: GenericLegendApplicationStore;
|
72
|
+
readonly graphManagerState: BasicGraphManagerState;
|
73
|
+
|
74
|
+
readonly surveyDatasets: () => Promise<DatasetSpecification[]>;
|
75
|
+
readonly checkDatasetEntitlements: (
|
76
|
+
datasets: DatasetSpecification[],
|
77
|
+
) => Promise<DatasetEntitlementReport[]>;
|
78
|
+
|
79
|
+
readonly initialDatasets?: DatasetSpecification[] | undefined;
|
80
|
+
readonly surveyDatasetsState = ActionState.create();
|
81
|
+
readonly checkEntitlementsState = ActionState.create();
|
82
|
+
|
83
|
+
datasets: DatasetAccessInfo[] = [];
|
84
|
+
|
85
|
+
constructor(
|
86
|
+
applicationStore: GenericLegendApplicationStore,
|
87
|
+
graphManagerState: BasicGraphManagerState,
|
88
|
+
options: {
|
89
|
+
initialDatasets?: DatasetSpecification[] | undefined;
|
90
|
+
surveyDatasets: () => Promise<DatasetSpecification[]>;
|
91
|
+
checkDatasetEntitlements: (
|
92
|
+
datasets: DatasetSpecification[],
|
93
|
+
) => Promise<DatasetEntitlementReport[]>;
|
94
|
+
},
|
95
|
+
) {
|
96
|
+
makeObservable(this, {
|
97
|
+
datasets: observable,
|
98
|
+
entitlementCheckInfo: computed,
|
99
|
+
fetchDatasetSpecifications: flow,
|
100
|
+
fetchDatasetEntitlementReports: flow,
|
101
|
+
});
|
102
|
+
|
103
|
+
this.applicationStore = applicationStore;
|
104
|
+
this.graphManagerState = graphManagerState;
|
105
|
+
this.initialDatasets = options.initialDatasets;
|
106
|
+
this.datasets = (options.initialDatasets ?? []).map(
|
107
|
+
(dataset) => new DatasetAccessInfo(dataset),
|
108
|
+
);
|
109
|
+
this.surveyDatasets = options.surveyDatasets;
|
110
|
+
this.checkDatasetEntitlements = options.checkDatasetEntitlements;
|
111
|
+
}
|
112
|
+
|
113
|
+
get entitlementCheckInfo(): EntitlementCheckInfo {
|
114
|
+
const total = this.datasets.length;
|
115
|
+
if (!total) {
|
116
|
+
return {
|
117
|
+
total,
|
118
|
+
data: [
|
119
|
+
{
|
120
|
+
label: 'Access Granted',
|
121
|
+
count: 1,
|
122
|
+
percentage: 100,
|
123
|
+
color: this.applicationStore.layoutService.getColor(
|
124
|
+
QUERY_BUILDER_COLOR_THEME_KEY.DATA_ACCESS_OVERVIEW__CHART__ACCESS_GRANTED,
|
125
|
+
),
|
126
|
+
},
|
127
|
+
],
|
128
|
+
};
|
129
|
+
}
|
130
|
+
|
131
|
+
const info: EntitlementCheckInfo = {
|
132
|
+
total,
|
133
|
+
data: [],
|
134
|
+
};
|
135
|
+
|
136
|
+
const accessGrantedCount = this.datasets.filter(
|
137
|
+
(dataset) =>
|
138
|
+
dataset.entitlementReport instanceof
|
139
|
+
DatasetEntitlementAccessGrantedReport,
|
140
|
+
).length;
|
141
|
+
const accessGrantedPercentage =
|
142
|
+
Math.round(accessGrantedCount / total) * 100;
|
143
|
+
info.data.push({
|
144
|
+
label: 'Access Granted',
|
145
|
+
count: accessGrantedCount,
|
146
|
+
percentage: accessGrantedPercentage,
|
147
|
+
color: this.applicationStore.layoutService.getColor(
|
148
|
+
QUERY_BUILDER_COLOR_THEME_KEY.DATA_ACCESS_OVERVIEW__CHART__ACCESS_GRANTED,
|
149
|
+
),
|
150
|
+
});
|
151
|
+
|
152
|
+
const accessApprovedCount = this.datasets.filter(
|
153
|
+
(dataset) =>
|
154
|
+
dataset.entitlementReport instanceof
|
155
|
+
DatasetEntitlementAccessApprovedReport,
|
156
|
+
).length;
|
157
|
+
const accessApprovedPercentage = Math.round(
|
158
|
+
(accessApprovedCount / total) * 100,
|
159
|
+
);
|
160
|
+
info.data.push({
|
161
|
+
label: 'Access Approved',
|
162
|
+
count: accessApprovedCount,
|
163
|
+
percentage: accessApprovedPercentage,
|
164
|
+
color: this.applicationStore.layoutService.getColor(
|
165
|
+
QUERY_BUILDER_COLOR_THEME_KEY.DATA_ACCESS_OVERVIEW__CHART__ACCESS_APPROVED,
|
166
|
+
),
|
167
|
+
});
|
168
|
+
|
169
|
+
const accessRequestedCount = this.datasets.filter(
|
170
|
+
(dataset) =>
|
171
|
+
dataset.entitlementReport instanceof
|
172
|
+
DatasetEntitlementAccessRequestedReport,
|
173
|
+
).length;
|
174
|
+
const accessRequestedPercentage = Math.round(
|
175
|
+
(accessRequestedCount / total) * 100,
|
176
|
+
);
|
177
|
+
info.data.push({
|
178
|
+
label: 'Access Requested',
|
179
|
+
count: accessRequestedCount,
|
180
|
+
percentage: accessRequestedPercentage,
|
181
|
+
color: this.applicationStore.layoutService.getColor(
|
182
|
+
QUERY_BUILDER_COLOR_THEME_KEY.DATA_ACCESS_OVERVIEW__CHART__ACCESS_REQUESTED,
|
183
|
+
),
|
184
|
+
});
|
185
|
+
|
186
|
+
const accessNotGrantedCount = this.datasets.filter(
|
187
|
+
(dataset) =>
|
188
|
+
dataset.entitlementReport instanceof
|
189
|
+
DatasetEntitlementAccessNotGrantedReport,
|
190
|
+
).length;
|
191
|
+
const accessNotGrantedPercentage =
|
192
|
+
Math.round(accessNotGrantedCount / total) * 100;
|
193
|
+
info.data.push({
|
194
|
+
label: 'Access Not Granted',
|
195
|
+
count: accessNotGrantedCount,
|
196
|
+
percentage: accessNotGrantedPercentage,
|
197
|
+
color: this.applicationStore.layoutService.getColor(
|
198
|
+
QUERY_BUILDER_COLOR_THEME_KEY.DATA_ACCESS_OVERVIEW__CHART__ACCESS_NOT_GRANTED,
|
199
|
+
),
|
200
|
+
});
|
201
|
+
|
202
|
+
const unsupportedCount = this.datasets.filter(
|
203
|
+
(dataset) =>
|
204
|
+
dataset.entitlementReport instanceof
|
205
|
+
DatasetEntitlementUnsupportedReport,
|
206
|
+
).length;
|
207
|
+
const unsupportedPercentage = Math.round((unsupportedCount / total) * 100);
|
208
|
+
info.data.push({
|
209
|
+
label: 'Unsupported',
|
210
|
+
count: unsupportedCount,
|
211
|
+
percentage: unsupportedPercentage,
|
212
|
+
color: this.applicationStore.layoutService.getColor(
|
213
|
+
QUERY_BUILDER_COLOR_THEME_KEY.DATA_ACCESS_OVERVIEW__CHART__UNSUPPORTED_ACCESS,
|
214
|
+
),
|
215
|
+
});
|
216
|
+
|
217
|
+
const unknownCount =
|
218
|
+
total -
|
219
|
+
accessGrantedCount -
|
220
|
+
accessApprovedCount -
|
221
|
+
accessRequestedCount -
|
222
|
+
accessNotGrantedCount -
|
223
|
+
unsupportedCount;
|
224
|
+
const unknownPercentage = Math.round(unknownCount / total) * 100;
|
225
|
+
info.data.push({
|
226
|
+
label: 'Unknown',
|
227
|
+
count: unknownCount,
|
228
|
+
percentage: unknownPercentage,
|
229
|
+
color: this.applicationStore.layoutService.getColor(
|
230
|
+
QUERY_BUILDER_COLOR_THEME_KEY.DATA_ACCESS_OVERVIEW__CHART__UNSUPPORTED_ACCESS,
|
231
|
+
),
|
232
|
+
});
|
233
|
+
|
234
|
+
let currentPercentageSum = 0;
|
235
|
+
for (let i = 0; i < info.data.length; ++i) {
|
236
|
+
const data = getNonNullableEntry(info.data, i);
|
237
|
+
if (currentPercentageSum + data.percentage >= 100) {
|
238
|
+
data.percentage = 100 - currentPercentageSum;
|
239
|
+
info.data = info.data.slice(0, i + 1);
|
240
|
+
break;
|
241
|
+
}
|
242
|
+
currentPercentageSum += data.percentage;
|
243
|
+
}
|
244
|
+
|
245
|
+
return info;
|
246
|
+
}
|
247
|
+
|
248
|
+
*fetchDatasetSpecifications(): GeneratorFn<void> {
|
249
|
+
this.surveyDatasetsState.inProgress();
|
250
|
+
|
251
|
+
try {
|
252
|
+
const datasets = (yield this.surveyDatasets()) as DatasetSpecification[];
|
253
|
+
this.datasets = datasets.map((dataset) => {
|
254
|
+
const existingDataset = this.datasets.find(
|
255
|
+
(ds) => ds.specification.hashCode === dataset.hashCode,
|
256
|
+
);
|
257
|
+
if (existingDataset) {
|
258
|
+
return existingDataset;
|
259
|
+
}
|
260
|
+
return new DatasetAccessInfo(dataset);
|
261
|
+
});
|
262
|
+
} catch (error) {
|
263
|
+
assertErrorThrown(error);
|
264
|
+
this.applicationStore.notificationService.notifyError(error);
|
265
|
+
} finally {
|
266
|
+
this.surveyDatasetsState.complete();
|
267
|
+
}
|
268
|
+
}
|
269
|
+
|
270
|
+
*fetchDatasetEntitlementReports(): GeneratorFn<void> {
|
271
|
+
this.checkEntitlementsState.inProgress();
|
272
|
+
|
273
|
+
try {
|
274
|
+
const reports = (yield this.checkDatasetEntitlements(
|
275
|
+
this.datasets.map((dataset) => dataset.specification),
|
276
|
+
)) as DatasetEntitlementReport[];
|
277
|
+
this.datasets.forEach((dataset) => {
|
278
|
+
const matchingReport = reports.find(
|
279
|
+
(report) =>
|
280
|
+
report.dataset.hashCode === dataset.specification.hashCode,
|
281
|
+
);
|
282
|
+
if (matchingReport) {
|
283
|
+
dataset.setEntitlementReport(matchingReport);
|
284
|
+
return;
|
285
|
+
}
|
286
|
+
dataset.setEntitlementReport(undefined);
|
287
|
+
});
|
288
|
+
const newDatasets: DatasetAccessInfo[] = [];
|
289
|
+
reports.forEach((report) => {
|
290
|
+
const matchingDataset = this.datasets.find(
|
291
|
+
(dataset) =>
|
292
|
+
dataset.specification.hashCode === report.dataset.hashCode,
|
293
|
+
);
|
294
|
+
if (!matchingDataset) {
|
295
|
+
const newDataset = new DatasetAccessInfo(report.dataset);
|
296
|
+
newDataset.setEntitlementReport(report);
|
297
|
+
newDatasets.push(newDataset);
|
298
|
+
}
|
299
|
+
});
|
300
|
+
this.datasets = this.datasets.concat(newDatasets);
|
301
|
+
} catch (error) {
|
302
|
+
assertErrorThrown(error);
|
303
|
+
this.applicationStore.notificationService.notifyError(error);
|
304
|
+
} finally {
|
305
|
+
this.checkEntitlementsState.complete();
|
306
|
+
}
|
307
|
+
}
|
308
|
+
|
309
|
+
async intialize(): Promise<void> {
|
310
|
+
if (!this.initialDatasets) {
|
311
|
+
await flowResult(this.fetchDatasetSpecifications());
|
312
|
+
await flowResult(this.fetchDatasetEntitlementReports());
|
313
|
+
} else {
|
314
|
+
await flowResult(this.fetchDatasetEntitlementReports());
|
315
|
+
}
|
316
|
+
}
|
317
|
+
|
318
|
+
async refresh(): Promise<void> {
|
319
|
+
await flowResult(this.fetchDatasetSpecifications());
|
320
|
+
await flowResult(this.fetchDatasetEntitlementReports());
|
321
|
+
}
|
322
|
+
}
|
@@ -18,29 +18,76 @@ import { type Hashable, hashArray } from '@finos/legend-shared';
|
|
18
18
|
import { makeObservable, observable, action, computed } from 'mobx';
|
19
19
|
import { QUERY_BUILDER_STATE_HASH_STRUCTURE } from '../QueryBuilderStateHashUtils.js';
|
20
20
|
import type { QueryBuilderState } from '../QueryBuilderState.js';
|
21
|
+
import { DataAccessState } from '../data-access/DataAccessState.js';
|
22
|
+
import {
|
23
|
+
RuntimePointer,
|
24
|
+
type DatasetEntitlementReport,
|
25
|
+
type DatasetSpecification,
|
26
|
+
InMemoryGraphData,
|
27
|
+
} from '@finos/legend-graph';
|
21
28
|
|
22
29
|
export class QueryBuilderCheckEntitlementsState implements Hashable {
|
23
30
|
readonly queryBuilderState: QueryBuilderState;
|
24
|
-
|
31
|
+
|
32
|
+
dataAccessState?: DataAccessState | undefined;
|
33
|
+
showCheckEntitlementsViewer = false;
|
25
34
|
|
26
35
|
constructor(queryBuilderState: QueryBuilderState) {
|
27
36
|
makeObservable(this, {
|
28
|
-
|
29
|
-
|
37
|
+
showCheckEntitlementsViewer: observable,
|
38
|
+
dataAccessState: observable,
|
39
|
+
setShowCheckEntitlementsViewer: action,
|
30
40
|
hashCode: computed,
|
31
41
|
});
|
32
42
|
|
33
43
|
this.queryBuilderState = queryBuilderState;
|
34
44
|
}
|
35
45
|
|
36
|
-
|
37
|
-
this.
|
46
|
+
setShowCheckEntitlementsViewer(val: boolean): void {
|
47
|
+
this.showCheckEntitlementsViewer = val;
|
48
|
+
|
49
|
+
this.dataAccessState = undefined;
|
50
|
+
if (
|
51
|
+
this.queryBuilderState.mapping &&
|
52
|
+
this.queryBuilderState.runtimeValue instanceof RuntimePointer
|
53
|
+
) {
|
54
|
+
const mappingPath = this.queryBuilderState.mapping.path;
|
55
|
+
const runtimePath =
|
56
|
+
this.queryBuilderState.runtimeValue.packageableRuntime.value.path;
|
57
|
+
this.dataAccessState = new DataAccessState(
|
58
|
+
this.queryBuilderState.applicationStore,
|
59
|
+
this.queryBuilderState.graphManagerState,
|
60
|
+
{
|
61
|
+
surveyDatasets: async (): Promise<DatasetSpecification[]> =>
|
62
|
+
this.queryBuilderState.graphManagerState.graphManager.surveyDatasets(
|
63
|
+
mappingPath,
|
64
|
+
runtimePath,
|
65
|
+
this.queryBuilderState.buildQuery(),
|
66
|
+
new InMemoryGraphData(
|
67
|
+
this.queryBuilderState.graphManagerState.graph,
|
68
|
+
),
|
69
|
+
),
|
70
|
+
checkDatasetEntitlements: async (
|
71
|
+
datasets: DatasetSpecification[],
|
72
|
+
): Promise<DatasetEntitlementReport[]> =>
|
73
|
+
this.queryBuilderState.graphManagerState.graphManager.checkDatasetEntitlements(
|
74
|
+
datasets,
|
75
|
+
mappingPath,
|
76
|
+
runtimePath,
|
77
|
+
this.queryBuilderState.buildQuery(),
|
78
|
+
new InMemoryGraphData(
|
79
|
+
this.queryBuilderState.graphManagerState.graph,
|
80
|
+
),
|
81
|
+
),
|
82
|
+
},
|
83
|
+
);
|
84
|
+
}
|
38
85
|
}
|
39
86
|
|
40
87
|
get hashCode(): string {
|
41
88
|
return hashArray([
|
42
89
|
QUERY_BUILDER_STATE_HASH_STRUCTURE.CHECK_ENTITLEMENTS_STATE,
|
43
|
-
this.
|
90
|
+
this.showCheckEntitlementsViewer,
|
44
91
|
]);
|
45
92
|
}
|
46
93
|
}
|
@@ -16,10 +16,13 @@
|
|
16
16
|
|
17
17
|
import {
|
18
18
|
type PureModel,
|
19
|
-
|
19
|
+
type GraphManagerState,
|
20
20
|
type ValueSpecification,
|
21
21
|
type Type,
|
22
22
|
type Enum,
|
23
|
+
type ObserverContext,
|
24
|
+
type RawLambda,
|
25
|
+
VariableExpression,
|
23
26
|
CollectionInstanceValue,
|
24
27
|
Enumeration,
|
25
28
|
EnumValueExplicitReference,
|
@@ -32,7 +35,12 @@ import {
|
|
32
35
|
PRIMITIVE_TYPE,
|
33
36
|
INTERNAL__PropagatedValue,
|
34
37
|
SimpleFunctionExpression,
|
35
|
-
|
38
|
+
LambdaFunction,
|
39
|
+
FunctionType,
|
40
|
+
PackageableElementExplicitReference,
|
41
|
+
Multiplicity,
|
42
|
+
CORE_PURE_PATH,
|
43
|
+
buildRawLambdaFromLambdaFunction,
|
36
44
|
} from '@finos/legend-graph';
|
37
45
|
import { Randomizer, UnsupportedOperationError } from '@finos/legend-shared';
|
38
46
|
import { generateDefaultValueForPrimitiveType } from '../QueryBuilderValueSpecificationHelper.js';
|
@@ -177,6 +185,35 @@ export const buildDefaultInstanceValue = (
|
|
177
185
|
}
|
178
186
|
};
|
179
187
|
|
188
|
+
export const buildDefaultEmptyStringLambda = (
|
189
|
+
graph: PureModel,
|
190
|
+
observerContext: ObserverContext,
|
191
|
+
): LambdaFunction => {
|
192
|
+
const lambdaFunction = new LambdaFunction(
|
193
|
+
new FunctionType(
|
194
|
+
PackageableElementExplicitReference.create(
|
195
|
+
graph.getType(CORE_PURE_PATH.ANY),
|
196
|
+
),
|
197
|
+
Multiplicity.ONE,
|
198
|
+
),
|
199
|
+
);
|
200
|
+
lambdaFunction.expressionSequence[0] = buildDefaultInstanceValue(
|
201
|
+
graph,
|
202
|
+
PrimitiveType.STRING,
|
203
|
+
observerContext,
|
204
|
+
);
|
205
|
+
return lambdaFunction;
|
206
|
+
};
|
207
|
+
|
208
|
+
export const buildDefaultEmptyStringRawLambda = (
|
209
|
+
graphState: GraphManagerState,
|
210
|
+
observerContext: ObserverContext,
|
211
|
+
): RawLambda =>
|
212
|
+
buildRawLambdaFromLambdaFunction(
|
213
|
+
buildDefaultEmptyStringLambda(graphState.graph, observerContext),
|
214
|
+
graphState,
|
215
|
+
);
|
216
|
+
|
180
217
|
export const generateVariableExpressionMockValue = (
|
181
218
|
parameter: VariableExpression,
|
182
219
|
graph: PureModel,
|
package/tsconfig.json
CHANGED
@@ -34,6 +34,7 @@
|
|
34
34
|
"files": [
|
35
35
|
"./src/__test__.ts",
|
36
36
|
"./src/index.ts",
|
37
|
+
"./src/__lib__/QueryBuilderColorTheme.ts",
|
37
38
|
"./src/__lib__/QueryBuilderDocumentation.ts",
|
38
39
|
"./src/__lib__/QueryBuilderEvent.ts",
|
39
40
|
"./src/__lib__/QueryBuilderSetting.ts",
|
@@ -71,8 +72,11 @@
|
|
71
72
|
"./src/stores/QueryBuilderValueSpecificationBuilder.ts",
|
72
73
|
"./src/stores/QueryBuilderValueSpecificationBuilderHelper.ts",
|
73
74
|
"./src/stores/QueryBuilderValueSpecificationHelper.ts",
|
75
|
+
"./src/stores/QueryBuilder_LegendApplicationPlugin_Extension.ts",
|
76
|
+
"./src/stores/QueryLoaderState.ts",
|
74
77
|
"./src/stores/ServiceInfo.ts",
|
75
78
|
"./src/stores/__test-utils__/QueryBuilderStateTestUtils.ts",
|
79
|
+
"./src/stores/data-access/DataAccessState.ts",
|
76
80
|
"./src/stores/entitlements/QueryBuilderCheckEntitlementsState.ts",
|
77
81
|
"./src/stores/execution-plan/ExecutionPlanState.ts",
|
78
82
|
"./src/stores/explorer/QueryBuilderExplorerState.ts",
|
@@ -213,8 +217,10 @@
|
|
213
217
|
"./src/components/QueryBuilderSideBar.tsx",
|
214
218
|
"./src/components/QueryBuilderTextEditor.tsx",
|
215
219
|
"./src/components/QueryBuilderUnsupportedQueryEditor.tsx",
|
220
|
+
"./src/components/QueryLoader.tsx",
|
216
221
|
"./src/components/ServiceQuerySetupUtils.tsx",
|
217
222
|
"./src/components/__test-utils__/QueryBuilderComponentTestUtils.tsx",
|
223
|
+
"./src/components/data-access/DataAccessOverview.tsx",
|
218
224
|
"./src/components/execution-plan/ExecutionPlanViewer.tsx",
|
219
225
|
"./src/components/execution-plan/SQLExecutionNodeViewer.tsx",
|
220
226
|
"./src/components/explorer/QueryBuilderExplorerPanel.tsx",
|