@finos/legend-query-builder 3.0.7 → 3.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. package/lib/__lib__/QueryBuilderDocumentation.d.ts +0 -1
  2. package/lib/__lib__/QueryBuilderDocumentation.d.ts.map +1 -1
  3. package/lib/__lib__/QueryBuilderDocumentation.js +0 -1
  4. package/lib/__lib__/QueryBuilderDocumentation.js.map +1 -1
  5. package/lib/__lib__/QueryBuilderEvent.d.ts +18 -0
  6. package/lib/__lib__/QueryBuilderEvent.d.ts.map +1 -1
  7. package/lib/__lib__/QueryBuilderEvent.js +20 -0
  8. package/lib/__lib__/QueryBuilderEvent.js.map +1 -1
  9. package/lib/__lib__/QueryBuilderTelemetryHelper.d.ts +14 -0
  10. package/lib/__lib__/QueryBuilderTelemetryHelper.d.ts.map +1 -1
  11. package/lib/__lib__/QueryBuilderTelemetryHelper.js +43 -1
  12. package/lib/__lib__/QueryBuilderTelemetryHelper.js.map +1 -1
  13. package/lib/components/QueryBuilder.d.ts +0 -1
  14. package/lib/components/QueryBuilder.d.ts.map +1 -1
  15. package/lib/components/QueryBuilder.js +25 -34
  16. package/lib/components/QueryBuilder.js.map +1 -1
  17. package/lib/components/QueryBuilderConstantExpressionPanel.d.ts +0 -1
  18. package/lib/components/QueryBuilderConstantExpressionPanel.d.ts.map +1 -1
  19. package/lib/components/QueryBuilderDiffPanel.d.ts +0 -1
  20. package/lib/components/QueryBuilderDiffPanel.d.ts.map +1 -1
  21. package/lib/components/QueryBuilderParametersPanel.d.ts +0 -1
  22. package/lib/components/QueryBuilderParametersPanel.d.ts.map +1 -1
  23. package/lib/components/QueryBuilderPropertyExpressionEditor.d.ts +0 -1
  24. package/lib/components/QueryBuilderPropertyExpressionEditor.d.ts.map +1 -1
  25. package/lib/components/QueryBuilderResultPanel.d.ts +0 -1
  26. package/lib/components/QueryBuilderResultPanel.d.ts.map +1 -1
  27. package/lib/components/QueryBuilderSideBar.d.ts +0 -1
  28. package/lib/components/QueryBuilderSideBar.d.ts.map +1 -1
  29. package/lib/components/QueryBuilderTextEditor.d.ts +0 -1
  30. package/lib/components/QueryBuilderTextEditor.d.ts.map +1 -1
  31. package/lib/components/QueryBuilderUnsupportedQueryEditor.d.ts +0 -1
  32. package/lib/components/QueryBuilderUnsupportedQueryEditor.d.ts.map +1 -1
  33. package/lib/components/explorer/QueryBuilderFunctionsExplorerPanel.d.ts +0 -1
  34. package/lib/components/explorer/QueryBuilderFunctionsExplorerPanel.d.ts.map +1 -1
  35. package/lib/components/explorer/QueryBuilderMilestoningEditor.d.ts +0 -1
  36. package/lib/components/explorer/QueryBuilderMilestoningEditor.d.ts.map +1 -1
  37. package/lib/components/explorer/QueryBuilderPropertySearchPanel.d.ts +0 -1
  38. package/lib/components/explorer/QueryBuilderPropertySearchPanel.d.ts.map +1 -1
  39. package/lib/components/fetch-structure/QueryBuilderFetchStructurePanel.d.ts +0 -1
  40. package/lib/components/fetch-structure/QueryBuilderFetchStructurePanel.d.ts.map +1 -1
  41. package/lib/components/fetch-structure/QueryBuilderGraphFetchTreePanel.d.ts +0 -1
  42. package/lib/components/fetch-structure/QueryBuilderGraphFetchTreePanel.d.ts.map +1 -1
  43. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.d.ts +0 -1
  44. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.d.ts.map +1 -1
  45. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js +13 -3
  46. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js.map +1 -1
  47. package/lib/components/fetch-structure/QueryBuilderPostTDSPanel.d.ts +0 -1
  48. package/lib/components/fetch-structure/QueryBuilderPostTDSPanel.d.ts.map +1 -1
  49. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.d.ts +0 -1
  50. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.d.ts.map +1 -1
  51. package/lib/components/fetch-structure/QueryBuilderTDSPanel.d.ts +0 -1
  52. package/lib/components/fetch-structure/QueryBuilderTDSPanel.d.ts.map +1 -1
  53. package/lib/components/fetch-structure/QueryBuilderTDSPanel.js +1 -1
  54. package/lib/components/fetch-structure/QueryBuilderTDSPanel.js.map +1 -1
  55. package/lib/components/fetch-structure/QueryBuilderTDSWindowPanel.d.ts +0 -1
  56. package/lib/components/fetch-structure/QueryBuilderTDSWindowPanel.d.ts.map +1 -1
  57. package/lib/components/fetch-structure/QueryBuilderTDSWindowPanel.js +2 -2
  58. package/lib/components/fetch-structure/QueryBuilderTDSWindowPanel.js.map +1 -1
  59. package/lib/components/filter/QueryBuilderFilterPanel.d.ts +0 -1
  60. package/lib/components/filter/QueryBuilderFilterPanel.d.ts.map +1 -1
  61. package/lib/components/filter/QueryBuilderFilterPanel.js +14 -3
  62. package/lib/components/filter/QueryBuilderFilterPanel.js.map +1 -1
  63. package/lib/components/shared/LambdaEditor.d.ts +0 -1
  64. package/lib/components/shared/LambdaEditor.d.ts.map +1 -1
  65. package/lib/components/shared/LambdaParameterValuesEditor.d.ts +0 -1
  66. package/lib/components/shared/LambdaParameterValuesEditor.d.ts.map +1 -1
  67. package/lib/components/shared/LambdaParameterValuesEditor.js +2 -1
  68. package/lib/components/shared/LambdaParameterValuesEditor.js.map +1 -1
  69. package/lib/components/shared/QueryBuilderVariableSelector.d.ts +0 -1
  70. package/lib/components/shared/QueryBuilderVariableSelector.d.ts.map +1 -1
  71. package/lib/components/watermark/QueryBuilderWatermark.d.ts +0 -1
  72. package/lib/components/watermark/QueryBuilderWatermark.d.ts.map +1 -1
  73. package/lib/index.css +2 -2
  74. package/lib/index.css.map +1 -1
  75. package/lib/package.json +4 -4
  76. package/lib/stores/QueryBuilderState.d.ts +1 -2
  77. package/lib/stores/QueryBuilderState.d.ts.map +1 -1
  78. package/lib/stores/QueryBuilderState.js +5 -6
  79. package/lib/stores/QueryBuilderState.js.map +1 -1
  80. package/package.json +10 -10
  81. package/src/__lib__/QueryBuilderDocumentation.ts +0 -2
  82. package/src/__lib__/QueryBuilderEvent.ts +20 -0
  83. package/src/__lib__/QueryBuilderTelemetryHelper.ts +131 -1
  84. package/src/components/QueryBuilder.tsx +147 -188
  85. package/src/components/fetch-structure/QueryBuilderPostFilterPanel.tsx +96 -60
  86. package/src/components/fetch-structure/QueryBuilderTDSPanel.tsx +1 -3
  87. package/src/components/fetch-structure/QueryBuilderTDSWindowPanel.tsx +2 -4
  88. package/src/components/filter/QueryBuilderFilterPanel.tsx +102 -60
  89. package/src/components/shared/LambdaParameterValuesEditor.tsx +2 -1
  90. package/src/stores/QueryBuilderState.ts +4 -9
