@finos/legend-application-data-cube 0.7.33 → 0.7.35
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/lib/components/__test-utils__/LegendDataCubeStoreTestUtils.d.ts.map +1 -1
- package/lib/components/__test-utils__/LegendDataCubeStoreTestUtils.js +12 -0
- package/lib/components/__test-utils__/LegendDataCubeStoreTestUtils.js.map +1 -1
- package/lib/components/builder/LegendDataCubeSourceViewer.js +2 -2
- package/lib/components/builder/LegendDataCubeSourceViewer.js.map +1 -1
- package/lib/components/builder/source/LakehouseConsumerDataCubeSourceBuilder.d.ts.map +1 -1
- package/lib/components/builder/source/LakehouseConsumerDataCubeSourceBuilder.js +64 -31
- package/lib/components/builder/source/LakehouseConsumerDataCubeSourceBuilder.js.map +1 -1
- package/lib/index.css +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/LegendDataCubeDataCubeEngine.d.ts.map +1 -1
- package/lib/stores/LegendDataCubeDataCubeEngine.js +30 -6
- package/lib/stores/LegendDataCubeDataCubeEngine.js.map +1 -1
- package/lib/stores/builder/LegendDataCubeCreatorState.d.ts.map +1 -1
- package/lib/stores/builder/LegendDataCubeCreatorState.js +1 -1
- package/lib/stores/builder/LegendDataCubeCreatorState.js.map +1 -1
- package/lib/stores/builder/source/LakehouseConsumerDataCubeSourceBuilderState.d.ts +8 -15
- package/lib/stores/builder/source/LakehouseConsumerDataCubeSourceBuilderState.d.ts.map +1 -1
- package/lib/stores/builder/source/LakehouseConsumerDataCubeSourceBuilderState.js +24 -60
- package/lib/stores/builder/source/LakehouseConsumerDataCubeSourceBuilderState.js.map +1 -1
- package/lib/stores/model/LakehouseConsumerDataCubeSource.d.ts +1 -1
- package/lib/stores/model/LakehouseConsumerDataCubeSource.d.ts.map +1 -1
- package/lib/stores/model/LakehouseConsumerDataCubeSource.js +1 -1
- package/lib/stores/model/LakehouseConsumerDataCubeSource.js.map +1 -1
- package/package.json +8 -8
- package/src/components/__test-utils__/LegendDataCubeStoreTestUtils.tsx +15 -0
- package/src/components/builder/LegendDataCubeSourceViewer.tsx +3 -3
- package/src/components/builder/source/LakehouseConsumerDataCubeSourceBuilder.tsx +148 -95
- package/src/stores/LegendDataCubeDataCubeEngine.ts +51 -8
- package/src/stores/builder/LegendDataCubeCreatorState.tsx +0 -1
- package/src/stores/builder/source/LakehouseConsumerDataCubeSourceBuilderState.ts +29 -104
- package/src/stores/model/LakehouseConsumerDataCubeSource.ts +1 -1
|
@@ -23,7 +23,7 @@ export declare class LakehouseConsumerDataCubeSource extends DataCubeSource {
|
|
|
23
23
|
dpCoordinates?: VersionedProjectData;
|
|
24
24
|
runtime: string;
|
|
25
25
|
warehouse: string;
|
|
26
|
-
|
|
26
|
+
userEnvironment: string;
|
|
27
27
|
paths: string[];
|
|
28
28
|
deploymentId?: number | undefined;
|
|
29
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LakehouseConsumerDataCubeSource.d.ts","sourceRoot":"","sources":["../../../src/stores/model/LakehouseConsumerDataCubeSource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAEL,oBAAoB,EAIpB,KAAK,WAAW,EACjB,MAAM,sBAAsB,CAAC;AAU9B,eAAO,MAAM,wCAAwC,sBAAsB,CAAC;AAE5E,qBAAa,+BAAgC,SAAQ,cAAc;IACjE,KAAK,EAAG,WAAW,CAAC,uBAAuB,CAAC,CAAC;IAC7C,aAAa,CAAC,EAAE,oBAAoB,CAAC;IACrC,OAAO,EAAG,MAAM,CAAC;IACjB,SAAS,EAAG,MAAM,CAAC;IACnB,
|
|
1
|
+
{"version":3,"file":"LakehouseConsumerDataCubeSource.d.ts","sour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
|
|
1
|
-
{"version":3,"file":"LakehouseConsumerDataCubeSource.js","sourceRoot":"","sources":["../../../src/stores/model/LakehouseConsumerDataCubeSource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EACL,wBAAwB,GAEzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,yBAAyB,EACzB,wBAAwB,EACxB,gBAAgB,GAEjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,iBAAiB,EACjB,WAAW,EACX,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,SAAS,GACV,MAAM,WAAW,CAAC;AAEnB,MAAM,CAAC,MAAM,wCAAwC,GAAG,mBAAmB,CAAC;AAE5E,MAAM,OAAO,+BAAgC,SAAQ,cAAc;IACjE,KAAK,CAAwC;IAC7C,aAAa,CAAwB;IACrC,OAAO,CAAU;IACjB,SAAS,CAAU;IACnB,
|
|
1
|
+
{"version":3,"file":"LakehouseConsumerDataCubeSource.js","sourceRoot":"","sources":["../../../src/stores/model/LakehouseConsumerDataCubeSource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EACL,wBAAwB,GAEzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,yBAAyB,EACzB,wBAAwB,EACxB,gBAAgB,GAEjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,iBAAiB,EACjB,WAAW,EACX,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,SAAS,GACV,MAAM,WAAW,CAAC;AAEnB,MAAM,CAAC,MAAM,wC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ACH,CAAC;SACF,CACF;KACF,CAAC,CACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@finos/legend-application-data-cube",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.35",
|
|
4
4
|
"description": "Legend DataCube application core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"legend",
|
|
@@ -43,14 +43,14 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@duckdb/duckdb-wasm": "1.31.0",
|
|
46
|
-
"@finos/legend-application": "16.0.
|
|
47
|
-
"@finos/legend-art": "7.1.
|
|
48
|
-
"@finos/legend-code-editor": "2.0.
|
|
49
|
-
"@finos/legend-data-cube": "0.3.
|
|
50
|
-
"@finos/legend-graph": "32.3.
|
|
51
|
-
"@finos/legend-query-builder": "4.17.
|
|
46
|
+
"@finos/legend-application": "16.0.89",
|
|
47
|
+
"@finos/legend-art": "7.1.139",
|
|
48
|
+
"@finos/legend-code-editor": "2.0.144",
|
|
49
|
+
"@finos/legend-data-cube": "0.3.58",
|
|
50
|
+
"@finos/legend-graph": "32.3.24",
|
|
51
|
+
"@finos/legend-query-builder": "4.17.75",
|
|
52
52
|
"@finos/legend-server-depot": "6.1.6",
|
|
53
|
-
"@finos/legend-server-lakehouse": "0.3.
|
|
53
|
+
"@finos/legend-server-lakehouse": "0.3.25",
|
|
54
54
|
"@finos/legend-shared": "11.0.22",
|
|
55
55
|
"@finos/legend-storage": "3.0.141",
|
|
56
56
|
"@types/react": "19.0.10",
|
|
@@ -191,6 +191,19 @@ export const TEST__provideMockedLegendDataCubeEngine = async (customization?: {
|
|
|
191
191
|
lakehouseIngestServerClient,
|
|
192
192
|
'getIngestDefinitionGrammar',
|
|
193
193
|
).mockResolvedValue('test-ingest-definition-grammar');
|
|
194
|
+
createSpy(
|
|
195
|
+
lakehouseContractServerClient,
|
|
196
|
+
'getUserEntitlementEnvs',
|
|
197
|
+
).mockResolvedValue({
|
|
198
|
+
total: 1,
|
|
199
|
+
users: [
|
|
200
|
+
{
|
|
201
|
+
name: 'TESTER',
|
|
202
|
+
userType: 'TEST_USER',
|
|
203
|
+
lakehouseEnvironment: 'testEnv1',
|
|
204
|
+
},
|
|
205
|
+
],
|
|
206
|
+
});
|
|
194
207
|
|
|
195
208
|
const graphManager =
|
|
196
209
|
customization?.graphManager ??
|
|
@@ -217,6 +230,8 @@ export const TEST__provideMockedLegendDataCubeEngine = async (customization?: {
|
|
|
217
230
|
export const mockLakehouseConsumerAdHocDataProduct = {
|
|
218
231
|
_type: 'lakehouseConsumer',
|
|
219
232
|
warehouse: 'TEST_WAREHOUSE',
|
|
233
|
+
// this environment gets overridden as we have runtime calls for fetching user entitlement envs
|
|
234
|
+
// this makes saving view user agnostic
|
|
220
235
|
environment: 'dev-testEnv',
|
|
221
236
|
paths: ['dataProduct::test_DataProduct', 'test_dataset'],
|
|
222
237
|
origin: {
|
|
@@ -529,16 +529,16 @@ const LakehouseConsumerSourceViewer = observer(
|
|
|
529
529
|
</button>
|
|
530
530
|
</div>
|
|
531
531
|
)}
|
|
532
|
-
{source.
|
|
532
|
+
{source.userEnvironment && (
|
|
533
533
|
<div className="mt-2 flex h-6 w-full">
|
|
534
534
|
<div className="flex h-full w-[calc(100%_-_20px)] items-center border border-r-0 border-neutral-400 px-1.5">
|
|
535
|
-
{source.
|
|
535
|
+
{source.userEnvironment}
|
|
536
536
|
</div>
|
|
537
537
|
<button
|
|
538
538
|
className="flex aspect-square h-full w-6 items-center justify-center border border-neutral-400 bg-neutral-300 hover:brightness-95"
|
|
539
539
|
onClick={() => {
|
|
540
540
|
store.application.clipboardService
|
|
541
|
-
.copyTextToClipboard(source.
|
|
541
|
+
.copyTextToClipboard(source.userEnvironment)
|
|
542
542
|
.catch((error) =>
|
|
543
543
|
store.alertService.alertUnhandledError(error),
|
|
544
544
|
);
|
|
@@ -18,52 +18,58 @@ import { DataCubeCodeEditor, FormTextInput } from '@finos/legend-data-cube';
|
|
|
18
18
|
import { CustomSelectorInput } from '@finos/legend-art';
|
|
19
19
|
import { useAuth } from 'react-oidc-context';
|
|
20
20
|
import { assertErrorThrown, guaranteeNonNullable } from '@finos/legend-shared';
|
|
21
|
-
import { useEffect } from 'react';
|
|
21
|
+
import { useEffect, type ReactNode } from 'react';
|
|
22
22
|
import type { LakehouseConsumerDataCubeSourceBuilderState } from '../../../stores/builder/source/LakehouseConsumerDataCubeSourceBuilderState.js';
|
|
23
23
|
import { useLegendDataCubeBuilderStore } from '../LegendDataCubeBuilderStoreProvider.js';
|
|
24
24
|
import {
|
|
25
|
-
|
|
26
|
-
type
|
|
27
|
-
} from '@finos/legend-
|
|
28
|
-
import { V1_IngestEnvironmentClassification } from '@finos/legend-graph';
|
|
25
|
+
V1_EntitlementsLakehouseEnvironmentType,
|
|
26
|
+
type V1_EntitlementsDataProductLite,
|
|
27
|
+
} from '@finos/legend-graph';
|
|
29
28
|
|
|
30
29
|
export const LakehouseConsumerDataCubeSourceBuilder: React.FC<{
|
|
31
30
|
sourceBuilder: LakehouseConsumerDataCubeSourceBuilderState;
|
|
32
31
|
}> = observer(({ sourceBuilder }) => {
|
|
33
32
|
const auth = useAuth();
|
|
34
33
|
const store = useLegendDataCubeBuilderStore();
|
|
35
|
-
const envOptions = sourceBuilder.environments
|
|
36
|
-
.map(buildIngestDeploymentServerConfigOption)
|
|
37
|
-
// not include dev
|
|
38
|
-
.filter(
|
|
39
|
-
(config) =>
|
|
40
|
-
config.value.environmentClassification !==
|
|
41
|
-
V1_IngestEnvironmentClassification.DEV,
|
|
42
|
-
)
|
|
43
|
-
.sort(
|
|
44
|
-
(a, b) =>
|
|
45
|
-
a.value.environmentName.localeCompare(b.value.environmentName) ||
|
|
46
|
-
a.value.environmentClassification.localeCompare(
|
|
47
|
-
b.value.environmentClassification,
|
|
48
|
-
),
|
|
49
|
-
);
|
|
50
34
|
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
35
|
+
const renderDataProductLabel = (
|
|
36
|
+
dataProduct: V1_EntitlementsDataProductLite,
|
|
37
|
+
): ReactNode => {
|
|
38
|
+
const title = dataProduct.title;
|
|
39
|
+
const id = guaranteeNonNullable(dataProduct.id);
|
|
40
|
+
// If title is empty, show id only. Otherwise show title (prominent) and id (muted)
|
|
41
|
+
// Main text: slightly larger and normal weight. Subtext: grey and slightly smaller.
|
|
42
|
+
return (
|
|
43
|
+
<div className="flex w-full flex-col items-start">
|
|
44
|
+
<div className="w-full whitespace-normal break-words text-base font-normal text-black">
|
|
45
|
+
{title ?? id}
|
|
46
|
+
</div>
|
|
47
|
+
{title ? (
|
|
48
|
+
<div className="mt-1 w-full truncate text-sm text-neutral-500">
|
|
49
|
+
{id}
|
|
50
|
+
</div>
|
|
51
|
+
) : null}
|
|
52
|
+
</div>
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
const renderDataProductMainText = (
|
|
56
|
+
dataProduct: V1_EntitlementsDataProductLite,
|
|
57
|
+
): ReactNode => {
|
|
58
|
+
const title = dataProduct.title;
|
|
59
|
+
const id = guaranteeNonNullable(dataProduct.id);
|
|
60
|
+
// Ensure selected value is vertically centered inside the control by
|
|
61
|
+
// making the label container full-height and centering its content.
|
|
62
|
+
return (
|
|
63
|
+
<div className="flex h-full w-full items-center whitespace-normal break-words text-base font-normal text-black">
|
|
64
|
+
{title ?? id}
|
|
65
|
+
</div>
|
|
66
|
+
);
|
|
59
67
|
};
|
|
60
68
|
|
|
61
69
|
useEffect(() => {
|
|
62
70
|
sourceBuilder.reset();
|
|
63
71
|
try {
|
|
64
72
|
sourceBuilder.loadDataProducts(auth.user?.access_token);
|
|
65
|
-
sourceBuilder.fetchEnvironment(auth.user?.access_token);
|
|
66
|
-
sourceBuilder.fetchUserEntitlementEnvs(auth.user?.access_token);
|
|
67
73
|
} catch (error) {
|
|
68
74
|
assertErrorThrown(error);
|
|
69
75
|
store.alertService.alertUnhandledError(error);
|
|
@@ -73,21 +79,91 @@ export const LakehouseConsumerDataCubeSourceBuilder: React.FC<{
|
|
|
73
79
|
return (
|
|
74
80
|
<div className="flex h-full w-full">
|
|
75
81
|
<div className="m-3 flex w-full flex-col items-stretch gap-2 text-neutral-500">
|
|
82
|
+
<div className="query-setup__wizard__group mt-3">
|
|
83
|
+
<div className="query-setup__wizard__group__title">Mode</div>
|
|
84
|
+
<CustomSelectorInput
|
|
85
|
+
className="query-setup__wizard__selector"
|
|
86
|
+
options={[
|
|
87
|
+
{
|
|
88
|
+
label: 'Production',
|
|
89
|
+
value: V1_EntitlementsLakehouseEnvironmentType.PRODUCTION,
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
label: 'Production (parallel)',
|
|
93
|
+
value:
|
|
94
|
+
V1_EntitlementsLakehouseEnvironmentType.PRODUCTION_PARALLEL,
|
|
95
|
+
},
|
|
96
|
+
]}
|
|
97
|
+
onChange={(newVal: {
|
|
98
|
+
label: string;
|
|
99
|
+
value: V1_EntitlementsLakehouseEnvironmentType;
|
|
100
|
+
}) => {
|
|
101
|
+
sourceBuilder.setEnvMode(newVal.value);
|
|
102
|
+
sourceBuilder.setSelectedDataProduct(undefined);
|
|
103
|
+
}}
|
|
104
|
+
value={{
|
|
105
|
+
label:
|
|
106
|
+
sourceBuilder.envMode ===
|
|
107
|
+
V1_EntitlementsLakehouseEnvironmentType.PRODUCTION
|
|
108
|
+
? 'Production'
|
|
109
|
+
: sourceBuilder.envMode ===
|
|
110
|
+
V1_EntitlementsLakehouseEnvironmentType.PRODUCTION_PARALLEL
|
|
111
|
+
? 'Production (parallel)'
|
|
112
|
+
: 'Development',
|
|
113
|
+
value: sourceBuilder.envMode,
|
|
114
|
+
}}
|
|
115
|
+
placeholder="Choose mode"
|
|
116
|
+
isClearable={true}
|
|
117
|
+
escapeClearsValue={true}
|
|
118
|
+
/>
|
|
119
|
+
</div>
|
|
76
120
|
<div className="query-setup__wizard__group mt-3">
|
|
77
121
|
<div className="query-setup__wizard__group__title">Data Product</div>
|
|
78
122
|
<CustomSelectorInput
|
|
79
123
|
className="query-setup__wizard__selector text-nowrap"
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
124
|
+
// give the option rows more height to accommodate wrapped titles
|
|
125
|
+
optionCustomization={{ rowHeight: 56 }}
|
|
126
|
+
options={sourceBuilder.filteredDataProducts.map((dataProduct) => {
|
|
127
|
+
const title = dataProduct.title;
|
|
128
|
+
const id = guaranteeNonNullable(dataProduct.id);
|
|
129
|
+
return {
|
|
130
|
+
label: renderDataProductLabel(dataProduct),
|
|
131
|
+
// include a searchable text so react-select filter can match id/title
|
|
132
|
+
searchText: `${title} ${id}`.trim(),
|
|
133
|
+
value: guaranteeNonNullable(dataProduct),
|
|
134
|
+
};
|
|
135
|
+
})}
|
|
136
|
+
filterOption={(option, rawInput) => {
|
|
137
|
+
const input = rawInput.toLowerCase();
|
|
138
|
+
// option.data may contain our custom searchText
|
|
139
|
+
const data = option.data as { searchText?: string } | undefined;
|
|
140
|
+
|
|
141
|
+
// Prefer a non-empty searchText from data when available
|
|
142
|
+
const searchTextSource =
|
|
143
|
+
data?.searchText && data.searchText.trim() !== ''
|
|
144
|
+
? data.searchText.toLowerCase().trim()
|
|
145
|
+
: ''.trim();
|
|
146
|
+
|
|
147
|
+
// If user hasn't typed anything, show all options
|
|
148
|
+
if (input === '') {
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return searchTextSource.includes(input);
|
|
153
|
+
}}
|
|
84
154
|
disabled={
|
|
85
155
|
sourceBuilder.dataProductLoadingState.isInProgress ||
|
|
86
156
|
sourceBuilder.dataProductLoadingState.hasFailed
|
|
87
157
|
}
|
|
88
158
|
isLoading={sourceBuilder.dataProductLoadingState.isInProgress}
|
|
89
|
-
onChange={(
|
|
90
|
-
|
|
159
|
+
onChange={(
|
|
160
|
+
newValue: {
|
|
161
|
+
label: ReactNode;
|
|
162
|
+
searchText?: string;
|
|
163
|
+
value: V1_EntitlementsDataProductLite;
|
|
164
|
+
} | null,
|
|
165
|
+
) => {
|
|
166
|
+
sourceBuilder.setSelectedDataProduct(newValue?.value);
|
|
91
167
|
sourceBuilder
|
|
92
168
|
.fetchDataProduct(auth.user?.access_token)
|
|
93
169
|
.catch((error) =>
|
|
@@ -97,7 +173,11 @@ export const LakehouseConsumerDataCubeSourceBuilder: React.FC<{
|
|
|
97
173
|
value={
|
|
98
174
|
sourceBuilder.selectedDataProduct
|
|
99
175
|
? {
|
|
100
|
-
label:
|
|
176
|
+
label: renderDataProductMainText(
|
|
177
|
+
sourceBuilder.selectedDataProduct,
|
|
178
|
+
),
|
|
179
|
+
searchText:
|
|
180
|
+
`${sourceBuilder.selectedDataProduct.title ?? ''} ${sourceBuilder.selectedDataProduct.id}`.trim(),
|
|
101
181
|
value: sourceBuilder.selectedDataProduct,
|
|
102
182
|
}
|
|
103
183
|
: null
|
|
@@ -107,71 +187,44 @@ export const LakehouseConsumerDataCubeSourceBuilder: React.FC<{
|
|
|
107
187
|
escapeClearsValue={true}
|
|
108
188
|
/>
|
|
109
189
|
</div>
|
|
110
|
-
{sourceBuilder.
|
|
111
|
-
<div className="query-setup__wizard__group mt-
|
|
112
|
-
<div className="query-setup__wizard__group__title">
|
|
190
|
+
{sourceBuilder.accessPoints.length > 0 && (
|
|
191
|
+
<div className="query-setup__wizard__group mt-2">
|
|
192
|
+
<div className="query-setup__wizard__group__title">
|
|
193
|
+
Access Point
|
|
194
|
+
</div>
|
|
113
195
|
<CustomSelectorInput
|
|
114
|
-
className="query-setup__wizard__selector
|
|
115
|
-
options={
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
196
|
+
className="query-setup__wizard__selector"
|
|
197
|
+
options={sourceBuilder.accessPoints.map((accessPoint) => ({
|
|
198
|
+
label: accessPoint,
|
|
199
|
+
value: accessPoint,
|
|
200
|
+
}))}
|
|
201
|
+
disabled={false}
|
|
202
|
+
isLoading={false}
|
|
203
|
+
onChange={(newValue: { label: string; value: string } | null) => {
|
|
204
|
+
const accessPoint = newValue?.value ?? '';
|
|
205
|
+
sourceBuilder.setSelectedAccessPoint(accessPoint);
|
|
206
|
+
sourceBuilder.setWarehouse(
|
|
207
|
+
sourceBuilder.DEFAULT_CONSUMER_WAREHOUSE,
|
|
208
|
+
);
|
|
209
|
+
sourceBuilder
|
|
210
|
+
.initializeQuery()
|
|
211
|
+
.catch((error) =>
|
|
212
|
+
store.alertService.alertUnhandledError(error),
|
|
213
|
+
);
|
|
126
214
|
}}
|
|
127
|
-
value={
|
|
128
|
-
|
|
215
|
+
value={
|
|
216
|
+
sourceBuilder.selectedAccessPoint
|
|
217
|
+
? {
|
|
218
|
+
label: sourceBuilder.selectedAccessPoint,
|
|
219
|
+
value: sourceBuilder.selectedAccessPoint,
|
|
220
|
+
}
|
|
221
|
+
: null
|
|
222
|
+
}
|
|
129
223
|
isClearable={false}
|
|
130
224
|
escapeClearsValue={true}
|
|
131
225
|
/>
|
|
132
226
|
</div>
|
|
133
227
|
)}
|
|
134
|
-
{sourceBuilder.accessPoints.length > 0 &&
|
|
135
|
-
sourceBuilder.selectedEnvironment && (
|
|
136
|
-
<div className="query-setup__wizard__group mt-2">
|
|
137
|
-
<div className="query-setup__wizard__group__title">
|
|
138
|
-
Access Point
|
|
139
|
-
</div>
|
|
140
|
-
<CustomSelectorInput
|
|
141
|
-
className="query-setup__wizard__selector"
|
|
142
|
-
options={sourceBuilder.accessPoints.map((accessPoint) => ({
|
|
143
|
-
label: accessPoint,
|
|
144
|
-
value: accessPoint,
|
|
145
|
-
}))}
|
|
146
|
-
disabled={false}
|
|
147
|
-
isLoading={false}
|
|
148
|
-
onChange={(
|
|
149
|
-
newValue: { label: string; value: string } | null,
|
|
150
|
-
) => {
|
|
151
|
-
const accessPoint = newValue?.value ?? '';
|
|
152
|
-
sourceBuilder.setSelectedAccessPoint(accessPoint);
|
|
153
|
-
sourceBuilder.setWarehouse(
|
|
154
|
-
sourceBuilder.DEFAULT_CONSUMER_WAREHOUSE,
|
|
155
|
-
);
|
|
156
|
-
sourceBuilder
|
|
157
|
-
.initializeQuery()
|
|
158
|
-
.catch((error) =>
|
|
159
|
-
store.alertService.alertUnhandledError(error),
|
|
160
|
-
);
|
|
161
|
-
}}
|
|
162
|
-
value={
|
|
163
|
-
sourceBuilder.selectedAccessPoint
|
|
164
|
-
? {
|
|
165
|
-
label: sourceBuilder.selectedAccessPoint,
|
|
166
|
-
value: sourceBuilder.selectedAccessPoint,
|
|
167
|
-
}
|
|
168
|
-
: null
|
|
169
|
-
}
|
|
170
|
-
isClearable={false}
|
|
171
|
-
escapeClearsValue={true}
|
|
172
|
-
/>
|
|
173
|
-
</div>
|
|
174
|
-
)}
|
|
175
228
|
{sourceBuilder.selectedAccessPoint && (
|
|
176
229
|
<div className="query-setup__wizard__group mt-2">
|
|
177
230
|
<div className="query-setup__wizard__group__title">Warehouse</div>
|
|
@@ -171,7 +171,9 @@ import {
|
|
|
171
171
|
RawLakehouseSdlcOrigin,
|
|
172
172
|
} from './model/LakehouseConsumerDataCubeSource.js';
|
|
173
173
|
import {
|
|
174
|
-
|
|
174
|
+
buildEnvNameCompatibleWithLakehouseEnvironmentType,
|
|
175
|
+
getEntitlementsLakehouseEnvironmentTypeCompatibleWithEnvName,
|
|
176
|
+
isLakehouseEnvironmentType,
|
|
175
177
|
type LakehouseContractServerClient,
|
|
176
178
|
type LakehouseIngestServerClient,
|
|
177
179
|
} from '@finos/legend-server-lakehouse';
|
|
@@ -347,7 +349,7 @@ export class LegendDataCubeDataCubeEngine extends DataCubeEngine {
|
|
|
347
349
|
}
|
|
348
350
|
} else if (source instanceof LakehouseConsumerDataCubeSource) {
|
|
349
351
|
return {
|
|
350
|
-
environment: source.
|
|
352
|
+
environment: source.userEnvironment,
|
|
351
353
|
warehouse: source.warehouse,
|
|
352
354
|
deploymentId: source.deploymentId,
|
|
353
355
|
project: source.dpCoordinates
|
|
@@ -849,7 +851,6 @@ export class LegendDataCubeDataCubeEngine extends DataCubeEngine {
|
|
|
849
851
|
rawSource,
|
|
850
852
|
source,
|
|
851
853
|
);
|
|
852
|
-
source.environment = rawSource.environment;
|
|
853
854
|
source.paths = rawSource.paths;
|
|
854
855
|
source.warehouse = rawSource.warehouse;
|
|
855
856
|
source.deploymentId = rawSource.deploymentId;
|
|
@@ -1953,9 +1954,49 @@ export class LegendDataCubeDataCubeEngine extends DataCubeEngine {
|
|
|
1953
1954
|
) {
|
|
1954
1955
|
let pmcd: V1_PureModelContext | undefined;
|
|
1955
1956
|
|
|
1957
|
+
// find user entitled environment
|
|
1958
|
+
const env =
|
|
1959
|
+
await this._lakehouseContractServerClient.getUserEntitlementEnvs(
|
|
1960
|
+
this._application.identityService.currentUser,
|
|
1961
|
+
authStore.getAccessToken(),
|
|
1962
|
+
);
|
|
1963
|
+
const userEnv = guaranteeNonNullable(
|
|
1964
|
+
env.users.map((e) => e.lakehouseEnvironment).at(0),
|
|
1965
|
+
);
|
|
1966
|
+
|
|
1967
|
+
// Backwards-compatible environment handling
|
|
1968
|
+
//
|
|
1969
|
+
// The incoming `rawSource.environment` may be in one of two forms:
|
|
1970
|
+
// 1. An entitlement environment type (the canonical enum used by the entitlements
|
|
1971
|
+
// service, e.g. PRODUCTION / PRODUCTION_PARALLEL / DEVELOPMENT).
|
|
1972
|
+
// 2. A legacy, user-specific environment name string (used by older queries).
|
|
1973
|
+
//
|
|
1974
|
+
// To make the consumer view robust across both representations, we normalize
|
|
1975
|
+
// the raw environment into a runtime-compatible environment name that is
|
|
1976
|
+
// compatible with the current user's entitled environment (`userEnv`). This
|
|
1977
|
+
// preserves the ability for any user to open the view regardless of how the
|
|
1978
|
+
// environment was stored.
|
|
1979
|
+
|
|
1980
|
+
if (isLakehouseEnvironmentType(rawSource.environment)) {
|
|
1981
|
+
const lakehouseEnv =
|
|
1982
|
+
getEntitlementsLakehouseEnvironmentTypeCompatibleWithEnvName(
|
|
1983
|
+
rawSource.environment,
|
|
1984
|
+
);
|
|
1985
|
+
source.userEnvironment =
|
|
1986
|
+
buildEnvNameCompatibleWithLakehouseEnvironmentType(
|
|
1987
|
+
userEnv,
|
|
1988
|
+
lakehouseEnv,
|
|
1989
|
+
);
|
|
1990
|
+
} else {
|
|
1991
|
+
source.userEnvironment =
|
|
1992
|
+
buildEnvNameCompatibleWithLakehouseEnvironmentType(
|
|
1993
|
+
userEnv,
|
|
1994
|
+
rawSource.environment,
|
|
1995
|
+
);
|
|
1996
|
+
}
|
|
1956
1997
|
const runtime = new V1_LakehouseRuntime();
|
|
1957
1998
|
runtime.warehouse = rawSource.warehouse;
|
|
1958
|
-
runtime.environment =
|
|
1999
|
+
runtime.environment = source.userEnvironment;
|
|
1959
2000
|
|
|
1960
2001
|
const packageableRuntime = new V1_PackageableRuntime();
|
|
1961
2002
|
packageableRuntime.runtimeValue = runtime;
|
|
@@ -1985,15 +2026,17 @@ export class LegendDataCubeDataCubeEngine extends DataCubeEngine {
|
|
|
1985
2026
|
),
|
|
1986
2027
|
)
|
|
1987
2028
|
: [];
|
|
1988
|
-
const selectedEnv =
|
|
2029
|
+
const selectedEnv = source.userEnvironment;
|
|
1989
2030
|
const dataProduct = dataProducts.find((dp) => {
|
|
1990
2031
|
const envType = dp.lakehouseEnvironment?.type;
|
|
1991
2032
|
if (!envType) {
|
|
1992
2033
|
return false;
|
|
1993
2034
|
}
|
|
1994
|
-
return
|
|
1995
|
-
|
|
1996
|
-
|
|
2035
|
+
return (
|
|
2036
|
+
envType ===
|
|
2037
|
+
getEntitlementsLakehouseEnvironmentTypeCompatibleWithEnvName(
|
|
2038
|
+
selectedEnv,
|
|
2039
|
+
)
|
|
1997
2040
|
);
|
|
1998
2041
|
});
|
|
1999
2042
|
const fullGraphGrammar = guaranteeType(
|