@unisphere/nx 2.2.2 → 3.2.4
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/dist/generators/add-application/add-application.d.ts.map +1 -1
- package/dist/generators/add-application/add-application.js +186 -63
- package/dist/generators/add-application/schema.d.ts +3 -1
- package/dist/generators/add-application/schema.json +8 -8
- package/dist/generators/add-application/templates/default/.env-template +6 -0
- package/dist/generators/add-application/templates/default/.eslintrc.json +1 -1
- package/dist/generators/add-application/templates/default/jest.config.ts +3 -3
- package/dist/generators/add-application/templates/default/project.json.template +2 -2
- package/dist/generators/add-application/templates/default/readme.md.template +11 -0
- package/dist/generators/add-application/templates/default/src/app/app.tsx.template +77 -77
- package/dist/generators/add-application/templates/default/tsconfig.json +1 -1
- package/dist/generators/add-application/templates/default/webpack.config.js.template +6 -1
- package/dist/generators/add-package/README.md +2 -2
- package/dist/generators/add-package/add-package.d.ts.map +1 -1
- package/dist/generators/add-package/add-package.js +11 -23
- package/dist/generators/add-package/schema.d.ts +1 -1
- package/dist/generators/add-package/schema.json +27 -19
- package/dist/generators/add-package/templates/new-package/.eslintrc.json +1 -1
- package/dist/generators/add-package/templates/new-package/package.json.template +0 -1
- package/dist/generators/add-package/templates/new-package/project.json.template +4 -4
- package/dist/generators/add-package/templates/new-package/rollup.config.js +1 -1
- package/dist/generators/add-package/templates/new-package/tsconfig.json +1 -1
- package/dist/generators/add-package/templates/new-package/tsconfig.lib.json.template +1 -1
- package/dist/generators/add-package/templates/new-package/tsconfig.spec.json +1 -1
- package/dist/generators/add-runtime/add-runtime.d.ts.map +1 -1
- package/dist/generators/add-runtime/add-runtime.js +62 -9
- package/dist/generators/add-runtime/schema.d.ts +1 -0
- package/dist/generators/add-runtime/schema.json +1 -9
- package/dist/generators/add-runtime/templates/new-runtime/src/lib/create-factory.tsx.template +4 -4
- package/dist/generators/add-runtime/templates/new-runtime/src/lib/runtime.tsx.template +26 -2
- package/dist/generators/add-visual/add-visual.d.ts +1 -1
- package/dist/generators/add-visual/add-visual.d.ts.map +1 -1
- package/dist/generators/add-visual/add-visual.js +108 -15
- package/dist/generators/add-visual/schema.d.ts +3 -3
- package/dist/generators/add-visual/schema.json +2 -24
- package/dist/generators/dependency-config.d.ts.map +1 -1
- package/dist/generators/dependency-config.js +1 -0
- package/dist/generators/internal-dev-runner/generator.d.ts +3 -0
- package/dist/generators/internal-dev-runner/generator.d.ts.map +1 -0
- package/dist/generators/internal-dev-runner/generator.js +47 -0
- package/dist/generators/internal-dev-runner/schema.json +9 -0
- package/dist/generators/remove/remove.d.ts +19 -0
- package/dist/generators/remove/remove.d.ts.map +1 -0
- package/dist/generators/remove/remove.js +270 -0
- package/dist/generators/remove/schema.d.ts +4 -0
- package/dist/generators/remove/schema.json +38 -0
- package/dist/generators/rename-package/rename-package.d.ts +3 -0
- package/dist/generators/rename-package/rename-package.d.ts.map +1 -1
- package/dist/generators/rename-package/rename-package.js +139 -20
- package/dist/generators/utils.d.ts +30 -1
- package/dist/generators/utils.d.ts.map +1 -1
- package/dist/generators/utils.js +258 -7
- package/dist/migrations/1-22-0/patches/@changesets+cli+2.29.7.patch +36 -4
- package/dist/migrations/3-0-0/add-define-plugin-to-webpack.d.ts +3 -0
- package/dist/migrations/3-0-0/add-define-plugin-to-webpack.d.ts.map +1 -0
- package/dist/migrations/3-0-0/add-define-plugin-to-webpack.js +233 -0
- package/dist/migrations/3-0-0/add-env-to-application-gitignore.d.ts +3 -0
- package/dist/migrations/3-0-0/add-env-to-application-gitignore.d.ts.map +1 -0
- package/dist/migrations/3-0-0/add-env-to-application-gitignore.js +117 -0
- package/dist/migrations/3-0-0/fix-vite-config-cache-paths.d.ts +10 -0
- package/dist/migrations/3-0-0/fix-vite-config-cache-paths.d.ts.map +1 -0
- package/dist/migrations/3-0-0/fix-vite-config-cache-paths.js +66 -0
- package/dist/migrations/3-0-0/patches/@changesets+cli+2.29.7.patch +88 -0
- package/dist/migrations/3-0-0/post-cleanup-empty-directories.d.ts +12 -0
- package/dist/migrations/3-0-0/post-cleanup-empty-directories.d.ts.map +1 -0
- package/dist/migrations/3-0-0/post-cleanup-empty-directories.js +62 -0
- package/dist/migrations/3-0-0/pre-cleanup-empty-directories.d.ts +14 -0
- package/dist/migrations/3-0-0/pre-cleanup-empty-directories.d.ts.map +1 -0
- package/dist/migrations/3-0-0/pre-cleanup-empty-directories.js +105 -0
- package/dist/migrations/3-0-0/remove-kaltura-tools-to-pre-install.d.ts +3 -0
- package/dist/migrations/3-0-0/remove-kaltura-tools-to-pre-install.d.ts.map +1 -0
- package/dist/migrations/3-0-0/remove-kaltura-tools-to-pre-install.js +21 -0
- package/dist/migrations/3-0-0/remove-private-from-applications-and-runtimes.d.ts +9 -0
- package/dist/migrations/3-0-0/remove-private-from-applications-and-runtimes.d.ts.map +1 -0
- package/dist/migrations/3-0-0/remove-private-from-applications-and-runtimes.js +88 -0
- package/dist/migrations/3-0-0/remove-publish-config-from-packages.d.ts +9 -0
- package/dist/migrations/3-0-0/remove-publish-config-from-packages.d.ts.map +1 -0
- package/dist/migrations/3-0-0/remove-publish-config-from-packages.js +45 -0
- package/dist/migrations/3-0-0/reorganize-applications-by-distribution-channel.d.ts +15 -0
- package/dist/migrations/3-0-0/reorganize-applications-by-distribution-channel.d.ts.map +1 -0
- package/dist/migrations/3-0-0/reorganize-applications-by-distribution-channel.js +563 -0
- package/dist/migrations/3-0-0/reorganize-packages-by-distribution-channel.d.ts +23 -0
- package/dist/migrations/3-0-0/reorganize-packages-by-distribution-channel.d.ts.map +1 -0
- package/dist/migrations/3-0-0/reorganize-packages-by-distribution-channel.js +645 -0
- package/dist/migrations/3-0-0/replace-github-workflow.d.ts +3 -0
- package/dist/migrations/3-0-0/replace-github-workflow.d.ts.map +1 -0
- package/dist/migrations/3-0-0/replace-github-workflow.js +48 -0
- package/dist/migrations/3-0-0/sync-package-lock.d.ts +10 -0
- package/dist/migrations/3-0-0/sync-package-lock.d.ts.map +1 -0
- package/dist/migrations/3-0-0/sync-package-lock.js +26 -0
- package/dist/migrations/3-0-0/templates/_publish-artifacts.template +363 -0
- package/dist/migrations/3-0-0/templates/cicd.template +89 -0
- package/dist/migrations/3-0-0/update-changeset-patch.d.ts +3 -0
- package/dist/migrations/3-0-0/update-changeset-patch.d.ts.map +1 -0
- package/dist/migrations/3-0-0/update-changeset-patch.js +31 -0
- package/dist/migrations/3-0-0/upgrade-schema-to-2-0-0.d.ts +21 -0
- package/dist/migrations/3-0-0/upgrade-schema-to-2-0-0.d.ts.map +1 -0
- package/dist/migrations/3-0-0/upgrade-schema-to-2-0-0.js +105 -0
- package/dist/migrations/3-1-0/fix-workspaces-pattern.d.ts +23 -0
- package/dist/migrations/3-1-0/fix-workspaces-pattern.d.ts.map +1 -0
- package/dist/migrations/3-1-0/fix-workspaces-pattern.js +72 -0
- package/dist/migrations/utils/has-react-dependency.d.ts +14 -0
- package/dist/migrations/utils/has-react-dependency.d.ts.map +1 -0
- package/dist/migrations/utils/has-react-dependency.js +72 -0
- package/dist/shared.d.ts +6 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/shared.js +9 -0
- package/generators.json +12 -1
- package/migrations.json +125 -0
- package/package.json +3 -2
- package/dist/generators/add-application/templates/local-dev-playground/.babelrc +0 -11
- package/dist/generators/add-application/templates/local-dev-playground/.eslintrc.json +0 -22
- package/dist/generators/add-application/templates/local-dev-playground/jest.config.ts +0 -11
- package/dist/generators/add-application/templates/local-dev-playground/package.json +0 -6
- package/dist/generators/add-application/templates/local-dev-playground/project.json +0 -9
- package/dist/generators/add-application/templates/local-dev-playground/src/app/app.tsx.template +0 -212
- package/dist/generators/add-application/templates/local-dev-playground/src/app/components/header.tsx.template +0 -123
- package/dist/generators/add-application/templates/local-dev-playground/src/app/components/settings-buttons.tsx +0 -57
- package/dist/generators/add-application/templates/local-dev-playground/src/app/components/settings-form.tsx +0 -108
- package/dist/generators/add-application/templates/local-dev-playground/src/app/components/settings.tsx +0 -74
- package/dist/generators/add-application/templates/local-dev-playground/src/app/configuration-provider.tsx +0 -163
- package/dist/generators/add-application/templates/local-dev-playground/src/app/definitions.ts +0 -25
- package/dist/generators/add-application/templates/local-dev-playground/src/app/utils/merge-deep.ts +0 -31
- package/dist/generators/add-application/templates/local-dev-playground/src/favicon.ico +0 -0
- package/dist/generators/add-application/templates/local-dev-playground/src/index.html +0 -17
- package/dist/generators/add-application/templates/local-dev-playground/src/main.tsx +0 -13
- package/dist/generators/add-application/templates/local-dev-playground/src/styles.css +0 -0
- package/dist/generators/add-application/templates/local-dev-playground/tsconfig.app.json +0 -24
- package/dist/generators/add-application/templates/local-dev-playground/tsconfig.json +0 -20
- package/dist/generators/add-application/templates/local-dev-playground/tsconfig.spec.json +0 -25
- package/dist/generators/add-application/templates/local-dev-playground/webpack.config.js +0 -33
- /package/dist/generators/add-runtime/templates/{core-templates → types-templates}/__runtimeName__-runtime/index.ts.template +0 -0
- /package/dist/generators/add-runtime/templates/{core-templates → types-templates}/__runtimeName__-runtime/runtime-types.ts.template +0 -0
package/dist/generators/add-application/templates/local-dev-playground/src/app/app.tsx.template
DELETED
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
import { useContext, useState } from 'react';
|
|
2
|
-
import { HostThemeProvider } from '@kaltura/ds-react-theme';
|
|
3
|
-
import { Box } from '@mui/material';
|
|
4
|
-
import { ConfigurationContext } from './configuration-provider';
|
|
5
|
-
import { isConfigurationValid } from './definitions';
|
|
6
|
-
import { Header } from './components/header';
|
|
7
|
-
import { ConfigurationProvider } from './configuration-provider';
|
|
8
|
-
import { UnisphereProvider, UnisphereRuntimeVisual } from '@unisphere/runtime-react';
|
|
9
|
-
import { UnisphereWorkspaceConfig } from '@unisphere/runtime';
|
|
10
|
-
import { UnisphereWorkspaceType } from '@unisphere/runtime';
|
|
11
|
-
import { <%= runtimeName__pascalCase %>Runtime } from '<%= typesAlias %>';
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const Hihi: React.FC = () => {
|
|
15
|
-
return (
|
|
16
|
-
<div
|
|
17
|
-
style={{
|
|
18
|
-
display: 'flex',
|
|
19
|
-
flexDirection: 'column',
|
|
20
|
-
alignItems: 'center',
|
|
21
|
-
justifyContent: 'center',
|
|
22
|
-
height: '100vh',
|
|
23
|
-
padding: '2rem',
|
|
24
|
-
backgroundColor: '#f9f9f9',
|
|
25
|
-
color: '#333',
|
|
26
|
-
fontFamily: 'sans-serif',
|
|
27
|
-
textAlign: 'center',
|
|
28
|
-
}}
|
|
29
|
-
>
|
|
30
|
-
<h1
|
|
31
|
-
style={{
|
|
32
|
-
fontSize: '1.5rem',
|
|
33
|
-
}}
|
|
34
|
-
>
|
|
35
|
-
Hihi :)
|
|
36
|
-
</h1>
|
|
37
|
-
|
|
38
|
-
<h2
|
|
39
|
-
style={{
|
|
40
|
-
fontSize: '1.0rem',
|
|
41
|
-
marginBottom: '1rem',
|
|
42
|
-
}}
|
|
43
|
-
>
|
|
44
|
-
No visuals are mounted yet
|
|
45
|
-
</h2>
|
|
46
|
-
|
|
47
|
-
<p
|
|
48
|
-
style={{
|
|
49
|
-
fontSize: '1rem',
|
|
50
|
-
maxWidth: '400px',
|
|
51
|
-
lineHeight: 1.4,
|
|
52
|
-
marginBottom: '2rem',
|
|
53
|
-
}}
|
|
54
|
-
>
|
|
55
|
-
You haven’t created a runtime visual or just didn't mount it in the Dev
|
|
56
|
-
application. Once you add one, open{' '}
|
|
57
|
-
<span
|
|
58
|
-
style={{
|
|
59
|
-
backgroundColor: '#eaeaea',
|
|
60
|
-
padding: '0.2rem 0.4rem',
|
|
61
|
-
borderRadius: '4px',
|
|
62
|
-
fontFamily: 'monospace',
|
|
63
|
-
}}
|
|
64
|
-
>
|
|
65
|
-
app.tsx
|
|
66
|
-
</span>{' '}
|
|
67
|
-
and uncomment the{' '}
|
|
68
|
-
<span
|
|
69
|
-
style={{
|
|
70
|
-
backgroundColor: '#eaeaea',
|
|
71
|
-
padding: '0.2rem 0.4rem',
|
|
72
|
-
borderRadius: '4px',
|
|
73
|
-
fontFamily: 'monospace',
|
|
74
|
-
}}
|
|
75
|
-
>
|
|
76
|
-
<UnisphereRuntimeVisual />
|
|
77
|
-
</span>{' '}
|
|
78
|
-
component to see it render here.
|
|
79
|
-
</p>
|
|
80
|
-
|
|
81
|
-
<pre
|
|
82
|
-
style={{
|
|
83
|
-
backgroundColor: '#fff',
|
|
84
|
-
padding: '1rem',
|
|
85
|
-
border: '1px solid #ddd',
|
|
86
|
-
borderRadius: '4px',
|
|
87
|
-
overflowX: 'auto',
|
|
88
|
-
fontFamily: 'monospace',
|
|
89
|
-
textAlign: 'left',
|
|
90
|
-
}}
|
|
91
|
-
>
|
|
92
|
-
{`<UnisphereRuntimeVisual
|
|
93
|
-
widgetName="unisphere.widget.<%= widgetName__lowerDashCase %>"
|
|
94
|
-
runtimeName="<%= runtimeName__lowerDashCase %>"
|
|
95
|
-
visualType="-- provide here the visual name --"
|
|
96
|
-
visualSettings={{ }}
|
|
97
|
-
/>`}
|
|
98
|
-
</pre>
|
|
99
|
-
</div>
|
|
100
|
-
);
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
export function AppContent() {
|
|
104
|
-
const { configuration } = useContext(ConfigurationContext);
|
|
105
|
-
|
|
106
|
-
const [workspace, setWorkspace] = useState<UnisphereWorkspaceType | null>(
|
|
107
|
-
null
|
|
108
|
-
);
|
|
109
|
-
const [runtime, setRuntime] = useState<<%= runtimeName__pascalCase %>Runtime | null>(null);
|
|
110
|
-
|
|
111
|
-
const [initialConfiguration] = useState<UnisphereWorkspaceConfig | null>(
|
|
112
|
-
() => {
|
|
113
|
-
/*
|
|
114
|
-
Developer Note:
|
|
115
|
-
The Dev app lets you provide runtime configuration as a JSON object that matches the same schema used in your production or staging environments.
|
|
116
|
-
|
|
117
|
-
• If the runtime is already active in production or staging:
|
|
118
|
-
1. Open Unisphere (Cmd + K) and choose Manage Workspace Runtimes.
|
|
119
|
-
2. Locate your runtime, click the ••• (Actions) menu, and select Copy Settings.
|
|
120
|
-
3. Open the Dev app in the browser, in the header click on the settings icon and paste the JSON into the settings field.
|
|
121
|
-
4. Use the Save button to persist your settings. They’ll be stored in local storage and automatically loaded the next time the app runs.
|
|
122
|
-
|
|
123
|
-
• If the runtime isn’t yet in use:
|
|
124
|
-
1. Manually create a JSON payload that conforms to your runtime’s schema.
|
|
125
|
-
2. Open the Dev app in the browser, in the header click on the settings icon and paste the JSON into the settings field.
|
|
126
|
-
3. Use the Save button to persist your settings. They’ll be stored in local storage and automatically loaded the next time the app runs.
|
|
127
|
-
*/
|
|
128
|
-
|
|
129
|
-
try {
|
|
130
|
-
if (!isConfigurationValid(configuration)) {
|
|
131
|
-
return null;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
return {
|
|
135
|
-
appId: '<%= runtimeName__lowerDashCase %>',
|
|
136
|
-
appVersion: '1.0.0',
|
|
137
|
-
serverUrl: configuration.unisphereServerUrl,
|
|
138
|
-
ui: {
|
|
139
|
-
theme: configuration.theme,
|
|
140
|
-
language: configuration.language,
|
|
141
|
-
},
|
|
142
|
-
runtimes: [
|
|
143
|
-
{
|
|
144
|
-
widgetName: 'unisphere.widget.<%= widgetName__lowerDashCase %>',
|
|
145
|
-
runtimeName: '<%= runtimeName__lowerDashCase %>',
|
|
146
|
-
settings: JSON.parse(configuration.settings),
|
|
147
|
-
visuals: [],
|
|
148
|
-
},
|
|
149
|
-
],
|
|
150
|
-
};
|
|
151
|
-
} catch (e) {
|
|
152
|
-
console.error('Failed to parse settings', e);
|
|
153
|
-
return null;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
);
|
|
157
|
-
|
|
158
|
-
const onWorkspaceLoaded = (workspace: UnisphereWorkspaceType) => {
|
|
159
|
-
setWorkspace(workspace);
|
|
160
|
-
const runtime = workspace.getRuntime<<%= runtimeName__pascalCase %>Runtime>(
|
|
161
|
-
'unisphere.widget.<%= widgetName__lowerDashCase %>',
|
|
162
|
-
'<%= runtimeName__lowerDashCase %>'
|
|
163
|
-
);
|
|
164
|
-
setRuntime(runtime);
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
return (
|
|
168
|
-
<Box
|
|
169
|
-
sx={{
|
|
170
|
-
width: '100vw',
|
|
171
|
-
height: '100vh',
|
|
172
|
-
overflow: 'hidden',
|
|
173
|
-
padding: '12px 24px',
|
|
174
|
-
}}
|
|
175
|
-
>
|
|
176
|
-
<HostThemeProvider
|
|
177
|
-
overrides={{
|
|
178
|
-
mode: configuration.theme,
|
|
179
|
-
}}
|
|
180
|
-
>
|
|
181
|
-
<Box sx={{ height: '100vh', width: '100vw', pt: '64px' }}>
|
|
182
|
-
<Header />
|
|
183
|
-
{initialConfiguration && (
|
|
184
|
-
<UnisphereProvider
|
|
185
|
-
onWorkspaceLoaded={onWorkspaceLoaded}
|
|
186
|
-
initialConfiguration={initialConfiguration}
|
|
187
|
-
>
|
|
188
|
-
<Hihi />
|
|
189
|
-
|
|
190
|
-
{/* <UnisphereRuntimeVisual
|
|
191
|
-
widgetName="unisphere.widget.<%= widgetName__lowerDashCase %>"
|
|
192
|
-
runtimeName="<%= runtimeName__lowerDashCase %>"
|
|
193
|
-
visualType="-- provide here the visual name --"
|
|
194
|
-
visualSettings={{ }}
|
|
195
|
-
/> */}
|
|
196
|
-
</UnisphereProvider>
|
|
197
|
-
)}
|
|
198
|
-
</Box>
|
|
199
|
-
</HostThemeProvider>
|
|
200
|
-
</Box>
|
|
201
|
-
);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
const App = () => {
|
|
205
|
-
return (
|
|
206
|
-
<ConfigurationProvider configurationKey="unisphere-<%= widgetName__lowerDashCase %>-<%= runtimeName__lowerDashCase %>-dev">
|
|
207
|
-
<AppContent />
|
|
208
|
-
</ConfigurationProvider>
|
|
209
|
-
);
|
|
210
|
-
};
|
|
211
|
-
|
|
212
|
-
export default App;
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import React, { useContext, useState } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
AppBar,
|
|
4
|
-
Box,
|
|
5
|
-
IconButton,
|
|
6
|
-
ListItemIcon,
|
|
7
|
-
Menu,
|
|
8
|
-
MenuItem,
|
|
9
|
-
Toolbar,
|
|
10
|
-
Tooltip,
|
|
11
|
-
Typography,
|
|
12
|
-
} from '@mui/material';
|
|
13
|
-
import { ConfigurationContext } from '../configuration-provider';
|
|
14
|
-
import { isConfigurationValid } from '../definitions';
|
|
15
|
-
import {
|
|
16
|
-
DeveloperBoard as DeveloperBoardIcon,
|
|
17
|
-
Settings as SettingsIcon,
|
|
18
|
-
Storage as StorageIcon,
|
|
19
|
-
} from '@mui/icons-material';
|
|
20
|
-
import { Settings } from './settings';
|
|
21
|
-
|
|
22
|
-
export const Header: React.FC = () => {
|
|
23
|
-
const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);
|
|
24
|
-
const { configuration: Configuration, createSharedUrl } =
|
|
25
|
-
useContext(ConfigurationContext);
|
|
26
|
-
|
|
27
|
-
const open = Boolean(anchorEl);
|
|
28
|
-
const replaceBaseUrlInNewTab = () => {
|
|
29
|
-
const baseUrl = prompt('please provide the new base url');
|
|
30
|
-
if (!baseUrl) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const filteredUrl = baseUrl.replace(/\/configuration$/, '');
|
|
35
|
-
window.open(
|
|
36
|
-
createSharedUrl({
|
|
37
|
-
baseUrl: `${filteredUrl}`,
|
|
38
|
-
})
|
|
39
|
-
);
|
|
40
|
-
return;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const handleMenu = (event: React.MouseEvent<HTMLElement>) => {
|
|
44
|
-
setAnchorEl(event.currentTarget);
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
const handleClose = () => {
|
|
48
|
-
setAnchorEl(null);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
const [settingsOpen, setSettingsOpen] = useState(() => {
|
|
52
|
-
return !isConfigurationValid(Configuration);
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
const handleSettingsClosed = () => {
|
|
56
|
-
setSettingsOpen(false);
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
return (
|
|
60
|
-
<AppBar position="fixed" sx={{ zIndex: 1000 }}>
|
|
61
|
-
<Toolbar style={{ justifyContent: 'space-between' }}>
|
|
62
|
-
<Box
|
|
63
|
-
sx={{
|
|
64
|
-
display: 'flex',
|
|
65
|
-
alignItems: 'center',
|
|
66
|
-
}}
|
|
67
|
-
>
|
|
68
|
-
<Typography variant="h6" sx={{ flexGrow: 1 }}>
|
|
69
|
-
<%= widgetName__pascalCase %> - <%= runtimeName__pascalCase %> Dev
|
|
70
|
-
</Typography>
|
|
71
|
-
</Box>
|
|
72
|
-
|
|
73
|
-
<Box
|
|
74
|
-
sx={{
|
|
75
|
-
display: 'flex',
|
|
76
|
-
alignItems: 'center',
|
|
77
|
-
}}
|
|
78
|
-
>
|
|
79
|
-
<Tooltip title="Menu">
|
|
80
|
-
<IconButton onClick={handleMenu} color="inherit" aria-label="menu">
|
|
81
|
-
<SettingsIcon />
|
|
82
|
-
</IconButton>
|
|
83
|
-
</Tooltip>
|
|
84
|
-
|
|
85
|
-
<Menu
|
|
86
|
-
id="menu-appbar"
|
|
87
|
-
anchorEl={anchorEl}
|
|
88
|
-
anchorOrigin={{
|
|
89
|
-
vertical: 'top',
|
|
90
|
-
horizontal: 'right',
|
|
91
|
-
}}
|
|
92
|
-
keepMounted
|
|
93
|
-
transformOrigin={{
|
|
94
|
-
vertical: 'top',
|
|
95
|
-
horizontal: 'right',
|
|
96
|
-
}}
|
|
97
|
-
open={open}
|
|
98
|
-
onClose={handleClose}
|
|
99
|
-
>
|
|
100
|
-
<MenuItem
|
|
101
|
-
onClick={() => {
|
|
102
|
-
handleClose();
|
|
103
|
-
setSettingsOpen(true);
|
|
104
|
-
}}
|
|
105
|
-
>
|
|
106
|
-
<ListItemIcon>
|
|
107
|
-
<StorageIcon fontSize="small" />
|
|
108
|
-
</ListItemIcon>
|
|
109
|
-
<Typography variant="inherit">Configuration</Typography>
|
|
110
|
-
</MenuItem>
|
|
111
|
-
<MenuItem onClick={replaceBaseUrlInNewTab}>
|
|
112
|
-
<ListItemIcon>
|
|
113
|
-
<DeveloperBoardIcon fontSize="small" />
|
|
114
|
-
</ListItemIcon>
|
|
115
|
-
<Typography variant="inherit">Change Base URL</Typography>
|
|
116
|
-
</MenuItem>
|
|
117
|
-
</Menu>
|
|
118
|
-
</Box>
|
|
119
|
-
</Toolbar>
|
|
120
|
-
{settingsOpen && <Settings onClose={handleSettingsClosed} />}
|
|
121
|
-
</AppBar>
|
|
122
|
-
);
|
|
123
|
-
};
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import React, { useContext, PropsWithChildren } from 'react';
|
|
2
|
-
import { Box, Button } from '@mui/material';
|
|
3
|
-
import {
|
|
4
|
-
ConfigurationContext,
|
|
5
|
-
ConfigurationTypes,
|
|
6
|
-
} from '../configuration-provider';
|
|
7
|
-
|
|
8
|
-
export interface SettingsButtonsProps {
|
|
9
|
-
onReset: () => void;
|
|
10
|
-
customSave?: React.ReactElement;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const ButtonsContainer: React.FC<PropsWithChildren> = ({ children }) => {
|
|
14
|
-
return (
|
|
15
|
-
<Box
|
|
16
|
-
sx={{
|
|
17
|
-
display: 'flex',
|
|
18
|
-
justifyContent: 'space-between',
|
|
19
|
-
alignItems: 'center',
|
|
20
|
-
marginTop: '20px',
|
|
21
|
-
}}
|
|
22
|
-
>
|
|
23
|
-
{children}
|
|
24
|
-
</Box>
|
|
25
|
-
);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export const SettingsButtons: React.FC<SettingsButtonsProps> = ({
|
|
29
|
-
customSave,
|
|
30
|
-
onReset,
|
|
31
|
-
}) => {
|
|
32
|
-
const { ConfigurationType } = useContext(ConfigurationContext);
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
<ButtonsContainer>
|
|
36
|
-
<>
|
|
37
|
-
{ConfigurationType === ConfigurationTypes.Localstorage && (
|
|
38
|
-
<Button
|
|
39
|
-
onClick={onReset}
|
|
40
|
-
variant="contained"
|
|
41
|
-
color="secondary"
|
|
42
|
-
style={{ marginRight: '8px' }}
|
|
43
|
-
>
|
|
44
|
-
Clear All
|
|
45
|
-
</Button>
|
|
46
|
-
)}
|
|
47
|
-
{customSave ? (
|
|
48
|
-
customSave
|
|
49
|
-
) : (
|
|
50
|
-
<Button variant="contained" color="primary" type={'submit'}>
|
|
51
|
-
Save & Close
|
|
52
|
-
</Button>
|
|
53
|
-
)}
|
|
54
|
-
</>
|
|
55
|
-
</ButtonsContainer>
|
|
56
|
-
);
|
|
57
|
-
};
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { Controller, useFormContext } from 'react-hook-form';
|
|
2
|
-
import React, { MouseEvent } from 'react';
|
|
3
|
-
import { MenuItem, Select, Stack, TextField, Typography } from '@mui/material';
|
|
4
|
-
import { Configuration } from '../definitions';
|
|
5
|
-
import { UseFormReturn } from 'react-hook-form/dist/types';
|
|
6
|
-
|
|
7
|
-
const FormCard: React.FC<React.PropsWithChildren<{ title: string }>> = ({
|
|
8
|
-
title,
|
|
9
|
-
children,
|
|
10
|
-
}) => {
|
|
11
|
-
return (
|
|
12
|
-
<Stack
|
|
13
|
-
sx={{
|
|
14
|
-
padding: '8px',
|
|
15
|
-
border: '1px solid grey',
|
|
16
|
-
borderRadius: '8px',
|
|
17
|
-
gap: '16px',
|
|
18
|
-
}}
|
|
19
|
-
>
|
|
20
|
-
<Typography variant="body1" sx={{ fontWeight: 700 }}>
|
|
21
|
-
{title}
|
|
22
|
-
</Typography>
|
|
23
|
-
{children}
|
|
24
|
-
</Stack>
|
|
25
|
-
);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const FormItem: React.FC<React.PropsWithChildren<{ title: string }>> = ({
|
|
29
|
-
title,
|
|
30
|
-
children,
|
|
31
|
-
}) => {
|
|
32
|
-
return (
|
|
33
|
-
<Stack
|
|
34
|
-
sx={{
|
|
35
|
-
padding: '4px',
|
|
36
|
-
gap: '8px',
|
|
37
|
-
}}
|
|
38
|
-
>
|
|
39
|
-
<Typography variant="body1">{title}</Typography>
|
|
40
|
-
{children}
|
|
41
|
-
</Stack>
|
|
42
|
-
);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export const SettingsForm: React.FC = () => {
|
|
46
|
-
const context = useFormContext<Configuration>();
|
|
47
|
-
|
|
48
|
-
const {
|
|
49
|
-
register,
|
|
50
|
-
reset,
|
|
51
|
-
formState: { errors },
|
|
52
|
-
control,
|
|
53
|
-
watch,
|
|
54
|
-
} = context;
|
|
55
|
-
|
|
56
|
-
return (
|
|
57
|
-
<Stack gap="16px">
|
|
58
|
-
<FormCard title="Host Settings">
|
|
59
|
-
<TextField
|
|
60
|
-
name={'unisphereServerUrl'}
|
|
61
|
-
fullWidth
|
|
62
|
-
inputProps={{
|
|
63
|
-
...register('unisphereServerUrl', { required: true }),
|
|
64
|
-
}}
|
|
65
|
-
label={'Service URL'}
|
|
66
|
-
helperText={errors?.unisphereServerUrl ? 'required' : ''}
|
|
67
|
-
error={!!errors?.unisphereServerUrl}
|
|
68
|
-
/>
|
|
69
|
-
|
|
70
|
-
<TextField
|
|
71
|
-
name={'language'}
|
|
72
|
-
fullWidth
|
|
73
|
-
inputProps={{ ...register('language') }}
|
|
74
|
-
label={'Language code'}
|
|
75
|
-
/>
|
|
76
|
-
|
|
77
|
-
<FormItem title="Theme">
|
|
78
|
-
<Controller
|
|
79
|
-
control={control}
|
|
80
|
-
name="theme"
|
|
81
|
-
render={({ field }) => (
|
|
82
|
-
<Select {...field}>
|
|
83
|
-
<MenuItem value="light">Light</MenuItem>
|
|
84
|
-
<MenuItem value="dark">Dark</MenuItem>
|
|
85
|
-
</Select>
|
|
86
|
-
)}
|
|
87
|
-
/>
|
|
88
|
-
</FormItem>
|
|
89
|
-
</FormCard>
|
|
90
|
-
<FormCard title="Unisphere Settings">
|
|
91
|
-
<TextField
|
|
92
|
-
name={'settings'}
|
|
93
|
-
fullWidth
|
|
94
|
-
inputProps={{
|
|
95
|
-
...register('settings', {
|
|
96
|
-
required: `To pass empty settings, type "{}". Otherwise: (1) manually type valid JSON. (2) `,
|
|
97
|
-
}),
|
|
98
|
-
}}
|
|
99
|
-
label={'Unisphere Settings'}
|
|
100
|
-
helperText={`${
|
|
101
|
-
errors?.settings?.message || ''
|
|
102
|
-
}Easily copy settings from Unisphere by entering a workable host in NVQ2 and then do: Unisphere cmd+k > Manage Workspace Runtimes > show ... (actions) of desired runtime > copy settings`}
|
|
103
|
-
error={!!errors?.settings?.message}
|
|
104
|
-
/>
|
|
105
|
-
</FormCard>
|
|
106
|
-
</Stack>
|
|
107
|
-
);
|
|
108
|
-
};
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import React, { useContext } from 'react';
|
|
2
|
-
import { Dialog, DialogActions, DialogContent } from '@mui/material';
|
|
3
|
-
import { FormProvider, useForm } from 'react-hook-form';
|
|
4
|
-
import { ConfigurationContext } from '../configuration-provider';
|
|
5
|
-
import { getDefaultConfiguration, Configuration } from '../definitions';
|
|
6
|
-
import { SettingsButtons } from './settings-buttons';
|
|
7
|
-
import { SettingsForm } from './settings-form';
|
|
8
|
-
|
|
9
|
-
export const Settings: React.FC<{ onClose: () => void }> = ({ onClose }) => {
|
|
10
|
-
const {
|
|
11
|
-
clearConfiguration,
|
|
12
|
-
configuration: Configuration,
|
|
13
|
-
updateConfiguration,
|
|
14
|
-
} = useContext(ConfigurationContext);
|
|
15
|
-
|
|
16
|
-
const formMethods = useForm<Configuration>({
|
|
17
|
-
defaultValues: Configuration,
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
const onSubmit = (data: any) => {
|
|
21
|
-
const updatedData = {
|
|
22
|
-
...data,
|
|
23
|
-
};
|
|
24
|
-
updateConfiguration(updatedData);
|
|
25
|
-
|
|
26
|
-
onClose();
|
|
27
|
-
|
|
28
|
-
window.location.reload();
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const handleClose = (event: any, reason: string) => {
|
|
32
|
-
if (reason === 'backdropClick') {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
onClose();
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const handleReset = () => {
|
|
39
|
-
// eslint-disable-next-line no-restricted-globals
|
|
40
|
-
const accepted = confirm('Do you want to clear all values?');
|
|
41
|
-
if (!accepted) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
clearConfiguration();
|
|
45
|
-
formMethods.reset(getDefaultConfiguration());
|
|
46
|
-
};
|
|
47
|
-
return (
|
|
48
|
-
<div>
|
|
49
|
-
<Dialog open={true} onClose={handleClose} disableEscapeKeyDown={true}>
|
|
50
|
-
<FormProvider {...formMethods}>
|
|
51
|
-
<form
|
|
52
|
-
noValidate
|
|
53
|
-
autoComplete="off"
|
|
54
|
-
onSubmit={formMethods.handleSubmit(onSubmit)}
|
|
55
|
-
>
|
|
56
|
-
<DialogContent
|
|
57
|
-
sx={{
|
|
58
|
-
display: 'flex',
|
|
59
|
-
width: '500px',
|
|
60
|
-
flexDirection: 'column',
|
|
61
|
-
overflow: 'hidden',
|
|
62
|
-
}}
|
|
63
|
-
>
|
|
64
|
-
<SettingsForm />
|
|
65
|
-
<DialogActions sx={{ padding: 0 }}>
|
|
66
|
-
<SettingsButtons onReset={handleReset} />
|
|
67
|
-
</DialogActions>
|
|
68
|
-
</DialogContent>
|
|
69
|
-
</form>
|
|
70
|
-
</FormProvider>
|
|
71
|
-
</Dialog>
|
|
72
|
-
</div>
|
|
73
|
-
);
|
|
74
|
-
};
|