@finos/legend-application 14.0.4 → 15.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__/LegendApplicationDocumentation.d.ts.map +1 -0
- package/lib/__lib__/LegendApplicationDocumentation.js.map +1 -0
- package/lib/{application → __lib__}/LegendApplicationEvent.d.ts +0 -1
- package/lib/__lib__/LegendApplicationEvent.d.ts.map +1 -0
- package/lib/{application → __lib__}/LegendApplicationEvent.js +0 -1
- package/lib/__lib__/LegendApplicationEvent.js.map +1 -0
- package/lib/__lib__/LegendApplicationNavigation.d.ts +19 -0
- package/lib/__lib__/LegendApplicationNavigation.d.ts.map +1 -0
- package/lib/__lib__/LegendApplicationNavigation.js +20 -0
- package/lib/__lib__/LegendApplicationNavigation.js.map +1 -0
- package/lib/__lib__/LegendApplicationSetting.d.ts.map +1 -0
- package/lib/__lib__/LegendApplicationSetting.js.map +1 -0
- package/lib/{application → __lib__}/LegendApplicationTelemetry.d.ts +0 -11
- package/lib/__lib__/LegendApplicationTelemetry.d.ts.map +1 -0
- package/lib/{application → __lib__}/LegendApplicationTelemetry.js +0 -4
- package/lib/__lib__/LegendApplicationTelemetry.js.map +1 -0
- package/lib/__lib__/LegendApplicationTheme.d.ts.map +1 -0
- package/lib/__lib__/LegendApplicationTheme.js.map +1 -0
- package/lib/__test__.d.ts +18 -0
- package/lib/__test__.d.ts.map +1 -0
- package/lib/__test__.js +18 -0
- package/lib/__test__.js.map +1 -0
- package/lib/application/LegendApplication.d.ts +7 -4
- package/lib/application/LegendApplication.d.ts.map +1 -1
- package/lib/application/LegendApplication.js +28 -11
- package/lib/application/LegendApplication.js.map +1 -1
- package/lib/application/LegendApplicationConfig.d.ts +8 -1
- package/lib/application/LegendApplicationConfig.d.ts.map +1 -1
- package/lib/application/LegendApplicationConfig.js +6 -2
- package/lib/application/LegendApplicationConfig.js.map +1 -1
- package/lib/browser.d.ts +19 -0
- package/lib/browser.d.ts.map +1 -0
- package/lib/browser.js +19 -0
- package/lib/browser.js.map +1 -0
- package/lib/components/{LegendApplicationComponentFrameworkProvider.d.ts → ApplicationComponentFrameworkProvider.d.ts} +2 -2
- package/lib/components/ApplicationComponentFrameworkProvider.d.ts.map +1 -0
- package/lib/components/{LegendApplicationComponentFrameworkProvider.js → ApplicationComponentFrameworkProvider.js} +3 -3
- package/lib/components/ApplicationComponentFrameworkProvider.js.map +1 -0
- package/lib/components/ApplicationFrameworkProvider.d.ts +21 -0
- package/lib/components/ApplicationFrameworkProvider.d.ts.map +1 -0
- package/lib/components/ApplicationFrameworkProvider.js +39 -0
- package/lib/components/ApplicationFrameworkProvider.js.map +1 -0
- package/lib/components/{shared/DocumentationLink.d.ts → ApplicationPlatformProvider.d.ts} +4 -10
- package/lib/components/ApplicationPlatformProvider.d.ts.map +1 -0
- package/lib/components/{WebApplicationNavigatorProviderTestUtils.d.ts → ApplicationPlatformProvider.js} +5 -7
- package/lib/components/ApplicationPlatformProvider.js.map +1 -0
- package/lib/components/ApplicationStoreProvider.d.ts +3 -4
- package/lib/components/ApplicationStoreProvider.d.ts.map +1 -1
- package/lib/components/ApplicationStoreProvider.js +6 -23
- package/lib/components/ApplicationStoreProvider.js.map +1 -1
- package/lib/components/{WebApplicationNavigatorProvider.d.ts → BrowserEnvironmentProvider.d.ts} +3 -4
- package/lib/components/BrowserEnvironmentProvider.d.ts.map +1 -0
- package/lib/components/BrowserEnvironmentProvider.js +31 -0
- package/lib/components/BrowserEnvironmentProvider.js.map +1 -0
- package/lib/components/VirtualAssistant.d.ts.map +1 -1
- package/lib/components/VirtualAssistant.js +17 -9
- package/lib/components/VirtualAssistant.js.map +1 -1
- package/lib/components/{shared/FuzzySearchAdvancedConfigMenu.d.ts → __test-utils__/BrowserEnvironmentTestUtils.d.ts} +13 -7
- package/lib/components/__test-utils__/BrowserEnvironmentTestUtils.d.ts.map +1 -0
- package/lib/components/__test-utils__/BrowserEnvironmentTestUtils.js +42 -0
- package/lib/components/__test-utils__/BrowserEnvironmentTestUtils.js.map +1 -0
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/index.d.ts +8 -16
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +8 -18
- package/lib/index.js.map +1 -1
- package/lib/package.json +4 -6
- package/lib/stores/{shared/PackageableElementOption.d.ts → ApplicationConfig.d.ts} +6 -7
- package/lib/stores/ApplicationConfig.d.ts.map +1 -0
- package/lib/stores/ApplicationConfig.js +21 -0
- package/lib/stores/ApplicationConfig.js.map +1 -0
- package/lib/stores/ApplicationNavigationContextService.js +1 -1
- package/lib/stores/ApplicationNavigationContextService.js.map +1 -1
- package/lib/stores/ApplicationStore.d.ts +4 -8
- package/lib/stores/ApplicationStore.d.ts.map +1 -1
- package/lib/stores/ApplicationStore.js +14 -14
- package/lib/stores/ApplicationStore.js.map +1 -1
- package/lib/stores/AssistantService.d.ts +3 -3
- package/lib/stores/AssistantService.d.ts.map +1 -1
- package/lib/stores/AssistantService.js +18 -10
- package/lib/stores/AssistantService.js.map +1 -1
- package/lib/stores/CommandService.js +1 -1
- package/lib/stores/CommandService.js.map +1 -1
- package/lib/stores/Core_LegendApplicationPlugin.d.ts.map +1 -1
- package/lib/stores/Core_LegendApplicationPlugin.js +2 -52
- package/lib/stores/Core_LegendApplicationPlugin.js.map +1 -1
- package/lib/stores/DocumentationService.d.ts +1 -1
- package/lib/stores/DocumentationService.d.ts.map +1 -1
- package/lib/stores/DocumentationService.js +4 -5
- package/lib/stores/DocumentationService.js.map +1 -1
- package/lib/stores/LayoutService.js +3 -3
- package/lib/stores/LayoutService.js.map +1 -1
- package/lib/stores/LegendApplicationPlugin.d.ts +1 -15
- package/lib/stores/LegendApplicationPlugin.d.ts.map +1 -1
- package/lib/stores/LegendApplicationPlugin.js +0 -5
- package/lib/stores/LegendApplicationPlugin.js.map +1 -1
- package/lib/stores/SettingService.d.ts +1 -0
- package/lib/stores/SettingService.d.ts.map +1 -1
- package/lib/stores/SettingService.js +1 -1
- package/lib/stores/SettingService.js.map +1 -1
- package/lib/stores/__test-utils__/ApplicationStoreTestUtils.d.ts +18 -0
- package/lib/stores/__test-utils__/ApplicationStoreTestUtils.d.ts.map +1 -0
- package/lib/stores/__test-utils__/ApplicationStoreTestUtils.js +21 -0
- package/lib/stores/__test-utils__/ApplicationStoreTestUtils.js.map +1 -0
- package/lib/stores/navigation/BrowserNavigator.d.ts +64 -0
- package/lib/stores/navigation/BrowserNavigator.d.ts.map +1 -0
- package/lib/stores/navigation/{WebApplicationNavigator.js → BrowserNavigator.js} +22 -3
- package/lib/stores/navigation/BrowserNavigator.js.map +1 -0
- package/lib/stores/navigation/{WebApplicationNavigator.d.ts → DefaultNavigator.d.ts} +3 -12
- package/lib/stores/navigation/DefaultNavigator.d.ts.map +1 -0
- package/lib/stores/navigation/DefaultNavigator.js +74 -0
- package/lib/stores/navigation/DefaultNavigator.js.map +1 -0
- package/lib/stores/navigation/NavigationService.d.ts +7 -0
- package/lib/stores/navigation/NavigationService.d.ts.map +1 -1
- package/lib/stores/navigation/NavigationService.js.map +1 -1
- package/lib/stores/platform/ApplicationPlatform.d.ts +24 -0
- package/lib/stores/platform/ApplicationPlatform.d.ts.map +1 -0
- package/lib/stores/platform/ApplicationPlatform.js +25 -0
- package/lib/stores/platform/ApplicationPlatform.js.map +1 -0
- package/lib/stores/platform/BrowserPlatform.d.ts +29 -0
- package/lib/stores/platform/BrowserPlatform.d.ts.map +1 -0
- package/lib/stores/platform/BrowserPlatform.js +39 -0
- package/lib/stores/platform/BrowserPlatform.js.map +1 -0
- package/lib/stores/storage/StorageService.d.ts +5 -2
- package/lib/stores/storage/StorageService.d.ts.map +1 -1
- package/lib/stores/storage/StorageService.js +20 -10
- package/lib/stores/storage/StorageService.js.map +1 -1
- package/lib/stores/terminal/XTerm.d.ts.map +1 -1
- package/lib/stores/terminal/XTerm.js +5 -5
- package/lib/stores/terminal/XTerm.js.map +1 -1
- package/package.json +7 -9
- package/src/{application → __lib__}/LegendApplicationEvent.ts +1 -1
- package/{lib/stores/shared/PackageableElementOption.js → src/__lib__/LegendApplicationNavigation.ts} +4 -5
- package/src/{application → __lib__}/LegendApplicationTelemetry.ts +0 -24
- package/src/{components.ts → __test__.ts} +2 -7
- package/src/application/LegendApplication.ts +45 -16
- package/src/application/LegendApplicationConfig.ts +13 -2
- package/src/browser.ts +19 -0
- package/src/components/{LegendApplicationComponentFrameworkProvider.tsx → ApplicationComponentFrameworkProvider.tsx} +2 -2
- package/src/components/ApplicationFrameworkProvider.tsx +47 -0
- package/src/components/ApplicationPlatformProvider.tsx +29 -0
- package/src/components/ApplicationStoreProvider.tsx +8 -33
- package/src/components/BrowserEnvironmentProvider.tsx +48 -0
- package/src/components/VirtualAssistant.tsx +53 -11
- package/src/components/__test-utils__/BrowserEnvironmentTestUtils.tsx +63 -0
- package/src/index.ts +12 -24
- package/src/stores/ApplicationConfig.ts +22 -0
- package/src/stores/ApplicationNavigationContextService.ts +1 -1
- package/src/stores/ApplicationStore.ts +18 -19
- package/src/stores/AssistantService.ts +20 -9
- package/src/stores/CommandService.ts +1 -1
- package/src/stores/Core_LegendApplicationPlugin.ts +2 -78
- package/src/stores/DocumentationService.ts +4 -5
- package/src/stores/LayoutService.ts +3 -3
- package/src/stores/LegendApplicationPlugin.ts +1 -21
- package/src/stores/SettingService.ts +2 -1
- package/src/stores/__test-utils__/ApplicationStoreTestUtils.ts +24 -0
- package/src/stores/navigation/{WebApplicationNavigator.ts → BrowserNavigator.ts} +41 -2
- package/src/stores/navigation/DefaultNavigator.ts +150 -0
- package/src/stores/navigation/NavigationService.ts +8 -0
- package/src/stores/{shared/PackageableElementOption.ts → platform/ApplicationPlatform.ts} +14 -11
- package/src/stores/platform/BrowserPlatform.ts +54 -0
- package/src/stores/storage/StorageService.ts +32 -14
- package/src/stores/terminal/XTerm.ts +8 -5
- package/tsconfig.json +19 -23
- package/lib/application/LegendApplicationDocumentation.d.ts.map +0 -1
- package/lib/application/LegendApplicationDocumentation.js.map +0 -1
- package/lib/application/LegendApplicationEvent.d.ts.map +0 -1
- package/lib/application/LegendApplicationEvent.js.map +0 -1
- package/lib/application/LegendApplicationSetting.d.ts.map +0 -1
- package/lib/application/LegendApplicationSetting.js.map +0 -1
- package/lib/application/LegendApplicationTelemetry.d.ts.map +0 -1
- package/lib/application/LegendApplicationTelemetry.js.map +0 -1
- package/lib/application/LegendApplicationTheme.d.ts.map +0 -1
- package/lib/application/LegendApplicationTheme.js.map +0 -1
- package/lib/components/ApplicationStoreProviderTestUtils.d.ts +0 -31
- package/lib/components/ApplicationStoreProviderTestUtils.d.ts.map +0 -1
- package/lib/components/ApplicationStoreProviderTestUtils.js +0 -32
- package/lib/components/ApplicationStoreProviderTestUtils.js.map +0 -1
- package/lib/components/LegendApplicationComponentFrameworkProvider.d.ts.map +0 -1
- package/lib/components/LegendApplicationComponentFrameworkProvider.js.map +0 -1
- package/lib/components/WebApplicationNavigatorProvider.d.ts.map +0 -1
- package/lib/components/WebApplicationNavigatorProvider.js +0 -29
- package/lib/components/WebApplicationNavigatorProvider.js.map +0 -1
- package/lib/components/WebApplicationNavigatorProviderTestUtils.d.ts.map +0 -1
- package/lib/components/WebApplicationNavigatorProviderTestUtils.js +0 -28
- package/lib/components/WebApplicationNavigatorProviderTestUtils.js.map +0 -1
- package/lib/components/shared/DocumentationLink.d.ts.map +0 -1
- package/lib/components/shared/DocumentationLink.js +0 -53
- package/lib/components/shared/DocumentationLink.js.map +0 -1
- package/lib/components/shared/FuzzySearchAdvancedConfigMenu.d.ts.map +0 -1
- package/lib/components/shared/FuzzySearchAdvancedConfigMenu.js +0 -37
- package/lib/components/shared/FuzzySearchAdvancedConfigMenu.js.map +0 -1
- package/lib/components/shared/PackageableElementOptionLabel.d.ts +0 -22
- package/lib/components/shared/PackageableElementOptionLabel.d.ts.map +0 -1
- package/lib/components/shared/PackageableElementOptionLabel.js +0 -46
- package/lib/components/shared/PackageableElementOptionLabel.js.map +0 -1
- package/lib/components/shared/TabManager.d.ts +0 -24
- package/lib/components/shared/TabManager.d.ts.map +0 -1
- package/lib/components/shared/TabManager.js +0 -117
- package/lib/components/shared/TabManager.js.map +0 -1
- package/lib/components.d.ts +0 -21
- package/lib/components.d.ts.map +0 -1
- package/lib/components.js +0 -21
- package/lib/components.js.map +0 -1
- package/lib/const.d.ts +0 -35
- package/lib/const.d.ts.map +0 -1
- package/lib/const.js +0 -39
- package/lib/const.js.map +0 -1
- package/lib/stores/ApplicationStoreTestUtils.d.ts +0 -41
- package/lib/stores/ApplicationStoreTestUtils.d.ts.map +0 -1
- package/lib/stores/ApplicationStoreTestUtils.js +0 -70
- package/lib/stores/ApplicationStoreTestUtils.js.map +0 -1
- package/lib/stores/navigation/WebApplicationNavigator.d.ts.map +0 -1
- package/lib/stores/navigation/WebApplicationNavigator.js.map +0 -1
- package/lib/stores/navigation/WebApplicationRouter.d.ts +0 -22
- package/lib/stores/navigation/WebApplicationRouter.d.ts.map +0 -1
- package/lib/stores/navigation/WebApplicationRouter.js +0 -25
- package/lib/stores/navigation/WebApplicationRouter.js.map +0 -1
- package/lib/stores/pure-language/PureLanguageCodeEditorSupport.d.ts +0 -70
- package/lib/stores/pure-language/PureLanguageCodeEditorSupport.d.ts.map +0 -1
- package/lib/stores/pure-language/PureLanguageCodeEditorSupport.js +0 -237
- package/lib/stores/pure-language/PureLanguageCodeEditorSupport.js.map +0 -1
- package/lib/stores/pure-language/PureLanguageSupport.d.ts +0 -39
- package/lib/stores/pure-language/PureLanguageSupport.d.ts.map +0 -1
- package/lib/stores/pure-language/PureLanguageSupport.js +0 -437
- package/lib/stores/pure-language/PureLanguageSupport.js.map +0 -1
- package/lib/stores/shared/FuzzySearchAdvancedConfigState.d.ts +0 -30
- package/lib/stores/shared/FuzzySearchAdvancedConfigState.d.ts.map +0 -1
- package/lib/stores/shared/FuzzySearchAdvancedConfigState.js +0 -59
- package/lib/stores/shared/FuzzySearchAdvancedConfigState.js.map +0 -1
- package/lib/stores/shared/PackageableElementOption.d.ts.map +0 -1
- package/lib/stores/shared/PackageableElementOption.js.map +0 -1
- package/lib/stores/shared/TabManagerState.d.ts +0 -40
- package/lib/stores/shared/TabManagerState.d.ts.map +0 -1
- package/lib/stores/shared/TabManagerState.js +0 -93
- package/lib/stores/shared/TabManagerState.js.map +0 -1
- package/src/components/ApplicationStoreProviderTestUtils.tsx +0 -59
- package/src/components/WebApplicationNavigatorProvider.tsx +0 -46
- package/src/components/WebApplicationNavigatorProviderTestUtils.tsx +0 -37
- package/src/components/shared/DocumentationLink.tsx +0 -87
- package/src/components/shared/FuzzySearchAdvancedConfigMenu.tsx +0 -73
- package/src/components/shared/PackageableElementOptionLabel.tsx +0 -85
- package/src/components/shared/TabManager.tsx +0 -288
- package/src/const.ts +0 -40
- package/src/stores/ApplicationStoreTestUtils.ts +0 -107
- package/src/stores/navigation/WebApplicationRouter.ts +0 -49
- package/src/stores/pure-language/PureLanguageCodeEditorSupport.ts +0 -338
- package/src/stores/pure-language/PureLanguageSupport.ts +0 -498
- package/src/stores/shared/FuzzySearchAdvancedConfigState.ts +0 -65
- package/src/stores/shared/TabManagerState.ts +0 -124
- /package/lib/{application → __lib__}/LegendApplicationDocumentation.d.ts +0 -0
- /package/lib/{application → __lib__}/LegendApplicationDocumentation.js +0 -0
- /package/lib/{application → __lib__}/LegendApplicationSetting.d.ts +0 -0
- /package/lib/{application → __lib__}/LegendApplicationSetting.js +0 -0
- /package/lib/{application → __lib__}/LegendApplicationTheme.d.ts +0 -0
- /package/lib/{application → __lib__}/LegendApplicationTheme.js +0 -0
- /package/src/{application → __lib__}/LegendApplicationDocumentation.ts +0 -0
- /package/src/{application → __lib__}/LegendApplicationSetting.ts +0 -0
- /package/src/{application → __lib__}/LegendApplicationTheme.ts +0 -0
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
type ContextualDocumentationEntry,
|
|
31
31
|
type DocumentationRegistryEntry,
|
|
32
32
|
} from '../stores/DocumentationService.js';
|
|
33
|
+
import type { SettingOverrideConfigData } from '../stores/SettingService.js';
|
|
33
34
|
|
|
34
35
|
export interface LegendApplicationVersionData {
|
|
35
36
|
buildTime: string;
|
|
@@ -46,6 +47,10 @@ export interface LegendApplicationConfigurationData {
|
|
|
46
47
|
entries?: Record<string, DocumentationEntryData>;
|
|
47
48
|
contextualEntries?: ContextualDocumentationConfig;
|
|
48
49
|
};
|
|
50
|
+
application?: {
|
|
51
|
+
storageKey?: string;
|
|
52
|
+
settingsOverrides?: SettingOverrideConfigData;
|
|
53
|
+
};
|
|
49
54
|
// TODO: when we support vault-like settings, we could support `settingOverrides`
|
|
50
55
|
// See https://github.com/finos/legend-studio/issues/407
|
|
51
56
|
// settingOverrides
|
|
@@ -54,8 +59,9 @@ export interface LegendApplicationConfigurationData {
|
|
|
54
59
|
|
|
55
60
|
export abstract class LegendApplicationConfig {
|
|
56
61
|
readonly appName: string;
|
|
57
|
-
readonly
|
|
62
|
+
readonly baseAddress: string;
|
|
58
63
|
readonly env: string;
|
|
64
|
+
readonly applicationStorageKey: string;
|
|
59
65
|
|
|
60
66
|
// documentation
|
|
61
67
|
readonly documentationUrl?: string | undefined;
|
|
@@ -71,7 +77,7 @@ export abstract class LegendApplicationConfig {
|
|
|
71
77
|
constructor(
|
|
72
78
|
input: LegendApplicationConfigurationInput<LegendApplicationConfigurationData>,
|
|
73
79
|
) {
|
|
74
|
-
this.
|
|
80
|
+
this.baseAddress = input.baseAddress;
|
|
75
81
|
this.appName = guaranteeNonEmptyString(
|
|
76
82
|
input.configData.appName,
|
|
77
83
|
`Can't configure application: 'appName' field is missing or empty`,
|
|
@@ -80,6 +86,9 @@ export abstract class LegendApplicationConfig {
|
|
|
80
86
|
input.configData.env,
|
|
81
87
|
`Can't configure application: 'env' field is missing or empty`,
|
|
82
88
|
);
|
|
89
|
+
this.applicationStorageKey =
|
|
90
|
+
input.configData.application?.storageKey ??
|
|
91
|
+
this.getDefaultApplicationStorageKey();
|
|
83
92
|
|
|
84
93
|
// Documentation
|
|
85
94
|
this.documentationUrl = input.configData.documentation?.url;
|
|
@@ -113,4 +122,6 @@ export abstract class LegendApplicationConfig {
|
|
|
113
122
|
}
|
|
114
123
|
return url;
|
|
115
124
|
}
|
|
125
|
+
|
|
126
|
+
abstract getDefaultApplicationStorageKey(): string;
|
|
116
127
|
}
|
package/src/browser.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 './components/BrowserEnvironmentProvider.js';
|
|
18
|
+
export * from './stores/platform/BrowserPlatform.js';
|
|
19
|
+
export * from './stores/navigation/BrowserNavigator.js';
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
type KeyBindingConfig,
|
|
29
29
|
} from '@finos/legend-shared';
|
|
30
30
|
import { VirtualAssistant } from './VirtualAssistant.js';
|
|
31
|
-
import { LegendApplicationTelemetryHelper } from '../
|
|
31
|
+
import { LegendApplicationTelemetryHelper } from '../__lib__/LegendApplicationTelemetry.js';
|
|
32
32
|
import type { GenericLegendApplicationStore } from '../stores/ApplicationStore.js';
|
|
33
33
|
|
|
34
34
|
enum APPLICATION_COMPONENT_ELEMENT_ID {
|
|
@@ -114,7 +114,7 @@ export const BackdropContainer: React.FC<{ elementId: string }> = (props) => (
|
|
|
114
114
|
<div className="backdrop__container" data-elementid={props.elementId} />
|
|
115
115
|
);
|
|
116
116
|
|
|
117
|
-
export const
|
|
117
|
+
export const ApplicationComponentFrameworkProvider = observer(
|
|
118
118
|
(props: { children: React.ReactNode }) => {
|
|
119
119
|
const { children } = props;
|
|
120
120
|
const applicationStore = useApplicationStore();
|
|
@@ -0,0 +1,47 @@
|
|
|
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 { useEffect } from 'react';
|
|
18
|
+
import { observer } from 'mobx-react-lite';
|
|
19
|
+
import { ApplicationComponentFrameworkProvider } from './ApplicationComponentFrameworkProvider.js';
|
|
20
|
+
import { useApplicationStore } from './ApplicationStoreProvider.js';
|
|
21
|
+
import { useApplicationPlatform } from './ApplicationPlatformProvider.js';
|
|
22
|
+
|
|
23
|
+
export const ApplicationFrameworkProvider = observer(
|
|
24
|
+
(props: { children: React.ReactNode }): React.ReactElement => {
|
|
25
|
+
const { children } = props;
|
|
26
|
+
const platform = useApplicationPlatform();
|
|
27
|
+
const applicationStore = useApplicationStore();
|
|
28
|
+
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
applicationStore
|
|
31
|
+
.initialize(platform)
|
|
32
|
+
.catch(applicationStore.alertUnhandledError);
|
|
33
|
+
}, [applicationStore, platform]);
|
|
34
|
+
|
|
35
|
+
if (!applicationStore.initState.hasSucceeded) {
|
|
36
|
+
return <></>;
|
|
37
|
+
}
|
|
38
|
+
// TODO: would be great if we can have <React.StrictMode> here but since Mobx React is not ready for
|
|
39
|
+
// concurrency yet, we would have to wait
|
|
40
|
+
// See https://github.com/mobxjs/mobx/issues/2526
|
|
41
|
+
return (
|
|
42
|
+
<ApplicationComponentFrameworkProvider>
|
|
43
|
+
{children}
|
|
44
|
+
</ApplicationComponentFrameworkProvider>
|
|
45
|
+
);
|
|
46
|
+
},
|
|
47
|
+
);
|
|
@@ -0,0 +1,29 @@
|
|
|
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 { guaranteeNonNullable } from '@finos/legend-shared';
|
|
18
|
+
import { createContext, useContext } from 'react';
|
|
19
|
+
import type { ApplicationPlatform } from '../stores/platform/ApplicationPlatform.js';
|
|
20
|
+
|
|
21
|
+
export const ApplicationPlatformContext = createContext<
|
|
22
|
+
ApplicationPlatform | undefined
|
|
23
|
+
>(undefined);
|
|
24
|
+
|
|
25
|
+
export const useApplicationPlatform = (): ApplicationPlatform =>
|
|
26
|
+
guaranteeNonNullable(
|
|
27
|
+
useContext(ApplicationPlatformContext),
|
|
28
|
+
`Can't find application platform in context`,
|
|
29
|
+
);
|
|
@@ -14,15 +14,14 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { createContext, useContext
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
17
|
+
import { createContext, useContext } from 'react';
|
|
18
|
+
import { useLocalObservable } from 'mobx-react-lite';
|
|
19
|
+
import type {
|
|
20
20
|
ApplicationStore,
|
|
21
|
-
|
|
21
|
+
GenericLegendApplicationStore,
|
|
22
22
|
} from '../stores/ApplicationStore.js';
|
|
23
23
|
import type { LegendApplicationConfig } from '../application/LegendApplicationConfig.js';
|
|
24
24
|
import { guaranteeNonNullable } from '@finos/legend-shared';
|
|
25
|
-
import { useWebApplicationNavigator } from './WebApplicationNavigatorProvider.js';
|
|
26
25
|
import type { LegendApplicationPluginManager } from '../application/LegendApplicationPluginManager.js';
|
|
27
26
|
import type { LegendApplicationPlugin } from '../stores/LegendApplicationPlugin.js';
|
|
28
27
|
|
|
@@ -39,44 +38,20 @@ export const useApplicationStore = <
|
|
|
39
38
|
`Can't find application store in context`,
|
|
40
39
|
);
|
|
41
40
|
|
|
42
|
-
const ApplicationContent = observer(
|
|
43
|
-
(props: { children: React.ReactNode }): React.ReactElement => {
|
|
44
|
-
const { children } = props;
|
|
45
|
-
const applicationStore = useApplicationStore();
|
|
46
|
-
|
|
47
|
-
useEffect(() => {
|
|
48
|
-
applicationStore.initialize().catch(applicationStore.alertUnhandledError);
|
|
49
|
-
}, [applicationStore]);
|
|
50
|
-
|
|
51
|
-
if (!applicationStore.initState.hasSucceeded) {
|
|
52
|
-
return <></>;
|
|
53
|
-
}
|
|
54
|
-
// TODO: would be great if we can have <React.StrictMode> here but since Mobx React is not ready for
|
|
55
|
-
// concurrency yet, we would have to wait
|
|
56
|
-
// See https://github.com/mobxjs/mobx/issues/2526
|
|
57
|
-
return <>{children}</>;
|
|
58
|
-
},
|
|
59
|
-
);
|
|
60
|
-
|
|
61
41
|
export const ApplicationStoreProvider = <
|
|
62
42
|
T extends LegendApplicationConfig,
|
|
63
43
|
V extends LegendApplicationPluginManager<LegendApplicationPlugin>,
|
|
64
44
|
>({
|
|
65
45
|
children,
|
|
66
|
-
|
|
67
|
-
pluginManager,
|
|
46
|
+
store,
|
|
68
47
|
}: {
|
|
69
48
|
children: React.ReactNode;
|
|
70
|
-
|
|
71
|
-
pluginManager: V;
|
|
49
|
+
store: ApplicationStore<T, V>;
|
|
72
50
|
}): React.ReactElement => {
|
|
73
|
-
const
|
|
74
|
-
const applicationStore = useLocalObservable(
|
|
75
|
-
() => new ApplicationStore(config, navigator, pluginManager),
|
|
76
|
-
);
|
|
51
|
+
const applicationStore = useLocalObservable(() => store);
|
|
77
52
|
return (
|
|
78
53
|
<ApplicationStoreContext.Provider value={applicationStore}>
|
|
79
|
-
|
|
54
|
+
{children}
|
|
80
55
|
</ApplicationStoreContext.Provider>
|
|
81
56
|
);
|
|
82
57
|
};
|
|
@@ -0,0 +1,48 @@
|
|
|
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 { type History } from 'history';
|
|
18
|
+
import { useLocalObservable } from 'mobx-react-lite';
|
|
19
|
+
import { useHistory } from 'react-router';
|
|
20
|
+
import { BrowserRouter } from 'react-router-dom';
|
|
21
|
+
import { BrowserPlatform } from '../stores/platform/BrowserPlatform.js';
|
|
22
|
+
import { ApplicationPlatformContext } from './ApplicationPlatformProvider.js';
|
|
23
|
+
import { useApplicationStore } from './ApplicationStoreProvider.js';
|
|
24
|
+
|
|
25
|
+
const BrowserPlatformProvider: React.FC<{
|
|
26
|
+
children: React.ReactNode;
|
|
27
|
+
}> = ({ children }) => {
|
|
28
|
+
const applicationStore = useApplicationStore();
|
|
29
|
+
const historyAPI = useHistory() as History; // TODO: this is a temporary hack until we upgrade react-router
|
|
30
|
+
const platform = useLocalObservable(
|
|
31
|
+
() => new BrowserPlatform(applicationStore, { historyAPI }),
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<ApplicationPlatformContext.Provider value={platform}>
|
|
36
|
+
{children}
|
|
37
|
+
</ApplicationPlatformContext.Provider>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const BrowserEnvironmentProvider: React.FC<{
|
|
42
|
+
children: React.ReactNode;
|
|
43
|
+
baseUrl: string;
|
|
44
|
+
}> = ({ children, baseUrl }) => (
|
|
45
|
+
<BrowserRouter basename={baseUrl}>
|
|
46
|
+
<BrowserPlatformProvider>{children}</BrowserPlatformProvider>
|
|
47
|
+
</BrowserRouter>
|
|
48
|
+
);
|
|
@@ -38,8 +38,11 @@ import {
|
|
|
38
38
|
FaceSadTearIcon,
|
|
39
39
|
CogIcon,
|
|
40
40
|
Draggable,
|
|
41
|
+
BaseRadioGroup,
|
|
42
|
+
QuestionCircleIcon,
|
|
41
43
|
} from '@finos/legend-art';
|
|
42
44
|
import {
|
|
45
|
+
ADVANCED_FUZZY_SEARCH_MODE,
|
|
43
46
|
ContentType,
|
|
44
47
|
debounce,
|
|
45
48
|
downloadFileUsingDataURI,
|
|
@@ -49,15 +52,17 @@ import {
|
|
|
49
52
|
} from '@finos/legend-shared';
|
|
50
53
|
import { observer } from 'mobx-react-lite';
|
|
51
54
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
52
|
-
import {
|
|
55
|
+
import {
|
|
56
|
+
DEFAULT_DATE_TIME_FORMAT,
|
|
57
|
+
DEFAULT_TAB_SIZE,
|
|
58
|
+
} from '../stores/ApplicationConfig.js';
|
|
53
59
|
import {
|
|
54
60
|
type VirtualAssistantDocumentationEntry,
|
|
55
61
|
VIRTUAL_ASSISTANT_TAB,
|
|
56
62
|
} from '../stores/AssistantService.js';
|
|
57
63
|
import { useApplicationStore } from './ApplicationStoreProvider.js';
|
|
58
|
-
import {
|
|
59
|
-
import {
|
|
60
|
-
import { FuzzySearchAdvancedConfigMenu } from './shared/FuzzySearchAdvancedConfigMenu.js';
|
|
64
|
+
import { LegendApplicationTelemetryHelper } from '../__lib__/LegendApplicationTelemetry.js';
|
|
65
|
+
import { LEGEND_APPLICATION_DOCUMENTATION_KEY } from '../__lib__/LegendApplicationDocumentation.js';
|
|
61
66
|
|
|
62
67
|
const WIZARD_GREETING = `Bonjour, It's Pierre!`;
|
|
63
68
|
|
|
@@ -293,12 +298,12 @@ const VirtualAssistantSearchPanel = observer(() => {
|
|
|
293
298
|
downloadFileUsingDataURI(
|
|
294
299
|
`documentation-registry_${formatDate(
|
|
295
300
|
new Date(Date.now()),
|
|
296
|
-
|
|
301
|
+
DEFAULT_DATE_TIME_FORMAT,
|
|
297
302
|
)}.json`,
|
|
298
303
|
JSON.stringify(
|
|
299
304
|
applicationStore.documentationService.publishDocRegistry(),
|
|
300
305
|
undefined,
|
|
301
|
-
|
|
306
|
+
DEFAULT_TAB_SIZE,
|
|
302
307
|
),
|
|
303
308
|
ContentType.APPLICATION_JSON,
|
|
304
309
|
);
|
|
@@ -307,12 +312,12 @@ const VirtualAssistantSearchPanel = observer(() => {
|
|
|
307
312
|
downloadFileUsingDataURI(
|
|
308
313
|
`documentation-registry_${formatDate(
|
|
309
314
|
new Date(Date.now()),
|
|
310
|
-
|
|
315
|
+
DEFAULT_DATE_TIME_FORMAT,
|
|
311
316
|
)}.json`,
|
|
312
317
|
JSON.stringify(
|
|
313
318
|
applicationStore.documentationService.publishContextualDocIndex(),
|
|
314
319
|
undefined,
|
|
315
|
-
|
|
320
|
+
DEFAULT_TAB_SIZE,
|
|
316
321
|
),
|
|
317
322
|
ContentType.APPLICATION_JSON,
|
|
318
323
|
);
|
|
@@ -414,9 +419,46 @@ const VirtualAssistantSearchPanel = observer(() => {
|
|
|
414
419
|
assistantService.showSearchConfigurationMenu,
|
|
415
420
|
})}
|
|
416
421
|
>
|
|
417
|
-
<
|
|
418
|
-
|
|
419
|
-
|
|
422
|
+
<div className="virtual-assistant__search__input__advanced-config__panel">
|
|
423
|
+
<div className="virtual-assistant__search__input__advanced-config__panel__header__label">
|
|
424
|
+
search config
|
|
425
|
+
{applicationStore.documentationService.hasDocEntry(
|
|
426
|
+
LEGEND_APPLICATION_DOCUMENTATION_KEY.QUESTION_HOW_TO_USE_ADVANCED_SEARCH_SYNTAX,
|
|
427
|
+
) && (
|
|
428
|
+
<div
|
|
429
|
+
onClick={() =>
|
|
430
|
+
assistantService.openDocumentationEntryLink(
|
|
431
|
+
LEGEND_APPLICATION_DOCUMENTATION_KEY.QUESTION_HOW_TO_USE_ADVANCED_SEARCH_SYNTAX,
|
|
432
|
+
)
|
|
433
|
+
}
|
|
434
|
+
title="Click to see documentation"
|
|
435
|
+
className="virtual-assistant__search__input__advanced-config__panel__header__label__hint"
|
|
436
|
+
>
|
|
437
|
+
<QuestionCircleIcon />
|
|
438
|
+
</div>
|
|
439
|
+
)}
|
|
440
|
+
</div>
|
|
441
|
+
<div>
|
|
442
|
+
<BaseRadioGroup
|
|
443
|
+
value={assistantService.searchConfigurationState.currentMode}
|
|
444
|
+
onChange={(event): void => {
|
|
445
|
+
const searchMode = event.target
|
|
446
|
+
.value as ADVANCED_FUZZY_SEARCH_MODE;
|
|
447
|
+
assistantService.searchConfigurationState.setCurrentMode(
|
|
448
|
+
searchMode,
|
|
449
|
+
);
|
|
450
|
+
}}
|
|
451
|
+
row={false}
|
|
452
|
+
options={[
|
|
453
|
+
ADVANCED_FUZZY_SEARCH_MODE.STANDARD,
|
|
454
|
+
ADVANCED_FUZZY_SEARCH_MODE.INCLUDE,
|
|
455
|
+
ADVANCED_FUZZY_SEARCH_MODE.EXACT,
|
|
456
|
+
ADVANCED_FUZZY_SEARCH_MODE.INVERSE,
|
|
457
|
+
]}
|
|
458
|
+
size={1}
|
|
459
|
+
/>
|
|
460
|
+
</div>
|
|
461
|
+
</div>
|
|
420
462
|
</div>
|
|
421
463
|
{assistantService.currentDocumentationEntry && (
|
|
422
464
|
<div className="virtual-assistant__search__results">
|
|
@@ -0,0 +1,63 @@
|
|
|
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 { createMemoryHistory, type History } from 'history';
|
|
18
|
+
import { useLocalObservable } from 'mobx-react-lite';
|
|
19
|
+
import { Router } from 'react-router';
|
|
20
|
+
import { BrowserPlatform } from '../../stores/platform/BrowserPlatform.js';
|
|
21
|
+
import { ApplicationPlatformContext } from '../ApplicationPlatformProvider.js';
|
|
22
|
+
import { type GenericLegendApplicationStore } from '../../stores/ApplicationStore.js';
|
|
23
|
+
import { useApplicationStore } from '../ApplicationStoreProvider.js';
|
|
24
|
+
import { createMock } from '@finos/legend-shared/test';
|
|
25
|
+
|
|
26
|
+
export { createMemoryHistory };
|
|
27
|
+
|
|
28
|
+
export const TEST__BrowserEnvironmentProvider: React.FC<{
|
|
29
|
+
children: React.ReactNode;
|
|
30
|
+
historyAPI?: History | undefined;
|
|
31
|
+
}> = ({ children, historyAPI }) => {
|
|
32
|
+
const applicationStore = useApplicationStore();
|
|
33
|
+
const history = historyAPI ?? createMemoryHistory();
|
|
34
|
+
const platform = useLocalObservable(
|
|
35
|
+
() => new BrowserPlatform(applicationStore, { historyAPI: history }),
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<Router history={history}>
|
|
40
|
+
<ApplicationPlatformContext.Provider value={platform}>
|
|
41
|
+
{children}
|
|
42
|
+
</ApplicationPlatformContext.Provider>
|
|
43
|
+
</Router>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const TEST__provideMockedBrowserPlatform = (
|
|
48
|
+
applicationStore: GenericLegendApplicationStore,
|
|
49
|
+
customization?: {
|
|
50
|
+
mock?: BrowserPlatform;
|
|
51
|
+
historyAPI?: History;
|
|
52
|
+
},
|
|
53
|
+
): BrowserPlatform => {
|
|
54
|
+
const value =
|
|
55
|
+
customization?.mock ??
|
|
56
|
+
new BrowserPlatform(applicationStore, {
|
|
57
|
+
historyAPI: customization?.historyAPI ?? createMemoryHistory(),
|
|
58
|
+
});
|
|
59
|
+
const MOCK__BrowserPlatform = require('../ApplicationPlatformProvider.js'); // eslint-disable-line @typescript-eslint/no-unsafe-assignment
|
|
60
|
+
MOCK__BrowserPlatform.useApplicationPlatform = createMock();
|
|
61
|
+
MOCK__BrowserPlatform.useApplicationPlatform.mockReturnValue(value);
|
|
62
|
+
return value;
|
|
63
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -14,26 +14,28 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
export * from './
|
|
17
|
+
export * from './stores/ApplicationConfig.js';
|
|
18
18
|
|
|
19
19
|
export * from './application/LegendApplication.js';
|
|
20
20
|
export * from './application/LegendApplicationConfig.js';
|
|
21
21
|
export * from './application/LegendApplicationPluginManager.js';
|
|
22
|
-
|
|
23
|
-
export * from './
|
|
24
|
-
export * from './
|
|
25
|
-
export
|
|
22
|
+
|
|
23
|
+
export * from './__lib__/LegendApplicationEvent.js';
|
|
24
|
+
export * from './__lib__/LegendApplicationTelemetry.js';
|
|
25
|
+
export * from './__lib__/LegendApplicationSetting.js';
|
|
26
|
+
export * from './__lib__/LegendApplicationDocumentation.js';
|
|
27
|
+
export { LEGEND_APPLICATION_COLOR_THEME } from './__lib__/LegendApplicationTheme.js';
|
|
26
28
|
|
|
27
29
|
export * from './components/ApplicationStoreProvider.js';
|
|
28
|
-
export * from './components/
|
|
29
|
-
export * from './components/LegendApplicationComponentFrameworkProvider.js';
|
|
30
|
+
export * from './components/ApplicationFrameworkProvider.js';
|
|
30
31
|
export * from './components/useApplicationNavigationContext.js';
|
|
31
32
|
export * from './components/useCommands.js';
|
|
32
|
-
export
|
|
33
|
-
|
|
33
|
+
export {
|
|
34
|
+
forceDispatchKeyboardEvent,
|
|
35
|
+
BackdropContainer,
|
|
36
|
+
} from './components/ApplicationComponentFrameworkProvider.js';
|
|
34
37
|
|
|
35
38
|
export * from './stores/ApplicationStore.js';
|
|
36
|
-
export { WebApplicationNavigator } from './stores/navigation/WebApplicationNavigator.js';
|
|
37
39
|
export {
|
|
38
40
|
NavigationService,
|
|
39
41
|
type NavigationAddress,
|
|
@@ -54,18 +56,4 @@ export * from './stores/AssistantService.js';
|
|
|
54
56
|
export * from './stores/ApplicationNavigationContextService.js';
|
|
55
57
|
export * from './stores/LegendApplicationPlugin.js';
|
|
56
58
|
export * from './stores/Core_LegendApplicationPlugin.js';
|
|
57
|
-
|
|
58
|
-
export * from './stores/ApplicationStoreTestUtils.js';
|
|
59
|
-
export * from './stores/navigation/WebApplicationRouter.js';
|
|
60
59
|
export { DISPLAY_ANSI_ESCAPE } from './stores/terminal/Terminal.js';
|
|
61
|
-
|
|
62
|
-
// ------------------------------------------- TO BE MOVED -------------------------------------------
|
|
63
|
-
|
|
64
|
-
// TODO: move to `@finos/legend-lego/code-editor`
|
|
65
|
-
export {
|
|
66
|
-
PURE_GRAMMAR_TOKEN,
|
|
67
|
-
setupPureLanguageService,
|
|
68
|
-
} from './stores/pure-language/PureLanguageSupport.js';
|
|
69
|
-
export * from './stores/pure-language/PureLanguageCodeEditorSupport.js';
|
|
70
|
-
export * from './components/shared/PackageableElementOptionLabel.js';
|
|
71
|
-
export * from './stores/shared/PackageableElementOption.js';
|
|
@@ -0,0 +1,22 @@
|
|
|
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 const DEFAULT_TAB_SIZE = 2;
|
|
18
|
+
export const DEFAULT_MONOSPACED_FONT_FAMILY = 'Roboto Mono';
|
|
19
|
+
export const DEFAULT_DATE_TIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss";
|
|
20
|
+
|
|
21
|
+
export const DEFAULT_TYPEAHEAD_SEARCH_MINIMUM_SEARCH_LENGTH = 2;
|
|
22
|
+
export const DEFAULT_TYPEAHEAD_SEARCH_LIMIT = 10;
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
import { IllegalStateError } from '@finos/legend-shared';
|
|
18
18
|
import { action, computed, makeObservable, observable } from 'mobx';
|
|
19
19
|
import type { GenericLegendApplicationStore } from './ApplicationStore.js';
|
|
20
|
-
import { LegendApplicationTelemetryHelper } from '../
|
|
20
|
+
import { LegendApplicationTelemetryHelper } from '../__lib__/LegendApplicationTelemetry.js';
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Context data refers to the area of the application that the user is
|
|
@@ -21,10 +21,11 @@ import {
|
|
|
21
21
|
uuid,
|
|
22
22
|
ActionState,
|
|
23
23
|
assertErrorThrown,
|
|
24
|
+
IllegalStateError,
|
|
25
|
+
type Writable,
|
|
24
26
|
} from '@finos/legend-shared';
|
|
25
|
-
import { APPLICATION_EVENT } from '../
|
|
27
|
+
import { APPLICATION_EVENT } from '../__lib__/LegendApplicationEvent.js';
|
|
26
28
|
import type { LegendApplicationConfig } from '../application/LegendApplicationConfig.js';
|
|
27
|
-
import type { WebApplicationNavigator } from './navigation/WebApplicationNavigator.js';
|
|
28
29
|
import type { LegendApplicationPluginManager } from '../application/LegendApplicationPluginManager.js';
|
|
29
30
|
import { DocumentationService } from './DocumentationService.js';
|
|
30
31
|
import { AssistantService } from './AssistantService.js';
|
|
@@ -44,6 +45,8 @@ import { LayoutService } from './LayoutService.js';
|
|
|
44
45
|
import { ClipboardService } from './ClipboardService.js';
|
|
45
46
|
import { NavigationService } from './navigation/NavigationService.js';
|
|
46
47
|
import { SettingService } from './SettingService.js';
|
|
48
|
+
import { DefaultNavigator } from './navigation/DefaultNavigator.js';
|
|
49
|
+
import type { ApplicationPlatform } from './platform/ApplicationPlatform.js';
|
|
47
50
|
|
|
48
51
|
export type GenericLegendApplicationStore = ApplicationStore<
|
|
49
52
|
LegendApplicationConfig,
|
|
@@ -59,6 +62,7 @@ export class ApplicationStore<
|
|
|
59
62
|
readonly config: T;
|
|
60
63
|
readonly pluginManager: V;
|
|
61
64
|
readonly initState = ActionState.create();
|
|
65
|
+
readonly platform?: ApplicationPlatform | undefined;
|
|
62
66
|
|
|
63
67
|
// core
|
|
64
68
|
readonly timeService: TimeService;
|
|
@@ -86,15 +90,7 @@ export class ApplicationStore<
|
|
|
86
90
|
readonly telemetryService: TelemetryService;
|
|
87
91
|
readonly tracerService: TracerService;
|
|
88
92
|
|
|
89
|
-
constructor(
|
|
90
|
-
config: T,
|
|
91
|
-
/**
|
|
92
|
-
* NOTE: as of now, we only support web environment, we will not provide a generic `ApplicationNavigator`
|
|
93
|
-
* This is something we need to think about when we potentially move to another platform
|
|
94
|
-
*/
|
|
95
|
-
navigator: WebApplicationNavigator,
|
|
96
|
-
pluginManager: V,
|
|
97
|
-
) {
|
|
93
|
+
constructor(config: T, pluginManager: V) {
|
|
98
94
|
this.config = config;
|
|
99
95
|
this.pluginManager = pluginManager;
|
|
100
96
|
|
|
@@ -114,7 +110,7 @@ export class ApplicationStore<
|
|
|
114
110
|
this.commandService = new CommandService(this);
|
|
115
111
|
this.keyboardShortcutsService = new KeyboardShortcutsService(this);
|
|
116
112
|
|
|
117
|
-
this.navigationService = new NavigationService(
|
|
113
|
+
this.navigationService = new NavigationService(new DefaultNavigator());
|
|
118
114
|
this.navigationContextService = new ApplicationNavigationContextService(
|
|
119
115
|
this,
|
|
120
116
|
);
|
|
@@ -135,7 +131,7 @@ export class ApplicationStore<
|
|
|
135
131
|
this.tracerService.registerPlugins(pluginManager.getTracerServicePlugins());
|
|
136
132
|
}
|
|
137
133
|
|
|
138
|
-
async initialize(): Promise<void> {
|
|
134
|
+
async initialize(platform: ApplicationPlatform): Promise<void> {
|
|
139
135
|
if (!this.initState.isInInitialState) {
|
|
140
136
|
this.notificationService.notifyIllegalState(
|
|
141
137
|
'Application store is re-initialized',
|
|
@@ -145,12 +141,15 @@ export class ApplicationStore<
|
|
|
145
141
|
this.initState.inProgress();
|
|
146
142
|
|
|
147
143
|
try {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
144
|
+
if (this.platform) {
|
|
145
|
+
throw new IllegalStateError(`Platform is already configured`);
|
|
146
|
+
}
|
|
147
|
+
(this as Writable<ApplicationStore<T, V>>).platform = platform;
|
|
148
|
+
(this as Writable<ApplicationStore<T, V>>).navigationService =
|
|
149
|
+
new NavigationService(platform.getNavigator());
|
|
150
|
+
|
|
151
|
+
await platform.initialize();
|
|
152
|
+
|
|
154
153
|
this.initState.pass();
|
|
155
154
|
} catch (error) {
|
|
156
155
|
assertErrorThrown(error);
|