@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.
Files changed (181) hide show
  1. package/lib/__lib__/LegendDataCubeNavigation.d.ts +5 -5
  2. package/lib/__lib__/LegendDataCubeNavigation.d.ts.map +1 -1
  3. package/lib/__lib__/LegendDataCubeNavigation.js +5 -5
  4. package/lib/__lib__/LegendDataCubeNavigation.js.map +1 -1
  5. package/lib/{stores/source/CubeInputSource.js → __lib__/LegendDataCubeSetting.d.ts} +6 -14
  6. package/lib/__lib__/LegendDataCubeSetting.d.ts.map +1 -0
  7. package/lib/__lib__/LegendDataCubeSetting.js +25 -0
  8. package/lib/__lib__/LegendDataCubeSetting.js.map +1 -0
  9. package/lib/{stores/model/DataCubeQueryContent.js → __lib__/LegendDataCubeUserData.d.ts} +4 -5
  10. package/lib/__lib__/LegendDataCubeUserData.d.ts.map +1 -0
  11. package/lib/{stores/model/DataCubeGenericSource.d.ts → __lib__/LegendDataCubeUserData.js} +6 -3
  12. package/lib/__lib__/LegendDataCubeUserData.js.map +1 -0
  13. package/lib/application/LegendDataCube.d.ts.map +1 -1
  14. package/lib/application/LegendDataCube.js.map +1 -1
  15. package/lib/application/LegendDataCubeApplicationConfig.d.ts +1 -1
  16. package/lib/application/LegendDataCubeApplicationConfig.d.ts.map +1 -1
  17. package/lib/application/LegendDataCubeApplicationConfig.js +3 -1
  18. package/lib/application/LegendDataCubeApplicationConfig.js.map +1 -1
  19. package/lib/application/LegendDataCubePluginManager.d.ts.map +1 -1
  20. package/lib/application/LegendDataCubePluginManager.js.map +1 -1
  21. package/lib/components/LegendDataCubeFrameworkProvider.d.ts +2 -2
  22. package/lib/components/LegendDataCubeFrameworkProvider.d.ts.map +1 -1
  23. package/lib/components/LegendDataCubeFrameworkProvider.js +5 -5
  24. package/lib/components/LegendDataCubeFrameworkProvider.js.map +1 -1
  25. package/lib/components/LegendDataCubeWebApplication.d.ts.map +1 -1
  26. package/lib/components/LegendDataCubeWebApplication.js +25 -6
  27. package/lib/components/LegendDataCubeWebApplication.js.map +1 -1
  28. package/lib/components/{source/DataCubeSourceEditor.d.ts → query-builder/LegendDataCubeNewQueryBuilder.d.ts} +4 -4
  29. package/lib/components/query-builder/LegendDataCubeNewQueryBuilder.d.ts.map +1 -0
  30. package/lib/components/query-builder/LegendDataCubeNewQueryBuilder.js +45 -0
  31. package/lib/components/query-builder/LegendDataCubeNewQueryBuilder.js.map +1 -0
  32. package/{src/stores/model/DataCubeGenericSource.ts → lib/components/query-builder/LegendDataCubeQueryBuilder.d.ts} +2 -2
  33. package/lib/components/query-builder/LegendDataCubeQueryBuilder.d.ts.map +1 -0
  34. package/lib/components/query-builder/LegendDataCubeQueryBuilder.js +85 -0
  35. package/lib/components/query-builder/LegendDataCubeQueryBuilder.js.map +1 -0
  36. package/lib/components/query-builder/LegendDataCubeQueryBuilderStoreProvider.d.ts +19 -0
  37. package/lib/components/query-builder/LegendDataCubeQueryBuilderStoreProvider.d.ts.map +1 -0
  38. package/lib/components/query-builder/LegendDataCubeQueryBuilderStoreProvider.js +33 -0
  39. package/lib/components/query-builder/LegendDataCubeQueryBuilderStoreProvider.js.map +1 -0
  40. package/lib/components/{source/ExistingDataCubeQuery.d.ts → query-builder/LegendDataCubeQueryLoader.d.ts} +2 -2
  41. package/lib/components/query-builder/LegendDataCubeQueryLoader.d.ts.map +1 -0
  42. package/lib/components/query-builder/LegendDataCubeQueryLoader.js +99 -0
  43. package/lib/components/query-builder/LegendDataCubeQueryLoader.js.map +1 -0
  44. package/lib/components/{DataCubeEditor.d.ts → query-builder/LegendDataCubeQuerySaver.d.ts} +2 -2
  45. package/lib/components/query-builder/LegendDataCubeQuerySaver.d.ts.map +1 -0
  46. package/lib/components/query-builder/LegendDataCubeQuerySaver.js +49 -0
  47. package/lib/components/query-builder/LegendDataCubeQuerySaver.js.map +1 -0
  48. package/lib/components/{source/SavedQuerySourceEditor.d.ts → query-builder/source-builder/AdhocQueryDataCubeSourceBuilder.d.ts} +4 -4
  49. package/lib/components/query-builder/source-builder/AdhocQueryDataCubeSourceBuilder.d.ts.map +1 -0
  50. package/lib/components/query-builder/source-builder/AdhocQueryDataCubeSourceBuilder.js +22 -0
  51. package/lib/components/query-builder/source-builder/AdhocQueryDataCubeSourceBuilder.js.map +1 -0
  52. package/lib/components/query-builder/source-builder/LegendQueryDataCubeSourceBuilder.d.ts +22 -0
  53. package/lib/components/query-builder/source-builder/LegendQueryDataCubeSourceBuilder.d.ts.map +1 -0
  54. package/lib/components/query-builder/source-builder/LegendQueryDataCubeSourceBuilder.js +97 -0
  55. package/lib/components/query-builder/source-builder/LegendQueryDataCubeSourceBuilder.js.map +1 -0
  56. package/lib/index.css +2 -2
  57. package/lib/index.css.map +1 -1
  58. package/lib/package.json +2 -2
  59. package/lib/stores/LegendDataCubeBaseStore.d.ts +41 -0
  60. package/lib/stores/LegendDataCubeBaseStore.d.ts.map +1 -0
  61. package/lib/stores/LegendDataCubeBaseStore.js +123 -0
  62. package/lib/stores/LegendDataCubeBaseStore.js.map +1 -0
  63. package/lib/stores/LegendDataCubeDataCubeEngine.d.ts +65 -0
  64. package/lib/stores/LegendDataCubeDataCubeEngine.d.ts.map +1 -0
  65. package/lib/stores/LegendDataCubeDataCubeEngine.js +249 -0
  66. package/lib/stores/LegendDataCubeDataCubeEngine.js.map +1 -0
  67. package/lib/stores/model/LegendQueryDataCubeSource.d.ts +32 -0
  68. package/lib/stores/model/LegendQueryDataCubeSource.d.ts.map +1 -0
  69. package/lib/stores/model/LegendQueryDataCubeSource.js +35 -0
  70. package/lib/stores/model/LegendQueryDataCubeSource.js.map +1 -0
  71. package/lib/stores/query-builder/LegendDataCubeNewQueryState.d.ts +34 -0
  72. package/lib/stores/query-builder/LegendDataCubeNewQueryState.d.ts.map +1 -0
  73. package/lib/stores/query-builder/LegendDataCubeNewQueryState.js +92 -0
  74. package/lib/stores/query-builder/LegendDataCubeNewQueryState.js.map +1 -0
  75. package/lib/stores/query-builder/LegendDataCubeQueryBuilderStore.d.ts +52 -0
  76. package/lib/stores/query-builder/LegendDataCubeQueryBuilderStore.d.ts.map +1 -0
  77. package/lib/stores/query-builder/LegendDataCubeQueryBuilderStore.js +211 -0
  78. package/lib/stores/query-builder/LegendDataCubeQueryBuilderStore.js.map +1 -0
  79. package/lib/stores/query-builder/LegendDataCubeQueryLoaderState.d.ts +54 -0
  80. package/lib/stores/query-builder/LegendDataCubeQueryLoaderState.d.ts.map +1 -0
  81. package/lib/stores/query-builder/LegendDataCubeQueryLoaderState.js +197 -0
  82. package/lib/stores/query-builder/LegendDataCubeQueryLoaderState.js.map +1 -0
  83. package/lib/stores/{model/DataCubeQueryContent.d.ts → query-builder/source-builder/AdhocQueryDataCubeSourceBuilderState.d.ts} +7 -7
  84. package/lib/stores/query-builder/source-builder/AdhocQueryDataCubeSourceBuilderState.d.ts.map +1 -0
  85. package/lib/stores/{model/LegendSavedQuerySource.js → query-builder/source-builder/AdhocQueryDataCubeSourceBuilderState.js} +12 -7
  86. package/lib/stores/query-builder/source-builder/AdhocQueryDataCubeSourceBuilderState.js.map +1 -0
  87. package/lib/stores/query-builder/source-builder/LegendDataCubeSourceBuilderState.d.ts +33 -0
  88. package/lib/stores/query-builder/source-builder/LegendDataCubeSourceBuilderState.d.ts.map +1 -0
  89. package/lib/stores/query-builder/source-builder/LegendDataCubeSourceBuilderState.js +31 -0
  90. package/lib/stores/query-builder/source-builder/LegendDataCubeSourceBuilderState.js.map +1 -0
  91. package/lib/stores/query-builder/source-builder/LegendQueryDataCubeSourceBuilderState.d.ts +31 -0
  92. package/lib/stores/query-builder/source-builder/LegendQueryDataCubeSourceBuilderState.d.ts.map +1 -0
  93. package/lib/stores/query-builder/source-builder/LegendQueryDataCubeSourceBuilderState.js +84 -0
  94. package/lib/stores/query-builder/source-builder/LegendQueryDataCubeSourceBuilderState.js.map +1 -0
  95. package/package.json +11 -11
  96. package/src/__lib__/LegendDataCubeNavigation.ts +7 -7
  97. package/src/{stores/model/DataCubeQueryContent.ts → __lib__/LegendDataCubeSetting.ts} +6 -6
  98. package/{lib/stores/model/DataCubeGenericSource.js → src/__lib__/LegendDataCubeUserData.ts} +5 -2
  99. package/src/application/LegendDataCube.tsx +1 -0
  100. package/src/application/LegendDataCubeApplicationConfig.ts +6 -4
  101. package/src/application/LegendDataCubePluginManager.ts +1 -0
  102. package/src/components/LegendDataCubeFrameworkProvider.tsx +7 -7
  103. package/src/components/LegendDataCubeWebApplication.tsx +48 -12
  104. package/src/components/query-builder/LegendDataCubeNewQueryBuilder.tsx +115 -0
  105. package/src/components/query-builder/LegendDataCubeQueryBuilder.tsx +213 -0
  106. package/src/components/query-builder/LegendDataCubeQueryBuilderStoreProvider.tsx +56 -0
  107. package/src/components/query-builder/LegendDataCubeQueryLoader.tsx +310 -0
  108. package/src/components/query-builder/LegendDataCubeQuerySaver.tsx +106 -0
  109. package/src/{stores/source/CubeInputSource.ts → components/query-builder/source-builder/AdhocQueryDataCubeSourceBuilder.tsx} +14 -19
  110. package/src/components/query-builder/source-builder/LegendQueryDataCubeSourceBuilder.tsx +313 -0
  111. package/src/stores/LegendDataCubeBaseStore.ts +198 -0
  112. package/src/stores/LegendDataCubeDataCubeEngine.ts +494 -0
  113. package/src/stores/model/LegendQueryDataCubeSource.ts +46 -0
  114. package/src/stores/query-builder/LegendDataCubeNewQueryState.tsx +139 -0
  115. package/src/stores/query-builder/LegendDataCubeQueryBuilderStore.tsx +296 -0
  116. package/src/stores/query-builder/LegendDataCubeQueryLoaderState.tsx +258 -0
  117. package/src/stores/{source/LegendCubeViewer.ts → query-builder/source-builder/AdhocQueryDataCubeSourceBuilderState.ts} +15 -8
  118. package/src/stores/query-builder/source-builder/LegendDataCubeSourceBuilderState.ts +40 -0
  119. package/src/stores/query-builder/source-builder/LegendQueryDataCubeSourceBuilderState.ts +125 -0
  120. package/tsconfig.json +18 -15
  121. package/lib/components/DataCubeEditor.d.ts.map +0 -1
  122. package/lib/components/DataCubeEditor.js +0 -59
  123. package/lib/components/DataCubeEditor.js.map +0 -1
  124. package/lib/components/source/DataCubeSourceEditor.d.ts.map +0 -1
  125. package/lib/components/source/DataCubeSourceEditor.js +0 -43
  126. package/lib/components/source/DataCubeSourceEditor.js.map +0 -1
  127. package/lib/components/source/ExistingDataCubeQuery.d.ts.map +0 -1
  128. package/lib/components/source/ExistingDataCubeQuery.js +0 -36
  129. package/lib/components/source/ExistingDataCubeQuery.js.map +0 -1
  130. package/lib/components/source/SavedQuerySourceEditor.d.ts.map +0 -1
  131. package/lib/components/source/SavedQuerySourceEditor.js +0 -25
  132. package/lib/components/source/SavedQuerySourceEditor.js.map +0 -1
  133. package/lib/stores/LegendDataCubeEditorStore.d.ts +0 -50
  134. package/lib/stores/LegendDataCubeEditorStore.d.ts.map +0 -1
  135. package/lib/stores/LegendDataCubeEditorStore.js +0 -153
  136. package/lib/stores/LegendDataCubeEditorStore.js.map +0 -1
  137. package/lib/stores/engine/LegendExecutionDataCubeEngine.d.ts +0 -52
  138. package/lib/stores/engine/LegendExecutionDataCubeEngine.d.ts.map +0 -1
  139. package/lib/stores/engine/LegendExecutionDataCubeEngine.js +0 -149
  140. package/lib/stores/engine/LegendExecutionDataCubeEngine.js.map +0 -1
  141. package/lib/stores/model/DataCubeGenericSource.d.ts.map +0 -1
  142. package/lib/stores/model/DataCubeGenericSource.js.map +0 -1
  143. package/lib/stores/model/DataCubeGenericSourceHelper.d.ts +0 -24
  144. package/lib/stores/model/DataCubeGenericSourceHelper.d.ts.map +0 -1
  145. package/lib/stores/model/DataCubeGenericSourceHelper.js +0 -58
  146. package/lib/stores/model/DataCubeGenericSourceHelper.js.map +0 -1
  147. package/lib/stores/model/DataCubeQueryContent.d.ts.map +0 -1
  148. package/lib/stores/model/DataCubeQueryContent.js.map +0 -1
  149. package/lib/stores/model/LegendSavedQuerySource.d.ts +0 -21
  150. package/lib/stores/model/LegendSavedQuerySource.d.ts.map +0 -1
  151. package/lib/stores/model/LegendSavedQuerySource.js.map +0 -1
  152. package/lib/stores/source/CubeInputSource.d.ts +0 -32
  153. package/lib/stores/source/CubeInputSource.d.ts.map +0 -1
  154. package/lib/stores/source/CubeInputSource.js.map +0 -1
  155. package/lib/stores/source/CubeInputSourceLoader.d.ts +0 -37
  156. package/lib/stores/source/CubeInputSourceLoader.d.ts.map +0 -1
  157. package/lib/stores/source/CubeInputSourceLoader.js +0 -39
  158. package/lib/stores/source/CubeInputSourceLoader.js.map +0 -1
  159. package/lib/stores/source/LegendCubeViewer.d.ts +0 -23
  160. package/lib/stores/source/LegendCubeViewer.d.ts.map +0 -1
  161. package/lib/stores/source/LegendCubeViewer.js +0 -24
  162. package/lib/stores/source/LegendCubeViewer.js.map +0 -1
  163. package/lib/stores/source/LegendDataCubeSourceBuilder.d.ts +0 -34
  164. package/lib/stores/source/LegendDataCubeSourceBuilder.d.ts.map +0 -1
  165. package/lib/stores/source/LegendDataCubeSourceBuilder.js +0 -70
  166. package/lib/stores/source/LegendDataCubeSourceBuilder.js.map +0 -1
  167. package/lib/stores/source/SavedQueryInputSourceState.d.ts +0 -35
  168. package/lib/stores/source/SavedQueryInputSourceState.d.ts.map +0 -1
  169. package/lib/stores/source/SavedQueryInputSourceState.js +0 -81
  170. package/lib/stores/source/SavedQueryInputSourceState.js.map +0 -1
  171. package/src/components/DataCubeEditor.tsx +0 -190
  172. package/src/components/source/DataCubeSourceEditor.tsx +0 -133
  173. package/src/components/source/ExistingDataCubeQuery.tsx +0 -101
  174. package/src/components/source/SavedQuerySourceEditor.tsx +0 -62
  175. package/src/stores/LegendDataCubeEditorStore.ts +0 -237
  176. package/src/stores/engine/LegendExecutionDataCubeEngine.ts +0 -267
  177. package/src/stores/model/DataCubeGenericSourceHelper.ts +0 -97
  178. package/src/stores/model/LegendSavedQuerySource.ts +0 -26
  179. package/src/stores/source/CubeInputSourceLoader.ts +0 -56
  180. package/src/stores/source/LegendDataCubeSourceBuilder.ts +0 -98
  181. package/src/stores/source/SavedQueryInputSourceState.ts +0 -142
