@finos/legend-application-data-cube 0.1.0

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.
Files changed (108) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +3 -0
  3. package/lib/application/Core_LegendDataCubeApplicationPlugin.d.ts +23 -0
  4. package/lib/application/Core_LegendDataCubeApplicationPlugin.d.ts.map +1 -0
  5. package/lib/application/Core_LegendDataCubeApplicationPlugin.js +35 -0
  6. package/lib/application/Core_LegendDataCubeApplicationPlugin.js.map +1 -0
  7. package/lib/application/Core_LegendDataCube_LegendApplicationPlugin.d.ts +19 -0
  8. package/lib/application/Core_LegendDataCube_LegendApplicationPlugin.d.ts.map +1 -0
  9. package/lib/application/Core_LegendDataCube_LegendApplicationPlugin.js +19 -0
  10. package/lib/application/Core_LegendDataCube_LegendApplicationPlugin.js.map +1 -0
  11. package/lib/application/LegendDataCube.d.ts +26 -0
  12. package/lib/application/LegendDataCube.d.ts.map +1 -0
  13. package/lib/application/LegendDataCube.js +41 -0
  14. package/lib/application/LegendDataCube.js.map +1 -0
  15. package/lib/application/LegendDataCubeApplicationConfig.d.ts +33 -0
  16. package/lib/application/LegendDataCubeApplicationConfig.d.ts.map +1 -0
  17. package/lib/application/LegendDataCubeApplicationConfig.js +36 -0
  18. package/lib/application/LegendDataCubeApplicationConfig.js.map +1 -0
  19. package/lib/application/LegendDataCubeApplicationPlugin.d.ts +26 -0
  20. package/lib/application/LegendDataCubeApplicationPlugin.d.ts.map +1 -0
  21. package/lib/application/LegendDataCubeApplicationPlugin.js +28 -0
  22. package/lib/application/LegendDataCubeApplicationPlugin.js.map +1 -0
  23. package/lib/application/LegendDataCubePluginManager.d.ts +32 -0
  24. package/lib/application/LegendDataCubePluginManager.d.ts.map +1 -0
  25. package/lib/application/LegendDataCubePluginManager.js +47 -0
  26. package/lib/application/LegendDataCubePluginManager.js.map +1 -0
  27. package/lib/components/DataCubeEditor.d.ts +19 -0
  28. package/lib/components/DataCubeEditor.d.ts.map +1 -0
  29. package/lib/components/DataCubeEditor.js +31 -0
  30. package/lib/components/DataCubeEditor.js.map +1 -0
  31. package/lib/components/LegendDataCubeFrameworkProvider.d.ts +25 -0
  32. package/lib/components/LegendDataCubeFrameworkProvider.d.ts.map +1 -0
  33. package/lib/components/LegendDataCubeFrameworkProvider.js +31 -0
  34. package/lib/components/LegendDataCubeFrameworkProvider.js.map +1 -0
  35. package/lib/components/LegendDataCubeWebApplication.d.ts +21 -0
  36. package/lib/components/LegendDataCubeWebApplication.d.ts.map +1 -0
  37. package/lib/components/LegendDataCubeWebApplication.js +29 -0
  38. package/lib/components/LegendDataCubeWebApplication.js.map +1 -0
  39. package/lib/components/source/DataCubeSourceEditor.d.ts +22 -0
  40. package/lib/components/source/DataCubeSourceEditor.d.ts.map +1 -0
  41. package/lib/components/source/DataCubeSourceEditor.js +43 -0
  42. package/lib/components/source/DataCubeSourceEditor.js.map +1 -0
  43. package/lib/components/source/SavedQuerySourceEditor.d.ts +22 -0
  44. package/lib/components/source/SavedQuerySourceEditor.d.ts.map +1 -0
  45. package/lib/components/source/SavedQuerySourceEditor.js +25 -0
  46. package/lib/components/source/SavedQuerySourceEditor.js.map +1 -0
  47. package/lib/index.css +17 -0
  48. package/lib/index.css.map +1 -0
  49. package/lib/index.d.ts +19 -0
  50. package/lib/index.d.ts.map +1 -0
  51. package/lib/index.js +19 -0
  52. package/lib/index.js.map +1 -0
  53. package/lib/package.json +81 -0
  54. package/lib/stores/LegendDataCubeEditorStore.d.ts +44 -0
  55. package/lib/stores/LegendDataCubeEditorStore.d.ts.map +1 -0
  56. package/lib/stores/LegendDataCubeEditorStore.js +91 -0
  57. package/lib/stores/LegendDataCubeEditorStore.js.map +1 -0
  58. package/lib/stores/engine/LegendExecutionDataCubeEngine.d.ts +46 -0
  59. package/lib/stores/engine/LegendExecutionDataCubeEngine.d.ts.map +1 -0
  60. package/lib/stores/engine/LegendExecutionDataCubeEngine.js +145 -0
  61. package/lib/stores/engine/LegendExecutionDataCubeEngine.js.map +1 -0
  62. package/lib/stores/source/CubeInputSource.d.ts +38 -0
  63. package/lib/stores/source/CubeInputSource.d.ts.map +1 -0
  64. package/lib/stores/source/CubeInputSource.js +40 -0
  65. package/lib/stores/source/CubeInputSource.js.map +1 -0
  66. package/lib/stores/source/CubeInputSourceLoader.d.ts +37 -0
  67. package/lib/stores/source/CubeInputSourceLoader.d.ts.map +1 -0
  68. package/lib/stores/source/CubeInputSourceLoader.js +40 -0
  69. package/lib/stores/source/CubeInputSourceLoader.js.map +1 -0
  70. package/lib/stores/source/LegendCubeViewer.d.ts +23 -0
  71. package/lib/stores/source/LegendCubeViewer.d.ts.map +1 -0
  72. package/lib/stores/source/LegendCubeViewer.js +24 -0
  73. package/lib/stores/source/LegendCubeViewer.js.map +1 -0
  74. package/lib/stores/source/LegendDataCubeSourceBuilder.d.ts +34 -0
  75. package/lib/stores/source/LegendDataCubeSourceBuilder.d.ts.map +1 -0
  76. package/lib/stores/source/LegendDataCubeSourceBuilder.js +70 -0
  77. package/lib/stores/source/LegendDataCubeSourceBuilder.js.map +1 -0
  78. package/lib/stores/source/SavedDepotInputSourceState.d.ts +47 -0
  79. package/lib/stores/source/SavedDepotInputSourceState.d.ts.map +1 -0
  80. package/lib/stores/source/SavedDepotInputSourceState.js +77 -0
  81. package/lib/stores/source/SavedDepotInputSourceState.js.map +1 -0
  82. package/lib/stores/source/SavedQueryInputSourceState.d.ts +35 -0
  83. package/lib/stores/source/SavedQueryInputSourceState.d.ts.map +1 -0
  84. package/lib/stores/source/SavedQueryInputSourceState.js +81 -0
  85. package/lib/stores/source/SavedQueryInputSourceState.js.map +1 -0
  86. package/package.json +81 -0
  87. package/src/application/Core_LegendDataCubeApplicationPlugin.ts +38 -0
  88. package/src/application/Core_LegendDataCube_LegendApplicationPlugin.ts +19 -0
  89. package/src/application/LegendDataCube.tsx +70 -0
  90. package/src/application/LegendDataCubeApplicationConfig.ts +74 -0
  91. package/src/application/LegendDataCubeApplicationPlugin.ts +30 -0
  92. package/src/application/LegendDataCubePluginManager.ts +66 -0
  93. package/src/components/DataCubeEditor.tsx +93 -0
  94. package/src/components/LegendDataCubeFrameworkProvider.tsx +70 -0
  95. package/src/components/LegendDataCubeWebApplication.tsx +45 -0
  96. package/src/components/source/DataCubeSourceEditor.tsx +133 -0
  97. package/src/components/source/SavedQuerySourceEditor.tsx +62 -0
  98. package/src/index.ts +19 -0
  99. package/src/stores/LegendDataCubeEditorStore.ts +120 -0
  100. package/src/stores/engine/LegendExecutionDataCubeEngine.ts +257 -0
  101. package/src/stores/source/CubeInputSource.ts +47 -0
  102. package/src/stores/source/CubeInputSourceLoader.ts +56 -0
  103. package/src/stores/source/LegendCubeViewer.ts +28 -0
  104. package/src/stores/source/LegendDataCubeSourceBuilder.ts +98 -0
  105. package/src/stores/source/SavedDepotInputSourceState.ts +103 -0
  106. package/src/stores/source/SavedQueryInputSourceState.ts +144 -0
  107. package/tsconfig.json +82 -0
  108. package/tsconfig.package.json +54 -0
