@finos/legend-application-marketplace 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +3 -0
  3. package/lib/__lib__/LegendMarketplaceEventHelper.d.ts +20 -0
  4. package/lib/__lib__/LegendMarketplaceEventHelper.d.ts.map +1 -0
  5. package/lib/__lib__/LegendMarketplaceEventHelper.js +22 -0
  6. package/lib/__lib__/LegendMarketplaceEventHelper.js.map +1 -0
  7. package/lib/__lib__/LegendMarketplaceNavigation.d.ts +19 -0
  8. package/lib/__lib__/LegendMarketplaceNavigation.d.ts.map +1 -0
  9. package/lib/__lib__/LegendMarketplaceNavigation.js +19 -0
  10. package/lib/__lib__/LegendMarketplaceNavigation.js.map +1 -0
  11. package/lib/__lib__/LegendMarketplaceTesting.d.ts +19 -0
  12. package/lib/__lib__/LegendMarketplaceTesting.d.ts.map +1 -0
  13. package/lib/__lib__/LegendMarketplaceTesting.js +20 -0
  14. package/lib/__lib__/LegendMarketplaceTesting.js.map +1 -0
  15. package/lib/application/LegendMarketplace.d.ts +27 -0
  16. package/lib/application/LegendMarketplace.d.ts.map +1 -0
  17. package/lib/application/LegendMarketplace.js +39 -0
  18. package/lib/application/LegendMarketplace.js.map +1 -0
  19. package/lib/application/LegendMarketplaceApplicationConfig.d.ts +53 -0
  20. package/lib/application/LegendMarketplaceApplicationConfig.d.ts.map +1 -0
  21. package/lib/application/LegendMarketplaceApplicationConfig.js +65 -0
  22. package/lib/application/LegendMarketplaceApplicationConfig.js.map +1 -0
  23. package/lib/application/LegendMarketplacePluginManager.d.ts +22 -0
  24. package/lib/application/LegendMarketplacePluginManager.d.ts.map +1 -0
  25. package/lib/application/LegendMarketplacePluginManager.js +25 -0
  26. package/lib/application/LegendMarketplacePluginManager.js.map +1 -0
  27. package/lib/application/__test-utils__/LegendMarketplaceApplicationTestUtils.d.ts +18 -0
  28. package/lib/application/__test-utils__/LegendMarketplaceApplicationTestUtils.d.ts.map +1 -0
  29. package/lib/application/__test-utils__/LegendMarketplaceApplicationTestUtils.js +46 -0
  30. package/lib/application/__test-utils__/LegendMarketplaceApplicationTestUtils.js.map +1 -0
  31. package/lib/components/LegendMarketplaceFrameworkProvider.d.ts +22 -0
  32. package/lib/components/LegendMarketplaceFrameworkProvider.d.ts.map +1 -0
  33. package/lib/components/LegendMarketplaceFrameworkProvider.js +31 -0
  34. package/lib/components/LegendMarketplaceFrameworkProvider.js.map +1 -0
  35. package/lib/components/LegendMarketplaceWebApplication.d.ts +24 -0
  36. package/lib/components/LegendMarketplaceWebApplication.d.ts.map +1 -0
  37. package/lib/components/LegendMarketplaceWebApplication.js +43 -0
  38. package/lib/components/LegendMarketplaceWebApplication.js.map +1 -0
  39. package/lib/components/__test-utils__/LegendMarketplaceStoreTestUtils.d.ts +30 -0
  40. package/lib/components/__test-utils__/LegendMarketplaceStoreTestUtils.d.ts.map +1 -0
  41. package/lib/components/__test-utils__/LegendMarketplaceStoreTestUtils.js +56 -0
  42. package/lib/components/__test-utils__/LegendMarketplaceStoreTestUtils.js.map +1 -0
  43. package/lib/components/extensions/Core_LegendMarketplaceApplicationPlugin.d.ts +21 -0
  44. package/lib/components/extensions/Core_LegendMarketplaceApplicationPlugin.d.ts.map +1 -0
  45. package/lib/components/extensions/Core_LegendMarketplaceApplicationPlugin.js +24 -0
  46. package/lib/components/extensions/Core_LegendMarketplaceApplicationPlugin.js.map +1 -0
  47. package/lib/components/header/LegendMarketplaceAppInfo.d.ts +21 -0
  48. package/lib/components/header/LegendMarketplaceAppInfo.d.ts.map +1 -0
  49. package/lib/components/header/LegendMarketplaceAppInfo.js +28 -0
  50. package/lib/components/header/LegendMarketplaceAppInfo.js.map +1 -0
  51. package/lib/components/header/LegendMarketplaceHeader.d.ts +19 -0
  52. package/lib/components/header/LegendMarketplaceHeader.d.ts.map +1 -0
  53. package/lib/components/header/LegendMarketplaceHeader.js +36 -0
  54. package/lib/components/header/LegendMarketplaceHeader.js.map +1 -0
  55. package/lib/components/home/LegendMarketplaceHome.d.ts +19 -0
  56. package/lib/components/home/LegendMarketplaceHome.d.ts.map +1 -0
  57. package/lib/components/home/LegendMarketplaceHome.js +22 -0
  58. package/lib/components/home/LegendMarketplaceHome.js.map +1 -0
  59. package/lib/index.css +17 -0
  60. package/lib/index.css.map +1 -0
  61. package/lib/index.d.ts +22 -0
  62. package/lib/index.d.ts.map +1 -0
  63. package/lib/index.js +24 -0
  64. package/lib/index.js.map +1 -0
  65. package/lib/package.json +87 -0
  66. package/lib/stores/LegendMarketplaceApplicationPlugin.d.ts +26 -0
  67. package/lib/stores/LegendMarketplaceApplicationPlugin.d.ts.map +1 -0
  68. package/lib/stores/LegendMarketplaceApplicationPlugin.js +27 -0
  69. package/lib/stores/LegendMarketplaceApplicationPlugin.js.map +1 -0
  70. package/lib/stores/LegendMarketplaceBaseStore.d.ts +30 -0
  71. package/lib/stores/LegendMarketplaceBaseStore.d.ts.map +1 -0
  72. package/lib/stores/LegendMarketplaceBaseStore.js +63 -0
  73. package/lib/stores/LegendMarketplaceBaseStore.js.map +1 -0
  74. package/package.json +87 -0
  75. package/src/__lib__/LegendMarketplaceEventHelper.ts +26 -0
  76. package/src/__lib__/LegendMarketplaceNavigation.ts +19 -0
  77. package/src/__lib__/LegendMarketplaceTesting.ts +19 -0
  78. package/src/application/LegendMarketplace.tsx +65 -0
  79. package/src/application/LegendMarketplaceApplicationConfig.ts +129 -0
  80. package/src/application/LegendMarketplacePluginManager.ts +28 -0
  81. package/src/application/__test-utils__/LegendMarketplaceApplicationTestUtils.ts +53 -0
  82. package/src/components/LegendMarketplaceFrameworkProvider.tsx +70 -0
  83. package/src/components/LegendMarketplaceWebApplication.tsx +117 -0
  84. package/src/components/__test-utils__/LegendMarketplaceStoreTestUtils.tsx +98 -0
  85. package/src/components/extensions/Core_LegendMarketplaceApplicationPlugin.tsx +26 -0
  86. package/src/components/header/LegendMarketplaceAppInfo.tsx +166 -0
  87. package/src/components/header/LegendMarketplaceHeader.tsx +68 -0
  88. package/src/components/home/LegendMarketplaceHome.tsx +41 -0
  89. package/src/index.ts +28 -0
  90. package/src/stores/LegendMarketplaceApplicationPlugin.ts +30 -0
  91. package/src/stores/LegendMarketplaceBaseStore.ts +105 -0
  92. package/tsconfig.json +81 -0
  93. package/tsconfig.package.json +56 -0
