@fluxo-dev/shell 0.0.8 → 0.0.12
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/index.esm.css +115 -0
- package/index.esm.d.ts +1 -0
- package/index.esm.js +68195 -0
- package/package.json +13 -2
- package/src/index.d.ts +1 -0
- package/src/lib/app.d.ts +16 -0
- package/src/lib/components/error-page/404.d.ts +1 -0
- package/src/lib/components/routes/main-routes.d.ts +6 -0
- package/src/lib/layouts/blank/blank-layout.d.ts +2 -0
- package/src/lib/layouts/main/app-bar.d.ts +9 -0
- package/src/lib/layouts/main/app-layout.d.ts +5 -0
- package/src/lib/layouts/main/content.d.ts +2 -0
- package/src/lib/layouts/main/footer-bar.d.ts +5 -0
- package/src/lib/layouts/main/navbar-item.d.ts +12 -0
- package/src/lib/layouts/main/navbar.d.ts +1 -0
- package/src/lib/layouts/main/search-bar.d.ts +5 -0
- package/src/lib/layouts/main/shell-spotlight.d.ts +2 -0
- package/src/lib/models/app-jit.d.ts +5 -0
- package/src/lib/pages/general/fluxo-plugin-loader.d.ts +7 -0
- package/src/lib/pages/login/account-confirmation.d.ts +2 -0
- package/src/lib/pages/login/change-password.d.ts +2 -0
- package/src/lib/pages/login/forgot-password.d.ts +2 -0
- package/src/lib/pages/login/login-page.d.ts +2 -0
- package/src/lib/pages/login/reset-password.d.ts +2 -0
- package/src/lib/pages/settings/apps/add-jit-app.d.ts +5 -0
- package/src/lib/pages/settings/apps/app-item.d.ts +10 -0
- package/src/lib/pages/settings/apps/app-jit-item.d.ts +8 -0
- package/src/lib/pages/settings/apps/apps-list.d.ts +6 -0
- package/src/lib/pages/settings/apps/embedded-module-item.d.ts +10 -0
- package/src/lib/pages/settings/apps/install-or-upgrade-app.d.ts +6 -0
- package/src/lib/pages/settings/menu-designer/custom-node.d.ts +14 -0
- package/src/lib/pages/settings/menu-designer/menu-create-form.d.ts +5 -0
- package/src/lib/pages/settings/menu-designer/menu-designer.d.ts +1 -0
- package/src/lib/pages/settings/menu-designer/menu-item-edit.d.ts +8 -0
- package/src/lib/pages/settings/menu-designer/placeholder.d.ts +8 -0
- package/src/lib/pages/settings/security/components/domani-role/domain-role-form.d.ts +6 -0
- package/src/lib/pages/settings/security/components/domani-role/domain-role-grid.d.ts +1 -0
- package/src/lib/pages/settings/security/components/permission/create-custom-permission-form.d.ts +7 -0
- package/src/lib/pages/settings/security/components/permission/create-scope-form.d.ts +7 -0
- package/src/lib/pages/settings/security/components/permission/permission-grid.d.ts +1 -0
- package/src/lib/pages/settings/security/components/permission/permission-navigator.d.ts +8 -0
- package/src/lib/pages/settings/security/components/permission/update-permission.d.ts +5 -0
- package/src/lib/pages/settings/security/components/route-rule/route-rule-create-form.d.ts +7 -0
- package/src/lib/pages/settings/security/components/route-rule/route-rule-grid.d.ts +1 -0
- package/src/lib/pages/settings/security/components/user/user-form.d.ts +7 -0
- package/src/lib/pages/settings/security/components/user/users-grid.d.ts +1 -0
- package/src/lib/pages/settings/settings.d.ts +6 -0
- package/src/lib/pages/settings/token/token-row.d.ts +7 -0
- package/src/lib/pages/settings/token/tokens.d.ts +2 -0
- package/src/lib/pages/settings/ui/ui.d.ts +1 -0
- package/src/lib/services/app-jit-manager.d.ts +10 -0
- package/src/lib/services/app-menu.service.d.ts +5 -0
- package/src/lib/utils/icon-factory.d.ts +9 -0
- package/src/lib/utils/security/only-not-logged-route.d.ts +2 -0
- package/src/lib/utils/security/protected-route.d.ts +2 -0
- package/.babelrc +0 -12
- package/.eslintrc.json +0 -18
- package/jest.config.ts +0 -11
- package/project.json +0 -43
- package/src/index.ts +0 -1
- package/src/lib/app.module.css +0 -1
- package/src/lib/app.spec.tsx +0 -17
- package/src/lib/app.tsx +0 -374
- package/src/lib/components/error-page/404.tsx +0 -16
- package/src/lib/components/routes/main-routes.tsx +0 -26
- package/src/lib/layouts/blank/blank-layout.tsx +0 -10
- package/src/lib/layouts/main/app-bar.tsx +0 -192
- package/src/lib/layouts/main/app-layout.tsx +0 -52
- package/src/lib/layouts/main/content.tsx +0 -10
- package/src/lib/layouts/main/footer-bar.tsx +0 -76
- package/src/lib/layouts/main/navbar-item.module.css +0 -49
- package/src/lib/layouts/main/navbar-item.tsx +0 -129
- package/src/lib/layouts/main/navbar.tsx +0 -38
- package/src/lib/layouts/main/search-bar.tsx +0 -44
- package/src/lib/layouts/main/shell-spotlight.tsx +0 -58
- package/src/lib/models/app-jit.ts +0 -6
- package/src/lib/pages/general/fluxo-plugin-loader.tsx +0 -22
- package/src/lib/pages/login/account-confirmation.tsx +0 -86
- package/src/lib/pages/login/change-password.tsx +0 -58
- package/src/lib/pages/login/forgot-password.tsx +0 -53
- package/src/lib/pages/login/login-page.tsx +0 -70
- package/src/lib/pages/login/reset-password.tsx +0 -91
- package/src/lib/pages/settings/apps/add-jit-app.tsx +0 -79
- package/src/lib/pages/settings/apps/app-item.tsx +0 -157
- package/src/lib/pages/settings/apps/app-jit-item.tsx +0 -105
- package/src/lib/pages/settings/apps/apps-list.tsx +0 -171
- package/src/lib/pages/settings/apps/embedded-module-item.tsx +0 -66
- package/src/lib/pages/settings/apps/install-or-upgrade-app.tsx +0 -105
- package/src/lib/pages/settings/menu-designer/custom-node.module.css +0 -34
- package/src/lib/pages/settings/menu-designer/custom-node.tsx +0 -160
- package/src/lib/pages/settings/menu-designer/menu-create-form.tsx +0 -109
- package/src/lib/pages/settings/menu-designer/menu-designer.module.css +0 -19
- package/src/lib/pages/settings/menu-designer/menu-designer.tsx +0 -463
- package/src/lib/pages/settings/menu-designer/menu-item-edit.tsx +0 -115
- package/src/lib/pages/settings/menu-designer/placeholder.module.css +0 -8
- package/src/lib/pages/settings/menu-designer/placeholder.tsx +0 -13
- package/src/lib/pages/settings/security/components/domani-role/domain-role-form.tsx +0 -67
- package/src/lib/pages/settings/security/components/domani-role/domain-role-grid.tsx +0 -139
- package/src/lib/pages/settings/security/components/permission/create-custom-permission-form.tsx +0 -64
- package/src/lib/pages/settings/security/components/permission/create-scope-form.tsx +0 -158
- package/src/lib/pages/settings/security/components/permission/permission-grid.tsx +0 -304
- package/src/lib/pages/settings/security/components/permission/permission-navigator.tsx +0 -320
- package/src/lib/pages/settings/security/components/permission/update-permission.tsx +0 -54
- package/src/lib/pages/settings/security/components/route-rule/route-rule-create-form.tsx +0 -59
- package/src/lib/pages/settings/security/components/route-rule/route-rule-grid.tsx +0 -229
- package/src/lib/pages/settings/security/components/user/user-form.tsx +0 -123
- package/src/lib/pages/settings/security/components/user/users-grid.tsx +0 -127
- package/src/lib/pages/settings/settings.tsx +0 -298
- package/src/lib/pages/settings/token/token-row.tsx +0 -69
- package/src/lib/pages/settings/token/tokens.tsx +0 -73
- package/src/lib/pages/settings/ui/ui.tsx +0 -149
- package/src/lib/services/app-jit-manager.ts +0 -92
- package/src/lib/services/app-menu.service.ts +0 -35
- package/src/lib/utils/icon-factory.tsx +0 -25
- package/src/lib/utils/security/only-not-logged-route.tsx +0 -17
- package/src/lib/utils/security/protected-route.tsx +0 -47
- package/tsconfig.json +0 -20
- package/tsconfig.lib.json +0 -24
- package/tsconfig.spec.json +0 -20
package/src/lib/app.tsx
DELETED
|
@@ -1,374 +0,0 @@
|
|
|
1
|
-
import React, {useEffect, useState} from "react";
|
|
2
|
-
import {Provider} from "react-redux";
|
|
3
|
-
import {createBrowserRouter, RouteObject, RouterProvider} from "react-router-dom";
|
|
4
|
-
import ErrorPage from "./components/error-page/404";
|
|
5
|
-
import ProtectedRoute from "./utils/security/protected-route";
|
|
6
|
-
|
|
7
|
-
import FluxoPluginLoader from "./pages/general/fluxo-plugin-loader";
|
|
8
|
-
import OnlyNotLoggedRoute from "./utils/security/only-not-logged-route";
|
|
9
|
-
import BlankLayout from "./layouts/blank/blank-layout";
|
|
10
|
-
import AppLayout from "./layouts/main/app-layout";
|
|
11
|
-
import LoginPage from "./pages/login/login-page";
|
|
12
|
-
|
|
13
|
-
import {store} from "@fluxo-dev/state";
|
|
14
|
-
import {MantineProvider} from "@mantine/core";
|
|
15
|
-
import {Notifications} from "@mantine/notifications";
|
|
16
|
-
import {MainRoutes} from "./components/routes/main-routes";
|
|
17
|
-
import {
|
|
18
|
-
AppState,
|
|
19
|
-
EmbeddedModule,
|
|
20
|
-
FeatureList,
|
|
21
|
-
FluxoApp,
|
|
22
|
-
FluxoClientSys,
|
|
23
|
-
FluxoStateDispatcher
|
|
24
|
-
} from "@fluxo-dev/api-client-base";
|
|
25
|
-
import {WaitData} from "@fluxo-dev/ui-components";
|
|
26
|
-
import ForgotPassword from "./pages/login/forgot-password";
|
|
27
|
-
import ResetPassword from "./pages/login/reset-password";
|
|
28
|
-
import AccountConfirmation from "./pages/login/account-confirmation";
|
|
29
|
-
import {AppJitManager} from "./services/app-jit-manager";
|
|
30
|
-
import {DatesProvider} from "@mantine/dates";
|
|
31
|
-
import {reportsModule} from "@fluxo-fe/shell/reporting";
|
|
32
|
-
import {workflowModule} from "@fluxo-fe/shell/workflow";
|
|
33
|
-
import './app.module.css';
|
|
34
|
-
import 'dayjs/locale/it';
|
|
35
|
-
|
|
36
|
-
export interface FluxoShellProps {
|
|
37
|
-
pluginEndpoint: string,
|
|
38
|
-
appVersion: string,
|
|
39
|
-
dashboardComponent: React.ReactNode,
|
|
40
|
-
modules: EmbeddedModule[]
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export function FluxoShell(props: FluxoShellProps) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const [initialOperationsFinished, setInitialOperationsFinished] = useState<boolean>(false);
|
|
47
|
-
const [router, setRouter] = useState<any>();
|
|
48
|
-
const [brandColors, setBrandColors] = useState<any>(["#e9f4ff","#c2d8ef","#9bbae1","#749ad6","#4d7aca","#355db2","#29458a","#1d2e63","#101b3d","#030a18"]);
|
|
49
|
-
|
|
50
|
-
const generateRoutesFromEmbeddedModules = (): RouteObject[] => {
|
|
51
|
-
const embeddedModules: EmbeddedModule[] = [
|
|
52
|
-
...props.modules,
|
|
53
|
-
reportsModule,
|
|
54
|
-
workflowModule
|
|
55
|
-
];
|
|
56
|
-
|
|
57
|
-
const rObjs: RouteObject[] = [];
|
|
58
|
-
|
|
59
|
-
embeddedModules.forEach((eModule) => {
|
|
60
|
-
rObjs.push({
|
|
61
|
-
path: `/${eModule.scope}/${eModule.name}/*`,
|
|
62
|
-
children: eModule.getRouteObject()
|
|
63
|
-
});
|
|
64
|
-
})
|
|
65
|
-
|
|
66
|
-
return rObjs;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const generateRoutesFromJitApps = (): RouteObject[] => {
|
|
70
|
-
const jitAppManager = new AppJitManager();
|
|
71
|
-
|
|
72
|
-
const jitApps = jitAppManager.loadAppConfigurations();
|
|
73
|
-
|
|
74
|
-
const rObjs: RouteObject[] = [];
|
|
75
|
-
|
|
76
|
-
jitApps.filter(a => a.state == AppState.Active).map((app) => {
|
|
77
|
-
rObjs.push({
|
|
78
|
-
path: `/${app.developmentRoute}`,
|
|
79
|
-
children: [
|
|
80
|
-
{
|
|
81
|
-
path: `*`,
|
|
82
|
-
element: <FluxoPluginLoader module={`./${app.scope}`} scope={app.name} url={`${app.developmentUrl}/remoteEntry.js`} />
|
|
83
|
-
}
|
|
84
|
-
]
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
const jitAppsFeatures: FeatureList = {
|
|
89
|
-
features: [],
|
|
90
|
-
modules: []
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
jitApps.filter(a => a.state == AppState.Active).map((app) => {
|
|
94
|
-
|
|
95
|
-
jitAppsFeatures.modules.push(
|
|
96
|
-
{key: app.scope, name: app.name, description: app.description}
|
|
97
|
-
);
|
|
98
|
-
|
|
99
|
-
app.menu.map((f) => {
|
|
100
|
-
|
|
101
|
-
f.items?.map((ff) => {
|
|
102
|
-
jitAppsFeatures.features.push({
|
|
103
|
-
name: ff.name,
|
|
104
|
-
description: ff.name,
|
|
105
|
-
routerLink: `${app.developmentRoute}/${ff.route}`,
|
|
106
|
-
identifier: app.scope + '.' + f.name + '.' + ff.name,
|
|
107
|
-
groupName: f.name,
|
|
108
|
-
groupKey: f.name,
|
|
109
|
-
moduleKey: app.scope,
|
|
110
|
-
moduleName: app.name
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
FluxoStateDispatcher.dispatchSetJitAppsFeatures(jitAppsFeatures);
|
|
118
|
-
|
|
119
|
-
return rObjs;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
const generateRoutesFromDeployedApps = (apps: FluxoApp[]): RouteObject[] => {
|
|
123
|
-
|
|
124
|
-
const rObjs: RouteObject[] = [];
|
|
125
|
-
|
|
126
|
-
apps.map((app) => {
|
|
127
|
-
rObjs.push({
|
|
128
|
-
path: `/${app.scope}/${app.name}`,
|
|
129
|
-
children: [
|
|
130
|
-
{
|
|
131
|
-
path: `*`,
|
|
132
|
-
element: <FluxoPluginLoader module={`./${app.scope}`} scope={app.name} url={`${props.pluginEndpoint}/${app.scope}/${app.name}/remoteEntry.js`} />
|
|
133
|
-
}
|
|
134
|
-
]
|
|
135
|
-
});
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
return rObjs;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
const generateAuthRoutes = (): RouteObject => {
|
|
142
|
-
return {
|
|
143
|
-
path: "/auth",
|
|
144
|
-
element: <OnlyNotLoggedRoute><BlankLayout/></OnlyNotLoggedRoute>,
|
|
145
|
-
children: [
|
|
146
|
-
{
|
|
147
|
-
path: "login",
|
|
148
|
-
element: <LoginPage/>
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
path: "forgot-password",
|
|
152
|
-
element: <ForgotPassword/>
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
path: "reset-password",
|
|
156
|
-
element: <ResetPassword/>
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
path: "account-confirmation",
|
|
160
|
-
element: <AccountConfirmation/>
|
|
161
|
-
}
|
|
162
|
-
]
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
useEffect(() => {
|
|
167
|
-
FluxoClientSys.Instance.configuration.getInitialConfiguration()
|
|
168
|
-
.then((res) => {
|
|
169
|
-
|
|
170
|
-
FluxoStateDispatcher.dispatchSetConfiguration(res.ui);
|
|
171
|
-
FluxoStateDispatcher.dispatchSetAppMenu(res.menu);
|
|
172
|
-
FluxoStateDispatcher.dispatchSetSysFeatures(res.features);
|
|
173
|
-
FluxoStateDispatcher.dispatchSetUserPermissions(res.permissions.map(a => a.fullIdentifier))
|
|
174
|
-
FluxoStateDispatcher.dispatchSetRouteRules(res.routeRules);
|
|
175
|
-
|
|
176
|
-
const rObjs: RouteObject[] = [
|
|
177
|
-
generateAuthRoutes(),
|
|
178
|
-
{
|
|
179
|
-
element: <ProtectedRoute><AppLayout appVersion={props.appVersion} /></ProtectedRoute>,
|
|
180
|
-
errorElement: <ErrorPage />,
|
|
181
|
-
children: [
|
|
182
|
-
{
|
|
183
|
-
index: true,
|
|
184
|
-
element: props.dashboardComponent
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
path: '/*',
|
|
188
|
-
element: <MainRoutes pluginEndpoint={props.pluginEndpoint} modules={props.modules} />,
|
|
189
|
-
},
|
|
190
|
-
...generateRoutesFromEmbeddedModules(),
|
|
191
|
-
...generateRoutesFromDeployedApps(res.apps),
|
|
192
|
-
...generateRoutesFromJitApps(),
|
|
193
|
-
],
|
|
194
|
-
},
|
|
195
|
-
{
|
|
196
|
-
path: '*',
|
|
197
|
-
element: <ErrorPage />,
|
|
198
|
-
}
|
|
199
|
-
];
|
|
200
|
-
|
|
201
|
-
const router1 = createBrowserRouter(rObjs, { basename: '/' });
|
|
202
|
-
|
|
203
|
-
setRouter(router1);
|
|
204
|
-
setBrandColors(res.ui.colors);
|
|
205
|
-
})
|
|
206
|
-
.finally(() => {
|
|
207
|
-
setInitialOperationsFinished(true);
|
|
208
|
-
});
|
|
209
|
-
}, [])
|
|
210
|
-
|
|
211
|
-
return (
|
|
212
|
-
<MantineProvider theme={{
|
|
213
|
-
defaultRadius: 0,
|
|
214
|
-
components: {
|
|
215
|
-
ActionIcon: {
|
|
216
|
-
defaultProps: {
|
|
217
|
-
variant: 'transparent'
|
|
218
|
-
}
|
|
219
|
-
},
|
|
220
|
-
Text: {
|
|
221
|
-
defaultProps: {
|
|
222
|
-
size: 'xs',
|
|
223
|
-
fontSize: '10.5pt'
|
|
224
|
-
},
|
|
225
|
-
},
|
|
226
|
-
Button: {
|
|
227
|
-
defaultProps: {
|
|
228
|
-
size: 'xs',
|
|
229
|
-
fontSize: '10.5pt'
|
|
230
|
-
},
|
|
231
|
-
},
|
|
232
|
-
NumberInput: {
|
|
233
|
-
defaultProps: {
|
|
234
|
-
size: 'xs',
|
|
235
|
-
fontSize: '10.5pt'
|
|
236
|
-
},
|
|
237
|
-
},
|
|
238
|
-
DateInput: {
|
|
239
|
-
defaultProps: {
|
|
240
|
-
size: 'xs',
|
|
241
|
-
fontSize: '10.5pt'
|
|
242
|
-
},
|
|
243
|
-
},
|
|
244
|
-
Select: {
|
|
245
|
-
defaultProps: {
|
|
246
|
-
size: 'xs',
|
|
247
|
-
fontSize: '10.5pt'
|
|
248
|
-
},
|
|
249
|
-
},
|
|
250
|
-
Switch: {
|
|
251
|
-
defaultProps: {
|
|
252
|
-
size: 'xs',
|
|
253
|
-
fontSize: '10.5pt'
|
|
254
|
-
},
|
|
255
|
-
},
|
|
256
|
-
DatePickerInput: {
|
|
257
|
-
defaultProps: {
|
|
258
|
-
size: 'xs',
|
|
259
|
-
fontSize: '10.5pt',
|
|
260
|
-
popoverProps: {withinPortal: true}
|
|
261
|
-
},
|
|
262
|
-
},
|
|
263
|
-
TextInput: {
|
|
264
|
-
defaultProps: {
|
|
265
|
-
size: 'xs',
|
|
266
|
-
fontSize: '10.5pt'
|
|
267
|
-
}
|
|
268
|
-
},
|
|
269
|
-
Textarea: {
|
|
270
|
-
defaultProps: {
|
|
271
|
-
size: 'xs',
|
|
272
|
-
fontSize: '10.5pt'
|
|
273
|
-
}
|
|
274
|
-
},
|
|
275
|
-
MultiSelect: {
|
|
276
|
-
defaultProps: {
|
|
277
|
-
size: 'xs',
|
|
278
|
-
fontSize: '10.5pt'
|
|
279
|
-
}
|
|
280
|
-
},
|
|
281
|
-
Pill: {
|
|
282
|
-
defaultProps: {
|
|
283
|
-
size: 'xs',
|
|
284
|
-
fontSize: '10.5pt'
|
|
285
|
-
}
|
|
286
|
-
},
|
|
287
|
-
PillsInput: {
|
|
288
|
-
defaultProps: {
|
|
289
|
-
size: 'xs',
|
|
290
|
-
fontSize: '10.5pt'
|
|
291
|
-
}
|
|
292
|
-
},
|
|
293
|
-
Modal: {
|
|
294
|
-
defaultProps: {
|
|
295
|
-
shadow: '0 0 200px rgba(16,16,16,.4)',
|
|
296
|
-
styles: {
|
|
297
|
-
close: {color: 'black'},
|
|
298
|
-
header: {
|
|
299
|
-
background: '#fff',
|
|
300
|
-
padding: 8,
|
|
301
|
-
marginBottom: 16,
|
|
302
|
-
color: 'black',
|
|
303
|
-
boxShadow: 'rgba(33, 33, 33, 0.1) 2px 1px 1px'
|
|
304
|
-
}
|
|
305
|
-
},
|
|
306
|
-
overlayProps: {
|
|
307
|
-
color: 'rgba(153,153,153)',
|
|
308
|
-
opacity: 0.44,
|
|
309
|
-
blur: 0,
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
},
|
|
313
|
-
Pagination: {
|
|
314
|
-
styles: {
|
|
315
|
-
root: {
|
|
316
|
-
borderRadius: 0,
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
},
|
|
320
|
-
Loader: {
|
|
321
|
-
defaultProps: {
|
|
322
|
-
type: 'bars'
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
},
|
|
326
|
-
colors: {
|
|
327
|
-
darkGreen: ['#dcf6ff','#b3e8fc','#86ddf8','#5ad5f4','#37d1f2','#26bfd8','#1799a8','#077179','#004049','#00151a'],
|
|
328
|
-
darkBlue: [
|
|
329
|
-
'#e9f4ff',
|
|
330
|
-
'#c2d8ef',
|
|
331
|
-
'#9bbae1',
|
|
332
|
-
'#749ad6',
|
|
333
|
-
'#4d7aca',
|
|
334
|
-
'#355db2',
|
|
335
|
-
'#29458a',
|
|
336
|
-
'#1d2e63',
|
|
337
|
-
'#101b3d',
|
|
338
|
-
'#030a18',
|
|
339
|
-
],
|
|
340
|
-
//brand: ['#000','#111','#222','#333','#444','#555','#666','#777'],
|
|
341
|
-
// DIA brand: ['#dcf6ff','#b3e8fc','#86ddf8','#5ad5f4','#37d1f2','#26bfd8','#1799a8','#077179','#004049','#00151a'],
|
|
342
|
-
brand: brandColors,
|
|
343
|
-
},
|
|
344
|
-
fontFamily: 'Roboto', primaryColor: 'brand'
|
|
345
|
-
}}>
|
|
346
|
-
<React.Fragment>
|
|
347
|
-
{initialOperationsFinished && (((router && brandColors))) ?
|
|
348
|
-
<React.Fragment>
|
|
349
|
-
<DatesProvider settings={{ locale: 'it', firstDayOfWeek: 1, weekendDays: [0,6] }}>
|
|
350
|
-
<Provider store={store}>
|
|
351
|
-
<Notifications />
|
|
352
|
-
<AppInner router={router} />
|
|
353
|
-
</Provider>
|
|
354
|
-
</DatesProvider>
|
|
355
|
-
</React.Fragment> : <WaitData />
|
|
356
|
-
}
|
|
357
|
-
</React.Fragment>
|
|
358
|
-
</MantineProvider>
|
|
359
|
-
);
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
export default FluxoShell;
|
|
363
|
-
|
|
364
|
-
export interface AppInnerProps {
|
|
365
|
-
router: any;
|
|
366
|
-
}
|
|
367
|
-
export function AppInner(props: AppInnerProps) {
|
|
368
|
-
|
|
369
|
-
return (
|
|
370
|
-
<React.Suspense fallback={<>...</>}>
|
|
371
|
-
<RouterProvider router={props.router} />
|
|
372
|
-
</React.Suspense>
|
|
373
|
-
)
|
|
374
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { useRouteError } from "react-router-dom";
|
|
2
|
-
|
|
3
|
-
export default function ErrorPage() {
|
|
4
|
-
//const error: any = useRouteError();
|
|
5
|
-
//console.error(error);
|
|
6
|
-
|
|
7
|
-
return (
|
|
8
|
-
<div id="error-page">
|
|
9
|
-
<h1>Oops!</h1>
|
|
10
|
-
<p>Sorry, an unexpected error has occurred.</p>
|
|
11
|
-
{/*<p>
|
|
12
|
-
<i>{error.statusText || error.message}</i>
|
|
13
|
-
</p>*/}
|
|
14
|
-
</div>
|
|
15
|
-
);
|
|
16
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { FlxRoutes } from "@fluxo-dev/ui-components";
|
|
2
|
-
import { Route } from "react-router-dom";
|
|
3
|
-
import ChangePassword from "../../pages/login/change-password";
|
|
4
|
-
import { Settings } from "../../pages/settings/settings";
|
|
5
|
-
import React, {lazy, Suspense} from "react";
|
|
6
|
-
import {EmbeddedModule, UserService} from "@fluxo-dev/api-client-base";
|
|
7
|
-
|
|
8
|
-
export interface MainRoutesProps {
|
|
9
|
-
pluginEndpoint: string;
|
|
10
|
-
modules: EmbeddedModule[];
|
|
11
|
-
}
|
|
12
|
-
export function MainRoutes(props: MainRoutesProps) {
|
|
13
|
-
|
|
14
|
-
const KIde = lazy(() => import('@fluxo-fe/shell/korebi').then(({KorebiIde}) => ({default: KorebiIde})));
|
|
15
|
-
const user = new UserService();
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<FlxRoutes>
|
|
21
|
-
<Route path={'settings'} element={<Settings pluginEndpoint={props.pluginEndpoint} modules={props.modules} />} />
|
|
22
|
-
<Route path={'change-password'} element={<ChangePassword />} />
|
|
23
|
-
<Route path={'korebi-ide'} element={<Suspense><KIde /></Suspense>} />
|
|
24
|
-
</FlxRoutes>
|
|
25
|
-
)
|
|
26
|
-
}
|
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
import React, {useEffect} from 'react';
|
|
2
|
-
import {useSelector} from "react-redux";
|
|
3
|
-
import {Link, useLocation, useNavigate} from "react-router-dom";
|
|
4
|
-
import SearchBar from "./search-bar";
|
|
5
|
-
import {FluxoClientSys, FluxoStateDispatcher} from "@fluxo-dev/api-client-base";
|
|
6
|
-
import {
|
|
7
|
-
Group,
|
|
8
|
-
Avatar,
|
|
9
|
-
Stack,
|
|
10
|
-
Burger,
|
|
11
|
-
ActionIcon, Drawer, NavLink, Badge, AppShell
|
|
12
|
-
} from "@mantine/core";
|
|
13
|
-
import {
|
|
14
|
-
IconApps,
|
|
15
|
-
IconChevronRight,
|
|
16
|
-
IconLink,
|
|
17
|
-
IconRefresh
|
|
18
|
-
} from '@tabler/icons-react';
|
|
19
|
-
import { useMantineTheme } from '@mantine/core';
|
|
20
|
-
import {IFluxoRootState} from "@fluxo-dev/state";
|
|
21
|
-
import {AppJit} from "../../models/app-jit";
|
|
22
|
-
import {AppJitManager} from "../../services/app-jit-manager";
|
|
23
|
-
import {showNotification} from "@mantine/notifications";
|
|
24
|
-
import {DataCard} from "@fluxo-dev/ui-components";
|
|
25
|
-
import {useHotkeys} from "@mantine/hooks";
|
|
26
|
-
|
|
27
|
-
export interface AppBarProps {
|
|
28
|
-
previewMode?: {
|
|
29
|
-
logo?: string,
|
|
30
|
-
logoHeight: number,
|
|
31
|
-
headerColor: string,
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
function AppBar(props: AppBarProps) {
|
|
35
|
-
|
|
36
|
-
const {userInfo} = useSelector((state: any) => state.user)
|
|
37
|
-
const {navbarOpened, configuration} = useSelector((state: IFluxoRootState) => state.layout);
|
|
38
|
-
|
|
39
|
-
const [jitApps, setJitApps] = React.useState<AppJit[]>([]);
|
|
40
|
-
const [jitAppsLoaded, setJitAppsLoaded] = React.useState<boolean>(false);
|
|
41
|
-
const [jitAppsDrawerOpened, setJitAppsDrawerOpened] = React.useState<boolean>(false);
|
|
42
|
-
|
|
43
|
-
const fluxoTheme = useMantineTheme();
|
|
44
|
-
const navigate = useNavigate();
|
|
45
|
-
const location = useLocation();
|
|
46
|
-
|
|
47
|
-
const [developmentMode, setDevelopmentMode] = React.useState<boolean | undefined>(undefined);
|
|
48
|
-
const [lastLocation, setLastLocation] = React.useState<string | undefined>(undefined);
|
|
49
|
-
|
|
50
|
-
useHotkeys([
|
|
51
|
-
['mod + o', () => {
|
|
52
|
-
if(navbarOpened)
|
|
53
|
-
FluxoStateDispatcher.dispatchCloseNavbar()
|
|
54
|
-
else
|
|
55
|
-
FluxoStateDispatcher.dispatchOpenNavbar()
|
|
56
|
-
}]
|
|
57
|
-
]);
|
|
58
|
-
|
|
59
|
-
useEffect(() => {
|
|
60
|
-
|
|
61
|
-
if(!jitAppsLoaded)
|
|
62
|
-
return;
|
|
63
|
-
|
|
64
|
-
const splittedLocation = location.pathname.split('/');
|
|
65
|
-
|
|
66
|
-
if(splittedLocation.length < 2) {
|
|
67
|
-
setDevelopmentMode(false);
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
const found = jitApps.filter(a => a.developmentRoute === splittedLocation[1]);
|
|
72
|
-
if(found.length > 0) {
|
|
73
|
-
setDevelopmentMode(true);
|
|
74
|
-
} else {
|
|
75
|
-
setDevelopmentMode(false);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if(lastLocation) {
|
|
79
|
-
const splittedLastLocation = lastLocation.split('/');
|
|
80
|
-
const foundInLastLocation = jitApps.filter(a => a.developmentRoute === splittedLastLocation[1]);
|
|
81
|
-
if((foundInLastLocation.length > 0 && found.length === 0) || (foundInLastLocation.length === 0 && found.length > 0)) {
|
|
82
|
-
navigate(0);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
setLastLocation(location.pathname);
|
|
87
|
-
|
|
88
|
-
}, [location, jitApps])
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
const appJitManager = new AppJitManager();
|
|
92
|
-
|
|
93
|
-
useEffect(() => {
|
|
94
|
-
setJitApps(appJitManager.loadAppConfigurations());
|
|
95
|
-
setJitAppsLoaded(true);
|
|
96
|
-
}, [])
|
|
97
|
-
|
|
98
|
-
const logout = () => {
|
|
99
|
-
FluxoClientSys.Instance.auth.logout();
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const refreshJitApps = (app: AppJit) => {
|
|
103
|
-
appJitManager.refreshApp(app)
|
|
104
|
-
.then((result: boolean) => {
|
|
105
|
-
if(result) {
|
|
106
|
-
setJitApps(appJitManager.loadAppConfigurations());
|
|
107
|
-
showNotification({
|
|
108
|
-
title: 'Applicazione aggiornata',
|
|
109
|
-
message: `L'applicazione ${app.name} è stata aggiornata correttamente`,
|
|
110
|
-
color: 'green',
|
|
111
|
-
icon: <IconRefresh />,
|
|
112
|
-
})
|
|
113
|
-
} else {
|
|
114
|
-
showNotification({
|
|
115
|
-
title: 'Errore',
|
|
116
|
-
message: `L'applicazione ${app.name} non è stata aggiornata. Verifica che la JIT App sia attiva e raggiungibile e che il file di configurazione sia corretto.`,
|
|
117
|
-
color: 'red',
|
|
118
|
-
icon: <IconRefresh />,
|
|
119
|
-
})
|
|
120
|
-
}
|
|
121
|
-
})
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
return (
|
|
125
|
-
<AppShell.Header
|
|
126
|
-
id={'fluxo-app-bar'}
|
|
127
|
-
style={{
|
|
128
|
-
borderBlockEnd: 'none',
|
|
129
|
-
position: props.previewMode ? 'relative' : 'fixed',
|
|
130
|
-
zIndex: props.previewMode ? 1 : 200,
|
|
131
|
-
}}
|
|
132
|
-
>
|
|
133
|
-
<Stack gap={0}>
|
|
134
|
-
<Group px={16} justify={'space-between'} wrap="nowrap" style={{height: '48px', backgroundColor: props.previewMode?.headerColor ?? fluxoTheme.colors['brand'][7],}}>
|
|
135
|
-
<Group>
|
|
136
|
-
<Burger
|
|
137
|
-
disabled={props.previewMode !== undefined}
|
|
138
|
-
color={'#fff'}
|
|
139
|
-
opened={navbarOpened}
|
|
140
|
-
title={'Menu'}
|
|
141
|
-
onClick={() => {
|
|
142
|
-
if(navbarOpened)
|
|
143
|
-
FluxoStateDispatcher.dispatchCloseNavbar()
|
|
144
|
-
else
|
|
145
|
-
FluxoStateDispatcher.dispatchOpenNavbar()
|
|
146
|
-
}}
|
|
147
|
-
/>
|
|
148
|
-
<Link to={props.previewMode ? '' : '/'} style={{maxHeight: props.previewMode?.logoHeight ?? configuration.logoHeight}} >
|
|
149
|
-
<img src={props.previewMode?.logo ? props.previewMode.logo : configuration.logo} style={{maxHeight: props.previewMode?.logoHeight ?? configuration.logoHeight}} />
|
|
150
|
-
</Link>
|
|
151
|
-
</Group>
|
|
152
|
-
<Group wrap="nowrap">
|
|
153
|
-
{developmentMode &&
|
|
154
|
-
<Badge color={'red'}>Development mode</Badge>
|
|
155
|
-
}
|
|
156
|
-
{jitApps && jitApps.length > 0 &&
|
|
157
|
-
<>
|
|
158
|
-
<ActionIcon variant={'transparent'} onClick={() => setJitAppsDrawerOpened(true)}><IconApps color={'white'} size={32}/></ActionIcon>
|
|
159
|
-
|
|
160
|
-
<Drawer title={'Navigazione (App JIT)'} position={'right'} opened={jitAppsDrawerOpened} onClose={() => setJitAppsDrawerOpened(false)}>
|
|
161
|
-
<div>
|
|
162
|
-
{jitApps.map((app, index) => {
|
|
163
|
-
return (
|
|
164
|
-
<DataCard padded={false} key={index} title={app.name} actions={[{icon: <IconRefresh size={18} />, onClick: () => refreshJitApps(app),}]}>
|
|
165
|
-
{app.menu.map((group, index) => {
|
|
166
|
-
return (
|
|
167
|
-
<React.Fragment key={`${group.name}_${index}`}>
|
|
168
|
-
<NavLink leftSection={<Badge size="xs" variant="filled" color={fluxoTheme.colors['brand'][7]} w={16} h={16} p={0}>{group.items ? group.items?.length : 0}</Badge>} rightSection={<IconChevronRight size={16} />} label={group.name}>
|
|
169
|
-
{group.items?.map((feature, index) => {
|
|
170
|
-
return (
|
|
171
|
-
<NavLink key={`${feature.name}_${index}`} onClick={() => navigate(`${app.developmentRoute}/${feature.route}`)} label={feature.name} leftSection={<IconLink size={16} />} />
|
|
172
|
-
)})}
|
|
173
|
-
</NavLink>
|
|
174
|
-
</React.Fragment>
|
|
175
|
-
)})}
|
|
176
|
-
</DataCard>
|
|
177
|
-
)
|
|
178
|
-
})}
|
|
179
|
-
</div>
|
|
180
|
-
</Drawer>
|
|
181
|
-
</>
|
|
182
|
-
}
|
|
183
|
-
<SearchBar disabled={props.previewMode !== undefined}/>
|
|
184
|
-
<Avatar onClick={() => props.previewMode ? undefined : logout()} color="cyan" radius="xl" size={32}>{userInfo.FirstName.substr(0, 1)}{userInfo.LastName.substr(0, 1)}</Avatar>
|
|
185
|
-
</Group>
|
|
186
|
-
</Group>
|
|
187
|
-
</Stack>
|
|
188
|
-
</AppShell.Header>
|
|
189
|
-
)
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
export default AppBar;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import React, {Suspense} from 'react';
|
|
2
|
-
import AppBar from "./app-bar";
|
|
3
|
-
import AppContent from "./content";
|
|
4
|
-
import FooterBar from "./footer-bar";
|
|
5
|
-
import {AppShell, Loader, ScrollArea} from '@mantine/core';
|
|
6
|
-
import {Navbar} from "./navbar";
|
|
7
|
-
import {useSelector} from "react-redux";
|
|
8
|
-
import {IFluxoRootState} from "@fluxo-dev/state";
|
|
9
|
-
import ShellSpotlight from './shell-spotlight';
|
|
10
|
-
|
|
11
|
-
export interface AppLayoutProps {
|
|
12
|
-
appVersion: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function AppLayout(props: AppLayoutProps) {
|
|
16
|
-
|
|
17
|
-
const {navbarOpened} = useSelector((state: IFluxoRootState) => state.layout);
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<>
|
|
21
|
-
<AppShell
|
|
22
|
-
padding={0}
|
|
23
|
-
styles={{main: {backgroundColor: (1 == 1) ? '#edeff3' : '#f9f9f9'}}}
|
|
24
|
-
navbar={{width: 248, breakpoint: 'sm', collapsed: {mobile: !navbarOpened, desktop: !navbarOpened}}}
|
|
25
|
-
header={{height: 48}}
|
|
26
|
-
footer={{height: 40}}
|
|
27
|
-
transitionDuration={0}
|
|
28
|
-
layout={'default'}
|
|
29
|
-
>
|
|
30
|
-
<AppBar/>
|
|
31
|
-
|
|
32
|
-
<Navbar/>
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
<AppShell.Main>
|
|
36
|
-
<Suspense fallback={<Loader/>}>
|
|
37
|
-
<AppContent/>
|
|
38
|
-
</Suspense>
|
|
39
|
-
</AppShell.Main>
|
|
40
|
-
|
|
41
|
-
<AppShell.Footer>
|
|
42
|
-
<FooterBar appVersion={props.appVersion} />
|
|
43
|
-
</AppShell.Footer>
|
|
44
|
-
|
|
45
|
-
</AppShell>
|
|
46
|
-
|
|
47
|
-
<ShellSpotlight/>
|
|
48
|
-
</>
|
|
49
|
-
)
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export default AppLayout;
|