@@ -43,6 +43,9 @@ import {
43
43
  PanelEntryDropZonePlaceholder,
44
44
  useDragPreviewLayer,
45
45
  PanelContent,
46
+ MoreVerticalIcon,
47
+ MenuContentItemIcon,
48
+ MenuContentItemLabel,
46
49
  } from '@finos/legend-art';
47
50
  import {
48
51
  type QueryBuilderFilterConditionDragSource,
@@ -84,6 +87,7 @@ import {
84
87
  type QueryBuilderVariableDragSource,
85
88
  QUERY_BUILDER_VARIABLE_DND_TYPE,
86
89
  } from '../shared/BasicValueSpecificationEditor.js';
90
+ import { QueryBuilderTelemetryHelper } from '../../__lib__/QueryBuilderTelemetryHelper.js';
87
91
 
88
92
  const QueryBuilderFilterGroupConditionEditor = observer(
89
93
  (props: {
@@ -335,6 +339,10 @@ const QueryBuilderFilterConditionContextMenu = observer(
335
339
  filterState.addGroupConditionNodeFromNode(node);
336
340
  };
337
341
  const newGroupWithCondition = (): void => {
342
+ QueryBuilderTelemetryHelper.logEvent_FilterCreateGroupFromConditionLaunched(
343
+ queryBuilderState.applicationStore.telemetryService,
344
+ );
345
+
338
346
  filterState.suppressClickawayEventListener();
339
347
  filterState.newGroupWithConditionFromNode(undefined, node);
340
348
  };
@@ -677,26 +685,42 @@ const QueryBuilderFilterTree = observer(
677
685
  export const QueryBuilderFilterPanel = observer(
678
686
  (props: { queryBuilderState: QueryBuilderState }) => {
679
687
  const { queryBuilderState } = props;
688
+
680
689
  const applicationStore = useApplicationStore();
681
690
  const filterState = queryBuilderState.filterState;
682
691
  const rootNode = filterState.getRootNode();
683
692
  const collapseTree = (): void => {
693
+ QueryBuilderTelemetryHelper.logEvent_FilterCollapseTreeLaunched(
694
+ queryBuilderState.applicationStore.telemetryService,
695
+ );
684
696
  filterState.setSelectedNode(undefined);
685
697
  filterState.collapseTree();
686
698
  };
687
699
  const expandTree = (): void => {
700
+ QueryBuilderTelemetryHelper.logEvent_FilterExpandTreeLaunched(
701
+ queryBuilderState.applicationStore.telemetryService,
702
+ );
688
703
  filterState.setSelectedNode(undefined);
689
704
  filterState.expandTree();
690
705
  };
691
706
  const pruneTree = (): void => {
707
+ QueryBuilderTelemetryHelper.logEvent_FilterCleanupTreeLaunched(
708
+ queryBuilderState.applicationStore.telemetryService,
709
+ );
692
710
  filterState.suppressClickawayEventListener();
693
711
  filterState.pruneTree();
694
712
  };
695
713
  const simplifyTree = (): void => {
714
+ QueryBuilderTelemetryHelper.logEvent_FilterSimplifyTreeLaunched(
715
+ queryBuilderState.applicationStore.telemetryService,
716
+ );
696
717
  filterState.suppressClickawayEventListener();
697
718
  filterState.simplifyTree();
698
719
  };
699
720
  const createCondition = (): void => {
721
+ QueryBuilderTelemetryHelper.logEvent_FilterCreateConditionLaunched(
722
+ queryBuilderState.applicationStore.telemetryService,
723
+ );
700
724
  filterState.suppressClickawayEventListener();
701
725
  filterState.addNodeFromNode(
702
726
  new QueryBuilderFilterTreeBlankConditionNodeData(undefined),
@@ -709,12 +733,18 @@ export const QueryBuilderFilterPanel = observer(
709
733
  (filterState.selectedNode !== rootNode || // either not a root node
710
734
  rootNode instanceof QueryBuilderFilterTreeGroupNodeData)); // or if it is the root note, it has to be a group node
711
735
  const createGroupCondition = (): void => {
736
+ QueryBuilderTelemetryHelper.logEvent_FilterCreateLogicalGroupLaunched(
737
+ queryBuilderState.applicationStore.telemetryService,
738
+ );
712
739
  filterState.suppressClickawayEventListener();
713
740
  if (allowGroupCreation) {
714
741
  filterState.addGroupConditionNodeFromNode(filterState.selectedNode);
715
742
  }
716
743
  };
717
744
  const newGroupWithCondition = (): void => {
745
+ QueryBuilderTelemetryHelper.logEvent_FilterCreateLogicalGroupLaunched(
746
+ applicationStore.telemetryService,
747
+ );
718
748
  filterState.suppressClickawayEventListener();
719
749
  if (
720
750
  filterState.selectedNode instanceof
@@ -812,70 +842,82 @@ export const QueryBuilderFilterPanel = observer(
812
842
  <div className="panel__header__title">
813
843
  <div className="panel__header__title__label">filter</div>
814
844
  </div>
845
+
815
846
  <div className="panel__header__actions">
816
- <button
817
- className="panel__header__action"
818
- onClick={createCondition}
819
- tabIndex={-1}
820
- title="Create Condition"
821
- >
822
- <PlusIcon />
823
- </button>
824
- <button
847
+ <DropdownMenu
825
848
  className="panel__header__action"
826
- disabled={
827
- !(
828
- filterState.selectedNode instanceof
829
- QueryBuilderFilterTreeConditionNodeData
830
- )
849
+ title="Show Filter Options Menu..."
850
+ content={
851
+ <MenuContent>
852
+ <MenuContentItem onClick={createCondition}>
853
+ <MenuContentItemIcon>
854
+ <PlusIcon />
855
+ </MenuContentItemIcon>
856
+ <MenuContentItemLabel>
857
+ Create Condition
858
+ </MenuContentItemLabel>
859
+ </MenuContentItem>
860
+ <MenuContentItem
861
+ disabled={
862
+ !(
863
+ filterState.selectedNode instanceof
864
+ QueryBuilderFilterTreeConditionNodeData
865
+ )
866
+ }
867
+ onClick={newGroupWithCondition}
868
+ >
869
+ <MenuContentItemIcon>
870
+ <PlusCircleIcon />
871
+ </MenuContentItemIcon>
872
+ <MenuContentItemLabel>
873
+ Create Group From Condition
874
+ </MenuContentItemLabel>
875
+ </MenuContentItem>
876
+ <MenuContentItem
877
+ disabled={!allowGroupCreation}
878
+ title={
879
+ !allowGroupCreation
880
+ ? 'Please select a filter node first to create logical group'
881
+ : ''
882
+ }
883
+ onClick={createGroupCondition}
884
+ >
885
+ <MenuContentItemIcon>
886
+ <NewFolderIcon />
887
+ </MenuContentItemIcon>
888
+ <MenuContentItemLabel>
889
+ Create Logical Group
890
+ </MenuContentItemLabel>
891
+ </MenuContentItem>
892
+ <MenuContentItem onClick={pruneTree}>
893
+ <MenuContentItemIcon>
894
+ <TrashIcon />
895
+ </MenuContentItemIcon>
896
+ <MenuContentItemLabel>Cleanup Tree</MenuContentItemLabel>
897
+ </MenuContentItem>
898
+ <MenuContentItem onClick={simplifyTree}>
899
+ <MenuContentItemIcon>
900
+ <CircleIcon />
901
+ </MenuContentItemIcon>
902
+ <MenuContentItemLabel>Simplify Tree</MenuContentItemLabel>
903
+ </MenuContentItem>
904
+ <MenuContentItem onClick={collapseTree}>
905
+ <MenuContentItemIcon>
906
+ <CompressIcon />
907
+ </MenuContentItemIcon>
908
+ <MenuContentItemLabel>Collapse Tree</MenuContentItemLabel>
909
+ </MenuContentItem>
910
+ <MenuContentItem onClick={expandTree}>
911
+ <MenuContentItemIcon>
912
+ <ExpandIcon />
913
+ </MenuContentItemIcon>
914
+ <MenuContentItemLabel>Expand Tree</MenuContentItemLabel>
915
+ </MenuContentItem>
916
+ </MenuContent>
831
917
  }
832
- onClick={newGroupWithCondition}
833
- tabIndex={-1}
834
- title="Create Group From Condition"
835
918
  >
836
- <PlusCircleIcon />
837
- </button>
838
- <button
839
- className="panel__header__action"
840
- disabled={!allowGroupCreation}
841
- onClick={createGroupCondition}
842
- tabIndex={-1}
843
- title="Create Logical Group"
844
- >
845
- <NewFolderIcon />
846
- </button>
847
- <button
848
- className="panel__header__action"
849
- onClick={pruneTree}
850
- tabIndex={-1}
851
- title="Cleanup Tree"
852
- >
853
- <TrashIcon />
854
- </button>
855
- <button
856
- className="panel__header__action"
857
- onClick={simplifyTree}
858
- tabIndex={-1}
859
- title="Simplify Tree"
860
- >
861
- <CircleIcon />
862
- </button>
863
- <button
864
- className="panel__header__action"
865
- onClick={collapseTree}
866
- tabIndex={-1}
867
- title="Collapse Tree"
868
- >
869
- <CompressIcon />
870
- </button>
871
- <button
872
- className="panel__header__action"
873
- onClick={expandTree}
874
- tabIndex={-1}
875
- title="Expand Tree"
876
- >
877
- <ExpandIcon />
878
- </button>
919
+ <MoreVerticalIcon className="query-builder__icon__more-options" />
920
+ </DropdownMenu>
879
921
  </div>
880
922
  </div>
881
923
  <PanelContent>
@@ -30,6 +30,7 @@ import {
30
30
  type ObserverContext,
31
31
  PrimitiveType,
32
32
  } from '@finos/legend-graph';
33
+ import { prettyCONSTName } from '@finos/legend-shared';
33
34
  import { observer } from 'mobx-react-lite';
34
35
  import { useState } from 'react';
35
36
  import type { LambdaParametersState } from '../../stores/shared/LambdaParameterState.js';
@@ -123,7 +124,7 @@ export const LambdaParameterValuesEditor = observer(
123
124
  isSubmitAction ? `${submitAction.label}...` : undefined
124
125
  }
125
126
  onClick={submit}
126
- text={submitAction.label}
127
+ text={prettyCONSTName(submitAction.label)}
127
128
  />
128
129
  )}
129
130
  <ModalFooterButton
@@ -87,6 +87,7 @@ export abstract class QueryBuilderState implements CommandRegistrar {
87
87
  readonly changeDetectionState: QueryBuilderChangeDetectionState;
88
88
  readonly queryCompileState = ActionState.create();
89
89
  readonly observerContext: ObserverContext;
90
+ readonly saveQueryProgressState = ActionState.create();
90
91
 
91
92
  explorerState: QueryBuilderExplorerState;
92
93
  functionsExplorerState: QueryFunctionsExplorerState;
@@ -102,8 +103,6 @@ export abstract class QueryBuilderState implements CommandRegistrar {
102
103
  resultState: QueryBuilderResultState;
103
104
  textEditorState: QueryBuilderTextEditorState;
104
105
  unsupportedQueryState: QueryBuilderUnsupportedQueryState;
105
-
106
- titleOfQuery: string | undefined;
107
106
  showFunctionsExplorerPanel = false;
108
107
  showParametersPanel = false;
109
108
  isEditingWatermark = false;
@@ -129,7 +128,6 @@ export abstract class QueryBuilderState implements CommandRegistrar {
129
128
  fetchStructureState: observable,
130
129
  filterState: observable,
131
130
  watermarkState: observable,
132
- titleOfQuery: observable,
133
131
  checkEntitlementsState: observable,
134
132
  resultState: observable,
135
133
  textEditorState: observable,
@@ -155,8 +153,6 @@ export abstract class QueryBuilderState implements CommandRegistrar {
155
153
  setMapping: action,
156
154
  setRuntimeValue: action,
157
155
 
158
- setTitleOfQuery: action,
159
-
160
156
  resetQueryResult: action,
161
157
  resetQueryContent: action,
162
158
  changeClass: action,
@@ -259,10 +255,6 @@ export abstract class QueryBuilderState implements CommandRegistrar {
259
255
  this.runtimeValue = val;
260
256
  }
261
257
 
262
- setTitleOfQuery(val: string | undefined): void {
263
- this.titleOfQuery = val;
264
- }
265
-
266
258
  get isQuerySupported(): boolean {
267
259
  return !this.unsupportedQueryState.rawLambda;
268
260
  }
@@ -455,6 +447,7 @@ export abstract class QueryBuilderState implements CommandRegistrar {
455
447
  async saveQuery(
456
448
  onSaveQuery: (lambda: RawLambda) => Promise<void>,
457
449
  ): Promise<void> {
450
+ this.saveQueryProgressState.inProgress();
458
451
  try {
459
452
  const query = this.buildQuery();
460
453
  await onSaveQuery(query);
@@ -463,6 +456,8 @@ export abstract class QueryBuilderState implements CommandRegistrar {
463
456
  this.applicationStore.notificationService.notifyError(
464
457
  `Can't save query: ${error.message}`,
465
458
  );
459
+ } finally {
460
+ this.saveQueryProgressState.complete();
466
461
  }
467
462
  }
468
463