@finos/legend-application-query 12.0.9 → 13.0.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.
- package/lib/__lib__/LegendQueryEvent.d.ts +1 -0
- package/lib/__lib__/LegendQueryEvent.d.ts.map +1 -1
- package/lib/__lib__/LegendQueryEvent.js +1 -0
- package/lib/__lib__/LegendQueryEvent.js.map +1 -1
- package/lib/__lib__/LegendQueryTelemetryHelper.d.ts +7 -6
- package/lib/__lib__/LegendQueryTelemetryHelper.d.ts.map +1 -1
- package/lib/__lib__/LegendQueryTelemetryHelper.js +15 -12
- package/lib/__lib__/LegendQueryTelemetryHelper.js.map +1 -1
- package/lib/__lib__/LegendQueryUserDataHelper.d.ts +27 -0
- package/lib/__lib__/LegendQueryUserDataHelper.d.ts.map +1 -0
- package/lib/__lib__/LegendQueryUserDataHelper.js +63 -0
- package/lib/__lib__/LegendQueryUserDataHelper.js.map +1 -0
- package/lib/components/EditExistingQuerySetup.d.ts.map +1 -1
- package/lib/components/EditExistingQuerySetup.js +7 -71
- package/lib/components/EditExistingQuerySetup.js.map +1 -1
- package/lib/components/QueryEditor.d.ts.map +1 -1
- package/lib/components/QueryEditor.js +15 -72
- package/lib/components/QueryEditor.js.map +1 -1
- package/lib/components/QueryProductionizerSetup.d.ts.map +1 -1
- package/lib/components/QueryProductionizerSetup.js +6 -47
- package/lib/components/QueryProductionizerSetup.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/EditExistingQuerySetupStore.d.ts +3 -12
- package/lib/stores/EditExistingQuerySetupStore.d.ts.map +1 -1
- package/lib/stores/EditExistingQuerySetupStore.js +27 -64
- package/lib/stores/EditExistingQuerySetupStore.js.map +1 -1
- package/lib/stores/LegendQueryApplicationPlugin.d.ts +4 -3
- package/lib/stores/LegendQueryApplicationPlugin.d.ts.map +1 -1
- package/lib/stores/LegendQueryApplicationPlugin.js.map +1 -1
- package/lib/stores/QueryEditorStore.d.ts +5 -18
- package/lib/stores/QueryEditorStore.d.ts.map +1 -1
- package/lib/stores/QueryEditorStore.js +34 -62
- package/lib/stores/QueryEditorStore.js.map +1 -1
- package/lib/stores/QueryProductionizerSetupStore.d.ts +4 -10
- package/lib/stores/QueryProductionizerSetupStore.d.ts.map +1 -1
- package/lib/stores/QueryProductionizerSetupStore.js +29 -62
- package/lib/stores/QueryProductionizerSetupStore.js.map +1 -1
- package/package.json +9 -9
- package/src/__lib__/LegendQueryEvent.ts +1 -0
- package/src/__lib__/LegendQueryTelemetryHelper.ts +19 -26
- package/src/__lib__/LegendQueryUserDataHelper.ts +92 -0
- package/src/components/EditExistingQuerySetup.tsx +10 -204
- package/src/components/QueryEditor.tsx +36 -251
- package/src/components/QueryProductionizerSetup.tsx +9 -124
- package/src/stores/EditExistingQuerySetupStore.ts +54 -87
- package/src/stores/LegendQueryApplicationPlugin.ts +4 -3
- package/src/stores/QueryEditorStore.ts +66 -73
- package/src/stores/QueryProductionizerSetupStore.ts +55 -84
- package/tsconfig.json +1 -0
@@ -14,33 +14,18 @@
|
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
16
|
|
17
|
-
import {
|
18
|
-
|
19
|
-
DEFAULT_TYPEAHEAD_SEARCH_MINIMUM_SEARCH_LENGTH,
|
20
|
-
} from '@finos/legend-application';
|
21
|
-
import {
|
22
|
-
QuerySearchSpecification,
|
23
|
-
type LightQuery,
|
24
|
-
type QueryInfo,
|
25
|
-
} from '@finos/legend-graph';
|
17
|
+
import { QueryLoaderState } from '@finos/legend-query-builder';
|
18
|
+
import { BaseQuerySetupStore } from './QuerySetupStore.js';
|
26
19
|
import type { DepotServerClient } from '@finos/legend-server-depot';
|
27
|
-
import {
|
28
|
-
|
29
|
-
assertErrorThrown,
|
30
|
-
type GeneratorFn,
|
31
|
-
} from '@finos/legend-shared';
|
32
|
-
import { action, flow, makeObservable, observable } from 'mobx';
|
20
|
+
import { quantifyList } from '@finos/legend-shared';
|
21
|
+
import { LegendQueryUserDataHelper } from '../__lib__/LegendQueryUserDataHelper.js';
|
33
22
|
import type { LegendQueryApplicationStore } from './LegendQueryBaseStore.js';
|
34
|
-
import {
|
23
|
+
import type { LightQuery } from '@finos/legend-graph';
|
24
|
+
import { generateExistingQueryEditorRoute } from '../__lib__/LegendQueryNavigation.js';
|
25
|
+
import { LegendQueryTelemetryHelper } from '../__lib__/LegendQueryTelemetryHelper.js';
|
35
26
|
|
36
27
|
export class EditExistingQuerySetupStore extends BaseQuerySetupStore {
|
37
|
-
readonly
|
38
|
-
readonly loadQueryState = ActionState.create();
|
39
|
-
|
40
|
-
queries: LightQuery[] = [];
|
41
|
-
currentQuery?: LightQuery | undefined;
|
42
|
-
currentQueryInfo?: QueryInfo | undefined;
|
43
|
-
showCurrentUserQueriesOnly = false;
|
28
|
+
readonly queryLoaderState: QueryLoaderState;
|
44
29
|
|
45
30
|
constructor(
|
46
31
|
applicationStore: LegendQueryApplicationStore,
|
@@ -48,69 +33,51 @@ export class EditExistingQuerySetupStore extends BaseQuerySetupStore {
|
|
48
33
|
) {
|
49
34
|
super(applicationStore, depotServerClient);
|
50
35
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
this.loadQueriesState.inProgress();
|
98
|
-
try {
|
99
|
-
const searchSpecification = new QuerySearchSpecification();
|
100
|
-
searchSpecification.searchTerm = isValidSearchString
|
101
|
-
? searchText
|
102
|
-
: undefined;
|
103
|
-
searchSpecification.limit = DEFAULT_TYPEAHEAD_SEARCH_LIMIT;
|
104
|
-
searchSpecification.showCurrentUserQueriesOnly =
|
105
|
-
this.showCurrentUserQueriesOnly;
|
106
|
-
this.queries = (yield this.graphManagerState.graphManager.searchQueries(
|
107
|
-
searchSpecification,
|
108
|
-
)) as LightQuery[];
|
109
|
-
this.loadQueriesState.pass();
|
110
|
-
} catch (error) {
|
111
|
-
assertErrorThrown(error);
|
112
|
-
this.applicationStore.notificationService.notifyError(error);
|
113
|
-
this.loadQueriesState.fail();
|
114
|
-
}
|
36
|
+
this.queryLoaderState = new QueryLoaderState(
|
37
|
+
applicationStore,
|
38
|
+
this.graphManagerState,
|
39
|
+
{
|
40
|
+
loadQuery: (query: LightQuery): void => {
|
41
|
+
this.queryLoaderState.setQueryLoaderDialogOpen(false);
|
42
|
+
this.applicationStore.navigationService.navigator.goToLocation(
|
43
|
+
generateExistingQueryEditorRoute(query.id),
|
44
|
+
{ ignoreBlocking: true },
|
45
|
+
);
|
46
|
+
},
|
47
|
+
fetchDefaultQueries: () =>
|
48
|
+
this.graphManagerState.graphManager.getQueries(
|
49
|
+
LegendQueryUserDataHelper.getRecentlyViewedQueries(
|
50
|
+
this.applicationStore.userDataService,
|
51
|
+
),
|
52
|
+
),
|
53
|
+
generateDefaultQueriesSummaryText: (queries) =>
|
54
|
+
queries.length
|
55
|
+
? `Showing ${quantifyList(
|
56
|
+
queries,
|
57
|
+
'recently viewed query',
|
58
|
+
'recently viewed queries',
|
59
|
+
)}`
|
60
|
+
: `No recently viewed queries`,
|
61
|
+
onQueryDeleted: (query): void =>
|
62
|
+
LegendQueryUserDataHelper.removeRecentlyViewedQuery(
|
63
|
+
this.applicationStore.userDataService,
|
64
|
+
query.id,
|
65
|
+
),
|
66
|
+
onQueryRenamed: (query): void => {
|
67
|
+
LegendQueryTelemetryHelper.logEvent_RenameQuerySucceeded(
|
68
|
+
applicationStore.telemetryService,
|
69
|
+
{
|
70
|
+
query: {
|
71
|
+
id: query.id,
|
72
|
+
name: query.name,
|
73
|
+
groupId: query.groupId,
|
74
|
+
artifactId: query.artifactId,
|
75
|
+
versionId: query.versionId,
|
76
|
+
},
|
77
|
+
},
|
78
|
+
);
|
79
|
+
},
|
80
|
+
},
|
81
|
+
);
|
115
82
|
}
|
116
83
|
}
|
@@ -64,7 +64,8 @@ export type QueryEditorActionConfiguration = {
|
|
64
64
|
) => React.ReactNode | undefined;
|
65
65
|
};
|
66
66
|
|
67
|
-
export type
|
67
|
+
export type QueryEditorHelpMenuActionConfiguration = {
|
68
|
+
key: string;
|
68
69
|
title?: string;
|
69
70
|
label: string;
|
70
71
|
onClick: () => void;
|
@@ -88,9 +89,9 @@ export abstract class LegendQueryApplicationPlugin extends LegendApplicationPlug
|
|
88
89
|
getExtraQuerySetupActionConfigurations?(): QuerySetupActionConfiguration[];
|
89
90
|
|
90
91
|
/**
|
91
|
-
* Get the list of help
|
92
|
+
* Get the list of query editor help menu action configurations.
|
92
93
|
*/
|
93
|
-
|
94
|
+
getExtraQueryEditorHelpMenuActionConfigurations?(): QueryEditorHelpMenuActionConfiguration[];
|
94
95
|
|
95
96
|
/**
|
96
97
|
* Get the list of existing query editor state builders.
|
@@ -33,6 +33,7 @@ import {
|
|
33
33
|
ActionState,
|
34
34
|
StopWatch,
|
35
35
|
guaranteeType,
|
36
|
+
quantifyList,
|
36
37
|
} from '@finos/legend-shared';
|
37
38
|
import {
|
38
39
|
type LightQuery,
|
@@ -45,12 +46,12 @@ import {
|
|
45
46
|
RuntimePointer,
|
46
47
|
GRAPH_MANAGER_EVENT,
|
47
48
|
extractElementNameFromPath,
|
48
|
-
QuerySearchSpecification,
|
49
49
|
Mapping,
|
50
50
|
type Runtime,
|
51
51
|
type Service,
|
52
52
|
createGraphBuilderReport,
|
53
53
|
LegendSDLC,
|
54
|
+
QuerySearchSpecification,
|
54
55
|
} from '@finos/legend-graph';
|
55
56
|
import {
|
56
57
|
EXTERNAL_APPLICATION_NAVIGATION__generateStudioProjectViewUrl,
|
@@ -74,7 +75,6 @@ import {
|
|
74
75
|
import {
|
75
76
|
DEFAULT_TAB_SIZE,
|
76
77
|
DEFAULT_TYPEAHEAD_SEARCH_MINIMUM_SEARCH_LENGTH,
|
77
|
-
DEFAULT_TYPEAHEAD_SEARCH_LIMIT,
|
78
78
|
} from '@finos/legend-application';
|
79
79
|
import type { LegendQueryPluginManager } from '../application/LegendQueryPluginManager.js';
|
80
80
|
import { LegendQueryEventHelper } from '../__lib__/LegendQueryEventHelper.js';
|
@@ -85,7 +85,9 @@ import {
|
|
85
85
|
ClassQueryBuilderState,
|
86
86
|
MappingQueryBuilderState,
|
87
87
|
ServiceQueryBuilderState,
|
88
|
+
QueryLoaderState,
|
88
89
|
} from '@finos/legend-query-builder';
|
90
|
+
import { LegendQueryUserDataHelper } from '../__lib__/LegendQueryUserDataHelper.js';
|
89
91
|
import { LegendQueryTelemetryHelper } from '../__lib__/LegendQueryTelemetryHelper.js';
|
90
92
|
|
91
93
|
export const createViewProjectHandler =
|
@@ -409,14 +411,16 @@ export class QuerySaveState {
|
|
409
411
|
}
|
410
412
|
|
411
413
|
export class QueryRenameState {
|
412
|
-
editorStore: QueryEditorStore;
|
414
|
+
readonly editorStore: QueryEditorStore;
|
415
|
+
readonly queryBuilderState: QueryBuilderState;
|
416
|
+
|
417
|
+
readonly saveQueryState = ActionState.create();
|
418
|
+
|
413
419
|
lambda: RawLambda;
|
414
420
|
queryName: string;
|
415
421
|
allowUpdate = false;
|
416
422
|
onQueryUpdate?: ((query: Query) => void) | undefined;
|
417
423
|
decorator?: ((query: Query) => void) | undefined;
|
418
|
-
queryBuilderState: QueryBuilderState;
|
419
|
-
saveQueryState = ActionState.create();
|
420
424
|
|
421
425
|
constructor(
|
422
426
|
editorStore: QueryEditorStore,
|
@@ -512,84 +516,20 @@ export class QueryRenameState {
|
|
512
516
|
}
|
513
517
|
}
|
514
518
|
|
515
|
-
export class QueryLoaderState {
|
516
|
-
readonly editorStore: QueryEditorStore;
|
517
|
-
|
518
|
-
readonly loadQueriesState = ActionState.create();
|
519
|
-
queries: LightQuery[] = [];
|
520
|
-
isQueryLoaderOpen = false;
|
521
|
-
showCurrentUserQueriesOnly = false;
|
522
|
-
|
523
|
-
constructor(editorStore: QueryEditorStore) {
|
524
|
-
makeObservable(this, {
|
525
|
-
isQueryLoaderOpen: observable,
|
526
|
-
queries: observable,
|
527
|
-
showCurrentUserQueriesOnly: observable,
|
528
|
-
setIsQueryLoaderOpen: action,
|
529
|
-
setQueries: action,
|
530
|
-
setShowCurrentUserQueriesOnly: action,
|
531
|
-
loadQueries: flow,
|
532
|
-
});
|
533
|
-
this.editorStore = editorStore;
|
534
|
-
}
|
535
|
-
|
536
|
-
setIsQueryLoaderOpen(val: boolean): void {
|
537
|
-
this.isQueryLoaderOpen = val;
|
538
|
-
}
|
539
|
-
|
540
|
-
setQueries(val: LightQuery[]): void {
|
541
|
-
this.queries = val;
|
542
|
-
}
|
543
|
-
|
544
|
-
setShowCurrentUserQueriesOnly(val: boolean): void {
|
545
|
-
this.showCurrentUserQueriesOnly = val;
|
546
|
-
}
|
547
|
-
|
548
|
-
*loadQueries(searchText: string): GeneratorFn<void> {
|
549
|
-
const isValidSearchString =
|
550
|
-
searchText.length >= DEFAULT_TYPEAHEAD_SEARCH_MINIMUM_SEARCH_LENGTH;
|
551
|
-
this.loadQueriesState.inProgress();
|
552
|
-
try {
|
553
|
-
const searchSpecification = new QuerySearchSpecification();
|
554
|
-
searchSpecification.searchTerm = isValidSearchString
|
555
|
-
? searchText
|
556
|
-
: undefined;
|
557
|
-
searchSpecification.limit = DEFAULT_TYPEAHEAD_SEARCH_LIMIT;
|
558
|
-
searchSpecification.showCurrentUserQueriesOnly =
|
559
|
-
this.showCurrentUserQueriesOnly;
|
560
|
-
this.queries =
|
561
|
-
(yield this.editorStore.graphManagerState.graphManager.searchQueries(
|
562
|
-
searchSpecification,
|
563
|
-
)) as LightQuery[];
|
564
|
-
this.loadQueriesState.pass();
|
565
|
-
} catch (error) {
|
566
|
-
this.loadQueriesState.fail();
|
567
|
-
assertErrorThrown(error);
|
568
|
-
this.editorStore.applicationStore.notificationService.notifyError(error);
|
569
|
-
}
|
570
|
-
}
|
571
|
-
|
572
|
-
reset(): void {
|
573
|
-
this.setShowCurrentUserQueriesOnly(false);
|
574
|
-
}
|
575
|
-
}
|
576
|
-
|
577
519
|
export abstract class QueryEditorStore {
|
578
520
|
readonly applicationStore: LegendQueryApplicationStore;
|
579
521
|
readonly depotServerClient: DepotServerClient;
|
580
522
|
readonly pluginManager: LegendQueryPluginManager;
|
581
523
|
readonly graphManagerState: GraphManagerState;
|
524
|
+
readonly queryLoaderState: QueryLoaderState;
|
582
525
|
|
583
526
|
readonly initState = ActionState.create();
|
527
|
+
|
584
528
|
queryBuilderState?: QueryBuilderState | undefined;
|
585
529
|
saveAsState?: QuerySaveAsState | undefined;
|
586
530
|
saveState?: QuerySaveState | undefined;
|
587
531
|
renameState?: QueryRenameState | undefined;
|
588
532
|
|
589
|
-
// if the implementation of QueryEditorStore does not support save
|
590
|
-
// saveState = undefined
|
591
|
-
|
592
|
-
queryLoaderState: QueryLoaderState;
|
593
533
|
title: string | undefined;
|
594
534
|
existingQueryName: string | undefined;
|
595
535
|
|
@@ -621,7 +561,56 @@ export abstract class QueryEditorStore {
|
|
621
561
|
applicationStore.pluginManager,
|
622
562
|
applicationStore.logService,
|
623
563
|
);
|
624
|
-
this.queryLoaderState = new QueryLoaderState(
|
564
|
+
this.queryLoaderState = new QueryLoaderState(
|
565
|
+
applicationStore,
|
566
|
+
this.graphManagerState,
|
567
|
+
{
|
568
|
+
loadQuery: (query: LightQuery): void => {
|
569
|
+
this.queryBuilderState?.changeDetectionState.alertUnsavedChanges(
|
570
|
+
() => {
|
571
|
+
this.queryLoaderState.setQueryLoaderDialogOpen(false);
|
572
|
+
applicationStore.navigationService.navigator.goToLocation(
|
573
|
+
generateExistingQueryEditorRoute(query.id),
|
574
|
+
{ ignoreBlocking: true },
|
575
|
+
);
|
576
|
+
},
|
577
|
+
);
|
578
|
+
},
|
579
|
+
fetchDefaultQueries: () =>
|
580
|
+
this.graphManagerState.graphManager.getQueries(
|
581
|
+
LegendQueryUserDataHelper.getRecentlyViewedQueries(
|
582
|
+
this.applicationStore.userDataService,
|
583
|
+
),
|
584
|
+
),
|
585
|
+
generateDefaultQueriesSummaryText: (queries) =>
|
586
|
+
queries.length
|
587
|
+
? `Showing ${quantifyList(
|
588
|
+
queries,
|
589
|
+
'recently viewed query',
|
590
|
+
'recently viewed queries',
|
591
|
+
)}`
|
592
|
+
: `No recently viewed queries`,
|
593
|
+
onQueryDeleted: (query): void =>
|
594
|
+
LegendQueryUserDataHelper.removeRecentlyViewedQuery(
|
595
|
+
this.applicationStore.userDataService,
|
596
|
+
query.id,
|
597
|
+
),
|
598
|
+
onQueryRenamed: (query): void => {
|
599
|
+
LegendQueryTelemetryHelper.logEvent_RenameQuerySucceeded(
|
600
|
+
applicationStore.telemetryService,
|
601
|
+
{
|
602
|
+
query: {
|
603
|
+
id: query.id,
|
604
|
+
name: query.name,
|
605
|
+
groupId: query.groupId,
|
606
|
+
artifactId: query.artifactId,
|
607
|
+
versionId: query.versionId,
|
608
|
+
},
|
609
|
+
},
|
610
|
+
);
|
611
|
+
},
|
612
|
+
},
|
613
|
+
);
|
625
614
|
}
|
626
615
|
|
627
616
|
get isViewProjectActionDisabled(): boolean {
|
@@ -703,7 +692,7 @@ export abstract class QueryEditorStore {
|
|
703
692
|
yield flowResult(this.buildGraph());
|
704
693
|
this.queryBuilderState =
|
705
694
|
(yield this.initializeQueryBuilderState()) as QueryBuilderState;
|
706
|
-
|
695
|
+
this.queryLoaderState.initialize(this.queryBuilderState);
|
707
696
|
this.initState.pass();
|
708
697
|
} catch (error) {
|
709
698
|
assertErrorThrown(error);
|
@@ -1064,6 +1053,10 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
|
|
1064
1053
|
this.queryId,
|
1065
1054
|
this.graphManagerState.graph,
|
1066
1055
|
);
|
1056
|
+
LegendQueryUserDataHelper.addRecentlyViewedQuery(
|
1057
|
+
this.applicationStore.userDataService,
|
1058
|
+
query.id,
|
1059
|
+
);
|
1067
1060
|
let queryBuilderState: QueryBuilderState | undefined;
|
1068
1061
|
const existingQueryEditorStateBuilders = this.applicationStore.pluginManager
|
1069
1062
|
.getApplicationPlugins()
|
@@ -14,36 +14,22 @@
|
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
16
|
|
17
|
-
import {
|
18
|
-
|
19
|
-
DEFAULT_TYPEAHEAD_SEARCH_MINIMUM_SEARCH_LENGTH,
|
20
|
-
} from '@finos/legend-application';
|
21
|
-
import {
|
22
|
-
type LightQuery,
|
23
|
-
type QueryInfo,
|
24
|
-
QuerySearchSpecification,
|
25
|
-
} from '@finos/legend-graph';
|
17
|
+
import type { LightQuery } from '@finos/legend-graph';
|
18
|
+
import { QueryLoaderState } from '@finos/legend-query-builder';
|
26
19
|
import {
|
27
20
|
type DepotServerClient,
|
28
21
|
StoreProjectData,
|
29
22
|
} from '@finos/legend-server-depot';
|
30
|
-
import {
|
31
|
-
ActionState,
|
32
|
-
assertErrorThrown,
|
33
|
-
type GeneratorFn,
|
34
|
-
} from '@finos/legend-shared';
|
35
23
|
import { parseProjectIdentifier } from '@finos/legend-storage';
|
36
|
-
import { flow, makeObservable, observable } from 'mobx';
|
37
24
|
import type { LegendQueryApplicationStore } from './LegendQueryBaseStore.js';
|
38
25
|
import { EXTERNAL_APPLICATION_NAVIGATION__generateStudioProductionizeQueryUrl } from '../__lib__/LegendQueryNavigation.js';
|
39
26
|
import { BaseQuerySetupStore } from './QuerySetupStore.js';
|
27
|
+
import { LegendQueryUserDataHelper } from '../__lib__/LegendQueryUserDataHelper.js';
|
28
|
+
import { quantifyList } from '@finos/legend-shared';
|
29
|
+
import { LegendQueryTelemetryHelper } from '../__lib__/LegendQueryTelemetryHelper.js';
|
40
30
|
|
41
31
|
export class QueryProductionizerSetupStore extends BaseQuerySetupStore {
|
42
|
-
readonly
|
43
|
-
readonly loadQueryState = ActionState.create();
|
44
|
-
queries: LightQuery[] = [];
|
45
|
-
currentQuery?: LightQuery | undefined;
|
46
|
-
currentQueryInfo?: QueryInfo | undefined;
|
32
|
+
readonly queryLoaderState: QueryLoaderState;
|
47
33
|
|
48
34
|
constructor(
|
49
35
|
applicationStore: LegendQueryApplicationStore,
|
@@ -51,25 +37,59 @@ export class QueryProductionizerSetupStore extends BaseQuerySetupStore {
|
|
51
37
|
) {
|
52
38
|
super(applicationStore, depotServerClient);
|
53
39
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
40
|
+
this.queryLoaderState = new QueryLoaderState(
|
41
|
+
applicationStore,
|
42
|
+
this.graphManagerState,
|
43
|
+
{
|
44
|
+
loadQuery: (query: LightQuery): void => {
|
45
|
+
this.queryLoaderState.setQueryLoaderDialogOpen(false);
|
46
|
+
this.loadQueryProductionizer(query).catch(
|
47
|
+
applicationStore.alertUnhandledError,
|
48
|
+
);
|
49
|
+
},
|
50
|
+
fetchDefaultQueries: () =>
|
51
|
+
this.graphManagerState.graphManager.getQueries(
|
52
|
+
LegendQueryUserDataHelper.getRecentlyViewedQueries(
|
53
|
+
this.applicationStore.userDataService,
|
54
|
+
),
|
55
|
+
),
|
56
|
+
generateDefaultQueriesSummaryText: (queries) =>
|
57
|
+
queries.length
|
58
|
+
? `Showing ${quantifyList(
|
59
|
+
queries,
|
60
|
+
'recently viewed query',
|
61
|
+
'recently viewed queries',
|
62
|
+
)}`
|
63
|
+
: `No recently viewed queries`,
|
64
|
+
onQueryDeleted: (query): void =>
|
65
|
+
LegendQueryUserDataHelper.removeRecentlyViewedQuery(
|
66
|
+
this.applicationStore.userDataService,
|
67
|
+
query.id,
|
68
|
+
),
|
69
|
+
onQueryRenamed: (query): void => {
|
70
|
+
LegendQueryTelemetryHelper.logEvent_RenameQuerySucceeded(
|
71
|
+
applicationStore.telemetryService,
|
72
|
+
{
|
73
|
+
query: {
|
74
|
+
id: query.id,
|
75
|
+
name: query.name,
|
76
|
+
groupId: query.groupId,
|
77
|
+
artifactId: query.artifactId,
|
78
|
+
versionId: query.versionId,
|
79
|
+
},
|
80
|
+
},
|
81
|
+
);
|
82
|
+
},
|
83
|
+
},
|
84
|
+
);
|
61
85
|
}
|
62
86
|
|
63
|
-
async loadQueryProductionizer(): Promise<void> {
|
64
|
-
if (!this.currentQuery) {
|
65
|
-
return;
|
66
|
-
}
|
67
|
-
|
87
|
+
async loadQueryProductionizer(selectedQuery: LightQuery): Promise<void> {
|
68
88
|
// fetch project data
|
69
89
|
const project = StoreProjectData.serialization.fromJson(
|
70
90
|
await this.depotServerClient.getProject(
|
71
|
-
|
72
|
-
|
91
|
+
selectedQuery.groupId,
|
92
|
+
selectedQuery.artifactId,
|
73
93
|
),
|
74
94
|
);
|
75
95
|
|
@@ -87,7 +107,7 @@ export class QueryProductionizerSetupStore extends BaseQuerySetupStore {
|
|
87
107
|
this.applicationStore.navigationService.navigator.goToAddress(
|
88
108
|
EXTERNAL_APPLICATION_NAVIGATION__generateStudioProductionizeQueryUrl(
|
89
109
|
matchingSDLCEntry.url,
|
90
|
-
|
110
|
+
selectedQuery.id,
|
91
111
|
),
|
92
112
|
);
|
93
113
|
} else {
|
@@ -96,53 +116,4 @@ export class QueryProductionizerSetupStore extends BaseQuerySetupStore {
|
|
96
116
|
);
|
97
117
|
}
|
98
118
|
}
|
99
|
-
|
100
|
-
*setCurrentQuery(queryId: string | undefined): GeneratorFn<void> {
|
101
|
-
if (queryId) {
|
102
|
-
try {
|
103
|
-
this.loadQueryState.inProgress();
|
104
|
-
this.currentQuery =
|
105
|
-
(yield this.graphManagerState.graphManager.getLightQuery(
|
106
|
-
queryId,
|
107
|
-
)) as LightQuery;
|
108
|
-
const queryInfo =
|
109
|
-
(yield this.graphManagerState.graphManager.getQueryInfo(
|
110
|
-
queryId,
|
111
|
-
)) as QueryInfo;
|
112
|
-
queryInfo.content =
|
113
|
-
(yield this.graphManagerState.graphManager.prettyLambdaContent(
|
114
|
-
queryInfo.content,
|
115
|
-
)) as string;
|
116
|
-
this.currentQueryInfo = queryInfo;
|
117
|
-
} catch (error) {
|
118
|
-
assertErrorThrown(error);
|
119
|
-
this.applicationStore.notificationService.notifyError(error);
|
120
|
-
} finally {
|
121
|
-
this.loadQueryState.reset();
|
122
|
-
}
|
123
|
-
} else {
|
124
|
-
this.currentQuery = undefined;
|
125
|
-
}
|
126
|
-
}
|
127
|
-
|
128
|
-
*loadQueries(searchText: string): GeneratorFn<void> {
|
129
|
-
const isValidSearchString =
|
130
|
-
searchText.length >= DEFAULT_TYPEAHEAD_SEARCH_MINIMUM_SEARCH_LENGTH;
|
131
|
-
this.loadQueriesState.inProgress();
|
132
|
-
try {
|
133
|
-
const searchSpecification = new QuerySearchSpecification();
|
134
|
-
searchSpecification.searchTerm = isValidSearchString
|
135
|
-
? searchText
|
136
|
-
: undefined;
|
137
|
-
searchSpecification.limit = DEFAULT_TYPEAHEAD_SEARCH_LIMIT;
|
138
|
-
this.queries = (yield this.graphManagerState.graphManager.searchQueries(
|
139
|
-
searchSpecification,
|
140
|
-
)) as LightQuery[];
|
141
|
-
this.loadQueriesState.pass();
|
142
|
-
} catch (error) {
|
143
|
-
assertErrorThrown(error);
|
144
|
-
this.applicationStore.notificationService.notifyError(error);
|
145
|
-
this.loadQueriesState.fail();
|
146
|
-
}
|
147
|
-
}
|
148
119
|
}
|
package/tsconfig.json
CHANGED
@@ -38,6 +38,7 @@
|
|
38
38
|
"./src/__lib__/LegendQueryEventHelper.ts",
|
39
39
|
"./src/__lib__/LegendQueryNavigation.ts",
|
40
40
|
"./src/__lib__/LegendQueryTelemetryHelper.ts",
|
41
|
+
"./src/__lib__/LegendQueryUserDataHelper.ts",
|
41
42
|
"./src/application/LegendQueryApplicationConfig.ts",
|
42
43
|
"./src/application/LegendQueryDocumentation.ts",
|
43
44
|
"./src/application/LegendQueryPluginManager.ts",
|