-
Notifications
You must be signed in to change notification settings - Fork 111
/
Copy pathEnterpriseEditionAgreementDialog.tsx
129 lines (120 loc) · 4.48 KB
/
EnterpriseEditionAgreementDialog.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/*
Copyright (c) 2021-2024 Filigran SAS
This file is part of the OpenBAS Enterprise Edition ("EE") and is
licensed under the OpenBAS Enterprise Edition License (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://github.com/OpenBAS-Platform/openbas/blob/master/LICENSE
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/
import { Alert, Button, TextField } from '@mui/material';
import { useState } from 'react';
import { makeStyles } from 'tss-react/mui';
import { updatePlatformEnterpriseEditionParameters } from '../../../../actions/Application';
import Dialog from '../../../../components/common/Dialog';
import { useFormatter } from '../../../../components/i18n';
import type { SettingsEnterpriseEditionUpdateInput } from '../../../../utils/api-types';
import { useAppDispatch } from '../../../../utils/hooks';
import useEnterpriseEdition from '../../../../utils/hooks/useEnterpriseEdition';
import { isEmptyField } from '../../../../utils/utils';
import EEChip from './EEChip';
const useStyles = makeStyles()(theme => ({
eeDialogContainer: {
display: 'grid',
gap: theme.spacing(2),
},
}));
const EnterpriseEditionAgreementDialog = () => {
const { t } = useFormatter();
const { open, closeDialog, featureDetectedInfo, setFeatureDetectedInfo } = useEnterpriseEdition();
const { classes } = useStyles();
const dispatch = useAppDispatch();
const [enterpriseLicense, setEnterpriseLicense] = useState('');
const onCloseEnterpriseEditionDialog = () => {
closeDialog();
setFeatureDetectedInfo('');
};
const updateEnterpriseEdition = (data: SettingsEnterpriseEditionUpdateInput) => {
dispatch(updatePlatformEnterpriseEditionParameters(data));
onCloseEnterpriseEditionDialog();
};
const enableEnterpriseEdition = () => updateEnterpriseEdition({ platform_enterprise_license: enterpriseLicense });
return (
<Dialog
open={open}
handleClose={onCloseEnterpriseEditionDialog}
title={t('OpenBAS Enterprise Edition (EE) license agreement')}
action={(
<>
<Button onClick={onCloseEnterpriseEditionDialog}>{t('Cancel')}</Button>
<Button
color="secondary"
onClick={enableEnterpriseEdition}
disabled={isEmptyField((enterpriseLicense))}
>
{t('Enable')}
</Button>
</>
)}
>
<div className={classes.eeDialogContainer}>
{!isEmptyField(featureDetectedInfo) && (
<Alert icon={<EEChip />} severity="success">
{`${t('Enterprise Edition feature detected :')} `}
{featureDetectedInfo}
</Alert>
)}
<div>
{t('OpenBAS Enterprise Edition requires a license key to be enabled. Filigran provides a free-to-use license for development and research purposes as well as for charity organizations.')}
<ul>
<li>
{`${t('To obtain a license, please')} `}
<a
href="https://filigran.io/contact/"
target="_blank"
rel="noreferrer"
>
{t('reach out to the Filigran team')}
</a>
</li>
<li>
{`${t('You just need to try? Get right now')} `}
<a
href="https://filigran.io/enterprise-editions-trial/"
target="_blank"
rel="noreferrer"
>
{t('your trial license online')}
</a>
</li>
</ul>
</div>
<div>
{t('Paste your Filigran OpenBAS Enterprise Edition license')}
<TextField
onChange={event => setEnterpriseLicense(event.target.value)}
multiline={true}
fullWidth={true}
minRows={5}
variant="outlined"
/>
</div>
<div>
{t('By enabling the OpenBAS Enterprise Edition, you (and your organization) agrees')}
<a
href="https://github.com/OpenBAS-Platform/openbas/blob/master/LICENSE"
target="_blank"
rel="noreferrer"
>
{t('OpenBAS EE license terms and conditions of usage')}
</a>
.
</div>
</div>
</Dialog>
);
};
export default EnterpriseEditionAgreementDialog;