@@ -0,0 +1,74 @@
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 {
18
+ LegendApplicationConfig,
19
+ type LegendApplicationConfigurationData,
20
+ type LegendApplicationConfigurationInput,
21
+ } from '@finos/legend-application';
22
+ import {
23
+ assertNonNullable,
24
+ guaranteeNonEmptyString,
25
+ } from '@finos/legend-shared';
26
+
27
+ export interface LegendDataCubeApplicationConfigurationData
28
+ extends LegendApplicationConfigurationData {
29
+ depot: {
30
+ url: string;
31
+ };
32
+ engine: { url: string; queryUrl: string };
33
+ }
34
+
35
+ export class LegendDataCubeApplicationConfig extends LegendApplicationConfig {
36
+ readonly engineServerUrl: string;
37
+ readonly depotServerUrl: string;
38
+ readonly engineQueryServerUrl: string;
39
+
40
+ constructor(
41
+ input: LegendApplicationConfigurationInput<LegendDataCubeApplicationConfigurationData>,
42
+ ) {
43
+ super(input);
44
+
45
+ // engine
46
+ assertNonNullable(
47
+ input.configData.engine,
48
+ `Can't configure application: 'engine' field is missing`,
49
+ );
50
+ this.engineServerUrl = LegendApplicationConfig.resolveAbsoluteUrl(
51
+ guaranteeNonEmptyString(
52
+ input.configData.engine.url,
53
+ `Can't configure application: 'engine.url' field is missing or empty`,
54
+ ),
55
+ );
56
+ this.engineQueryServerUrl = LegendApplicationConfig.resolveAbsoluteUrl(
57
+ input.configData.engine.queryUrl,
58
+ );
59
+ // depot
60
+ assertNonNullable(
61
+ input.configData.depot,
62
+ `Can't configure application: 'depot' field is missing`,
63
+ );
64
+ this.depotServerUrl = LegendApplicationConfig.resolveAbsoluteUrl(
65
+ guaranteeNonEmptyString(
66
+ input.configData.depot.url,
67
+ `Can't configure application: 'depot.url' field is missing or empty`,
68
+ ),
69
+ );
70
+ }
71
+ getDefaultApplicationStorageKey(): string {
72
+ return 'legend-data-cube';
73
+ }
74
+ }
@@ -0,0 +1,30 @@
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 { LegendApplicationPlugin } from '@finos/legend-application';
18
+ import { type LegendDataCubePluginManager } from './LegendDataCubePluginManager.js';
19
+
20
+ export class LegendDataCubeApplicationPlugin extends LegendApplicationPlugin {
21
+ /**
22
+ * This helps to better type-check for this empty abtract type
23
+ * See https://github.com/finos/legend-studio/blob/master/docs/technical/typescript-usage.md#understand-typescript-structual-type-system
24
+ */
25
+ private readonly _$nominalTypeBrand!: 'LegendDataCubeApplicationPlugin';
26
+
27
+ install(pluginManager: LegendDataCubePluginManager): void {
28
+ pluginManager.registerApplicationPlugin(this);
29
+ }
30
+ }
@@ -0,0 +1,66 @@
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 { LegendApplicationPluginManager } from '@finos/legend-application';
18
+ import { type LegendDataCubeApplicationPlugin } from './LegendDataCubeApplicationPlugin.js';
19
+ import type {
20
+ GraphManagerPluginManager,
21
+ PureGraphManagerPlugin,
22
+ PureGraphPlugin,
23
+ PureProtocolProcessorPlugin,
24
+ } from '@finos/legend-graph';
25
+
26
+ export class LegendDataCubePluginManager
27
+ extends LegendApplicationPluginManager<LegendDataCubeApplicationPlugin>
28
+ implements GraphManagerPluginManager
29
+ {
30
+ private pureProtocolProcessorPlugins: PureProtocolProcessorPlugin[] = [];
31
+ private pureGraphManagerPlugins: PureGraphManagerPlugin[] = [];
32
+ private pureGraphPlugins: PureGraphPlugin[] = [];
33
+
34
+ private constructor() {
35
+ super();
36
+ }
37
+ registerPureProtocolProcessorPlugin(
38
+ plugin: PureProtocolProcessorPlugin,
39
+ ): void {
40
+ this.pureProtocolProcessorPlugins.push(plugin);
41
+ }
42
+
43
+ registerPureGraphManagerPlugin(plugin: PureGraphManagerPlugin): void {
44
+ this.pureGraphManagerPlugins.push(plugin);
45
+ }
46
+
47
+ registerPureGraphPlugin(plugin: PureGraphPlugin): void {
48
+ this.pureGraphPlugins.push(plugin);
49
+ }
50
+
51
+ getPureGraphManagerPlugins(): PureGraphManagerPlugin[] {
52
+ return [...this.pureGraphManagerPlugins];
53
+ }
54
+
55
+ getPureProtocolProcessorPlugins(): PureProtocolProcessorPlugin[] {
56
+ return [...this.pureProtocolProcessorPlugins];
57
+ }
58
+
59
+ getPureGraphPlugins(): PureGraphPlugin[] {
60
+ return [...this.pureGraphPlugins];
61
+ }
62
+
63
+ static create(): LegendDataCubePluginManager {
64
+ return new LegendDataCubePluginManager();
65
+ }
66
+ }
@@ -0,0 +1,93 @@
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 { QuestionIcon } from '@finos/legend-art';
19
+ import { useLegendDataCubeBaseStore } from './LegendDataCubeFrameworkProvider.js';
20
+ import { DataCubeSourceEditor } from './source/DataCubeSourceEditor.js';
21
+ import { useEffect } from 'react';
22
+ import { DataCube } from '@finos/legend-data-cube';
23
+
24
+ export const DataCubeEditor = observer(() => {
25
+ const dataCubeStore = useLegendDataCubeBaseStore();
26
+ const sourceSelector = dataCubeStore.sourceSelector;
27
+
28
+ useEffect(() => {
29
+ dataCubeStore.context.initialize();
30
+ }, [dataCubeStore]);
31
+ return (
32
+ <>
33
+ <div className="h-full w-full bg-white">
34
+ <div className="bg-sky-900">
35
+ <div className="mx-auto max-w-full px-2 sm:px-6 lg:px-8">
36
+ <div className="relative flex h-12 items-center justify-between">
37
+ <div className="flex flex-1 items-center justify-center sm:items-stretch sm:justify-start">
38
+ <div className="flex flex-shrink-0 items-center">
39
+ <div className="text-gray-300">Legend Data Cube</div>
40
+ </div>
41
+ </div>
42
+ <div className="md:block">
43
+ <div className="ml-4 flex items-center md:ml-6">
44
+ <button
45
+ type="button"
46
+ 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"
47
+ >
48
+ <QuestionIcon />
49
+ </button>
50
+ </div>
51
+ </div>
52
+ </div>
53
+ </div>
54
+ </div>
55
+ {dataCubeStore.cubeViewer ? (
56
+ <>
57
+ <div className="h-[calc(100%_-_30px)]">
58
+ <div className="h-12 w-full bg-gray-200"></div>
59
+ <div className="h-[calc(100%_-_30px)]">
60
+ <DataCube engine={dataCubeStore.cubeViewer.engine} />
61
+ </div>
62
+ </div>
63
+ </>
64
+ ) : (
65
+ <>
66
+ <div
67
+ onClick={() => sourceSelector.openModal()}
68
+ className="bg-white shadow"
69
+ >
70
+ <div className="mx-auto h-40 px-4 py-6 sm:px-6 lg:px-8">
71
+ <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">
72
+ <svg
73
+ className="mb-1 text-slate-400 group-hover:text-blue-500"
74
+ width="20"
75
+ height="20"
76
+ fill="currentColor"
77
+ aria-hidden="true"
78
+ >
79
+ <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" />
80
+ </svg>
81
+ Add Source
82
+ </div>
83
+ </div>
84
+ </div>
85
+ </>
86
+ )}
87
+ </div>
88
+ {sourceSelector.open && (
89
+ <DataCubeSourceEditor sourceBuilder={sourceSelector} />
90
+ )}
91
+ </>
92
+ );
93
+ });
@@ -0,0 +1,70 @@
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 { createContext, useContext } from 'react';
18
+ import { useLocalObservable } from 'mobx-react-lite';
19
+ import { guaranteeNonNullable } from '@finos/legend-shared';
20
+ import {
21
+ type ApplicationStore,
22
+ useApplicationStore,
23
+ ApplicationFrameworkProvider,
24
+ } from '@finos/legend-application';
25
+ import type { LegendDataCubeApplicationConfig } from '../application/LegendDataCubeApplicationConfig.js';
26
+ import type { LegendDataCubePluginManager } from '../application/LegendDataCubePluginManager.js';
27
+ import { LegendDataCubeStore } from '../stores/LegendDataCubeEditorStore.js';
28
+
29
+ export const useLegendDataCubeApplicationStore = (): ApplicationStore<
30
+ LegendDataCubeApplicationConfig,
31
+ LegendDataCubePluginManager
32
+ > =>
33
+ useApplicationStore<
34
+ LegendDataCubeApplicationConfig,
35
+ LegendDataCubePluginManager
36
+ >();
37
+
38
+ const LegendDataCubeBaseStoreContext = createContext<
39
+ LegendDataCubeStore | undefined
40
+ >(undefined);
41
+
42
+ const LegendDataCubeBaseStoreProvider: React.FC<{
43
+ children: React.ReactNode;
44
+ }> = ({ children }) => {
45
+ const applicationStore = useLegendDataCubeApplicationStore();
46
+ const store = useLocalObservable(
47
+ () => new LegendDataCubeStore(applicationStore),
48
+ );
49
+ return (
50
+ <LegendDataCubeBaseStoreContext.Provider value={store}>
51
+ {children}
52
+ </LegendDataCubeBaseStoreContext.Provider>
53
+ );
54
+ };
55
+
56
+ export const useLegendDataCubeBaseStore = (): LegendDataCubeStore =>
57
+ guaranteeNonNullable(
58
+ useContext(LegendDataCubeBaseStoreContext),
59
+ `Can't find Legend Data Cube base store in context`,
60
+ );
61
+
62
+ export const LegendDataCubeFrameworkProvider: React.FC<{
63
+ children: React.ReactNode;
64
+ }> = ({ children }) => (
65
+ <ApplicationFrameworkProvider>
66
+ <LegendDataCubeBaseStoreProvider>
67
+ {children}
68
+ </LegendDataCubeBaseStoreProvider>
69
+ </ApplicationFrameworkProvider>
70
+ );
@@ -0,0 +1,45 @@
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 { BrowserEnvironmentProvider } from '@finos/legend-application';
18
+ import { Route, Routes } from '@finos/legend-application/browser';
19
+ import { LegendDataCubeFrameworkProvider } from './LegendDataCubeFrameworkProvider.js';
20
+ import { observer } from 'mobx-react-lite';
21
+ import { DataCubeEditor } from './DataCubeEditor.js';
22
+
23
+ const LegendDataCubeWebApplicationRouter = observer(() => {
24
+ return (
25
+ <div className="app">
26
+ <Routes>
27
+ <Route path="*" element={<DataCubeEditor />} />
28
+ </Routes>
29
+ </div>
30
+ );
31
+ });
32
+
33
+ export const LegendDataCubeWebApplication = observer(
34
+ (props: { baseUrl: string }) => {
35
+ const { baseUrl } = props;
36
+
37
+ return (
38
+ <BrowserEnvironmentProvider baseUrl={baseUrl}>
39
+ <LegendDataCubeFrameworkProvider>
40
+ <LegendDataCubeWebApplicationRouter />
41
+ </LegendDataCubeFrameworkProvider>
42
+ </BrowserEnvironmentProvider>
43
+ );
44
+ },
45
+ );
@@ -0,0 +1,133 @@
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 { CubeInputSource } from '../../stores/source/CubeInputSource.js';
32
+ import type { DataCubeEngine } from '@finos/legend-data-cube';
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: CubeInputSource, 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
+ );
@@ -0,0 +1,62 @@
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 { QueryLoader } from '@finos/legend-query-builder';
19
+ import type { SavedQueryInputSourceState } from '../../stores/source/SavedQueryInputSourceState.js';
20
+ import { generateGAVCoordinates } from '@finos/legend-storage';
21
+
22
+ export const SavedQuerySourceEditor = observer(
23
+ (props: { savedQueryInputSourceState: SavedQueryInputSourceState }) => {
24
+ const { savedQueryInputSourceState } = props;
25
+ const savedQuery = savedQueryInputSourceState.query;
26
+
27
+ return (
28
+ <div>
29
+ {savedQuery ? (
30
+ <div className="p-3">
31
+ <div className="text-l font-bold">Saved Query</div>
32
+ <div className="">
33
+ <div className="flex pt-px">
34
+ <div className="font-bold">Name:</div>
35
+ <div>{savedQuery.name}</div>
36
+ </div>
37
+ <div className="flex pt-px">
38
+ <div className="font-bold">Project:</div>
39
+ <div>
40
+ {generateGAVCoordinates(
41
+ savedQuery.groupId,
42
+ savedQuery.artifactId,
43
+ savedQuery.versionId,
44
+ )}
45
+ </div>
46
+ </div>
47
+ <div className="flex pt-px">
48
+ <div className="font-bold">Owner:</div>
49
+ <div>{savedQuery.owner}</div>
50
+ </div>
51
+ </div>
52
+ </div>
53
+ ) : (
54
+ <QueryLoader
55
+ queryLoaderState={savedQueryInputSourceState.queryLoaderState}
56
+ loadActionLabel={'Open'}
57
+ />
58
+ )}
59
+ </div>
60
+ );
61
+ },
62
+ );
package/src/index.ts ADDED
@@ -0,0 +1,19 @@
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
+ export * from './application/LegendDataCube.js';
18
+ export * from './application/LegendDataCubeApplicationConfig.js';
19
+ export * from './application/LegendDataCubePluginManager.js';