@finos/legend-application 1.1.7 → 1.2.1
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/CHANGELOG.md +12 -4
- package/lib/application/LegendApplication.d.ts +1 -1
- package/lib/application/LegendApplication.d.ts.map +1 -1
- package/lib/components/ActionAlert.d.ts.map +1 -1
- package/lib/components/ActionAlert.js +3 -4
- package/lib/components/ActionAlert.js.map +1 -1
- package/lib/components/AppHeader.d.ts.map +1 -1
- package/lib/components/AppHeader.js +1 -1
- package/lib/components/AppHeader.js.map +1 -1
- package/lib/components/ApplicationStoreProvider.d.ts +1 -1
- package/lib/components/ApplicationStoreProvider.d.ts.map +1 -1
- package/lib/components/ApplicationStoreProvider.js +1 -1
- package/lib/components/ApplicationStoreProvider.js.map +1 -1
- package/lib/components/ApplicationStoreProviderTestUtils.d.ts +1 -1
- package/lib/components/ApplicationStoreProviderTestUtils.d.ts.map +1 -1
- package/lib/components/ApplicationStoreProviderTestUtils.js +1 -1
- package/lib/components/ApplicationStoreProviderTestUtils.js.map +1 -1
- package/lib/components/BlockingAlert.d.ts.map +1 -1
- package/lib/components/BlockingAlert.js +1 -3
- package/lib/components/BlockingAlert.js.map +1 -1
- package/lib/components/DocumentationLink.d.ts +21 -0
- package/lib/components/DocumentationLink.d.ts.map +1 -0
- package/lib/components/DocumentationLink.js +33 -0
- package/lib/components/DocumentationLink.js.map +1 -0
- package/lib/components/LambdaEditor.js +14 -14
- package/lib/components/LambdaEditor.js.map +1 -1
- package/lib/components/LegendApplicationComponentFrameworkProvider.js +1 -1
- package/lib/components/LegendApplicationComponentFrameworkProvider.js.map +1 -1
- package/lib/components/NotificationManager.d.ts.map +1 -1
- package/lib/components/NotificationManager.js +11 -13
- package/lib/components/NotificationManager.js.map +1 -1
- package/lib/components/TextInputEditor.js +1 -1
- package/lib/components/TextInputEditor.js.map +1 -1
- package/lib/components/WebApplicationNavigatorProvider.js +1 -1
- package/lib/components/WebApplicationNavigatorProvider.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/stores/ApplicationStore.d.ts +5 -3
- package/lib/stores/ApplicationStore.d.ts.map +1 -1
- package/lib/stores/ApplicationStore.js +7 -3
- package/lib/stores/ApplicationStore.js.map +1 -1
- package/lib/stores/ApplicationStoreTestUtils.d.ts +1 -1
- package/lib/stores/ApplicationStoreTestUtils.d.ts.map +1 -1
- package/lib/stores/{ApplicationConfig.d.ts → LegendApplicationConfig.d.ts} +7 -1
- package/lib/stores/LegendApplicationConfig.d.ts.map +1 -0
- package/lib/stores/{ApplicationConfig.js → LegendApplicationConfig.js} +7 -1
- package/lib/stores/LegendApplicationConfig.js.map +1 -0
- package/lib/stores/LegendApplicationDocumentationRegistry.d.ts +22 -0
- package/lib/stores/LegendApplicationDocumentationRegistry.d.ts.map +1 -0
- package/lib/stores/LegendApplicationDocumentationRegistry.js +26 -0
- package/lib/stores/LegendApplicationDocumentationRegistry.js.map +1 -0
- package/package.json +15 -15
- package/src/application/LegendApplication.tsx +1 -1
- package/src/components/ActionAlert.tsx +0 -1
- package/src/components/AppHeader.tsx +5 -3
- package/src/components/ApplicationStoreProvider.tsx +1 -1
- package/src/components/ApplicationStoreProviderTestUtils.tsx +1 -1
- package/src/components/BlockingAlert.tsx +0 -3
- package/src/components/DocumentationLink.tsx +44 -0
- package/src/components/LambdaEditor.tsx +9 -9
- package/src/components/NotificationManager.tsx +3 -5
- package/src/index.ts +2 -1
- package/src/stores/ApplicationStore.ts +11 -7
- package/src/stores/ApplicationStoreTestUtils.ts +1 -1
- package/src/stores/{ApplicationConfig.ts → LegendApplicationConfig.ts} +14 -0
- package/src/stores/LegendApplicationDocumentationRegistry.ts +29 -0
- package/tsconfig.json +3 -1
- package/lib/stores/ApplicationConfig.d.ts.map +0 -1
- package/lib/stores/ApplicationConfig.js.map +0 -1
|
@@ -55,7 +55,7 @@ export type LambdaEditorOnKeyDownEventHandler = {
|
|
|
55
55
|
|
|
56
56
|
const LambdaErrorFeedback: React.FC<{
|
|
57
57
|
error?: EngineError | undefined;
|
|
58
|
-
discardChanges: () =>
|
|
58
|
+
discardChanges: () => void;
|
|
59
59
|
}> = (props) => {
|
|
60
60
|
const { error, discardChanges } = props;
|
|
61
61
|
|
|
@@ -138,15 +138,15 @@ const LambdaEditorInline = observer(
|
|
|
138
138
|
transformStringToLambda?.cancel();
|
|
139
139
|
return await flowResult(
|
|
140
140
|
lambdaEditorState.convertLambdaObjectToGrammarString(pretty),
|
|
141
|
-
).catch(applicationStore.
|
|
141
|
+
).catch(applicationStore.alertUnhandledError);
|
|
142
142
|
};
|
|
143
|
-
const discardChanges = applicationStore.
|
|
143
|
+
const discardChanges = applicationStore.guardUnhandledError(() =>
|
|
144
144
|
transformLambdaToString(isExpanded),
|
|
145
145
|
);
|
|
146
146
|
const toggleExpandedMode = (): void => {
|
|
147
147
|
if (!forceExpansion && !parserError) {
|
|
148
148
|
transformLambdaToString(!isExpanded).catch(
|
|
149
|
-
applicationStore.
|
|
149
|
+
applicationStore.alertUnhandledError,
|
|
150
150
|
);
|
|
151
151
|
setExpanded(!isExpanded);
|
|
152
152
|
}
|
|
@@ -273,7 +273,7 @@ const LambdaEditorInline = observer(
|
|
|
273
273
|
const stringToLambdaTransformation = transformStringToLambda();
|
|
274
274
|
if (stringToLambdaTransformation) {
|
|
275
275
|
flowResult(stringToLambdaTransformation).catch(
|
|
276
|
-
applicationStore.
|
|
276
|
+
applicationStore.alertUnhandledError,
|
|
277
277
|
);
|
|
278
278
|
}
|
|
279
279
|
}
|
|
@@ -461,9 +461,9 @@ const LambdaEditorPopUp = observer(
|
|
|
461
461
|
transformStringToLambda?.cancel();
|
|
462
462
|
return await flowResult(
|
|
463
463
|
lambdaEditorState.convertLambdaObjectToGrammarString(pretty),
|
|
464
|
-
).catch(applicationStore.
|
|
464
|
+
).catch(applicationStore.alertUnhandledError);
|
|
465
465
|
};
|
|
466
|
-
const discardChanges = applicationStore.
|
|
466
|
+
const discardChanges = applicationStore.guardUnhandledError(() =>
|
|
467
467
|
transformLambdaToString(true),
|
|
468
468
|
);
|
|
469
469
|
|
|
@@ -531,7 +531,7 @@ const LambdaEditorPopUp = observer(
|
|
|
531
531
|
const stringToLambdaTransformation = transformStringToLambda();
|
|
532
532
|
if (stringToLambdaTransformation) {
|
|
533
533
|
flowResult(stringToLambdaTransformation).catch(
|
|
534
|
-
applicationStore.
|
|
534
|
+
applicationStore.alertUnhandledError,
|
|
535
535
|
);
|
|
536
536
|
}
|
|
537
537
|
}
|
|
@@ -598,7 +598,7 @@ const LambdaEditorPopUp = observer(
|
|
|
598
598
|
useEffect(() => {
|
|
599
599
|
flowResult(
|
|
600
600
|
lambdaEditorState.convertLambdaObjectToGrammarString(true),
|
|
601
|
-
).catch(applicationStore.
|
|
601
|
+
).catch(applicationStore.alertUnhandledError);
|
|
602
602
|
}, [applicationStore, lambdaEditorState]);
|
|
603
603
|
|
|
604
604
|
useEffect(
|
|
@@ -84,8 +84,9 @@ export const NotificationManager = observer(() => {
|
|
|
84
84
|
applicationStore.setNotification(undefined);
|
|
85
85
|
setIsExpanded(false);
|
|
86
86
|
};
|
|
87
|
-
const handleCopy = ()
|
|
88
|
-
applicationStore.copyTextToClipboard(message)
|
|
87
|
+
const handleCopy = applicationStore.guardUnhandledError(() =>
|
|
88
|
+
applicationStore.copyTextToClipboard(message),
|
|
89
|
+
);
|
|
89
90
|
const toggleExpansion = (): void => setIsExpanded(!isExpanded);
|
|
90
91
|
|
|
91
92
|
const onSnackbarAutoHideOrClickAway = (
|
|
@@ -102,9 +103,6 @@ export const NotificationManager = observer(() => {
|
|
|
102
103
|
|
|
103
104
|
return (
|
|
104
105
|
<Notification
|
|
105
|
-
TransitionProps={{
|
|
106
|
-
appear: false,
|
|
107
|
-
}}
|
|
108
106
|
classes={{
|
|
109
107
|
root: 'notification',
|
|
110
108
|
anchorOriginBottomRight: 'notification__position',
|
package/src/index.ts
CHANGED
|
@@ -27,12 +27,13 @@ export * from './components/ApplicationStoreProviderTestUtils';
|
|
|
27
27
|
export * from './components/WebApplicationNavigatorProviderTestUtils';
|
|
28
28
|
|
|
29
29
|
export { AppHeader } from './components/AppHeader';
|
|
30
|
+
export { DocumentationLink } from './components/DocumentationLink';
|
|
30
31
|
export * from './components/TextInputEditor';
|
|
31
32
|
export * from './components/LambdaEditor';
|
|
32
33
|
|
|
33
34
|
export * from './stores/ApplicationStore';
|
|
34
35
|
export { APPLICATION_LOG_EVENT } from './stores/ApplicationLogEvent';
|
|
35
|
-
export * from './stores/
|
|
36
|
+
export * from './stores/LegendApplicationConfig';
|
|
36
37
|
export { WebApplicationNavigator } from './stores/WebApplicationNavigator';
|
|
37
38
|
export { LambdaEditorState } from './stores/LambdaEditorState';
|
|
38
39
|
export * from './stores/PackageableElementOption';
|
|
@@ -28,9 +28,10 @@ import {
|
|
|
28
28
|
} from '@finos/legend-shared';
|
|
29
29
|
import { makeAutoObservable, action } from 'mobx';
|
|
30
30
|
import { APPLICATION_LOG_EVENT } from './ApplicationLogEvent';
|
|
31
|
-
import type { LegendApplicationConfig } from './
|
|
31
|
+
import type { LegendApplicationConfig } from './LegendApplicationConfig';
|
|
32
32
|
import type { WebApplicationNavigator } from './WebApplicationNavigator';
|
|
33
33
|
import type { LegendApplicationPluginManager } from '../application/LegendApplicationPluginManager';
|
|
34
|
+
import type { LegendApplicationDocumentationRegistry } from './LegendApplicationDocumentationRegistry';
|
|
34
35
|
|
|
35
36
|
export enum ActionAlertType {
|
|
36
37
|
STANDARD = 'STANDARD',
|
|
@@ -105,6 +106,7 @@ export class ApplicationStore<T extends LegendApplicationConfig> {
|
|
|
105
106
|
blockingAlertInfo?: BlockingAlertInfo | undefined;
|
|
106
107
|
actionAlertInfo?: ActionAlertInfo | undefined;
|
|
107
108
|
config: T;
|
|
109
|
+
docRegistry: LegendApplicationDocumentationRegistry;
|
|
108
110
|
|
|
109
111
|
log: Log = new Log();
|
|
110
112
|
telemetryService = new TelemetryService();
|
|
@@ -129,6 +131,7 @@ export class ApplicationStore<T extends LegendApplicationConfig> {
|
|
|
129
131
|
});
|
|
130
132
|
|
|
131
133
|
this.config = config;
|
|
134
|
+
this.docRegistry = config.docRegistry;
|
|
132
135
|
this.navigator = navigator;
|
|
133
136
|
|
|
134
137
|
// Register plugins
|
|
@@ -273,10 +276,10 @@ export class ApplicationStore<T extends LegendApplicationConfig> {
|
|
|
273
276
|
* When we call store/state functions from the component, we should handle error thrown at these functions instead
|
|
274
277
|
* of throwing them to the UI. This enforces that by throwing `IllegalStateError`
|
|
275
278
|
*/
|
|
276
|
-
|
|
279
|
+
alertUnhandledError = (error: Error): void => {
|
|
277
280
|
this.log.error(
|
|
278
281
|
LogEvent.create(APPLICATION_LOG_EVENT.ILLEGAL_APPLICATION_STATE_OCCURRED),
|
|
279
|
-
'Encountered unhandled
|
|
282
|
+
'Encountered unhandled error in component tree',
|
|
280
283
|
error,
|
|
281
284
|
);
|
|
282
285
|
this.notifyIllegalState(error.message);
|
|
@@ -285,10 +288,11 @@ export class ApplicationStore<T extends LegendApplicationConfig> {
|
|
|
285
288
|
/**
|
|
286
289
|
* Guarantee that the action being used by the component does not throw unhandled errors
|
|
287
290
|
*/
|
|
288
|
-
|
|
289
|
-
(actionFn: () => Promise<void>): (() =>
|
|
290
|
-
():
|
|
291
|
-
actionFn().catch(this.
|
|
291
|
+
guardUnhandledError =
|
|
292
|
+
(actionFn: () => Promise<void>): (() => void) =>
|
|
293
|
+
(): void => {
|
|
294
|
+
actionFn().catch(this.alertUnhandledError);
|
|
295
|
+
};
|
|
292
296
|
|
|
293
297
|
async copyTextToClipboard(text: string): Promise<void> {
|
|
294
298
|
if (typeof navigator.clipboard.writeText === 'function') {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
import { ApplicationStore } from './ApplicationStore';
|
|
18
18
|
import { createBrowserHistory } from 'history';
|
|
19
19
|
import { WebApplicationNavigator } from './WebApplicationNavigator';
|
|
20
|
-
import type { LegendApplicationConfig } from './
|
|
20
|
+
import type { LegendApplicationConfig } from './LegendApplicationConfig';
|
|
21
21
|
import type { LegendApplicationPluginManager } from '../application/LegendApplicationPluginManager';
|
|
22
22
|
|
|
23
23
|
export const TEST_DATA__applicationVersion = {
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
guaranteeNonEmptyString,
|
|
19
19
|
guaranteeNonNullable,
|
|
20
20
|
} from '@finos/legend-shared';
|
|
21
|
+
import { LegendApplicationDocumentationRegistry } from './LegendApplicationDocumentationRegistry';
|
|
21
22
|
|
|
22
23
|
export interface LegendApplicationVersionData {
|
|
23
24
|
buildTime: string;
|
|
@@ -28,6 +29,10 @@ export interface LegendApplicationVersionData {
|
|
|
28
29
|
export interface LegendApplicationConfigurationData {
|
|
29
30
|
appName: string;
|
|
30
31
|
env: string;
|
|
32
|
+
documentation?: {
|
|
33
|
+
url: string;
|
|
34
|
+
entries?: Record<string, string>;
|
|
35
|
+
};
|
|
31
36
|
// TODO: when we support vault-like settings
|
|
32
37
|
// See https://github.com/finos/legend-studio/issues/407
|
|
33
38
|
// settingOverrides
|
|
@@ -39,6 +44,8 @@ export abstract class LegendApplicationConfig {
|
|
|
39
44
|
readonly baseUrl: string;
|
|
40
45
|
readonly env: string;
|
|
41
46
|
|
|
47
|
+
readonly docRegistry: LegendApplicationDocumentationRegistry;
|
|
48
|
+
|
|
42
49
|
readonly appVersion: string;
|
|
43
50
|
readonly appVersionBuildTime: string;
|
|
44
51
|
readonly appVersionCommitId: string;
|
|
@@ -58,6 +65,13 @@ export abstract class LegendApplicationConfig {
|
|
|
58
65
|
`Can't configure application: 'env' field is missing or empty`,
|
|
59
66
|
);
|
|
60
67
|
|
|
68
|
+
// Documentation
|
|
69
|
+
this.docRegistry = new LegendApplicationDocumentationRegistry();
|
|
70
|
+
this.docRegistry.url = configData.documentation?.url;
|
|
71
|
+
Object.entries(configData.documentation?.entries ?? []).forEach((entry) =>
|
|
72
|
+
this.docRegistry.registerEntry(entry[0], entry[1]),
|
|
73
|
+
);
|
|
74
|
+
|
|
61
75
|
// Version
|
|
62
76
|
this.appVersion = guaranteeNonNullable(
|
|
63
77
|
versionData.version,
|
|
@@ -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
|
+
export class LegendApplicationDocumentationRegistry {
|
|
18
|
+
url?: string | undefined;
|
|
19
|
+
|
|
20
|
+
private registry = new Map<string, string>();
|
|
21
|
+
|
|
22
|
+
registerEntry(key: string, value: string): void {
|
|
23
|
+
this.registry.set(key, value);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
getEntry(key: string): string | undefined {
|
|
27
|
+
return this.registry.get(key);
|
|
28
|
+
}
|
|
29
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -34,11 +34,12 @@
|
|
|
34
34
|
"./src/const.ts",
|
|
35
35
|
"./src/index.ts",
|
|
36
36
|
"./src/components/ApplicationTestID.ts",
|
|
37
|
-
"./src/stores/ApplicationConfig.ts",
|
|
38
37
|
"./src/stores/ApplicationLogEvent.ts",
|
|
39
38
|
"./src/stores/ApplicationStore.ts",
|
|
40
39
|
"./src/stores/ApplicationStoreTestUtils.ts",
|
|
41
40
|
"./src/stores/LambdaEditorState.ts",
|
|
41
|
+
"./src/stores/LegendApplicationConfig.ts",
|
|
42
|
+
"./src/stores/LegendApplicationDocumentationRegistry.ts",
|
|
42
43
|
"./src/stores/PackageableElementOption.ts",
|
|
43
44
|
"./src/stores/PureLanguageSupport.ts",
|
|
44
45
|
"./src/stores/WebApplicationNavigator.ts",
|
|
@@ -49,6 +50,7 @@
|
|
|
49
50
|
"./src/components/ApplicationStoreProvider.tsx",
|
|
50
51
|
"./src/components/ApplicationStoreProviderTestUtils.tsx",
|
|
51
52
|
"./src/components/BlockingAlert.tsx",
|
|
53
|
+
"./src/components/DocumentationLink.tsx",
|
|
52
54
|
"./src/components/LambdaEditor.tsx",
|
|
53
55
|
"./src/components/LegendApplicationComponentFrameworkProvider.tsx",
|
|
54
56
|
"./src/components/NotificationManager.tsx",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ApplicationConfig.d.ts","sourceRoot":"","sources":["../../src/stores/ApplicationConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAOH,MAAM,WAAW,4BAA4B;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,kCAAkC;IACjD,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IAIZ,UAAU,CAAC,EAAE,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;CAC3C;AAED,8BAAsB,uBAAuB;IAC3C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;gBAGlC,UAAU,EAAE,kCAAkC,EAC9C,WAAW,EAAE,4BAA4B,EACzC,OAAO,EAAE,MAAM;CA0BlB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ApplicationConfig.js","sourceRoot":"","sources":["../../src/stores/ApplicationConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAiB9B,MAAM,OAAgB,uBAAuB;IAClC,OAAO,CAAS;IAChB,OAAO,CAAS;IAChB,GAAG,CAAS;IAEZ,UAAU,CAAS;IACnB,mBAAmB,CAAS;IAC5B,kBAAkB,CAAS;IAEpC,YACE,UAA8C,EAC9C,WAAyC,EACzC,OAAe;QAEf,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,uBAAuB,CACpC,UAAU,CAAC,OAAO,EAClB,kEAAkE,CACnE,CAAC;QACF,IAAI,CAAC,GAAG,GAAG,uBAAuB,CAChC,UAAU,CAAC,GAAG,EACd,8DAA8D,CAC/D,CAAC;QAEF,UAAU;QACV,IAAI,CAAC,UAAU,GAAG,oBAAoB,CACpC,WAAW,CAAC,OAAO,EACnB,+DAA+D,CAChE,CAAC;QACF,IAAI,CAAC,mBAAmB,GAAG,oBAAoB,CAC7C,WAAW,CAAC,SAAS,EACrB,iEAAiE,CAClE,CAAC;QACF,IAAI,CAAC,kBAAkB,GAAG,oBAAoB,CAC5C,WAAW,CAAC,SAAS,EACrB,iEAAiE,CAClE,CAAC;IACJ,CAAC;CACF"}
|