@fluxo-dev/shell 0.0.8 → 0.0.9
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 +4 -1
- 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
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { useSelector } from 'react-redux'
|
|
3
|
-
import { FluxoClientSys } from "@fluxo-dev/api-client-base";
|
|
4
|
-
import { useForm } from '@mantine/form';
|
|
5
|
-
import { TextInput, Button, PasswordInput, Grid, Stack } from "@mantine/core";
|
|
6
|
-
import { useNavigate } from 'react-router-dom';
|
|
7
|
-
|
|
8
|
-
function LoginPage() {
|
|
9
|
-
|
|
10
|
-
const { loading, error } = useSelector((state: any) => state.user)
|
|
11
|
-
const navigateTo = useNavigate();
|
|
12
|
-
|
|
13
|
-
const form = useForm({
|
|
14
|
-
initialValues: {
|
|
15
|
-
username: '',
|
|
16
|
-
password: '',
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
validate: {
|
|
20
|
-
username: (value) => (value?.length < 1 ? 'Username obbligatorio' : null),
|
|
21
|
-
password: (value) => (value?.length < 1 ? 'Password obbligatoria' : null),
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
const loginHandler = (values: any) => {
|
|
26
|
-
FluxoClientSys.Instance.auth.login(values.username, values.password);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<Grid justify="center">
|
|
31
|
-
<Grid.Col span={3}>
|
|
32
|
-
<h1>Login Page</h1>
|
|
33
|
-
<form onSubmit={form.onSubmit(
|
|
34
|
-
(values, event) => {
|
|
35
|
-
loginHandler(values);
|
|
36
|
-
}
|
|
37
|
-
)}>
|
|
38
|
-
<TextInput
|
|
39
|
-
withAsterisk
|
|
40
|
-
label="Nome utente"
|
|
41
|
-
placeholder="utente@azienda.com"
|
|
42
|
-
{...form.getInputProps('username')}
|
|
43
|
-
/>
|
|
44
|
-
<PasswordInput
|
|
45
|
-
withAsterisk
|
|
46
|
-
label="Password"
|
|
47
|
-
placeholder="Inserisci la password..."
|
|
48
|
-
{...form.getInputProps('password')}
|
|
49
|
-
/>
|
|
50
|
-
|
|
51
|
-
<Stack gap={5} mt="md">
|
|
52
|
-
<Stack align="flex-end">
|
|
53
|
-
<Button size="compact-XXX" variant="subtle" onClick={() => navigateTo('/auth/forgot-password')}>
|
|
54
|
-
Password Dimenticata?
|
|
55
|
-
</Button>
|
|
56
|
-
</Stack>
|
|
57
|
-
<Button loading={loading} type="submit">Accedi</Button>
|
|
58
|
-
</Stack>
|
|
59
|
-
|
|
60
|
-
</form>
|
|
61
|
-
{error &&
|
|
62
|
-
<p>Errore</p>
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
</Grid.Col>
|
|
66
|
-
</Grid>
|
|
67
|
-
)
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export default LoginPage;
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { Button, Grid, Stack, Text, TextInput } from '@mantine/core';
|
|
2
|
-
import { useEffect, useState } from 'react';
|
|
3
|
-
import { Link, useSearchParams } from 'react-router-dom';
|
|
4
|
-
import {UserService} from "@fluxo-dev/api-client-base";
|
|
5
|
-
|
|
6
|
-
export function ResetPassword() {
|
|
7
|
-
|
|
8
|
-
const [email, setEmail] = useState<string>();
|
|
9
|
-
const [token, setToken] = useState<string>();
|
|
10
|
-
const [linkIsValid, setLinkIsValid] = useState<boolean>(true);
|
|
11
|
-
|
|
12
|
-
const [newPassword, setNewPassword] = useState<string>();
|
|
13
|
-
const [confirmNewPassword, setConfirmNewPassword] = useState<string>();
|
|
14
|
-
|
|
15
|
-
const [recoveryResult, setRecoveryResult] = useState<{ success: boolean, errors: { code: string, description: string }[] } | undefined>();
|
|
16
|
-
|
|
17
|
-
const userService = new UserService();
|
|
18
|
-
let [searchParams] = useSearchParams();
|
|
19
|
-
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
if (searchParams) {
|
|
22
|
-
const currentEmail = searchParams.get('email');
|
|
23
|
-
const currentToken = searchParams.get('token');
|
|
24
|
-
|
|
25
|
-
if (!currentEmail || !currentToken) {
|
|
26
|
-
setLinkIsValid(false)
|
|
27
|
-
} else {
|
|
28
|
-
setEmail(currentEmail)
|
|
29
|
-
setToken(currentToken)
|
|
30
|
-
}
|
|
31
|
-
} else {
|
|
32
|
-
setLinkIsValid(false)
|
|
33
|
-
}
|
|
34
|
-
}, [searchParams])
|
|
35
|
-
|
|
36
|
-
const onFormSubmitClickHandler = () => {
|
|
37
|
-
if (email && token && newPassword) {
|
|
38
|
-
userService.forgotPasswordConfirm({ email: email, token: token, password: newPassword })
|
|
39
|
-
.then((res) => {
|
|
40
|
-
setRecoveryResult(res);
|
|
41
|
-
})
|
|
42
|
-
.catch(_err => setRecoveryResult({ success: false, errors: [{ code: 'unkown', description: 'Errore sconosciuto' }] }));
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return (
|
|
47
|
-
<Grid justify="center">
|
|
48
|
-
<Grid.Col span={3}>
|
|
49
|
-
{linkIsValid &&
|
|
50
|
-
<Stack gap={16}>
|
|
51
|
-
{(!recoveryResult || !recoveryResult.success) &&
|
|
52
|
-
<Stack gap={16}>
|
|
53
|
-
<h2>Reset password</h2>
|
|
54
|
-
<Text>{email}</Text>
|
|
55
|
-
<TextInput type={'password'} label={'Nuova password'} onChange={(e) => setNewPassword(e.target.value)} />
|
|
56
|
-
<TextInput type={'password'} label={'Conferma nuova password'} onChange={(e) => setConfirmNewPassword(e.target.value)} />
|
|
57
|
-
|
|
58
|
-
{recoveryResult?.errors.map((err) => {
|
|
59
|
-
return <Text>{err.description}</Text>
|
|
60
|
-
})}
|
|
61
|
-
|
|
62
|
-
<Button onClick={onFormSubmitClickHandler} disabled={!(newPassword && (newPassword === confirmNewPassword))}>Effettua il reset</Button>
|
|
63
|
-
<Link to={'/auth/login'} style={{ textAlign: 'center' }}>Non vuoi effettuare il reset? Effettua il login</Link>
|
|
64
|
-
</Stack>
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
{recoveryResult?.success &&
|
|
68
|
-
<div style={{ marginTop: 32 }}>
|
|
69
|
-
<Stack gap={16}>
|
|
70
|
-
<Text style={{ textAlign: 'center', width: '100%', display: 'block' }}>{'Reset effettuato con successo'}</Text>
|
|
71
|
-
<Link to={'/auth/login'} style={{ textAlign: 'center' }}>Effettua il login</Link>
|
|
72
|
-
</Stack>
|
|
73
|
-
</div>
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
</Stack>
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
{!linkIsValid &&
|
|
80
|
-
<Stack gap={16}>
|
|
81
|
-
<Text>Link non valido</Text>
|
|
82
|
-
<Link to={'/auth/login'} style={{ textAlign: 'center' }}>Effettua il login</Link>
|
|
83
|
-
</Stack>
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
</Grid.Col>
|
|
87
|
-
</Grid>
|
|
88
|
-
)
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export default ResetPassword;
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import {Button, Group, Stack, TextInput} from "@mantine/core";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import {AppJitManager} from "../../../services/app-jit-manager";
|
|
4
|
-
import {FluxoFrontendAppConfiguration} from "@fluxo-dev/api-client-base";
|
|
5
|
-
|
|
6
|
-
export interface AddJitAppProps {
|
|
7
|
-
onCanceled: () => void;
|
|
8
|
-
onAdded: () => void;
|
|
9
|
-
}
|
|
10
|
-
export function AddJitApp(props: AddJitAppProps) {
|
|
11
|
-
|
|
12
|
-
const [url, setUrl] = React.useState<string>('');
|
|
13
|
-
const [rootRoute, setRootRoute] = React.useState<string>('');
|
|
14
|
-
|
|
15
|
-
const [fluxoAppConfiguration, setFluxoAppConfiguration] = React.useState<FluxoFrontendAppConfiguration | undefined>(undefined);
|
|
16
|
-
|
|
17
|
-
const [verifyStatus, setVerifyStatus] = React.useState<'idle' | 'verified' | 'error'>('idle');
|
|
18
|
-
|
|
19
|
-
const verifyUrl = () => {
|
|
20
|
-
|
|
21
|
-
setVerifyStatus('idle');
|
|
22
|
-
|
|
23
|
-
fetch(`${url}/fluxo-fe-app-configuration.json`)
|
|
24
|
-
.then((response) => {
|
|
25
|
-
response.json()
|
|
26
|
-
.then((json) => {
|
|
27
|
-
setFluxoAppConfiguration(json);
|
|
28
|
-
setVerifyStatus('verified');
|
|
29
|
-
});
|
|
30
|
-
})
|
|
31
|
-
.catch((error) => {
|
|
32
|
-
setVerifyStatus('error');
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const addApp = () => {
|
|
37
|
-
const manager = new AppJitManager();
|
|
38
|
-
|
|
39
|
-
if(!fluxoAppConfiguration) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
manager.addAppConfiguration(fluxoAppConfiguration, url, rootRoute);
|
|
44
|
-
props.onAdded();
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return (
|
|
48
|
-
<Stack>
|
|
49
|
-
<form>
|
|
50
|
-
<Stack>
|
|
51
|
-
<TextInput
|
|
52
|
-
label={'Root route'}
|
|
53
|
-
placeholder={'root-route'}
|
|
54
|
-
value={rootRoute}
|
|
55
|
-
onChange={(e) => setRootRoute(e.currentTarget.value)}
|
|
56
|
-
/>
|
|
57
|
-
<TextInput
|
|
58
|
-
label={'Url'}
|
|
59
|
-
placeholder={'http://localhost:1234'}
|
|
60
|
-
value={url}
|
|
61
|
-
onChange={(e) => setUrl(e.currentTarget.value)}
|
|
62
|
-
/>
|
|
63
|
-
{fluxoAppConfiguration &&
|
|
64
|
-
<>
|
|
65
|
-
<p>{fluxoAppConfiguration.name}</p>
|
|
66
|
-
</>
|
|
67
|
-
}
|
|
68
|
-
</Stack>
|
|
69
|
-
</form>
|
|
70
|
-
<Group align={'end'} justify={'right'}>
|
|
71
|
-
<Button variant={'subtle'} onClick={props.onCanceled}>Annulla</Button>
|
|
72
|
-
{verifyStatus === 'idle' || verifyStatus === 'error' ?
|
|
73
|
-
<Button disabled={!rootRoute || !url} onClick={verifyUrl} type={'submit'}>Verifica</Button> :
|
|
74
|
-
<Button onClick={addApp} type={'submit'}>Aggiungi</Button>
|
|
75
|
-
}
|
|
76
|
-
</Group>
|
|
77
|
-
</Stack>
|
|
78
|
-
)
|
|
79
|
-
}
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import {AppState, AppType, FluxoApp, FluxoClientSys} from "@fluxo-dev/api-client-base";
|
|
2
|
-
import {ActionIcon, Badge, Button, Group, Image, Menu, Modal, Stack, Text} from "@mantine/core";
|
|
3
|
-
import React from "react";
|
|
4
|
-
import {IconArrowUp, IconCircleOff, IconDotsVertical, IconTrash} from '@tabler/icons-react';
|
|
5
|
-
import moment from "moment";
|
|
6
|
-
import {ConfirmModal} from "@fluxo-dev/ui-components";
|
|
7
|
-
import {showNotification} from "@mantine/notifications";
|
|
8
|
-
import {InstallOrUpgradeApp} from "./install-or-upgrade-app";
|
|
9
|
-
|
|
10
|
-
export interface AppItemProps {
|
|
11
|
-
app: FluxoApp;
|
|
12
|
-
onUninstall?: (app: FluxoApp) => void;
|
|
13
|
-
onDeactivate?: (app: FluxoApp) => void;
|
|
14
|
-
onActivate?: (app: FluxoApp) => void;
|
|
15
|
-
onUpgrade?: (app: FluxoApp) => void;
|
|
16
|
-
pluginEndpoint: string;
|
|
17
|
-
}
|
|
18
|
-
export function AppItem(props: AppItemProps) {
|
|
19
|
-
|
|
20
|
-
const [showDeleteModal, setShowDeleteModal] = React.useState(false);
|
|
21
|
-
const [showDeactivateModal, setShowDeactivateModale] = React.useState(false);
|
|
22
|
-
const [showActivateModal, setShowActivateModal] = React.useState(false);
|
|
23
|
-
const [showUpgradeAppModal, setShowUpgradeAppModal] = React.useState(false);
|
|
24
|
-
|
|
25
|
-
const disable = () => {
|
|
26
|
-
FluxoClientSys.Instance.apps.deactivateApp(props.app.id).then(() => {
|
|
27
|
-
showNotification({
|
|
28
|
-
title: 'Operazione completata',
|
|
29
|
-
message: `L'applicazione (${props.app.name} - ${props.app.version}) è stata disattivata con successo`,
|
|
30
|
-
color: 'green',
|
|
31
|
-
})
|
|
32
|
-
props.onDeactivate?.(props.app);
|
|
33
|
-
}).catch((err) => {
|
|
34
|
-
showNotification({
|
|
35
|
-
title: 'Operazione fallita',
|
|
36
|
-
message: `L'applicazione (${props.app.name} - ${props.app.version}) non è stata disattivata: ${err.message}`,
|
|
37
|
-
color: 'red',
|
|
38
|
-
})
|
|
39
|
-
})
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const enable = () => {
|
|
43
|
-
FluxoClientSys.Instance.apps.activateApp(props.app.id).then(() => {
|
|
44
|
-
showNotification({
|
|
45
|
-
title: 'Operazione completata',
|
|
46
|
-
message: `L'applicazione (${props.app.name} - ${props.app.version}) è stata attivata con successo`,
|
|
47
|
-
color: 'green',
|
|
48
|
-
})
|
|
49
|
-
props.onActivate?.(props.app);
|
|
50
|
-
}).catch((err) => {
|
|
51
|
-
showNotification({
|
|
52
|
-
title: 'Operazione fallita',
|
|
53
|
-
message: `L'applicazione (${props.app.name} - ${props.app.version}) non è stata attivata: ${err.message}`,
|
|
54
|
-
color: 'red',
|
|
55
|
-
})
|
|
56
|
-
})
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const uninstall = () => {
|
|
60
|
-
FluxoClientSys.Instance.apps.uninstallApp(props.app.id).then(() => {
|
|
61
|
-
showNotification({
|
|
62
|
-
title: 'Operazione completata',
|
|
63
|
-
message: `L'applicazione (${props.app.name} - ${props.app.version}) è stata disinstallata con successo`,
|
|
64
|
-
color: 'green',
|
|
65
|
-
})
|
|
66
|
-
props.onUninstall?.(props.app);
|
|
67
|
-
}).catch((err) => {
|
|
68
|
-
showNotification({
|
|
69
|
-
title: 'Operazione fallita',
|
|
70
|
-
message: `L'applicazione (${props.app.name} - ${props.app.version}) non è stata disinstallata: ${err.message}`,
|
|
71
|
-
color: 'red',
|
|
72
|
-
})
|
|
73
|
-
})
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return (
|
|
77
|
-
<Group justify='space-between' style={{ border: '1px solid #dedede', padding: 15 }}>
|
|
78
|
-
<Group>
|
|
79
|
-
<Image src={`${props.pluginEndpoint}/${props.app.scope}/${props.app.name}/favicon.ico`} width={48} height={48} />
|
|
80
|
-
<Stack gap={0}>
|
|
81
|
-
<span>{props.app.description} <small>({props.app.version})</small></span>
|
|
82
|
-
<small>{props.app.name} - <b>{props.app.author}</b></small>
|
|
83
|
-
</Stack>
|
|
84
|
-
</Group>
|
|
85
|
-
<Group>
|
|
86
|
-
|
|
87
|
-
{props.app.state === AppState.Active ? <Badge color="green">Attivo</Badge> : <Badge color="red">Disattivo</Badge>}
|
|
88
|
-
<Badge color={props.app.type === AppType.Frontend ? 'orange' : 'violet'}>{props.app.type === AppType.Frontend ? 'Frontend' : 'Backend'}</Badge>
|
|
89
|
-
<Badge color={'gray'}>{moment(props.app.installationDate).format("DD/MM/yyyy")}</Badge>
|
|
90
|
-
|
|
91
|
-
<Menu shadow="md" width={200}>
|
|
92
|
-
<Menu.Target>
|
|
93
|
-
<ActionIcon><IconDotsVertical size={18} /></ActionIcon>
|
|
94
|
-
</Menu.Target>
|
|
95
|
-
|
|
96
|
-
<Menu.Dropdown>
|
|
97
|
-
<Menu.Item leftSection={<IconCircleOff size={14} />} onClick={props.app.state == AppState.Active ? disable : enable}>
|
|
98
|
-
{props.app.state == AppState.Active ? 'Disattiva' : 'Attiva'}
|
|
99
|
-
</Menu.Item>
|
|
100
|
-
<Menu.Item onClick={() => setShowUpgradeAppModal(true)} leftSection={<IconArrowUp color={'green'} size={14} />}>Aggiorna</Menu.Item>
|
|
101
|
-
<Menu.Divider />
|
|
102
|
-
<Menu.Item color={'red'} onClick={() => setShowDeleteModal(true)} leftSection={<IconTrash color={'red'} size={14} />}>Disinstalla</Menu.Item>
|
|
103
|
-
</Menu.Dropdown>
|
|
104
|
-
</Menu>
|
|
105
|
-
</Group>
|
|
106
|
-
|
|
107
|
-
<ConfirmModal
|
|
108
|
-
title={'Disinstalla app'}
|
|
109
|
-
open={showDeleteModal}
|
|
110
|
-
onButtonCancelClick={() => setShowDeleteModal(false)}
|
|
111
|
-
onButtonConfirmClick={() => {
|
|
112
|
-
setShowDeleteModal(false);
|
|
113
|
-
uninstall();
|
|
114
|
-
}}
|
|
115
|
-
messageText={'Sei sicuro di voler disinstallare l\'applicazione?'}
|
|
116
|
-
/>
|
|
117
|
-
|
|
118
|
-
<ConfirmModal
|
|
119
|
-
title={'Attiva app'}
|
|
120
|
-
open={showActivateModal}
|
|
121
|
-
onButtonCancelClick={() => setShowActivateModal(false)}
|
|
122
|
-
onButtonConfirmClick={() => {
|
|
123
|
-
setShowActivateModal(false);
|
|
124
|
-
enable();
|
|
125
|
-
}}
|
|
126
|
-
messageText={'Sei sicuro di voler attivare l\'applicazione?'}
|
|
127
|
-
/>
|
|
128
|
-
|
|
129
|
-
<ConfirmModal
|
|
130
|
-
title={'Attiva app'}
|
|
131
|
-
open={showDeactivateModal}
|
|
132
|
-
onButtonCancelClick={() => setShowDeactivateModale(false)}
|
|
133
|
-
onButtonConfirmClick={() => {
|
|
134
|
-
setShowDeactivateModale(false);
|
|
135
|
-
disable();
|
|
136
|
-
}}
|
|
137
|
-
messageText={'Sei sicuro di voler attivare l\'applicazione?'}
|
|
138
|
-
/>
|
|
139
|
-
|
|
140
|
-
{
|
|
141
|
-
<Modal centered title={'Aggiornamento app'} opened={showUpgradeAppModal} onClose={() => setShowUpgradeAppModal(false)}>
|
|
142
|
-
<Stack>
|
|
143
|
-
<Text>Procedura di aggiornamento dell'app {props.app.name}</Text>
|
|
144
|
-
<InstallOrUpgradeApp mode={'upgrade'} appIdToUpgrade={props.app.id} onInstall={() => {
|
|
145
|
-
setShowUpgradeAppModal(false);
|
|
146
|
-
props.onUpgrade?.(props.app);
|
|
147
|
-
}} />
|
|
148
|
-
<Group justify={'right'}>
|
|
149
|
-
<Button onClick={() => setShowUpgradeAppModal(false)}>Annulla</Button>
|
|
150
|
-
</Group>
|
|
151
|
-
</Stack>
|
|
152
|
-
</Modal>
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
</Group>
|
|
156
|
-
)
|
|
157
|
-
}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import {AppState, AppType} from "@fluxo-dev/api-client-base";
|
|
2
|
-
import {ActionIcon, Badge, Group, Image, Menu, Stack} from "@mantine/core";
|
|
3
|
-
import React from "react";
|
|
4
|
-
import {IconBug, IconCircleOff, IconDotsVertical, IconTrash} from '@tabler/icons-react';
|
|
5
|
-
import moment from "moment";
|
|
6
|
-
import {ConfirmModal} from "@fluxo-dev/ui-components";
|
|
7
|
-
import {AppJitManager} from "../../../services/app-jit-manager";
|
|
8
|
-
import {AppJit} from "../../../models/app-jit";
|
|
9
|
-
|
|
10
|
-
export interface AppItemProps {
|
|
11
|
-
app: AppJit;
|
|
12
|
-
onDeactivate?: (app: AppJit) => void;
|
|
13
|
-
onActivate?: (app: AppJit) => void;
|
|
14
|
-
|
|
15
|
-
onRemove?: (app: AppJit) => void;
|
|
16
|
-
}
|
|
17
|
-
export function AppJitItem(props: AppItemProps) {
|
|
18
|
-
|
|
19
|
-
const [showDeleteModal, setShowDeleteModal] = React.useState(false);
|
|
20
|
-
const [showDeactivateModal, setShowDeactivateModale] = React.useState(false);
|
|
21
|
-
const [showActivateModal, setShowActivateModal] = React.useState(false);
|
|
22
|
-
|
|
23
|
-
const appJitManager = new AppJitManager();
|
|
24
|
-
|
|
25
|
-
const disable = () => {
|
|
26
|
-
appJitManager.setAppEnabled(props.app.scope, props.app.name, false);
|
|
27
|
-
props.onDeactivate?.(props.app);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const enable = () => {
|
|
31
|
-
appJitManager.setAppEnabled(props.app.scope, props.app.name, true);
|
|
32
|
-
props.onActivate?.(props.app);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const uninstall = () => {
|
|
36
|
-
appJitManager.removeAppConfiguration(props.app.scope, props.app.name);
|
|
37
|
-
props.onRemove?.(props.app);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<Group justify='space-between' style={{ border: '1px solid #dedede', padding: 15 }}>
|
|
42
|
-
<Group>
|
|
43
|
-
<IconBug size={48} color={'gray'} />
|
|
44
|
-
<Stack gap={0}>
|
|
45
|
-
<span>{props.app.description} <small>({props.app.version})</small></span>
|
|
46
|
-
<small>{props.app.name} - <b>{props.app.author}</b></small>
|
|
47
|
-
</Stack>
|
|
48
|
-
</Group>
|
|
49
|
-
<Group>
|
|
50
|
-
{props.app.state == AppState.Active ? <Badge color="green">Attivo</Badge> : <Badge color="red">Disattivo</Badge>}
|
|
51
|
-
<Badge color={'gray'}>Route: {props.app.developmentRoute}</Badge>
|
|
52
|
-
<Badge color={props.app.type === AppType.Frontend ? 'orange' : 'violet'}>{props.app.type === AppType.Frontend ? 'Frontend' : 'Backend'}</Badge>
|
|
53
|
-
<Badge color={'gray'}>{moment(props.app.installationDate).format("DD/MM/yyyy")}</Badge>
|
|
54
|
-
<Menu shadow="md" width={200}>
|
|
55
|
-
<Menu.Target>
|
|
56
|
-
<ActionIcon><IconDotsVertical size={18} /></ActionIcon>
|
|
57
|
-
</Menu.Target>
|
|
58
|
-
|
|
59
|
-
<Menu.Dropdown>
|
|
60
|
-
{/*<Menu.Label>Application</Menu.Label>*/}
|
|
61
|
-
<Menu.Item leftSection={<IconCircleOff size={14} />} onClick={props.app.state == AppState.Active ? disable : enable}>
|
|
62
|
-
{props.app.state == AppState.Active ? 'Disattiva' : 'Attiva'}
|
|
63
|
-
</Menu.Item>
|
|
64
|
-
<Menu.Divider />
|
|
65
|
-
<Menu.Item color={'red'} onClick={() => setShowDeleteModal(true)} leftSection={<IconTrash color={'red'} size={14} />}>Disinstalla</Menu.Item>
|
|
66
|
-
</Menu.Dropdown>
|
|
67
|
-
</Menu>
|
|
68
|
-
</Group>
|
|
69
|
-
|
|
70
|
-
<ConfirmModal
|
|
71
|
-
title={'Elimina JIT App'}
|
|
72
|
-
open={showDeleteModal}
|
|
73
|
-
onButtonCancelClick={() => setShowDeleteModal(false)}
|
|
74
|
-
onButtonConfirmClick={() => {
|
|
75
|
-
setShowDeleteModal(false);
|
|
76
|
-
uninstall();
|
|
77
|
-
}}
|
|
78
|
-
messageText={'Sei sicuro di voler disinstallare l\'applicazione?'}
|
|
79
|
-
/>
|
|
80
|
-
|
|
81
|
-
<ConfirmModal
|
|
82
|
-
title={'Attiva App'}
|
|
83
|
-
open={showActivateModal}
|
|
84
|
-
onButtonCancelClick={() => setShowActivateModal(false)}
|
|
85
|
-
onButtonConfirmClick={() => {
|
|
86
|
-
setShowActivateModal(false);
|
|
87
|
-
enable();
|
|
88
|
-
}}
|
|
89
|
-
messageText={'Sei sicuro di voler attivare l\'applicazione?'}
|
|
90
|
-
/>
|
|
91
|
-
|
|
92
|
-
<ConfirmModal
|
|
93
|
-
title={'Disablita App'}
|
|
94
|
-
open={showDeactivateModal}
|
|
95
|
-
onButtonCancelClick={() => setShowDeactivateModale(false)}
|
|
96
|
-
onButtonConfirmClick={() => {
|
|
97
|
-
setShowDeactivateModale(false);
|
|
98
|
-
disable();
|
|
99
|
-
}}
|
|
100
|
-
messageText={'Sei sicuro di voler attivare l\'applicazione?'}
|
|
101
|
-
/>
|
|
102
|
-
|
|
103
|
-
</Group>
|
|
104
|
-
)
|
|
105
|
-
}
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import {IconPlus} from '@tabler/icons-react';
|
|
2
|
-
import {Loader, Modal, Stack} from "@mantine/core";
|
|
3
|
-
import {DataCard, NoData} from "@fluxo-dev/ui-components";
|
|
4
|
-
import React, {useEffect, useState} from "react";
|
|
5
|
-
import {EmbeddedModule, FluxoApp, FluxoClientSys} from "@fluxo-dev/api-client-base";
|
|
6
|
-
import {AppItem} from "./app-item";
|
|
7
|
-
import {InstallOrUpgradeApp} from "./install-or-upgrade-app";
|
|
8
|
-
import {AddJitApp} from "./add-jit-app";
|
|
9
|
-
import {AppJitManager} from "../../../services/app-jit-manager";
|
|
10
|
-
import {AppJit} from "../../../models/app-jit";
|
|
11
|
-
import {AppJitItem} from "./app-jit-item";
|
|
12
|
-
import {EmbeddedModuleItem} from "./embedded-module-item";
|
|
13
|
-
import {reportsModule} from "@fluxo-fe/shell/reporting";
|
|
14
|
-
import {workflowModule} from "@fluxo-fe/shell/workflow";
|
|
15
|
-
import {ShellHub} from "@fluxo-fe/shell/hub";
|
|
16
|
-
|
|
17
|
-
export interface AppsListProps {
|
|
18
|
-
pluginEndpoint: string;
|
|
19
|
-
modules: EmbeddedModule[],
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function AppsList(props: AppsListProps) {
|
|
23
|
-
|
|
24
|
-
const [apps, setApps] = useState<FluxoApp[]>([]);
|
|
25
|
-
const [showInstallComponent, setShowInstallComponent] = useState(false);
|
|
26
|
-
const [showHubModal, setShowHubModal] = useState(false);
|
|
27
|
-
const [showAddJitApp, setShowAddJitApp] = useState(false);
|
|
28
|
-
const [jitApps, setJitApps] = useState<AppJit[]>([]);
|
|
29
|
-
|
|
30
|
-
const [loading, setLoading] = useState(true);
|
|
31
|
-
|
|
32
|
-
const [embeddedModules] = useState([...props.modules, reportsModule, workflowModule]);
|
|
33
|
-
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
refreshApps();
|
|
36
|
-
refreshJitApps();
|
|
37
|
-
}, [])
|
|
38
|
-
|
|
39
|
-
const checkIfEmbeddedModuleIsUpgradable = (scope: string, name: string, currentVersion: string): {state: 'uptodate' | 'upgradable' | 'installable', version: string} => {
|
|
40
|
-
const appFound = apps.find(m => m.scope === scope && m.name === name);
|
|
41
|
-
|
|
42
|
-
if (!appFound) {
|
|
43
|
-
return {state: 'installable', version: currentVersion};
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if(appFound && appFound.version === currentVersion) {
|
|
47
|
-
return {state: 'uptodate', version: currentVersion};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return {state: 'upgradable', version: currentVersion};
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const refreshApps = () => {
|
|
54
|
-
setLoading(true);
|
|
55
|
-
FluxoClientSys.Instance.apps.getApps(false).then((apps) => {
|
|
56
|
-
setApps(apps);
|
|
57
|
-
setLoading(false);
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const refreshJitApps = () => {
|
|
62
|
-
const manager = new AppJitManager();
|
|
63
|
-
setJitApps(manager.loadAppConfigurations());
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return (
|
|
67
|
-
<Stack>
|
|
68
|
-
<DataCard
|
|
69
|
-
title={'Apps installate'}
|
|
70
|
-
actions={[
|
|
71
|
-
{ icon: <IconPlus size={18} />, label: 'Installa app', onClick: () => setShowInstallComponent(true) },
|
|
72
|
-
{ icon: <IconPlus size={18} />, label: 'Aggiungi app', onClick: () => setShowHubModal(true) },
|
|
73
|
-
]}>
|
|
74
|
-
{showInstallComponent &&
|
|
75
|
-
<InstallOrUpgradeApp
|
|
76
|
-
mode={'install'}
|
|
77
|
-
onInstall={() => {
|
|
78
|
-
refreshApps();
|
|
79
|
-
setShowInstallComponent(false);
|
|
80
|
-
}} />
|
|
81
|
-
}
|
|
82
|
-
<Stack gap={16}>
|
|
83
|
-
{(!loading && (!apps || apps.filter(a => !a.isEmbedded).length === 0)) &&
|
|
84
|
-
<NoData message={'Nessuna applicazione installata'} />
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
{loading &&
|
|
88
|
-
<Loader />
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
{!loading && apps.filter(a => !a.isEmbedded).map((app) => (
|
|
92
|
-
<AppItem
|
|
93
|
-
key={app.id}
|
|
94
|
-
app={app}
|
|
95
|
-
onActivate={refreshApps}
|
|
96
|
-
onDeactivate={refreshApps}
|
|
97
|
-
onUninstall={refreshApps}
|
|
98
|
-
onUpgrade={refreshApps}
|
|
99
|
-
pluginEndpoint={props.pluginEndpoint}
|
|
100
|
-
/>
|
|
101
|
-
))}
|
|
102
|
-
</Stack>
|
|
103
|
-
</DataCard>
|
|
104
|
-
|
|
105
|
-
<DataCard
|
|
106
|
-
title={'Apps di sistema'}>
|
|
107
|
-
<Stack gap={16}>
|
|
108
|
-
{embeddedModules.length === 0 &&
|
|
109
|
-
<NoData message={'Nessun modulo di sistema trovato'} />
|
|
110
|
-
}
|
|
111
|
-
{!loading ?
|
|
112
|
-
<>
|
|
113
|
-
{embeddedModules.map((app, i) => (
|
|
114
|
-
<EmbeddedModuleItem
|
|
115
|
-
key={i}
|
|
116
|
-
app={app}
|
|
117
|
-
onUpgrade={refreshApps}
|
|
118
|
-
upgradable={checkIfEmbeddedModuleIsUpgradable(app.scope, app.name, app.version)}
|
|
119
|
-
/>
|
|
120
|
-
))}
|
|
121
|
-
</> :
|
|
122
|
-
<Loader />
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
</Stack>
|
|
126
|
-
</DataCard>
|
|
127
|
-
|
|
128
|
-
<DataCard
|
|
129
|
-
title={'Apps JIT (Sviluppo)'}
|
|
130
|
-
actions={[
|
|
131
|
-
{ icon: <IconPlus size={18} />, label: 'Aggiungi applicazione', onClick: () => setShowAddJitApp(true) },
|
|
132
|
-
]}>
|
|
133
|
-
{!jitApps || jitApps.length === 0 &&
|
|
134
|
-
<NoData message={'Nessuna applicazione JIT'} />
|
|
135
|
-
}
|
|
136
|
-
{!loading && jitApps.map((app) => (
|
|
137
|
-
<AppJitItem key={app.id} onDeactivate={refreshJitApps} onActivate={refreshJitApps} onRemove={refreshJitApps} app={app} />
|
|
138
|
-
))}
|
|
139
|
-
</DataCard>
|
|
140
|
-
|
|
141
|
-
<Modal centered title={'Aggiungi App JIT'} opened={showAddJitApp} onClose={() => setShowAddJitApp(false)}>
|
|
142
|
-
<AddJitApp
|
|
143
|
-
onAdded={() => {
|
|
144
|
-
setShowAddJitApp(false);
|
|
145
|
-
refreshJitApps();
|
|
146
|
-
}}
|
|
147
|
-
onCanceled={() => setShowAddJitApp(false)}
|
|
148
|
-
/>
|
|
149
|
-
</Modal>
|
|
150
|
-
|
|
151
|
-
<Modal
|
|
152
|
-
title={'Fluxo Apps'}
|
|
153
|
-
opened={showHubModal}
|
|
154
|
-
styles={{
|
|
155
|
-
close: {color: 'black'},
|
|
156
|
-
header: {
|
|
157
|
-
background: '#f6f7f9',
|
|
158
|
-
padding: 8,
|
|
159
|
-
marginBottom: 16,
|
|
160
|
-
color: 'black',
|
|
161
|
-
boxShadow: '0px 0px 16px -4px #888'
|
|
162
|
-
},
|
|
163
|
-
content: {background: '#f6f7f9'}
|
|
164
|
-
}}
|
|
165
|
-
fullScreen
|
|
166
|
-
onClose={() => setShowHubModal(false)} size={'xl'} padding={'none'}>
|
|
167
|
-
<ShellHub />
|
|
168
|
-
</Modal>
|
|
169
|
-
</Stack>
|
|
170
|
-
)
|
|
171
|
-
}
|