@@ -0,0 +1,53 @@
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 { TEST__getApplicationVersionData } from '@finos/legend-application/test';
18
+ import {
19
+ type LegendMarketplaceApplicationConfigurationData,
20
+ LegendMarketplaceApplicationConfig,
21
+ } from '../LegendMarketplaceApplicationConfig.js';
22
+
23
+ const TEST_DATA__appConfig: LegendMarketplaceApplicationConfigurationData = {
24
+ appName: 'marketplace',
25
+ env: 'test-env',
26
+ engine: {
27
+ url: 'https://testEngineUrl',
28
+ queryUrl: 'https://testEngineQueryUrl',
29
+ },
30
+ depot: {
31
+ url: 'https://testMetadataUrl',
32
+ },
33
+ studio: {
34
+ url: 'https://testStudioUrl',
35
+ },
36
+ query: {
37
+ url: 'https://testQueryUrl',
38
+ },
39
+ };
40
+
41
+ export const TEST__getTestLegendMarketplaceApplicationConfig = (
42
+ extraConfigData = {},
43
+ ): LegendMarketplaceApplicationConfig => {
44
+ const config = new LegendMarketplaceApplicationConfig({
45
+ configData: {
46
+ ...TEST_DATA__appConfig,
47
+ ...extraConfigData,
48
+ },
49
+ versionData: TEST__getApplicationVersionData(),
50
+ baseAddress: '/marketplace/',
51
+ });
52
+ return config;
53
+ };
@@ -0,0 +1,70 @@
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 { createContext, useContext } from 'react';
18
+ import { guaranteeNonNullable } from '@finos/legend-shared';
19
+ import { useLocalObservable } from 'mobx-react-lite';
20
+ import {
21
+ ApplicationFrameworkProvider,
22
+ useApplicationStore,
23
+ } from '@finos/legend-application';
24
+ import {
25
+ type LegendMarketplaceApplicationStore,
26
+ LegendMarketplaceBaseStore,
27
+ } from '../stores/LegendMarketplaceBaseStore.js';
28
+ import type { LegendMarketplaceApplicationConfig } from '../application/LegendMarketplaceApplicationConfig.js';
29
+ import type { LegendMarketplacePluginManager } from '../application/LegendMarketplacePluginManager.js';
30
+
31
+ export const useLegendMarketplaceApplicationStore =
32
+ (): LegendMarketplaceApplicationStore =>
33
+ useApplicationStore<
34
+ LegendMarketplaceApplicationConfig,
35
+ LegendMarketplacePluginManager
36
+ >();
37
+
38
+ const LegendMarketplaceBaseStoreContext = createContext<
39
+ LegendMarketplaceBaseStore | undefined
40
+ >(undefined);
41
+
42
+ const LegendMarketplaceBaseStoreProvider: React.FC<{
43
+ children: React.ReactNode;
44
+ }> = ({ children }) => {
45
+ const applicationStore = useLegendMarketplaceApplicationStore();
46
+ const baseStore = useLocalObservable(
47
+ () => new LegendMarketplaceBaseStore(applicationStore),
48
+ );
49
+ return (
50
+ <LegendMarketplaceBaseStoreContext.Provider value={baseStore}>
51
+ {children}
52
+ </LegendMarketplaceBaseStoreContext.Provider>
53
+ );
54
+ };
55
+
56
+ export const useLegendMarketplaceBaseStore = (): LegendMarketplaceBaseStore =>
57
+ guaranteeNonNullable(
58
+ useContext(LegendMarketplaceBaseStoreContext),
59
+ `Can't find Legend Marketplace base store in context`,
60
+ );
61
+
62
+ export const LegendMarketplaceFrameworkProvider: React.FC<{
63
+ children: React.ReactNode;
64
+ }> = ({ children }) => (
65
+ <ApplicationFrameworkProvider>
66
+ <LegendMarketplaceBaseStoreProvider>
67
+ {children}
68
+ </LegendMarketplaceBaseStoreProvider>
69
+ </ApplicationFrameworkProvider>
70
+ );
@@ -0,0 +1,117 @@
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 { GhostIcon } from '@finos/legend-art';
20
+ import { flowResult } from 'mobx';
21
+ import { useApplicationStore } from '@finos/legend-application';
22
+ import {
23
+ BrowserEnvironmentProvider,
24
+ Route,
25
+ Routes,
26
+ } from '@finos/legend-application/browser';
27
+ import {
28
+ LegendMarketplaceFrameworkProvider,
29
+ useLegendMarketplaceApplicationStore,
30
+ useLegendMarketplaceBaseStore,
31
+ } from './LegendMarketplaceFrameworkProvider.js';
32
+ import { LEGEND_MARKETPLACE_ROUTE_PATTERN } from '../__lib__/LegendMarketplaceNavigation.js';
33
+ import { LegendMarketplaceHome } from './home/LegendMarketplaceHome.js';
34
+
35
+ const NotFoundPage = observer(() => {
36
+ const applicationStore = useApplicationStore();
37
+
38
+ const currentPath =
39
+ applicationStore.navigationService.navigator.getCurrentLocation();
40
+
41
+ return (
42
+ <div className="app__page">
43
+ <div className="not-found-screen not-found-screen--no-documentation">
44
+ <div className="not-found-screen__icon">
45
+ <div className="not-found-screen__icon__ghost">
46
+ <GhostIcon />
47
+ </div>
48
+ <div className="not-found-screen__icon__shadow">
49
+ <svg viewBox="0 0 600 400">
50
+ <g transform="translate(300 200)">
51
+ <ellipse
52
+ className="not-found-screen__icon__shadow__inner"
53
+ rx="320"
54
+ ry="80"
55
+ ></ellipse>
56
+ </g>
57
+ </svg>
58
+ </div>
59
+ </div>
60
+ <div className="not-found-screen__text-content">
61
+ <div className="not-found-screen__text-content__title">
62
+ 404. Not Found
63
+ </div>
64
+ <div className="not-found-screen__text-content__detail">
65
+ The requested URL
66
+ <span className="not-found-screen__text-content__detail__url">
67
+ {applicationStore.navigationService.navigator.generateAddress(
68
+ currentPath,
69
+ )}
70
+ </span>
71
+ was not found in the application
72
+ </div>
73
+ </div>
74
+ </div>
75
+ </div>
76
+ );
77
+ });
78
+
79
+ export const LegendMarketplaceWebApplicationRouter = observer(() => {
80
+ const baseStore = useLegendMarketplaceBaseStore();
81
+ const applicationStore = useLegendMarketplaceApplicationStore();
82
+
83
+ useEffect(() => {
84
+ flowResult(baseStore.initialize()).catch(
85
+ applicationStore.alertUnhandledError,
86
+ );
87
+ }, [applicationStore, baseStore]);
88
+ return (
89
+ <div className="app">
90
+ {baseStore.initState.hasCompleted && (
91
+ <>
92
+ <Routes>
93
+ <Route
94
+ path={LEGEND_MARKETPLACE_ROUTE_PATTERN.DEFAULT}
95
+ element={<LegendMarketplaceHome />}
96
+ />
97
+ <Route path="*" element={<NotFoundPage />} />
98
+ </Routes>
99
+ </>
100
+ )}
101
+ </div>
102
+ );
103
+ });
104
+
105
+ export const LegendMarketplaceWebApplication = observer(
106
+ (props: { baseUrl: string }) => {
107
+ const { baseUrl } = props;
108
+
109
+ return (
110
+ <BrowserEnvironmentProvider baseUrl={baseUrl}>
111
+ <LegendMarketplaceFrameworkProvider>
112
+ <LegendMarketplaceWebApplicationRouter />
113
+ </LegendMarketplaceFrameworkProvider>
114
+ </BrowserEnvironmentProvider>
115
+ );
116
+ },
117
+ );
@@ -0,0 +1,98 @@
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 RenderResult, render, waitFor } from '@testing-library/react';
18
+ import { type AbstractPlugin, type AbstractPreset } from '@finos/legend-shared';
19
+ import { createMock } from '@finos/legend-shared/test';
20
+ import {
21
+ ApplicationStore,
22
+ ApplicationStoreProvider,
23
+ } from '@finos/legend-application';
24
+ import { TEST__BrowserEnvironmentProvider } from '@finos/legend-application/test';
25
+ import { Route, Routes } from '@finos/legend-application/browser';
26
+ import {
27
+ type LegendMarketplaceApplicationStore,
28
+ LegendMarketplaceBaseStore,
29
+ } from '../../stores/LegendMarketplaceBaseStore.js';
30
+ import { LegendMarketplaceFrameworkProvider } from '../LegendMarketplaceFrameworkProvider.js';
31
+ import { LEGEND_MARKETPLACE_ROUTE_PATTERN } from '../../__lib__/LegendMarketplaceNavigation.js';
32
+ import { LegendMarketplaceHome } from '../home/LegendMarketplaceHome.js';
33
+ import { LEGEND_MARKETPLACE_TEST_ID } from '../../__lib__/LegendMarketplaceTesting.js';
34
+ import { LegendMarketplacePluginManager } from '../../application/LegendMarketplacePluginManager.js';
35
+ import { Core_LegendMarketplaceApplicationPlugin } from '../extensions/Core_LegendMarketplaceApplicationPlugin.js';
36
+ import { TEST__getTestLegendMarketplaceApplicationConfig } from '../../application/__test-utils__/LegendMarketplaceApplicationTestUtils.js';
37
+
38
+ export const TEST__provideMockedLegendMarketplaceBaseStore =
39
+ async (customization?: {
40
+ mock?: LegendMarketplaceBaseStore;
41
+ applicationStore?: LegendMarketplaceApplicationStore;
42
+ pluginManager?: LegendMarketplacePluginManager;
43
+ extraPlugins?: AbstractPlugin[];
44
+ extraPresets?: AbstractPreset[];
45
+ }): Promise<LegendMarketplaceBaseStore> => {
46
+ const pluginManager =
47
+ customization?.pluginManager ?? LegendMarketplacePluginManager.create();
48
+ pluginManager
49
+ .usePlugins([
50
+ new Core_LegendMarketplaceApplicationPlugin(),
51
+ ...(customization?.extraPlugins ?? []),
52
+ ])
53
+ .usePresets([...(customization?.extraPresets ?? [])])
54
+ .install();
55
+ const applicationStore =
56
+ customization?.applicationStore ??
57
+ new ApplicationStore(
58
+ TEST__getTestLegendMarketplaceApplicationConfig(),
59
+ pluginManager,
60
+ );
61
+ const value =
62
+ customization?.mock ?? new LegendMarketplaceBaseStore(applicationStore);
63
+ const MOCK__LegendMarketplaceBaseStoreProvider = require('../LegendMarketplaceFrameworkProvider.js'); // eslint-disable-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-require-imports
64
+ MOCK__LegendMarketplaceBaseStoreProvider.useLegendMarketplaceBaseStore =
65
+ createMock();
66
+ MOCK__LegendMarketplaceBaseStoreProvider.useLegendMarketplaceBaseStore.mockReturnValue(
67
+ value,
68
+ );
69
+ return value;
70
+ };
71
+
72
+ export const TEST__setUpMarketplace = async (
73
+ MOCK__store: LegendMarketplaceBaseStore,
74
+ ): Promise<{
75
+ renderResult: RenderResult;
76
+ }> => {
77
+ const renderResult = render(
78
+ <ApplicationStoreProvider store={MOCK__store.applicationStore}>
79
+ <TEST__BrowserEnvironmentProvider initialEntries={['/']}>
80
+ <LegendMarketplaceFrameworkProvider>
81
+ <Routes>
82
+ <Route
83
+ path={LEGEND_MARKETPLACE_ROUTE_PATTERN.DEFAULT}
84
+ element={<LegendMarketplaceHome />}
85
+ />
86
+ </Routes>
87
+ </LegendMarketplaceFrameworkProvider>
88
+ </TEST__BrowserEnvironmentProvider>
89
+ </ApplicationStoreProvider>,
90
+ );
91
+ await waitFor(() =>
92
+ renderResult.getByTestId(LEGEND_MARKETPLACE_TEST_ID.HEADER),
93
+ );
94
+
95
+ return {
96
+ renderResult,
97
+ };
98
+ };
@@ -0,0 +1,26 @@
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 packageJson from '../../../package.json' with { type: 'json' };
18
+ import { LegendMarketplaceApplicationPlugin } from '../../stores/LegendMarketplaceApplicationPlugin.js';
19
+
20
+ export class Core_LegendMarketplaceApplicationPlugin extends LegendMarketplaceApplicationPlugin {
21
+ static NAME = packageJson.extensions.applicationMarketplacePlugin;
22
+
23
+ constructor() {
24
+ super(Core_LegendMarketplaceApplicationPlugin.NAME, packageJson.version);
25
+ }
26
+ }
@@ -0,0 +1,166 @@
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 React from 'react';
18
+ import { useLegendMarketplaceApplicationStore } from '../LegendMarketplaceFrameworkProvider.js';
19
+ import { isNonNullable } from '@finos/legend-shared';
20
+ import {
21
+ CopyIcon,
22
+ Dialog,
23
+ InfoCircleIcon,
24
+ Modal,
25
+ ModalBody,
26
+ ModalHeader,
27
+ ModalHeaderActions,
28
+ ModalTitle,
29
+ TimesIcon,
30
+ } from '@finos/legend-art';
31
+
32
+ export const LegendMarketplaceAppInfo: React.FC<{
33
+ open: boolean;
34
+ closeModal: () => void;
35
+ }> = (props) => {
36
+ const { open, closeModal } = props;
37
+ const applicationStore = useLegendMarketplaceApplicationStore();
38
+ const config = applicationStore.config;
39
+ const copyInfo = (): void => {
40
+ applicationStore.clipboardService
41
+ .copyTextToClipboard(
42
+ [
43
+ `Environment: ${config.env}`,
44
+ `Version: ${config.appVersion}`,
45
+ `Revision: ${config.appVersionCommitId}`,
46
+ `Build Time: ${config.appVersionBuildTime}`,
47
+ `Engine Server: ${config.engineServerUrl}`,
48
+ `Depot Server: ${config.depotServerUrl}`,
49
+ `Studio URL: ${config.studioApplicationUrl}`,
50
+ `Query URL: ${config.queryApplicationUrl}`,
51
+ ]
52
+ .filter(isNonNullable)
53
+ .join('\n'),
54
+ )
55
+ .then(() =>
56
+ applicationStore.notificationService.notifySuccess(
57
+ 'Copied application info to clipboard',
58
+ ),
59
+ )
60
+ .catch(applicationStore.alertUnhandledError);
61
+ };
62
+
63
+ return (
64
+ <Dialog onClose={closeModal} open={open}>
65
+ <Modal
66
+ darkMode={
67
+ !applicationStore.layoutService.TEMPORARY__isLightColorThemeEnabled
68
+ }
69
+ className="modal--scrollable app__info"
70
+ >
71
+ <ModalHeader>
72
+ <ModalTitle icon={<InfoCircleIcon />} title="About" />
73
+ <ModalHeaderActions>
74
+ <button
75
+ className="modal__header__action"
76
+ tabIndex={-1}
77
+ onClick={copyInfo}
78
+ title="Copy application info"
79
+ >
80
+ <CopyIcon />
81
+ </button>
82
+ <button
83
+ className="modal__header__action"
84
+ tabIndex={-1}
85
+ onClick={closeModal}
86
+ >
87
+ <TimesIcon />
88
+ </button>
89
+ </ModalHeaderActions>
90
+ </ModalHeader>
91
+ <ModalBody>
92
+ <div className="app__info__entry">
93
+ <div className="app__info__entry__title">Environment:</div>
94
+ <div className="app__info__entry__value">{config.env}</div>
95
+ </div>
96
+ <div className="app__info__entry">
97
+ <div className="app__info__entry__title">Version:</div>
98
+ <div className="app__info__entry__value">{config.appVersion}</div>
99
+ </div>
100
+ <div className="app__info__entry">
101
+ <div className="app__info__entry__title">Revision:</div>
102
+ <div className="app__info__entry__value">
103
+ {config.appVersionCommitId}
104
+ </div>
105
+ </div>
106
+ <div className="app__info__entry">
107
+ <div className="app__info__entry__title">Build Time:</div>
108
+ <div className="app__info__entry__value">
109
+ {config.appVersionBuildTime}
110
+ </div>
111
+ </div>
112
+ <div className="app__info__group">
113
+ <div className="app__info__entry">
114
+ <div className="app__info__entry__title">Engine Server:</div>
115
+ <div className="app__info__entry__value">
116
+ <a
117
+ href={config.engineServerUrl}
118
+ target="_blank"
119
+ rel="noopener noreferrer"
120
+ >
121
+ {config.engineServerUrl}
122
+ </a>
123
+ </div>
124
+ </div>
125
+ <div className="app__info__entry">
126
+ <div className="app__info__entry__title">Depot Server:</div>
127
+ <div className="app__info__entry__value">
128
+ <a
129
+ href={config.depotServerUrl}
130
+ target="_blank"
131
+ rel="noopener noreferrer"
132
+ >
133
+ {config.depotServerUrl}
134
+ </a>
135
+ </div>
136
+ </div>
137
+ <div className="app__info__entry">
138
+ <div className="app__info__entry__title">Studio URL:</div>
139
+ <div className="app__info__entry__value">
140
+ <a
141
+ href={config.studioApplicationUrl}
142
+ target="_blank"
143
+ rel="noopener noreferrer"
144
+ >
145
+ {config.studioApplicationUrl}
146
+ </a>
147
+ </div>
148
+ </div>
149
+ <div className="app__info__entry">
150
+ <div className="app__info__entry__title">Query URL:</div>
151
+ <div className="app__info__entry__value">
152
+ <a
153
+ href={config.queryApplicationUrl}
154
+ target="_blank"
155
+ rel="noopener noreferrer"
156
+ >
157
+ {config.queryApplicationUrl}
158
+ </a>
159
+ </div>
160
+ </div>
161
+ </div>
162
+ </ModalBody>
163
+ </Modal>
164
+ </Dialog>
165
+ );
166
+ };
@@ -0,0 +1,68 @@
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 {
18
+ ControlledDropdownMenu,
19
+ MenuContent,
20
+ MenuContentItem,
21
+ MenuIcon,
22
+ } from '@finos/legend-art';
23
+ import { observer } from 'mobx-react-lite';
24
+ import { useState } from 'react';
25
+ import { LegendMarketplaceAppInfo } from './LegendMarketplaceAppInfo.js';
26
+ import { LEGEND_MARKETPLACE_TEST_ID } from '../../__lib__/LegendMarketplaceTesting.js';
27
+
28
+ const LegendMarketplaceHeaderMenu = observer(() => {
29
+ // about modal
30
+ const [openAppInfo, setOpenAppInfo] = useState(false);
31
+ const showAppInfo = (): void => setOpenAppInfo(true);
32
+ const hideAppInfo = (): void => setOpenAppInfo(false);
33
+
34
+ return (
35
+ <>
36
+ <div className="legend-marketplace-header__menu">
37
+ <ControlledDropdownMenu
38
+ className="legend-marketplace-header__menu-item"
39
+ menuProps={{
40
+ anchorOrigin: { vertical: 'top', horizontal: 'right' },
41
+ transformOrigin: { vertical: 'top', horizontal: 'left' },
42
+ elevation: 7,
43
+ }}
44
+ content={
45
+ <MenuContent>
46
+ <MenuContentItem onClick={showAppInfo}>About</MenuContentItem>
47
+ </MenuContent>
48
+ }
49
+ >
50
+ <MenuIcon />
51
+ </ControlledDropdownMenu>
52
+ </div>
53
+ <LegendMarketplaceAppInfo open={openAppInfo} closeModal={hideAppInfo} />
54
+ </>
55
+ );
56
+ });
57
+
58
+ export const LegendMarketplaceHeader = observer(() => {
59
+ return (
60
+ <div
61
+ className="legend-marketplace-header"
62
+ data-testid={LEGEND_MARKETPLACE_TEST_ID.HEADER}
63
+ >
64
+ <LegendMarketplaceHeaderMenu />
65
+ <div className="legend-marketplace-header__name">Legend Marketplace</div>
66
+ </div>
67
+ );
68
+ });
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Copyright (c) 2020-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { observer } from 'mobx-react-lite';
18
+ import { LegendMarketplaceHeader } from '../header/LegendMarketplaceHeader.js';
19
+
20
+ export const LegendMarketplaceHome = observer(() => {
21
+ return (
22
+ <div className="app__page">
23
+ <div className="legend-marketplace-home">
24
+ <div className="legend-marketplace-home__body">
25
+ <LegendMarketplaceHeader />
26
+ <div className="legend-marketplace-home__content">
27
+ <div className="legend-marketplace-home__content__title">
28
+ Welcome to Legend Marketplace
29
+ </div>
30
+ <div className="legend-marketplace-home__content__description">
31
+ <p>
32
+ Legend Marketplace is a WIP. Please check back in the future for
33
+ updates.
34
+ </p>
35
+ </div>
36
+ </div>
37
+ </div>
38
+ </div>
39
+ </div>
40
+ );
41
+ });
package/src/index.ts ADDED
@@ -0,0 +1,28 @@
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
+ // application
18
+ export * from './application/LegendMarketplace.js';
19
+ export * from './application/LegendMarketplaceApplicationConfig.js';
20
+ export * from './application/LegendMarketplacePluginManager.js';
21
+ export {
22
+ useLegendMarketplaceApplicationStore,
23
+ useLegendMarketplaceBaseStore,
24
+ } from './components/LegendMarketplaceFrameworkProvider.js';
25
+ export { type LegendMarketplaceApplicationStore } from './stores/LegendMarketplaceBaseStore.js';
26
+
27
+ // stores
28
+ export * from './stores/LegendMarketplaceApplicationPlugin.js';