@@ -13,11 +13,11 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { PlainObject } from '@finos/legend-shared';
17
- import type { DataCubeGenericSource } from './DataCubeGenericSource.js';
18
- export declare class DataCubeQueryConent {
19
- query: string | undefined;
20
- configuration: PlainObject<object> | undefined;
21
- source: DataCubeGenericSource;
16
+ import { type PlainObject } from '@finos/legend-shared';
17
+ import { LegendDataCubeSourceBuilderState, LegendDataCubeSourceBuilderType } from './LegendDataCubeSourceBuilderState.js';
18
+ export declare class AdhocQueryDataCubeSourceBuilderState extends LegendDataCubeSourceBuilderState {
19
+ get label(): LegendDataCubeSourceBuilderType;
20
+ get isValid(): boolean;
21
+ build(): Promise<PlainObject>;
22
22
  }
23
- //# sourceMappingURL=DataCubeQueryContent.d.ts.map
23
+ //# sourceMappingURL=AdhocQueryDataCubeSourceBuilderState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AdhocQueryDataCubeSourceBuilderState.d.ts","sourceRoot":"","sources":["../../../../src/stores/query-builder/source-builder/AdhocQueryDataCubeSourceBuilderState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EACL,gCAAgC,EAChC,+BAA+B,EAChC,MAAM,uCAAuC,CAAC;AAE/C,qBAAa,oCAAqC,SAAQ,gCAAgC;IACxF,IAAa,KAAK,IAAI,+BAA+B,CAEpD;IAED,IAAa,OAAO,IAAI,OAAO,CAE9B;IAEQ,KAAK,IAAI,OAAO,CAAC,WAAW,CAAC;CAGvC"}
@@ -13,12 +13,17 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { DataCubeGenericSource } from './DataCubeGenericSource.js';
17
- export class LegendSavedQuerySource extends DataCubeGenericSource {
18
- id;
19
- constructor(id) {
20
- super();
21
- this.id = id;
16
+ import {} from '@finos/legend-shared';
17
+ import { LegendDataCubeSourceBuilderState, LegendDataCubeSourceBuilderType, } from './LegendDataCubeSourceBuilderState.js';
18
+ export class AdhocQueryDataCubeSourceBuilderState extends LegendDataCubeSourceBuilderState {
19
+ get label() {
20
+ return LegendDataCubeSourceBuilderType.ADHOC_QUERY;
21
+ }
22
+ get isValid() {
23
+ return false;
24
+ }
25
+ build() {
26
+ throw new Error('Method not implemented.');
22
27
  }
23
28
  }
24
- //# sourceMappingURL=LegendSavedQuerySource.js.map
29
+ //# sourceMappingURL=AdhocQueryDataCubeSourceBuilderState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AdhocQueryDataCubeSourceBuilderState.js","sourceRoot":"","sources":["../../../../src/stores/query-builder/source-builder/AdhocQueryDataCubeSourceBuilderState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAoB,MAAM,sBAAsB,CAAC;AACxD,OAAO,EACL,gCAAgC,EAChC,+BAA+B,GAChC,MAAM,uCAAuC,CAAC;AAE/C,MAAM,OAAO,oCAAqC,SAAQ,gCAAgC;IACxF,IAAa,KAAK;QAChB,OAAO,+BAA+B,CAAC,WAAW,CAAC;IACrD,CAAC;IAED,IAAa,OAAO;QAClB,OAAO,KAAK,CAAC;IACf,CAAC;IAEQ,KAAK;QACZ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;CACF"}
@@ -0,0 +1,33 @@
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 { ActionState, type PlainObject } from '@finos/legend-shared';
17
+ import type { LegendDataCubeApplicationStore } from '../../LegendDataCubeBaseStore.js';
18
+ import type { LegendDataCubeNewQueryState } from '../LegendDataCubeNewQueryState.js';
19
+ import type { LegendDataCubeDataCubeEngine } from '../../LegendDataCubeDataCubeEngine.js';
20
+ export declare enum LegendDataCubeSourceBuilderType {
21
+ LEGEND_QUERY = "Legend Query",
22
+ ADHOC_QUERY = "Ad hoc Query"
23
+ }
24
+ export declare abstract class LegendDataCubeSourceBuilderState {
25
+ readonly application: LegendDataCubeApplicationStore;
26
+ readonly engine: LegendDataCubeDataCubeEngine;
27
+ readonly buildState: ActionState;
28
+ constructor(newQueryState: LegendDataCubeNewQueryState);
29
+ abstract get label(): LegendDataCubeSourceBuilderType;
30
+ abstract get isValid(): boolean;
31
+ abstract build(): Promise<PlainObject>;
32
+ }
33
+ //# sourceMappingURL=LegendDataCubeSourceBuilderState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LegendDataCubeSourceBuilderState.d.ts","sourceRoot":"","sources":["../../../../src/stores/query-builder/source-builder/LegendDataCubeSourceBuilderState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AACvF,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AACrF,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AAE1F,oBAAY,+BAA+B;IACzC,YAAY,iBAAiB;IAC7B,WAAW,iBAAiB;CAC7B;AAED,8BAAsB,gCAAgC;IACpD,QAAQ,CAAC,WAAW,EAAE,8BAA8B,CAAC;IACrD,QAAQ,CAAC,MAAM,EAAE,4BAA4B,CAAC;IAC9C,QAAQ,CAAC,UAAU,cAAwB;gBAE/B,aAAa,EAAE,2BAA2B;IAKtD,QAAQ,KAAK,KAAK,IAAI,+BAA+B,CAAC;IACtD,QAAQ,KAAK,OAAO,IAAI,OAAO,CAAC;IAChC,QAAQ,CAAC,KAAK,IAAI,OAAO,CAAC,WAAW,CAAC;CACvC"}
@@ -0,0 +1,31 @@
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 { ActionState } from '@finos/legend-shared';
17
+ export var LegendDataCubeSourceBuilderType;
18
+ (function (LegendDataCubeSourceBuilderType) {
19
+ LegendDataCubeSourceBuilderType["LEGEND_QUERY"] = "Legend Query";
20
+ LegendDataCubeSourceBuilderType["ADHOC_QUERY"] = "Ad hoc Query";
21
+ })(LegendDataCubeSourceBuilderType || (LegendDataCubeSourceBuilderType = {}));
22
+ export class LegendDataCubeSourceBuilderState {
23
+ application;
24
+ engine;
25
+ buildState = ActionState.create();
26
+ constructor(newQueryState) {
27
+ this.application = newQueryState.application;
28
+ this.engine = newQueryState.engine;
29
+ }
30
+ }
31
+ //# sourceMappingURL=LegendDataCubeSourceBuilderState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LegendDataCubeSourceBuilderState.js","sourceRoot":"","sources":["../../../../src/stores/query-builder/source-builder/LegendDataCubeSourceBuilderState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,WAAW,EAAoB,MAAM,sBAAsB,CAAC;AAKrE,MAAM,CAAN,IAAY,+BAGX;AAHD,WAAY,+BAA+B;IACzC,gEAA6B,CAAA;IAC7B,+DAA4B,CAAA;AAC9B,CAAC,EAHW,+BAA+B,KAA/B,+BAA+B,QAG1C;AAED,MAAM,OAAgB,gCAAgC;IAC3C,WAAW,CAAiC;IAC5C,MAAM,CAA+B;IACrC,UAAU,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC;IAE3C,YAAY,aAA0C;QACpD,IAAI,CAAC,WAAW,GAAG,aAAa,CAAC,WAAW,CAAC;QAC7C,IAAI,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC;IACrC,CAAC;CAKF"}
@@ -0,0 +1,31 @@
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 { type LightQuery } from '@finos/legend-graph';
17
+ import { QueryLoaderState } from '@finos/legend-query-builder';
18
+ import { LegendDataCubeSourceBuilderState, LegendDataCubeSourceBuilderType } from './LegendDataCubeSourceBuilderState.js';
19
+ import type { LegendDataCubeNewQueryState } from '../LegendDataCubeNewQueryState.js';
20
+ export declare class LegendQueryDataCubeSourceBuilderState extends LegendDataCubeSourceBuilderState {
21
+ readonly queryLoaderState: QueryLoaderState;
22
+ query?: LightQuery | undefined;
23
+ queryCode?: string | undefined;
24
+ constructor(newQueryState: LegendDataCubeNewQueryState);
25
+ setQuery(lightQuery: LightQuery): Promise<void>;
26
+ unsetQuery(): void;
27
+ get label(): LegendDataCubeSourceBuilderType;
28
+ get isValid(): boolean;
29
+ build(): Promise<import("@finos/legend-shared").PlainObject<T>>;
30
+ }
31
+ //# sourceMappingURL=LegendQueryDataCubeSourceBuilderState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LegendQueryDataCubeSourceBuilderState.d.ts","sourceRoot":"","sources":["../../../../src/stores/query-builder/source-builder/LegendQueryDataCubeSourceBuilderState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAOH,OAAO,EAGL,KAAK,UAAU,EAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,gBAAgB,EACjB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,gCAAgC,EAChC,+BAA+B,EAChC,MAAM,uCAAuC,CAAC;AAE/C,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAGrF,qBAAa,qCAAsC,SAAQ,gCAAgC;IACzF,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAE5C,KAAK,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;gBAEnB,aAAa,EAAE,2BAA2B;IAgChD,QAAQ,CAAC,UAAU,EAAE,UAAU;IA0BrC,UAAU,IAAI,IAAI;IAKlB,IAAa,KAAK,oCAEjB;IAED,IAAa,OAAO,IAAI,OAAO,CAE9B;IAEc,KAAK;CAQrB"}
@@ -0,0 +1,84 @@
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 { assertErrorThrown, IllegalStateError, LogEvent, } from '@finos/legend-shared';
17
+ import { QuerySearchSpecification, V1_Query, } from '@finos/legend-graph';
18
+ import { QUERY_LOADER_TYPEAHEAD_SEARCH_LIMIT, QueryLoaderState, } from '@finos/legend-query-builder';
19
+ import { action, makeObservable, observable, runInAction } from 'mobx';
20
+ import { LegendDataCubeSourceBuilderState, LegendDataCubeSourceBuilderType, } from './LegendDataCubeSourceBuilderState.js';
21
+ import { RawLegendQueryDataCubeSource } from '../../model/LegendQueryDataCubeSource.js';
22
+ import { APPLICATION_EVENT } from '@finos/legend-application';
23
+ export class LegendQueryDataCubeSourceBuilderState extends LegendDataCubeSourceBuilderState {
24
+ queryLoaderState;
25
+ query;
26
+ queryCode;
27
+ constructor(newQueryState) {
28
+ super(newQueryState);
29
+ makeObservable(this, {
30
+ query: observable,
31
+ unsetQuery: action,
32
+ queryCode: observable,
33
+ });
34
+ this.queryLoaderState = new QueryLoaderState(this.application, newQueryState.engine.graphManager, {
35
+ loadQuery: (query) => {
36
+ this.setQuery(query).catch((error) => this.engine.alertUnhandledError(error));
37
+ },
38
+ decorateSearchSpecification: (val) => val,
39
+ fetchDefaultQueries: async () => {
40
+ const searchSpecification = new QuerySearchSpecification();
41
+ searchSpecification.limit = QUERY_LOADER_TYPEAHEAD_SEARCH_LIMIT;
42
+ return newQueryState.engine.graphManager.searchQueries(QuerySearchSpecification.createDefault(undefined));
43
+ },
44
+ isReadOnly: true,
45
+ });
46
+ }
47
+ async setQuery(lightQuery) {
48
+ try {
49
+ const processedQuery = V1_Query.serialization.fromJson(await this.engine.engineServerClient.getQuery(lightQuery.id));
50
+ const queryCode = await this.engine.getValueSpecificationCode(await this.engine.parseValueSpecification(processedQuery.content), true);
51
+ runInAction(() => {
52
+ this.query = lightQuery;
53
+ this.queryCode = queryCode;
54
+ });
55
+ }
56
+ catch (error) {
57
+ assertErrorThrown(error);
58
+ this.engine.logError(LogEvent.create(APPLICATION_EVENT.GENERIC_FAILURE), `Can't get code for query with ID '${lightQuery.id}'`);
59
+ runInAction(() => {
60
+ this.query = lightQuery;
61
+ this.queryCode = undefined;
62
+ });
63
+ }
64
+ }
65
+ unsetQuery() {
66
+ this.query = undefined;
67
+ this.queryCode = undefined;
68
+ }
69
+ get label() {
70
+ return LegendDataCubeSourceBuilderType.LEGEND_QUERY;
71
+ }
72
+ get isValid() {
73
+ return Boolean(this.query);
74
+ }
75
+ async build() {
76
+ if (!this.query) {
77
+ throw new IllegalStateError('Query is missing');
78
+ }
79
+ const source = new RawLegendQueryDataCubeSource();
80
+ source.queryId = this.query.id;
81
+ return RawLegendQueryDataCubeSource.serialization.toJson(source);
82
+ }
83
+ }
84
+ //# sourceMappingURL=LegendQueryDataCubeSourceBuilderState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LegendQueryDataCubeSourceBuilderState.js","sourceRoot":"","sources":["../../../../src/stores/query-builder/source-builder/LegendQueryDataCubeSourceBuilderState.ts"],"names":[],"mappings":"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"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@finos/legend-application-data-cube",
3
- "version": "0.1.6",
4
- "description": "Legend Data Cube application core",
3
+ "version": "0.1.7",
4
+ "description": "Legend DataCube application core",
5
5
  "keywords": [
6
6
  "legend",
7
7
  "legend-application",
@@ -42,15 +42,15 @@
42
42
  "test:watch": "jest --watch"
43
43
  },
44
44
  "dependencies": {
45
- "@finos/legend-application": "16.0.15",
46
- "@finos/legend-art": "7.1.72",
47
- "@finos/legend-code-editor": "2.0.31",
48
- "@finos/legend-data-cube": "0.0.36",
49
- "@finos/legend-graph": "31.10.65",
50
- "@finos/legend-query-builder": "4.15.34",
51
- "@finos/legend-server-depot": "6.0.73",
52
- "@finos/legend-shared": "10.0.64",
53
- "@finos/legend-storage": "3.0.115",
45
+ "@finos/legend-application": "16.0.16",
46
+ "@finos/legend-art": "7.1.73",
47
+ "@finos/legend-code-editor": "2.0.32",
48
+ "@finos/legend-data-cube": "0.0.37",
49
+ "@finos/legend-graph": "32.0.0",
50
+ "@finos/legend-query-builder": "4.15.35",
51
+ "@finos/legend-server-depot": "6.0.74",
52
+ "@finos/legend-shared": "10.0.65",
53
+ "@finos/legend-storage": "3.0.116",
54
54
  "@types/react": "19.0.2",
55
55
  "@types/react-dom": "19.0.2",
56
56
  "mobx": "6.13.5",
@@ -17,19 +17,19 @@
17
17
  import { generatePath } from '@finos/legend-application/browser';
18
18
 
19
19
  export enum LEGEND_DATA_CUBE_ROUTE_PATTERN_TOKEN {
20
- DATA_CUBE_QUERY_ID = 'id',
20
+ QUERY_ID = 'queryId',
21
21
  }
22
22
 
23
23
  export const LEGEND_DATA_CUBE_ROUTE_PATTERN = Object.freeze({
24
- VIEW_EXISTING_QUERY: `/:${LEGEND_DATA_CUBE_ROUTE_PATTERN_TOKEN.DATA_CUBE_QUERY_ID}`,
24
+ QUERY_BUILDER: `/:${LEGEND_DATA_CUBE_ROUTE_PATTERN_TOKEN.QUERY_ID}?`,
25
25
  });
26
26
 
27
- export type ExistingDataCubeViewerPathParams = {
28
- [LEGEND_DATA_CUBE_ROUTE_PATTERN_TOKEN.DATA_CUBE_QUERY_ID]: string;
27
+ export type LegendDataCubeQueryBuilderQueryPathParams = {
28
+ [LEGEND_DATA_CUBE_ROUTE_PATTERN_TOKEN.QUERY_ID]: string;
29
29
  };
30
30
 
31
- export const generatedSavedQueryUrl = (id: string): string => {
32
- return generatePath(LEGEND_DATA_CUBE_ROUTE_PATTERN.VIEW_EXISTING_QUERY, {
33
- id,
31
+ export const generateQueryBuilderRoute = (queryId: string | null): string => {
32
+ return generatePath(LEGEND_DATA_CUBE_ROUTE_PATTERN.QUERY_BUILDER, {
33
+ [LEGEND_DATA_CUBE_ROUTE_PATTERN_TOKEN.QUERY_ID]: queryId,
34
34
  });
35
35
  };
@@ -14,11 +14,11 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import type { PlainObject } from '@finos/legend-shared';
18
- import type { DataCubeGenericSource } from './DataCubeGenericSource.js';
17
+ export enum LegendDataCubeSettingStorageKey {
18
+ DATA_CUBE = 'data-cube',
19
+ }
19
20
 
20
- export class DataCubeQueryConent {
21
- query: string | undefined;
22
- configuration: PlainObject<object> | undefined;
23
- source!: DataCubeGenericSource;
21
+ export enum LegendDataCubeSettingKey {
22
+ DEBUGGER__ENGINE_SERVER_CLIENT__ENABLE_COMPRESSION = 'debugger.engineServerClient.enableCompression',
23
+ DEBUGGER__ENGINE_SERVER_CLIENT__BASE_URL = 'debugger.engineServerClient.baseUrl',
24
24
  }
@@ -13,6 +13,9 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export class DataCubeGenericSource {
16
+
17
+ export const RECENTLY_VIEWED_QUERIES_LIMIT = 10;
18
+
19
+ export enum LegendDataCubeUserDataKey {
20
+ RECENTLY_VIEWED_QUERIES = 'recentlyViewedQueries',
17
21
  }
18
- //# sourceMappingURL=DataCubeGenericSource.js.map
@@ -55,6 +55,7 @@ export class LegendDataCube extends LegendApplication {
55
55
  ): Promise<LegendApplicationConfig> {
56
56
  return new LegendDataCubeApplicationConfig(input);
57
57
  }
58
+
58
59
  async loadApplication(
59
60
  applicationStore: ApplicationStore<
60
61
  LegendApplicationConfig,
@@ -35,7 +35,7 @@ export interface LegendDataCubeApplicationConfigurationData
35
35
  export class LegendDataCubeApplicationConfig extends LegendApplicationConfig {
36
36
  readonly engineServerUrl: string;
37
37
  readonly depotServerUrl: string;
38
- readonly engineQueryServerUrl: string;
38
+ readonly engineQueryServerUrl?: string | undefined;
39
39
 
40
40
  constructor(
41
41
  input: LegendApplicationConfigurationInput<LegendDataCubeApplicationConfigurationData>,
@@ -53,9 +53,11 @@ export class LegendDataCubeApplicationConfig extends LegendApplicationConfig {
53
53
  `Can't configure application: 'engine.url' field is missing or empty`,
54
54
  ),
55
55
  );
56
- this.engineQueryServerUrl = LegendApplicationConfig.resolveAbsoluteUrl(
57
- input.configData.engine.queryUrl,
58
- );
56
+ this.engineQueryServerUrl = input.configData.engine.queryUrl
57
+ ? LegendApplicationConfig.resolveAbsoluteUrl(
58
+ input.configData.engine.queryUrl,
59
+ )
60
+ : undefined;
59
61
  // depot
60
62
  assertNonNullable(
61
63
  input.configData.depot,
@@ -34,6 +34,7 @@ export class LegendDataCubePluginManager
34
34
  private constructor() {
35
35
  super();
36
36
  }
37
+
37
38
  registerPureProtocolProcessorPlugin(
38
39
  plugin: PureProtocolProcessorPlugin,
39
40
  ): void {
@@ -24,7 +24,7 @@ import {
24
24
  } from '@finos/legend-application';
25
25
  import type { LegendDataCubeApplicationConfig } from '../application/LegendDataCubeApplicationConfig.js';
26
26
  import type { LegendDataCubePluginManager } from '../application/LegendDataCubePluginManager.js';
27
- import { LegendDataCubeStore } from '../stores/LegendDataCubeEditorStore.js';
27
+ import { LegendDataCubeBaseStore } from '../stores/LegendDataCubeBaseStore.js';
28
28
 
29
29
  export const useLegendDataCubeApplicationStore = (): ApplicationStore<
30
30
  LegendDataCubeApplicationConfig,
@@ -36,15 +36,15 @@ export const useLegendDataCubeApplicationStore = (): ApplicationStore<
36
36
  >();
37
37
 
38
38
  const LegendDataCubeBaseStoreContext = createContext<
39
- LegendDataCubeStore | undefined
39
+ LegendDataCubeBaseStore | undefined
40
40
  >(undefined);
41
41
 
42
42
  const LegendDataCubeBaseStoreProvider: React.FC<{
43
43
  children: React.ReactNode;
44
44
  }> = ({ children }) => {
45
- const applicationStore = useLegendDataCubeApplicationStore();
45
+ const application = useLegendDataCubeApplicationStore();
46
46
  const store = useLocalObservable(
47
- () => new LegendDataCubeStore(applicationStore),
47
+ () => new LegendDataCubeBaseStore(application),
48
48
  );
49
49
  return (
50
50
  <LegendDataCubeBaseStoreContext.Provider value={store}>
@@ -53,16 +53,16 @@ const LegendDataCubeBaseStoreProvider: React.FC<{
53
53
  );
54
54
  };
55
55
 
56
- export const useLegendDataCubeBaseStore = (): LegendDataCubeStore =>
56
+ export const useLegendDataCubeBaseStore = (): LegendDataCubeBaseStore =>
57
57
  guaranteeNonNullable(
58
58
  useContext(LegendDataCubeBaseStoreContext),
59
- `Can't find Legend Data Cube base store in context`,
59
+ `Can't find Legend DataCube base store in context`,
60
60
  );
61
61
 
62
62
  export const LegendDataCubeFrameworkProvider: React.FC<{
63
63
  children: React.ReactNode;
64
64
  }> = ({ children }) => (
65
- <ApplicationFrameworkProvider>
65
+ <ApplicationFrameworkProvider simple={true}>
66
66
  <LegendDataCubeBaseStoreProvider>
67
67
  {children}
68
68
  </LegendDataCubeBaseStoreProvider>
@@ -14,24 +14,60 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { BrowserEnvironmentProvider } from '@finos/legend-application';
17
+ import {
18
+ APPLICATION_EVENT,
19
+ BrowserEnvironmentProvider,
20
+ useApplicationStore,
21
+ } from '@finos/legend-application';
18
22
  import { Route, Routes } from '@finos/legend-application/browser';
19
- import { LegendDataCubeFrameworkProvider } from './LegendDataCubeFrameworkProvider.js';
23
+ import {
24
+ LegendDataCubeFrameworkProvider,
25
+ useLegendDataCubeBaseStore,
26
+ } from './LegendDataCubeFrameworkProvider.js';
20
27
  import { observer } from 'mobx-react-lite';
21
- import { DataCubeEditor } from './DataCubeEditor.js';
22
- import { ExistingDataCubeQuery } from './source/ExistingDataCubeQuery.js';
28
+ import { LegendDataCubeQueryBuilder } from './query-builder/LegendDataCubeQueryBuilder.js';
23
29
  import { LEGEND_DATA_CUBE_ROUTE_PATTERN } from '../__lib__/LegendDataCubeNavigation.js';
30
+ import { LogEvent } from '@finos/legend-shared';
31
+ import { useEffect } from 'react';
24
32
 
25
33
  const LegendDataCubeWebApplicationRouter = observer(() => {
34
+ const application = useApplicationStore();
35
+ const store = useLegendDataCubeBaseStore();
36
+
37
+ useEffect(() => {
38
+ store
39
+ .initialize()
40
+ .catch((error) => store.engine.alertUnhandledError(error));
41
+ }, [store]);
42
+
43
+ useEffect(() => {
44
+ application.navigationService.navigator.blockNavigation(
45
+ // Only block navigation in production
46
+ // eslint-disable-next-line no-process-env
47
+ [() => process.env.NODE_ENV === 'production'],
48
+ undefined,
49
+ () => {
50
+ application.logService.warn(
51
+ LogEvent.create(APPLICATION_EVENT.NAVIGATION_BLOCKED),
52
+ `Navigation from the application is blocked`,
53
+ );
54
+ },
55
+ );
56
+ return (): void => {
57
+ application.navigationService.navigator.unblockNavigation();
58
+ };
59
+ }, [application]);
60
+
26
61
  return (
27
- <div className="app">
28
- <Routes>
29
- <Route
30
- path={LEGEND_DATA_CUBE_ROUTE_PATTERN.VIEW_EXISTING_QUERY}
31
- element={<ExistingDataCubeQuery />}
32
- />
33
- <Route path="/" element={<DataCubeEditor />} />
34
- </Routes>
62
+ <div className="h-full">
63
+ {store.initializeState.hasSucceeded && (
64
+ <Routes>
65
+ <Route
66
+ path={LEGEND_DATA_CUBE_ROUTE_PATTERN.QUERY_BUILDER}
67
+ element={<LegendDataCubeQueryBuilder />}
68
+ />
69
+ </Routes>
70
+ )}
35
71
  </div>
36
72
  );
37
73
  });
@@ -0,0 +1,115 @@
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 LegendDataCubeNewQueryState } from '../../stores/query-builder/LegendDataCubeNewQueryState.js';
19
+ import { LegendDataCubeSourceBuilderType } from '../../stores/query-builder/source-builder/LegendDataCubeSourceBuilderState.js';
20
+ import { useDropdownMenu } from '@finos/legend-art';
21
+ import {
22
+ FormButton,
23
+ FormDropdownMenu,
24
+ FormDropdownMenuItem,
25
+ FormDropdownMenuTrigger,
26
+ } from '@finos/legend-data-cube';
27
+ import { LegendQueryDataCubeSourceBuilderState } from '../../stores/query-builder/source-builder/LegendQueryDataCubeSourceBuilderState.js';
28
+ import { LegendQueryDataCubeSourceBuilder } from './source-builder/LegendQueryDataCubeSourceBuilder.js';
29
+ import { AdhocQueryDataCubeSourceBuilder } from './source-builder/AdhocQueryDataCubeSourceBuilder.js';
30
+ import { AdhocQueryDataCubeSourceBuilderState } from '../../stores/query-builder/source-builder/AdhocQueryDataCubeSourceBuilderState.js';
31
+
32
+ export const LegendDataCubeNewQueryBuilder = observer(
33
+ (props: { state: LegendDataCubeNewQueryState }) => {
34
+ const { state } = props;
35
+ const sourceBuilder = state.sourceBuilder;
36
+ const selectedSourceType = sourceBuilder.label;
37
+ const [
38
+ openSourceTypeDropdown,
39
+ closeSourceTypeDropdown,
40
+ sourceTypeDropdownProps,
41
+ sourceTypeDropdownPropsOpen,
42
+ ] = useDropdownMenu();
43
+
44
+ return (
45
+ <>
46
+ <div className="h-[calc(100%_-_40px)] w-full px-2 pt-2">
47
+ <div className="h-full w-full overflow-auto border border-neutral-300 bg-white">
48
+ <div className="h-full w-full select-none p-2">
49
+ <div className="flex h-6 w-full items-center">
50
+ <div className="flex h-full w-32 flex-shrink-0 items-center text-sm">
51
+ Choose Source Type:
52
+ </div>
53
+ <FormDropdownMenuTrigger
54
+ className="w-80"
55
+ onClick={openSourceTypeDropdown}
56
+ open={sourceTypeDropdownPropsOpen}
57
+ >
58
+ {selectedSourceType}
59
+ </FormDropdownMenuTrigger>
60
+ <FormDropdownMenu className="w-80" {...sourceTypeDropdownProps}>
61
+ {[
62
+ LegendDataCubeSourceBuilderType.LEGEND_QUERY,
63
+ LegendDataCubeSourceBuilderType.ADHOC_QUERY,
64
+ ].map((type) => (
65
+ <FormDropdownMenuItem
66
+ key={type}
67
+ onClick={() => {
68
+ state.changeSourceBuilder(type);
69
+ closeSourceTypeDropdown();
70
+ }}
71
+ autoFocus={type === selectedSourceType}
72
+ >
73
+ {type}
74
+ </FormDropdownMenuItem>
75
+ ))}
76
+ </FormDropdownMenu>
77
+ </div>
78
+ <div className="-ml-2 mb-2 mt-2 h-[1px] w-[calc(100%_+_16px)] bg-neutral-200" />
79
+ <div className="h-[calc(100%_-_40px)] w-full">
80
+ {sourceBuilder instanceof
81
+ LegendQueryDataCubeSourceBuilderState && (
82
+ <LegendQueryDataCubeSourceBuilder
83
+ sourceBuilder={sourceBuilder}
84
+ />
85
+ )}
86
+ {sourceBuilder instanceof
87
+ AdhocQueryDataCubeSourceBuilderState && (
88
+ <AdhocQueryDataCubeSourceBuilder
89
+ sourceBuilder={sourceBuilder}
90
+ />
91
+ )}
92
+ </div>
93
+ </div>
94
+ </div>
95
+ </div>
96
+ <div className="flex h-10 items-center justify-end px-2">
97
+ <FormButton onClick={() => state.display.close()}>Cancel</FormButton>
98
+ <FormButton
99
+ className="ml-2"
100
+ disabled={
101
+ !sourceBuilder.isValid || state.finalizeState.isInProgress
102
+ }
103
+ onClick={() => {
104
+ state
105
+ .finalize()
106
+ .catch((error) => state.engine.alertUnhandledError(error));
107
+ }}
108
+ >
109
+ OK
110
+ </FormButton>
111
+ </div>
112
+ </>
113
+ );
114
+ },
115
+ );