@finos/legend-application-data-cube 0.1.6 → 0.1.7
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/__lib__/LegendDataCubeNavigation.d.ts +5 -5
- package/lib/__lib__/LegendDataCubeNavigation.d.ts.map +1 -1
- package/lib/__lib__/LegendDataCubeNavigation.js +5 -5
- package/lib/__lib__/LegendDataCubeNavigation.js.map +1 -1
- package/lib/{stores/source/CubeInputSource.js → __lib__/LegendDataCubeSetting.d.ts} +6 -14
- package/lib/__lib__/LegendDataCubeSetting.d.ts.map +1 -0
- package/lib/__lib__/LegendDataCubeSetting.js +25 -0
- package/lib/__lib__/LegendDataCubeSetting.js.map +1 -0
- package/lib/{stores/model/DataCubeQueryContent.js → __lib__/LegendDataCubeUserData.d.ts} +4 -5
- package/lib/__lib__/LegendDataCubeUserData.d.ts.map +1 -0
- package/lib/{stores/model/DataCubeGenericSource.d.ts → __lib__/LegendDataCubeUserData.js} +6 -3
- package/lib/__lib__/LegendDataCubeUserData.js.map +1 -0
- package/lib/application/LegendDataCube.d.ts.map +1 -1
- package/lib/application/LegendDataCube.js.map +1 -1
- package/lib/application/LegendDataCubeApplicationConfig.d.ts +1 -1
- package/lib/application/LegendDataCubeApplicationConfig.d.ts.map +1 -1
- package/lib/application/LegendDataCubeApplicationConfig.js +3 -1
- package/lib/application/LegendDataCubeApplicationConfig.js.map +1 -1
- package/lib/application/LegendDataCubePluginManager.d.ts.map +1 -1
- package/lib/application/LegendDataCubePluginManager.js.map +1 -1
- package/lib/components/LegendDataCubeFrameworkProvider.d.ts +2 -2
- package/lib/components/LegendDataCubeFrameworkProvider.d.ts.map +1 -1
- package/lib/components/LegendDataCubeFrameworkProvider.js +5 -5
- package/lib/components/LegendDataCubeFrameworkProvider.js.map +1 -1
- package/lib/components/LegendDataCubeWebApplication.d.ts.map +1 -1
- package/lib/components/LegendDataCubeWebApplication.js +25 -6
- package/lib/components/LegendDataCubeWebApplication.js.map +1 -1
- package/lib/components/{source/DataCubeSourceEditor.d.ts → query-builder/LegendDataCubeNewQueryBuilder.d.ts} +4 -4
- package/lib/components/query-builder/LegendDataCubeNewQueryBuilder.d.ts.map +1 -0
- package/lib/components/query-builder/LegendDataCubeNewQueryBuilder.js +45 -0
- package/lib/components/query-builder/LegendDataCubeNewQueryBuilder.js.map +1 -0
- package/{src/stores/model/DataCubeGenericSource.ts → lib/components/query-builder/LegendDataCubeQueryBuilder.d.ts} +2 -2
- package/lib/components/query-builder/LegendDataCubeQueryBuilder.d.ts.map +1 -0
- package/lib/components/query-builder/LegendDataCubeQueryBuilder.js +85 -0
- package/lib/components/query-builder/LegendDataCubeQueryBuilder.js.map +1 -0
- package/lib/components/query-builder/LegendDataCubeQueryBuilderStoreProvider.d.ts +19 -0
- package/lib/components/query-builder/LegendDataCubeQueryBuilderStoreProvider.d.ts.map +1 -0
- package/lib/components/query-builder/LegendDataCubeQueryBuilderStoreProvider.js +33 -0
- package/lib/components/query-builder/LegendDataCubeQueryBuilderStoreProvider.js.map +1 -0
- package/lib/components/{source/ExistingDataCubeQuery.d.ts → query-builder/LegendDataCubeQueryLoader.d.ts} +2 -2
- package/lib/components/query-builder/LegendDataCubeQueryLoader.d.ts.map +1 -0
- package/lib/components/query-builder/LegendDataCubeQueryLoader.js +99 -0
- package/lib/components/query-builder/LegendDataCubeQueryLoader.js.map +1 -0
- package/lib/components/{DataCubeEditor.d.ts → query-builder/LegendDataCubeQuerySaver.d.ts} +2 -2
- package/lib/components/query-builder/LegendDataCubeQuerySaver.d.ts.map +1 -0
- package/lib/components/query-builder/LegendDataCubeQuerySaver.js +49 -0
- package/lib/components/query-builder/LegendDataCubeQuerySaver.js.map +1 -0
- package/lib/components/{source/SavedQuerySourceEditor.d.ts → query-builder/source-builder/AdhocQueryDataCubeSourceBuilder.d.ts} +4 -4
- package/lib/components/query-builder/source-builder/AdhocQueryDataCubeSourceBuilder.d.ts.map +1 -0
- package/lib/components/query-builder/source-builder/AdhocQueryDataCubeSourceBuilder.js +22 -0
- package/lib/components/query-builder/source-builder/AdhocQueryDataCubeSourceBuilder.js.map +1 -0
- package/lib/components/query-builder/source-builder/LegendQueryDataCubeSourceBuilder.d.ts +22 -0
- package/lib/components/query-builder/source-builder/LegendQueryDataCubeSourceBuilder.d.ts.map +1 -0
- package/lib/components/query-builder/source-builder/LegendQueryDataCubeSourceBuilder.js +97 -0
- package/lib/components/query-builder/source-builder/LegendQueryDataCubeSourceBuilder.js.map +1 -0
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +2 -2
- package/lib/stores/LegendDataCubeBaseStore.d.ts +41 -0
- package/lib/stores/LegendDataCubeBaseStore.d.ts.map +1 -0
- package/lib/stores/LegendDataCubeBaseStore.js +123 -0
- package/lib/stores/LegendDataCubeBaseStore.js.map +1 -0
- package/lib/stores/LegendDataCubeDataCubeEngine.d.ts +65 -0
- package/lib/stores/LegendDataCubeDataCubeEngine.d.ts.map +1 -0
- package/lib/stores/LegendDataCubeDataCubeEngine.js +249 -0
- package/lib/stores/LegendDataCubeDataCubeEngine.js.map +1 -0
- package/lib/stores/model/LegendQueryDataCubeSource.d.ts +32 -0
- package/lib/stores/model/LegendQueryDataCubeSource.d.ts.map +1 -0
- package/lib/stores/model/LegendQueryDataCubeSource.js +35 -0
- package/lib/stores/model/LegendQueryDataCubeSource.js.map +1 -0
- package/lib/stores/query-builder/LegendDataCubeNewQueryState.d.ts +34 -0
- package/lib/stores/query-builder/LegendDataCubeNewQueryState.d.ts.map +1 -0
- package/lib/stores/query-builder/LegendDataCubeNewQueryState.js +92 -0
- package/lib/stores/query-builder/LegendDataCubeNewQueryState.js.map +1 -0
- package/lib/stores/query-builder/LegendDataCubeQueryBuilderStore.d.ts +52 -0
- package/lib/stores/query-builder/LegendDataCubeQueryBuilderStore.d.ts.map +1 -0
- package/lib/stores/query-builder/LegendDataCubeQueryBuilderStore.js +211 -0
- package/lib/stores/query-builder/LegendDataCubeQueryBuilderStore.js.map +1 -0
- package/lib/stores/query-builder/LegendDataCubeQueryLoaderState.d.ts +54 -0
- package/lib/stores/query-builder/LegendDataCubeQueryLoaderState.d.ts.map +1 -0
- package/lib/stores/query-builder/LegendDataCubeQueryLoaderState.js +197 -0
- package/lib/stores/query-builder/LegendDataCubeQueryLoaderState.js.map +1 -0
- package/lib/stores/{model/DataCubeQueryContent.d.ts → query-builder/source-builder/AdhocQueryDataCubeSourceBuilderState.d.ts} +7 -7
- package/lib/stores/query-builder/source-builder/AdhocQueryDataCubeSourceBuilderState.d.ts.map +1 -0
- package/lib/stores/{model/LegendSavedQuerySource.js → query-builder/source-builder/AdhocQueryDataCubeSourceBuilderState.js} +12 -7
- package/lib/stores/query-builder/source-builder/AdhocQueryDataCubeSourceBuilderState.js.map +1 -0
- package/lib/stores/query-builder/source-builder/LegendDataCubeSourceBuilderState.d.ts +33 -0
- package/lib/stores/query-builder/source-builder/LegendDataCubeSourceBuilderState.d.ts.map +1 -0
- package/lib/stores/query-builder/source-builder/LegendDataCubeSourceBuilderState.js +31 -0
- package/lib/stores/query-builder/source-builder/LegendDataCubeSourceBuilderState.js.map +1 -0
- package/lib/stores/query-builder/source-builder/LegendQueryDataCubeSourceBuilderState.d.ts +31 -0
- package/lib/stores/query-builder/source-builder/LegendQueryDataCubeSourceBuilderState.d.ts.map +1 -0
- package/lib/stores/query-builder/source-builder/LegendQueryDataCubeSourceBuilderState.js +84 -0
- package/lib/stores/query-builder/source-builder/LegendQueryDataCubeSourceBuilderState.js.map +1 -0
- package/package.json +11 -11
- package/src/__lib__/LegendDataCubeNavigation.ts +7 -7
- package/src/{stores/model/DataCubeQueryContent.ts → __lib__/LegendDataCubeSetting.ts} +6 -6
- package/{lib/stores/model/DataCubeGenericSource.js → src/__lib__/LegendDataCubeUserData.ts} +5 -2
- package/src/application/LegendDataCube.tsx +1 -0
- package/src/application/LegendDataCubeApplicationConfig.ts +6 -4
- package/src/application/LegendDataCubePluginManager.ts +1 -0
- package/src/components/LegendDataCubeFrameworkProvider.tsx +7 -7
- package/src/components/LegendDataCubeWebApplication.tsx +48 -12
- package/src/components/query-builder/LegendDataCubeNewQueryBuilder.tsx +115 -0
- package/src/components/query-builder/LegendDataCubeQueryBuilder.tsx +213 -0
- package/src/components/query-builder/LegendDataCubeQueryBuilderStoreProvider.tsx +56 -0
- package/src/components/query-builder/LegendDataCubeQueryLoader.tsx +310 -0
- package/src/components/query-builder/LegendDataCubeQuerySaver.tsx +106 -0
- package/src/{stores/source/CubeInputSource.ts → components/query-builder/source-builder/AdhocQueryDataCubeSourceBuilder.tsx} +14 -19
- package/src/components/query-builder/source-builder/LegendQueryDataCubeSourceBuilder.tsx +313 -0
- package/src/stores/LegendDataCubeBaseStore.ts +198 -0
- package/src/stores/LegendDataCubeDataCubeEngine.ts +494 -0
- package/src/stores/model/LegendQueryDataCubeSource.ts +46 -0
- package/src/stores/query-builder/LegendDataCubeNewQueryState.tsx +139 -0
- package/src/stores/query-builder/LegendDataCubeQueryBuilderStore.tsx +296 -0
- package/src/stores/query-builder/LegendDataCubeQueryLoaderState.tsx +258 -0
- package/src/stores/{source/LegendCubeViewer.ts → query-builder/source-builder/AdhocQueryDataCubeSourceBuilderState.ts} +15 -8
- package/src/stores/query-builder/source-builder/LegendDataCubeSourceBuilderState.ts +40 -0
- package/src/stores/query-builder/source-builder/LegendQueryDataCubeSourceBuilderState.ts +125 -0
- package/tsconfig.json +18 -15
- package/lib/components/DataCubeEditor.d.ts.map +0 -1
- package/lib/components/DataCubeEditor.js +0 -59
- package/lib/components/DataCubeEditor.js.map +0 -1
- package/lib/components/source/DataCubeSourceEditor.d.ts.map +0 -1
- package/lib/components/source/DataCubeSourceEditor.js +0 -43
- package/lib/components/source/DataCubeSourceEditor.js.map +0 -1
- package/lib/components/source/ExistingDataCubeQuery.d.ts.map +0 -1
- package/lib/components/source/ExistingDataCubeQuery.js +0 -36
- package/lib/components/source/ExistingDataCubeQuery.js.map +0 -1
- package/lib/components/source/SavedQuerySourceEditor.d.ts.map +0 -1
- package/lib/components/source/SavedQuerySourceEditor.js +0 -25
- package/lib/components/source/SavedQuerySourceEditor.js.map +0 -1
- package/lib/stores/LegendDataCubeEditorStore.d.ts +0 -50
- package/lib/stores/LegendDataCubeEditorStore.d.ts.map +0 -1
- package/lib/stores/LegendDataCubeEditorStore.js +0 -153
- package/lib/stores/LegendDataCubeEditorStore.js.map +0 -1
- package/lib/stores/engine/LegendExecutionDataCubeEngine.d.ts +0 -52
- package/lib/stores/engine/LegendExecutionDataCubeEngine.d.ts.map +0 -1
- package/lib/stores/engine/LegendExecutionDataCubeEngine.js +0 -149
- package/lib/stores/engine/LegendExecutionDataCubeEngine.js.map +0 -1
- package/lib/stores/model/DataCubeGenericSource.d.ts.map +0 -1
- package/lib/stores/model/DataCubeGenericSource.js.map +0 -1
- package/lib/stores/model/DataCubeGenericSourceHelper.d.ts +0 -24
- package/lib/stores/model/DataCubeGenericSourceHelper.d.ts.map +0 -1
- package/lib/stores/model/DataCubeGenericSourceHelper.js +0 -58
- package/lib/stores/model/DataCubeGenericSourceHelper.js.map +0 -1
- package/lib/stores/model/DataCubeQueryContent.d.ts.map +0 -1
- package/lib/stores/model/DataCubeQueryContent.js.map +0 -1
- package/lib/stores/model/LegendSavedQuerySource.d.ts +0 -21
- package/lib/stores/model/LegendSavedQuerySource.d.ts.map +0 -1
- package/lib/stores/model/LegendSavedQuerySource.js.map +0 -1
- package/lib/stores/source/CubeInputSource.d.ts +0 -32
- package/lib/stores/source/CubeInputSource.d.ts.map +0 -1
- package/lib/stores/source/CubeInputSource.js.map +0 -1
- package/lib/stores/source/CubeInputSourceLoader.d.ts +0 -37
- package/lib/stores/source/CubeInputSourceLoader.d.ts.map +0 -1
- package/lib/stores/source/CubeInputSourceLoader.js +0 -39
- package/lib/stores/source/CubeInputSourceLoader.js.map +0 -1
- package/lib/stores/source/LegendCubeViewer.d.ts +0 -23
- package/lib/stores/source/LegendCubeViewer.d.ts.map +0 -1
- package/lib/stores/source/LegendCubeViewer.js +0 -24
- package/lib/stores/source/LegendCubeViewer.js.map +0 -1
- package/lib/stores/source/LegendDataCubeSourceBuilder.d.ts +0 -34
- package/lib/stores/source/LegendDataCubeSourceBuilder.d.ts.map +0 -1
- package/lib/stores/source/LegendDataCubeSourceBuilder.js +0 -70
- package/lib/stores/source/LegendDataCubeSourceBuilder.js.map +0 -1
- package/lib/stores/source/SavedQueryInputSourceState.d.ts +0 -35
- package/lib/stores/source/SavedQueryInputSourceState.d.ts.map +0 -1
- package/lib/stores/source/SavedQueryInputSourceState.js +0 -81
- package/lib/stores/source/SavedQueryInputSourceState.js.map +0 -1
- package/src/components/DataCubeEditor.tsx +0 -190
- package/src/components/source/DataCubeSourceEditor.tsx +0 -133
- package/src/components/source/ExistingDataCubeQuery.tsx +0 -101
- package/src/components/source/SavedQuerySourceEditor.tsx +0 -62
- package/src/stores/LegendDataCubeEditorStore.ts +0 -237
- package/src/stores/engine/LegendExecutionDataCubeEngine.ts +0 -267
- package/src/stores/model/DataCubeGenericSourceHelper.ts +0 -97
- package/src/stores/model/LegendSavedQuerySource.ts +0 -26
- package/src/stores/source/CubeInputSourceLoader.ts +0 -56
- package/src/stores/source/LegendDataCubeSourceBuilder.ts +0 -98
- package/src/stores/source/SavedQueryInputSourceState.ts +0 -142
|
@@ -1,70 +0,0 @@
|
|
|
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
|
-
import { flow, makeObservable, observable } from 'mobx';
|
|
17
|
-
import { DataCubeSourceType, } from './CubeInputSourceLoader.js';
|
|
18
|
-
import { SavedQueryInputSourceState } from './SavedQueryInputSourceState.js';
|
|
19
|
-
import { UnsupportedOperationError, assertErrorThrown, assertTrue, guaranteeNonNullable, } from '@finos/legend-shared';
|
|
20
|
-
export class LegendDataCubeSourceBuilder {
|
|
21
|
-
context;
|
|
22
|
-
open = false;
|
|
23
|
-
sourceState;
|
|
24
|
-
constructor(context) {
|
|
25
|
-
makeObservable(this, {
|
|
26
|
-
open: observable,
|
|
27
|
-
sourceState: observable,
|
|
28
|
-
inputSource: flow,
|
|
29
|
-
});
|
|
30
|
-
this.context = context;
|
|
31
|
-
this.sourceState = this.buildSource(guaranteeNonNullable(this.options[0]));
|
|
32
|
-
}
|
|
33
|
-
get options() {
|
|
34
|
-
return Object.values(DataCubeSourceType);
|
|
35
|
-
}
|
|
36
|
-
get currentOption() {
|
|
37
|
-
throw new UnsupportedOperationError('');
|
|
38
|
-
}
|
|
39
|
-
openModal() {
|
|
40
|
-
this.open = true;
|
|
41
|
-
}
|
|
42
|
-
close() {
|
|
43
|
-
this.open = false;
|
|
44
|
-
}
|
|
45
|
-
changeSource(source) {
|
|
46
|
-
if (this.sourceState.label !== source) {
|
|
47
|
-
this.sourceState = this.buildSource(source);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
buildSource(source) {
|
|
51
|
-
if (source === DataCubeSourceType.LEGEND_QUERY) {
|
|
52
|
-
return SavedQueryInputSourceState.builder(this.context);
|
|
53
|
-
}
|
|
54
|
-
throw new UnsupportedOperationError('Not supported');
|
|
55
|
-
}
|
|
56
|
-
*inputSource(callback) {
|
|
57
|
-
try {
|
|
58
|
-
assertTrue(this.sourceState.isValid, 'Source State is in a valid state to input');
|
|
59
|
-
const engine = (yield this.sourceState.buildCubeEngine());
|
|
60
|
-
const source = this.sourceState.process();
|
|
61
|
-
callback(source, engine);
|
|
62
|
-
this.close();
|
|
63
|
-
}
|
|
64
|
-
catch (error) {
|
|
65
|
-
assertErrorThrown(error);
|
|
66
|
-
this.context.applicationStore.notificationService.notifyError(`Unable to import: ${this.sourceState.label}: ${error.message}`);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
//# sourceMappingURL=LegendDataCubeSourceBuilder.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LegendDataCubeSourceBuilder.js","sourceRoot":"","sources":["../../../src/stores/source/LegendDataCubeSourceBuilder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AACxD,OAAO,EACL,kBAAkB,GAEnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAE7E,OAAO,EACL,yBAAyB,EACzB,iBAAiB,EACjB,UAAU,EACV,oBAAoB,GAErB,MAAM,sBAAsB,CAAC;AAI9B,MAAM,OAAO,2BAA2B;IAC7B,OAAO,CAA6B;IAC7C,IAAI,GAAG,KAAK,CAAC;IACb,WAAW,CAAuB;IAElC,YAAY,OAAmC;QAC7C,cAAc,CAAC,IAAI,EAAE;YACnB,IAAI,EAAE,UAAU;YAChB,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,IAAI;SAClB,CAAC,CAAC;QACH,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7E,CAAC;IAED,IAAI,OAAO;QACT,OAAO,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;IAC3C,CAAC;IAED,IAAI,aAAa;QACf,MAAM,IAAI,yBAAyB,CAAC,EAAE,CAAC,CAAC;IAC1C,CAAC;IAED,SAAS;QACP,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,KAAK;QACH,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;IACpB,CAAC;IAED,YAAY,CAAC,MAA0B;QACrC,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,KAAK,MAAM,EAAE,CAAC;YACtC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;IAED,WAAW,CAAC,MAA0B;QACpC,IAAI,MAAM,KAAK,kBAAkB,CAAC,YAAY,EAAE,CAAC;YAC/C,OAAO,0BAA0B,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC1D,CAAC;QACD,MAAM,IAAI,yBAAyB,CAAC,eAAe,CAAC,CAAC;IACvD,CAAC;IAED,CAAC,WAAW,CACV,QAAyE;QAEzE,IAAI,CAAC;YACH,UAAU,CACR,IAAI,CAAC,WAAW,CAAC,OAAO,EACxB,2CAA2C,CAC5C,CAAC;YACF,MAAM,MAAM,GACV,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,eAAe,EAAE,CAAmB,CAAC;YAC/D,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;YAC1C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YACzB,IAAI,CAAC,KAAK,EAAE,CAAC;QACf,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,iBAAiB,CAAC,KAAK,CAAC,CAAC;YACzB,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,WAAW,CAC3D,qBAAqB,IAAI,CAAC,WAAW,CAAC,KAAK,KAAK,KAAK,CAAC,OAAO,EAAE,CAChE,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,35 +0,0 @@
|
|
|
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
|
-
import { CubeInputSourceState, DataCubeSourceType } from './CubeInputSourceLoader.js';
|
|
17
|
-
import type { DataCubeEngine } from '@finos/legend-data-cube';
|
|
18
|
-
import { type LightQuery } from '@finos/legend-graph';
|
|
19
|
-
import type { LegendDataCubeStoreContext } from '../LegendDataCubeEditorStore.js';
|
|
20
|
-
import { QueryLoaderState } from '@finos/legend-query-builder';
|
|
21
|
-
import type { DataCubeGenericSource } from '../model/DataCubeGenericSource.js';
|
|
22
|
-
export declare class SavedQueryInputSourceState extends CubeInputSourceState {
|
|
23
|
-
query: LightQuery | undefined;
|
|
24
|
-
queryLoaderState: QueryLoaderState;
|
|
25
|
-
constructor(context: LegendDataCubeStoreContext);
|
|
26
|
-
setQuery(query: LightQuery): void;
|
|
27
|
-
process(): DataCubeGenericSource;
|
|
28
|
-
get openActionable(): boolean;
|
|
29
|
-
static builder(context: LegendDataCubeStoreContext): CubeInputSourceState;
|
|
30
|
-
get label(): DataCubeSourceType;
|
|
31
|
-
setup(): Promise<void>;
|
|
32
|
-
buildCubeEngine(): Promise<DataCubeEngine | undefined>;
|
|
33
|
-
get isValid(): boolean;
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=SavedQueryInputSourceState.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SavedQueryInputSourceState.d.ts","sourceRoot":"","sources":["../../../src/stores/source/SavedQueryInputSourceState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAOH,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAIL,KAAK,UAAU,EAChB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAClF,OAAO,EAEL,gBAAgB,EACjB,MAAM,6BAA6B,CAAC;AAErC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAG/E,qBAAa,0BAA2B,SAAQ,oBAAoB;IAClE,KAAK,EAAE,UAAU,GAAG,SAAS,CAAC;IAC9B,gBAAgB,EAAE,gBAAgB,CAAC;gBAEvB,OAAO,EAAE,0BAA0B;IA2B/C,QAAQ,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAIxB,OAAO,IAAI,qBAAqB;IAKzC,IAAa,cAAc,IAAI,OAAO,CAErC;WAEe,OAAO,CACrB,OAAO,EAAE,0BAA0B,GAClC,oBAAoB;IAGvB,IAAa,KAAK,IAAI,kBAAkB,CAEvC;IACQ,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAIzB,eAAe,IAAI,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC;IAuC5D,IAAa,OAAO,IAAI,OAAO,CAE9B;CACF"}
|
|
@@ -1,81 +0,0 @@
|
|
|
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
|
-
import { assertTrue, guaranteeNonNullable, isNonNullable, } from '@finos/legend-shared';
|
|
17
|
-
import { CubeInputSourceState, DataCubeSourceType, } from './CubeInputSourceLoader.js';
|
|
18
|
-
import { LegendSDLC, QuerySearchSpecification, } from '@finos/legend-graph';
|
|
19
|
-
import { resolveVersion } from '@finos/legend-server-depot';
|
|
20
|
-
import { LegendExecutionDataCubeEngine } from '../engine/LegendExecutionDataCubeEngine.js';
|
|
21
|
-
import { QUERY_LOADER_TYPEAHEAD_SEARCH_LIMIT, QueryLoaderState, } from '@finos/legend-query-builder';
|
|
22
|
-
import { action, makeObservable, observable } from 'mobx';
|
|
23
|
-
import { LegendSavedQuerySource } from '../model/LegendSavedQuerySource.js';
|
|
24
|
-
export class SavedQueryInputSourceState extends CubeInputSourceState {
|
|
25
|
-
query;
|
|
26
|
-
queryLoaderState;
|
|
27
|
-
constructor(context) {
|
|
28
|
-
super(context);
|
|
29
|
-
makeObservable(this, {
|
|
30
|
-
query: observable,
|
|
31
|
-
buildCubeEngineState: observable,
|
|
32
|
-
setQuery: action,
|
|
33
|
-
});
|
|
34
|
-
this.queryLoaderState = new QueryLoaderState(this.context.applicationStore, this.context.graphManagerState, {
|
|
35
|
-
loadQuery: (query) => {
|
|
36
|
-
this.setQuery(query);
|
|
37
|
-
},
|
|
38
|
-
decorateSearchSpecification: (val) => val,
|
|
39
|
-
fetchDefaultQueries: async () => {
|
|
40
|
-
const searchSpecification = new QuerySearchSpecification();
|
|
41
|
-
searchSpecification.limit = QUERY_LOADER_TYPEAHEAD_SEARCH_LIMIT;
|
|
42
|
-
return this.context.graphManagerState.graphManager.searchQueries(QuerySearchSpecification.createDefault(undefined));
|
|
43
|
-
},
|
|
44
|
-
isReadOnly: true,
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
setQuery(query) {
|
|
48
|
-
this.query = query;
|
|
49
|
-
}
|
|
50
|
-
process() {
|
|
51
|
-
assertTrue(this.isValid);
|
|
52
|
-
return new LegendSavedQuerySource(guaranteeNonNullable(this.query).id);
|
|
53
|
-
}
|
|
54
|
-
get openActionable() {
|
|
55
|
-
return false;
|
|
56
|
-
}
|
|
57
|
-
static builder(context) {
|
|
58
|
-
return new SavedQueryInputSourceState(context);
|
|
59
|
-
}
|
|
60
|
-
get label() {
|
|
61
|
-
return DataCubeSourceType.LEGEND_QUERY;
|
|
62
|
-
}
|
|
63
|
-
setup() {
|
|
64
|
-
throw new Error('Method not implemented.');
|
|
65
|
-
}
|
|
66
|
-
async buildCubeEngine() {
|
|
67
|
-
this.buildCubeEngineState.inProgress();
|
|
68
|
-
const queryInfo = await this.context.graphManagerState.graphManager.getQueryInfo(guaranteeNonNullable(this.query).id);
|
|
69
|
-
const execConext = (await this.context.graphManagerState.graphManager.resolveQueryInfoExecutionContext(queryInfo, () => this.context.depotServerClient.getVersionEntities(queryInfo.groupId, queryInfo.artifactId, queryInfo.versionId)));
|
|
70
|
-
const lambda = (await this.context.graphManagerState.graphManager.pureCodeToLambda(queryInfo.content));
|
|
71
|
-
this.context.graphManagerState.graph.setOrigin(new LegendSDLC(queryInfo.groupId, queryInfo.artifactId, resolveVersion(queryInfo.versionId)));
|
|
72
|
-
// TODO: we should be able to call engine and convert lambda to relation if not one.
|
|
73
|
-
const engine = new LegendExecutionDataCubeEngine(lambda, undefined, execConext.mapping, execConext.runtime, this.context.graphManagerState);
|
|
74
|
-
this.buildCubeEngineState.complete();
|
|
75
|
-
return engine;
|
|
76
|
-
}
|
|
77
|
-
get isValid() {
|
|
78
|
-
return isNonNullable(this.query);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
//# sourceMappingURL=SavedQueryInputSourceState.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SavedQueryInputSourceState.js","sourceRoot":"","sources":["../../../src/stores/source/SavedQueryInputSourceState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,aAAa,GACd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,UAAU,EACV,wBAAwB,GAGzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,6BAA6B,EAAE,MAAM,4CAA4C,CAAC;AAE3F,OAAO,EACL,mCAAmC,EACnC,gBAAgB,GACjB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAE1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAE5E,MAAM,OAAO,0BAA2B,SAAQ,oBAAoB;IAClE,KAAK,CAAyB;IAC9B,gBAAgB,CAAmB;IAEnC,YAAY,OAAmC;QAC7C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,cAAc,CAAC,IAAI,EAAE;YACnB,KAAK,EAAE,UAAU;YACjB,oBAAoB,EAAE,UAAU;YAChC,QAAQ,EAAE,MAAM;SACjB,CAAC,CAAC;QACH,IAAI,CAAC,gBAAgB,GAAG,IAAI,gBAAgB,CAC1C,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAC7B,IAAI,CAAC,OAAO,CAAC,iBAAiB,EAC9B;YACE,SAAS,EAAE,CAAC,KAAiB,EAAQ,EAAE;gBACrC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YACvB,CAAC;YACD,2BAA2B,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG;YACzC,mBAAmB,EAAE,KAAK,IAA2B,EAAE;gBACrD,MAAM,mBAAmB,GAAG,IAAI,wBAAwB,EAAE,CAAC;gBAC3D,mBAAmB,CAAC,KAAK,GAAG,mCAAmC,CAAC;gBAChE,OAAO,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,YAAY,CAAC,aAAa,CAC9D,wBAAwB,CAAC,aAAa,CAAC,SAAS,CAAC,CAClD,CAAC;YACJ,CAAC;YACD,UAAU,EAAE,IAAI;SACjB,CACF,CAAC;IACJ,CAAC;IAED,QAAQ,CAAC,KAAiB;QACxB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAEQ,OAAO;QACd,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACzB,OAAO,IAAI,sBAAsB,CAAC,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;IACzE,CAAC;IAED,IAAa,cAAc;QACzB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,CAAU,OAAO,CACrB,OAAmC;QAEnC,OAAO,IAAI,0BAA0B,CAAC,OAAO,CAAC,CAAC;IACjD,CAAC;IACD,IAAa,KAAK;QAChB,OAAO,kBAAkB,CAAC,YAAY,CAAC;IACzC,CAAC;IACQ,KAAK;QACZ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,KAAK,CAAC,eAAe;QACnB,IAAI,CAAC,oBAAoB,CAAC,UAAU,EAAE,CAAC;QACvC,MAAM,SAAS,GACb,MAAM,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,YAAY,CAAC,YAAY,CAC5D,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CACpC,CAAC;QACJ,MAAM,UAAU,GACd,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,YAAY,CAAC,gCAAgC,CACjF,SAAS,EACT,GAAG,EAAE,CACH,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,kBAAkB,CAC/C,SAAS,CAAC,OAAO,EACjB,SAAS,CAAC,UAAU,EACpB,SAAS,CAAC,SAAS,CACpB,CACJ,CAAqD,CAAC;QACzD,MAAM,MAAM,GACV,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,YAAY,CAAC,gBAAgB,CACjE,SAAS,CAAC,OAAO,CAClB,CAAyB,CAAC;QAC7B,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,SAAS,CAC5C,IAAI,UAAU,CACZ,SAAS,CAAC,OAAO,EACjB,SAAS,CAAC,UAAU,EACpB,cAAc,CAAC,SAAS,CAAC,SAAS,CAAC,CACpC,CACF,CAAC;QACF,oFAAoF;QACpF,MAAM,MAAM,GAAG,IAAI,6BAA6B,CAC9C,MAAM,EACN,SAAS,EACT,UAAU,CAAC,OAAO,EAClB,UAAU,CAAC,OAAO,EAClB,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAC/B,CAAC;QACF,IAAI,CAAC,oBAAoB,CAAC,QAAQ,EAAE,CAAC;QACrC,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,IAAa,OAAO;QAClB,OAAO,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC;CACF"}
|
|
@@ -1,190 +0,0 @@
|
|
|
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 { observer } from 'mobx-react-lite';
|
|
18
|
-
import {
|
|
19
|
-
Dialog,
|
|
20
|
-
Modal,
|
|
21
|
-
ModalBody,
|
|
22
|
-
ModalFooter,
|
|
23
|
-
ModalFooterButton,
|
|
24
|
-
ModalHeader,
|
|
25
|
-
PanelListItem,
|
|
26
|
-
PanelLoadingIndicator,
|
|
27
|
-
QuestionIcon,
|
|
28
|
-
clsx,
|
|
29
|
-
} from '@finos/legend-art';
|
|
30
|
-
import { useLegendDataCubeBaseStore } from './LegendDataCubeFrameworkProvider.js';
|
|
31
|
-
import { DataCubeSourceEditor } from './source/DataCubeSourceEditor.js';
|
|
32
|
-
import { useEffect, useRef, useState } from 'react';
|
|
33
|
-
import { DataCube } from '@finos/legend-data-cube';
|
|
34
|
-
import type { LegendDataCubeStore } from '../stores/LegendDataCubeEditorStore.js';
|
|
35
|
-
import type { LegendCubeViewer } from '../stores/source/LegendCubeViewer.js';
|
|
36
|
-
import { flowResult } from 'mobx';
|
|
37
|
-
|
|
38
|
-
const CreateQueryDialog = observer(
|
|
39
|
-
(props: { view: LegendCubeViewer; store: LegendDataCubeStore }) => {
|
|
40
|
-
const { store } = props;
|
|
41
|
-
const close = (): void => store.setSaveModal(false);
|
|
42
|
-
const [queryName, setQueryName] = useState('');
|
|
43
|
-
const create = (): void => {
|
|
44
|
-
flowResult(store.saveQuery(queryName)).catch(
|
|
45
|
-
store.applicationStore.alertUnhandledError,
|
|
46
|
-
);
|
|
47
|
-
};
|
|
48
|
-
const isEmptyName = !queryName;
|
|
49
|
-
// name
|
|
50
|
-
const nameInputRef = useRef<HTMLInputElement>(null);
|
|
51
|
-
const setFocus = (): void => {
|
|
52
|
-
nameInputRef.current?.focus();
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
const changeName: React.ChangeEventHandler<HTMLInputElement> = (event) => {
|
|
56
|
-
setQueryName(event.target.value);
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
useEffect(() => {
|
|
60
|
-
setTimeout(() => setFocus(), 1);
|
|
61
|
-
}, []);
|
|
62
|
-
return (
|
|
63
|
-
<Dialog
|
|
64
|
-
open={store.saveModal}
|
|
65
|
-
onClose={close}
|
|
66
|
-
classes={{
|
|
67
|
-
root: 'editor-modal__root-container',
|
|
68
|
-
container: 'editor-modal__container',
|
|
69
|
-
paper: 'editor-modal__content',
|
|
70
|
-
}}
|
|
71
|
-
>
|
|
72
|
-
<Modal darkMode={false} className="query-export">
|
|
73
|
-
<ModalHeader title="Create New Query" />
|
|
74
|
-
<ModalBody>
|
|
75
|
-
<PanelLoadingIndicator
|
|
76
|
-
isLoading={store.saveModalState.isInProgress}
|
|
77
|
-
/>
|
|
78
|
-
<PanelListItem>
|
|
79
|
-
<div className="input--with-validation">
|
|
80
|
-
<input
|
|
81
|
-
ref={nameInputRef}
|
|
82
|
-
className={clsx('input input--dark', {
|
|
83
|
-
'input--caution': false,
|
|
84
|
-
})}
|
|
85
|
-
spellCheck={false}
|
|
86
|
-
value={queryName}
|
|
87
|
-
onChange={changeName}
|
|
88
|
-
title="New Query Name"
|
|
89
|
-
/>
|
|
90
|
-
</div>
|
|
91
|
-
</PanelListItem>
|
|
92
|
-
</ModalBody>
|
|
93
|
-
<ModalFooter>
|
|
94
|
-
<ModalFooterButton
|
|
95
|
-
text="Create Query"
|
|
96
|
-
title="Create new query"
|
|
97
|
-
disabled={isEmptyName}
|
|
98
|
-
onClick={create}
|
|
99
|
-
/>
|
|
100
|
-
</ModalFooter>
|
|
101
|
-
</Modal>
|
|
102
|
-
</Dialog>
|
|
103
|
-
);
|
|
104
|
-
},
|
|
105
|
-
);
|
|
106
|
-
|
|
107
|
-
export const DataCubeEditor = observer(() => {
|
|
108
|
-
const dataCubeStore = useLegendDataCubeBaseStore();
|
|
109
|
-
const sourceSelector = dataCubeStore.sourceSelector;
|
|
110
|
-
|
|
111
|
-
useEffect(() => {
|
|
112
|
-
dataCubeStore.context.initialize();
|
|
113
|
-
}, [dataCubeStore]);
|
|
114
|
-
return (
|
|
115
|
-
<>
|
|
116
|
-
<div className="h-full w-full bg-white">
|
|
117
|
-
<div className="bg-sky-900">
|
|
118
|
-
<div className="mx-auto max-w-full px-2 sm:px-6 lg:px-8">
|
|
119
|
-
<div className="relative flex h-12 items-center justify-between">
|
|
120
|
-
<div className="flex flex-1 items-center justify-center sm:items-stretch sm:justify-start">
|
|
121
|
-
<div className="flex flex-shrink-0 items-center">
|
|
122
|
-
<div className="text-gray-300">Legend Data Cube</div>
|
|
123
|
-
</div>
|
|
124
|
-
</div>
|
|
125
|
-
<div className="md:block">
|
|
126
|
-
<div className="ml-4 flex items-center md:ml-6">
|
|
127
|
-
<button
|
|
128
|
-
type="button"
|
|
129
|
-
className="relative rounded-full bg-sky-900 p-1 text-gray-400 hover:text-white focus:outline-none focus:ring-2 focus:ring-white focus:ring-offset-2 focus:ring-offset-gray-800"
|
|
130
|
-
>
|
|
131
|
-
<QuestionIcon />
|
|
132
|
-
</button>
|
|
133
|
-
</div>
|
|
134
|
-
</div>
|
|
135
|
-
</div>
|
|
136
|
-
</div>
|
|
137
|
-
</div>
|
|
138
|
-
{dataCubeStore.cubeViewer ? (
|
|
139
|
-
<>
|
|
140
|
-
<div className="h-[calc(100%_-_30px)]">
|
|
141
|
-
<div className="h-12 w-full bg-gray-200">
|
|
142
|
-
<button
|
|
143
|
-
onClick={() => dataCubeStore.setSaveModal(true)}
|
|
144
|
-
type="button"
|
|
145
|
-
className="relative rounded-full bg-sky-900 p-1 text-gray-400 hover:text-white focus:outline-none focus:ring-2 focus:ring-white focus:ring-offset-2 focus:ring-offset-gray-800"
|
|
146
|
-
>
|
|
147
|
-
Save
|
|
148
|
-
</button>
|
|
149
|
-
</div>
|
|
150
|
-
<div className="h-[calc(100%_-_30px)]">
|
|
151
|
-
<DataCube engine={dataCubeStore.cubeViewer.engine} />
|
|
152
|
-
</div>
|
|
153
|
-
</div>
|
|
154
|
-
</>
|
|
155
|
-
) : (
|
|
156
|
-
<>
|
|
157
|
-
<div
|
|
158
|
-
onClick={() => sourceSelector.openModal()}
|
|
159
|
-
className="bg-white shadow"
|
|
160
|
-
>
|
|
161
|
-
<div className="mx-auto h-40 px-4 py-6 sm:px-6 lg:px-8">
|
|
162
|
-
<div className="group flex w-full flex-col items-center justify-center rounded-md border-2 border-dashed border-slate-300 py-3 text-base font-medium leading-6 text-slate-900 hover:cursor-pointer hover:border-solid hover:border-blue-500 hover:bg-white hover:text-blue-500">
|
|
163
|
-
<svg
|
|
164
|
-
className="mb-1 text-slate-400 group-hover:text-blue-500"
|
|
165
|
-
width="20"
|
|
166
|
-
height="20"
|
|
167
|
-
fill="currentColor"
|
|
168
|
-
aria-hidden="true"
|
|
169
|
-
>
|
|
170
|
-
<path d="M10 5a1 1 0 0 1 1 1v3h3a1 1 0 1 1 0 2h-3v3a1 1 0 1 1-2 0v-3H6a1 1 0 1 1 0-2h3V6a1 1 0 0 1 1-1Z" />
|
|
171
|
-
</svg>
|
|
172
|
-
Add Source
|
|
173
|
-
</div>
|
|
174
|
-
</div>
|
|
175
|
-
</div>
|
|
176
|
-
</>
|
|
177
|
-
)}
|
|
178
|
-
</div>
|
|
179
|
-
{sourceSelector.open && (
|
|
180
|
-
<DataCubeSourceEditor sourceBuilder={sourceSelector} />
|
|
181
|
-
)}
|
|
182
|
-
{dataCubeStore.cubeViewer && dataCubeStore.saveModal && (
|
|
183
|
-
<CreateQueryDialog
|
|
184
|
-
store={dataCubeStore}
|
|
185
|
-
view={dataCubeStore.cubeViewer}
|
|
186
|
-
/>
|
|
187
|
-
)}
|
|
188
|
-
</>
|
|
189
|
-
);
|
|
190
|
-
});
|
|
@@ -1,133 +0,0 @@
|
|
|
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 { observer } from 'mobx-react-lite';
|
|
18
|
-
import { type LegendDataCubeSourceBuilder } from '../../stores/source/LegendDataCubeSourceBuilder.js';
|
|
19
|
-
import { DataCubeSourceType } from '../../stores/source/CubeInputSourceLoader.js';
|
|
20
|
-
import {
|
|
21
|
-
Dialog,
|
|
22
|
-
Modal,
|
|
23
|
-
PanelLoadingIndicator,
|
|
24
|
-
TimesIcon,
|
|
25
|
-
cn,
|
|
26
|
-
} from '@finos/legend-art';
|
|
27
|
-
import { SavedQuerySourceEditor } from './SavedQuerySourceEditor.js';
|
|
28
|
-
import { SavedQueryInputSourceState } from '../../stores/source/SavedQueryInputSourceState.js';
|
|
29
|
-
import { useLegendDataCubeBaseStore } from '../LegendDataCubeFrameworkProvider.js';
|
|
30
|
-
import { flowResult } from 'mobx';
|
|
31
|
-
import type { DataCubeEngine } from '@finos/legend-data-cube';
|
|
32
|
-
import type { DataCubeGenericSource } from '../../stores/model/DataCubeGenericSource.js';
|
|
33
|
-
|
|
34
|
-
export const DataCubeSourceEditor = observer(
|
|
35
|
-
(props: { sourceBuilder: LegendDataCubeSourceBuilder }) => {
|
|
36
|
-
const { sourceBuilder } = props;
|
|
37
|
-
const store = useLegendDataCubeBaseStore();
|
|
38
|
-
const sourceState = sourceBuilder.sourceState;
|
|
39
|
-
const tabs = Object.values(DataCubeSourceType);
|
|
40
|
-
const selectedTab = sourceState.label;
|
|
41
|
-
const closeModal = (): void => sourceBuilder.close();
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<Dialog
|
|
45
|
-
open={sourceBuilder.open}
|
|
46
|
-
onClose={closeModal}
|
|
47
|
-
classes={{
|
|
48
|
-
root: 'query-loader__dialog',
|
|
49
|
-
container: 'query-loader__dialog__container',
|
|
50
|
-
}}
|
|
51
|
-
PaperProps={{
|
|
52
|
-
classes: { root: 'query-loader__dialog__body' },
|
|
53
|
-
}}
|
|
54
|
-
>
|
|
55
|
-
<Modal
|
|
56
|
-
darkMode={false}
|
|
57
|
-
className="modal query-loader__dialog__body__content"
|
|
58
|
-
>
|
|
59
|
-
<div className="flex h-20 cursor-default items-center justify-between border-b border-l-0 border-r-0 border-t-0 border-solid border-slate-300 p-5">
|
|
60
|
-
<div className="flex items-center">
|
|
61
|
-
<div className="flex items-center text-xl font-bold">
|
|
62
|
-
Data Cube Source
|
|
63
|
-
</div>
|
|
64
|
-
</div>
|
|
65
|
-
<div className="flex items-center">
|
|
66
|
-
<button
|
|
67
|
-
className="mr-1 flex h-3 w-3 items-center justify-center"
|
|
68
|
-
tabIndex={-1}
|
|
69
|
-
onClick={close}
|
|
70
|
-
>
|
|
71
|
-
<TimesIcon className="text-xl text-slate-400 hover:text-slate-800" />
|
|
72
|
-
</button>
|
|
73
|
-
</div>
|
|
74
|
-
</div>
|
|
75
|
-
<div className="relative h-[calc(100%_-_100px)] p-5">
|
|
76
|
-
<PanelLoadingIndicator
|
|
77
|
-
isLoading={Boolean(sourceState.buildCubeEngineState.isInProgress)}
|
|
78
|
-
/>
|
|
79
|
-
|
|
80
|
-
<div className="h-15 flex overflow-y-hidden border-b border-l-0 border-r-0 border-t-0 border-solid border-slate-300 px-2 pb-1 pt-2 hover:font-light">
|
|
81
|
-
{tabs.map((tab) => (
|
|
82
|
-
<button
|
|
83
|
-
key={tab}
|
|
84
|
-
onClick={() => sourceBuilder.changeSource(tab)}
|
|
85
|
-
className={cn(
|
|
86
|
-
'flex h-6 items-center justify-center whitespace-nowrap pl-2 text-sm hover:font-bold focus:z-10',
|
|
87
|
-
{
|
|
88
|
-
'border-b-2 border-l-0 border-r-0 border-t-0 border-solid border-sky-800':
|
|
89
|
-
tab === selectedTab,
|
|
90
|
-
},
|
|
91
|
-
)}
|
|
92
|
-
>
|
|
93
|
-
{tab}
|
|
94
|
-
</button>
|
|
95
|
-
))}
|
|
96
|
-
</div>
|
|
97
|
-
<div className="h-[calc(100%_-_35px)] w-full overflow-auto border border-neutral-300 bg-white">
|
|
98
|
-
<div className="theme__legacy-light">
|
|
99
|
-
{sourceState instanceof SavedQueryInputSourceState && (
|
|
100
|
-
<SavedQuerySourceEditor
|
|
101
|
-
savedQueryInputSourceState={sourceState}
|
|
102
|
-
/>
|
|
103
|
-
)}
|
|
104
|
-
</div>
|
|
105
|
-
</div>
|
|
106
|
-
</div>
|
|
107
|
-
<div className="flex h-20 items-center justify-end border-b-0 border-l-0 border-r-0 border-t border-solid border-slate-300 p-2 px-2">
|
|
108
|
-
<button
|
|
109
|
-
className="ml-2 h-10 w-20 rounded border border-neutral-400 bg-neutral-300 bg-sky-700 px-2 text-white hover:brightness-95 disabled:cursor-not-allowed disabled:border-neutral-300 disabled:bg-gray-200 disabled:text-white disabled:hover:brightness-100"
|
|
110
|
-
disabled={!sourceState.isValid}
|
|
111
|
-
onClick={() => {
|
|
112
|
-
flowResult(
|
|
113
|
-
sourceBuilder.inputSource(
|
|
114
|
-
(source: DataCubeGenericSource, engine: DataCubeEngine) =>
|
|
115
|
-
store.initializeView(source, engine),
|
|
116
|
-
),
|
|
117
|
-
).catch(store.context.applicationStore.alertUnhandledError);
|
|
118
|
-
}}
|
|
119
|
-
>
|
|
120
|
-
Open
|
|
121
|
-
</button>
|
|
122
|
-
<button
|
|
123
|
-
className="ml-2 h-10 w-20 rounded border border-neutral-400 bg-gray-500 px-2 text-white hover:brightness-95"
|
|
124
|
-
onClick={() => sourceBuilder.close()}
|
|
125
|
-
>
|
|
126
|
-
Close
|
|
127
|
-
</button>
|
|
128
|
-
</div>
|
|
129
|
-
</Modal>
|
|
130
|
-
</Dialog>
|
|
131
|
-
);
|
|
132
|
-
},
|
|
133
|
-
);
|
|
@@ -1,101 +0,0 @@
|
|
|
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 { observer } from 'mobx-react-lite';
|
|
18
|
-
import { useLegendDataCubeBaseStore } from '../LegendDataCubeFrameworkProvider.js';
|
|
19
|
-
import { useEffect } from 'react';
|
|
20
|
-
import { QuestionIcon } from '@finos/legend-art';
|
|
21
|
-
import { useParams } from '@finos/legend-application/browser';
|
|
22
|
-
import { DataCube } from '@finos/legend-data-cube';
|
|
23
|
-
import { guaranteeNonNullable } from '@finos/legend-shared';
|
|
24
|
-
import {
|
|
25
|
-
LEGEND_DATA_CUBE_ROUTE_PATTERN_TOKEN,
|
|
26
|
-
type ExistingDataCubeViewerPathParams,
|
|
27
|
-
} from '../../__lib__/LegendDataCubeNavigation.js';
|
|
28
|
-
import { flowResult } from 'mobx';
|
|
29
|
-
|
|
30
|
-
export const ExistingDataCubeQuery = observer(() => {
|
|
31
|
-
const dataCubeStore = useLegendDataCubeBaseStore();
|
|
32
|
-
const params = useParams<ExistingDataCubeViewerPathParams>();
|
|
33
|
-
const sourceSelector = dataCubeStore.sourceSelector;
|
|
34
|
-
const queryId = guaranteeNonNullable(
|
|
35
|
-
params[LEGEND_DATA_CUBE_ROUTE_PATTERN_TOKEN.DATA_CUBE_QUERY_ID],
|
|
36
|
-
);
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
flowResult(dataCubeStore.initialize(queryId)).catch(
|
|
39
|
-
dataCubeStore.applicationStore.alertUnhandledError,
|
|
40
|
-
);
|
|
41
|
-
}, [dataCubeStore, queryId]);
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<>
|
|
45
|
-
<div className="h-full w-full bg-white">
|
|
46
|
-
<div className="bg-sky-900">
|
|
47
|
-
<div className="mx-auto max-w-full px-2 sm:px-6 lg:px-8">
|
|
48
|
-
<div className="relative flex h-12 items-center justify-between">
|
|
49
|
-
<div className="flex flex-1 items-center justify-center sm:items-stretch sm:justify-start">
|
|
50
|
-
<div className="flex flex-shrink-0 items-center">
|
|
51
|
-
<div className="text-gray-300">Legend Data Cube</div>
|
|
52
|
-
</div>
|
|
53
|
-
</div>
|
|
54
|
-
<div className="md:block">
|
|
55
|
-
<div className="ml-4 flex items-center md:ml-6">
|
|
56
|
-
<button
|
|
57
|
-
type="button"
|
|
58
|
-
className="relative rounded-full bg-sky-900 p-1 text-gray-400 hover:text-white focus:outline-none focus:ring-2 focus:ring-white focus:ring-offset-2 focus:ring-offset-gray-800"
|
|
59
|
-
>
|
|
60
|
-
<QuestionIcon />
|
|
61
|
-
</button>
|
|
62
|
-
</div>
|
|
63
|
-
</div>
|
|
64
|
-
</div>
|
|
65
|
-
</div>
|
|
66
|
-
</div>
|
|
67
|
-
{dataCubeStore.cubeViewer ? (
|
|
68
|
-
<>
|
|
69
|
-
<div className="h-[calc(100%_-_30px)]">
|
|
70
|
-
<div className="h-[calc(100%_-_30px)]">
|
|
71
|
-
<DataCube engine={dataCubeStore.cubeViewer.engine} />
|
|
72
|
-
</div>
|
|
73
|
-
</div>
|
|
74
|
-
</>
|
|
75
|
-
) : (
|
|
76
|
-
<>
|
|
77
|
-
<div
|
|
78
|
-
onClick={() => sourceSelector.openModal()}
|
|
79
|
-
className="bg-white shadow"
|
|
80
|
-
>
|
|
81
|
-
<div className="mx-auto h-40 px-4 py-6 sm:px-6 lg:px-8">
|
|
82
|
-
<div className="group flex w-full flex-col items-center justify-center rounded-md border-2 border-dashed border-slate-300 py-3 text-base font-medium leading-6 text-slate-900 hover:cursor-pointer hover:border-solid hover:border-blue-500 hover:bg-white hover:text-blue-500">
|
|
83
|
-
<svg
|
|
84
|
-
className="mb-1 text-slate-400 group-hover:text-blue-500"
|
|
85
|
-
width="20"
|
|
86
|
-
height="20"
|
|
87
|
-
fill="currentColor"
|
|
88
|
-
aria-hidden="true"
|
|
89
|
-
>
|
|
90
|
-
<path d="M10 5a1 1 0 0 1 1 1v3h3a1 1 0 1 1 0 2h-3v3a1 1 0 1 1-2 0v-3H6a1 1 0 1 1 0-2h3V6a1 1 0 0 1 1-1Z" />
|
|
91
|
-
</svg>
|
|
92
|
-
Add Source
|
|
93
|
-
</div>
|
|
94
|
-
</div>
|
|
95
|
-
</div>
|
|
96
|
-
</>
|
|
97
|
-
)}
|
|
98
|
-
</div>
|
|
99
|
-
</>
|
|
100
|
-
);
|
|
101
|
-
});
|