@iobroker/json-config 6.17.12 → 6.17.14
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/package.json +27 -27
- package/src/JsonConfig.tsx +0 -710
- package/src/JsonConfigComponent/ChipInput.tsx +0 -752
- package/src/JsonConfigComponent/ConfigAccordion.tsx +0 -278
- package/src/JsonConfigComponent/ConfigAlive.tsx +0 -74
- package/src/JsonConfigComponent/ConfigAutocomplete.tsx +0 -108
- package/src/JsonConfigComponent/ConfigAutocompleteSendTo.tsx +0 -183
- package/src/JsonConfigComponent/ConfigCRON.jsx +0 -101
- package/src/JsonConfigComponent/ConfigCertCollection.tsx +0 -102
- package/src/JsonConfigComponent/ConfigCertificateSelect.tsx +0 -92
- package/src/JsonConfigComponent/ConfigCertificates.tsx +0 -202
- package/src/JsonConfigComponent/ConfigCheckLicense.jsx +0 -662
- package/src/JsonConfigComponent/ConfigCheckbox.tsx +0 -67
- package/src/JsonConfigComponent/ConfigChip.jsx +0 -81
- package/src/JsonConfigComponent/ConfigColor.tsx +0 -86
- package/src/JsonConfigComponent/ConfigCoordinates.tsx +0 -234
- package/src/JsonConfigComponent/ConfigCustom.tsx +0 -246
- package/src/JsonConfigComponent/ConfigDatePicker.tsx +0 -48
- package/src/JsonConfigComponent/ConfigDeviceManager.tsx +0 -33
- package/src/JsonConfigComponent/ConfigFile.jsx +0 -181
- package/src/JsonConfigComponent/ConfigFileSelector.jsx +0 -520
- package/src/JsonConfigComponent/ConfigFunc.jsx +0 -90
- package/src/JsonConfigComponent/ConfigGeneric.tsx +0 -1027
- package/src/JsonConfigComponent/ConfigIP.jsx +0 -96
- package/src/JsonConfigComponent/ConfigImageSendTo.jsx +0 -79
- package/src/JsonConfigComponent/ConfigImageUpload.jsx +0 -114
- package/src/JsonConfigComponent/ConfigInstanceSelect.jsx +0 -172
- package/src/JsonConfigComponent/ConfigInterface.jsx +0 -112
- package/src/JsonConfigComponent/ConfigJsonEditor.jsx +0 -103
- package/src/JsonConfigComponent/ConfigLanguage.tsx +0 -153
- package/src/JsonConfigComponent/ConfigLicense.jsx +0 -148
- package/src/JsonConfigComponent/ConfigNumber.tsx +0 -207
- package/src/JsonConfigComponent/ConfigObjectId.jsx +0 -113
- package/src/JsonConfigComponent/ConfigPanel.tsx +0 -360
- package/src/JsonConfigComponent/ConfigPassword.jsx +0 -160
- package/src/JsonConfigComponent/ConfigPattern.jsx +0 -50
- package/src/JsonConfigComponent/ConfigPort.tsx +0 -232
- package/src/JsonConfigComponent/ConfigRoom.jsx +0 -90
- package/src/JsonConfigComponent/ConfigSelect.jsx +0 -124
- package/src/JsonConfigComponent/ConfigSelectSendTo.tsx +0 -251
- package/src/JsonConfigComponent/ConfigSendto.tsx +0 -340
- package/src/JsonConfigComponent/ConfigSetState.jsx +0 -116
- package/src/JsonConfigComponent/ConfigSlider.jsx +0 -97
- package/src/JsonConfigComponent/ConfigStaticDivider.jsx +0 -51
- package/src/JsonConfigComponent/ConfigStaticHeader.jsx +0 -63
- package/src/JsonConfigComponent/ConfigStaticImage.jsx +0 -48
- package/src/JsonConfigComponent/ConfigStaticText.jsx +0 -72
- package/src/JsonConfigComponent/ConfigTable.tsx +0 -1040
- package/src/JsonConfigComponent/ConfigTabs.tsx +0 -150
- package/src/JsonConfigComponent/ConfigText.tsx +0 -188
- package/src/JsonConfigComponent/ConfigTextSendTo.tsx +0 -102
- package/src/JsonConfigComponent/ConfigTimePicker.tsx +0 -63
- package/src/JsonConfigComponent/ConfigTopic.jsx +0 -78
- package/src/JsonConfigComponent/ConfigUUID.tsx +0 -55
- package/src/JsonConfigComponent/ConfigUser.jsx +0 -104
- package/src/JsonConfigComponent/index.tsx +0 -435
- package/src/JsonConfigComponent/wrapper/Components/CustomModal.jsx +0 -145
- package/src/JsonConfigComponent/wrapper/Components/Editor.jsx +0 -65
- package/src/Utils.jsx +0 -1683
- package/src/index.tsx +0 -14
- package/src/types.d.ts +0 -372
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { withStyles } from '@mui/styles';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
InputLabel,
|
|
7
|
-
FormControl,
|
|
8
|
-
Button,
|
|
9
|
-
TextField,
|
|
10
|
-
} from '@mui/material';
|
|
11
|
-
|
|
12
|
-
import { Cron as DialogCron, I18n } from '@iobroker/adapter-react-v5';
|
|
13
|
-
|
|
14
|
-
import ConfigGeneric from './ConfigGeneric';
|
|
15
|
-
|
|
16
|
-
const styles = () => ({
|
|
17
|
-
fullWidth: {
|
|
18
|
-
width: '100%',
|
|
19
|
-
},
|
|
20
|
-
flex: {
|
|
21
|
-
display: 'flex',
|
|
22
|
-
},
|
|
23
|
-
button: {
|
|
24
|
-
height: 48,
|
|
25
|
-
marginLeft: 4,
|
|
26
|
-
minWidth: 48,
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
class ConfigCRON extends ConfigGeneric {
|
|
31
|
-
async componentDidMount() {
|
|
32
|
-
super.componentDidMount();
|
|
33
|
-
const { data, attr } = this.props;
|
|
34
|
-
const value = ConfigGeneric.getValue(data, attr) || '';
|
|
35
|
-
this.setState({ value, showDialog: false });
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
renderItem(error, disabled /* , defaultValue */) {
|
|
39
|
-
const { classes, schema, attr } = this.props;
|
|
40
|
-
const { value, showDialog } = this.state;
|
|
41
|
-
|
|
42
|
-
return (
|
|
43
|
-
<FormControl className={classes.fullWidth} variant="standard">
|
|
44
|
-
{schema.label ? <InputLabel shrink>{this.getText(schema.label)}</InputLabel> : null}
|
|
45
|
-
<div className={classes.flex}>
|
|
46
|
-
<TextField
|
|
47
|
-
variant="standard"
|
|
48
|
-
fullWidth
|
|
49
|
-
value={value ?? ''}
|
|
50
|
-
error={!!error}
|
|
51
|
-
disabled={disabled}
|
|
52
|
-
placeholder={this.getText(schema.placeholder)}
|
|
53
|
-
label={this.getText(schema.label)}
|
|
54
|
-
helperText={this.renderHelp(schema.help, schema.helpLink, schema.noTranslation)}
|
|
55
|
-
onChange={e => {
|
|
56
|
-
const value_ = e.target.value;
|
|
57
|
-
this.setState({ value: value_ }, () => this.onChange(attr, value_));
|
|
58
|
-
}}
|
|
59
|
-
/>
|
|
60
|
-
<Button
|
|
61
|
-
color="grey"
|
|
62
|
-
className={this.props.classes.button}
|
|
63
|
-
size="small"
|
|
64
|
-
variant="outlined"
|
|
65
|
-
onClick={() => this.setState({ showDialog: true })}
|
|
66
|
-
>
|
|
67
|
-
...
|
|
68
|
-
</Button>
|
|
69
|
-
</div>
|
|
70
|
-
{showDialog ? (
|
|
71
|
-
<DialogCron
|
|
72
|
-
title={I18n.t('ra_Define schedule')}
|
|
73
|
-
simple={schema.simple}
|
|
74
|
-
complex={schema.complex}
|
|
75
|
-
cron={value}
|
|
76
|
-
language={I18n.getLanguage()}
|
|
77
|
-
onClose={() => this.setState({ showDialog: false })}
|
|
78
|
-
cancel={I18n.t('ra_Cancel')}
|
|
79
|
-
ok={I18n.t('ra_Ok')}
|
|
80
|
-
onOk={value_ => this.setState({ showDialog: false, value: value_ }, () => this.onChange(attr, value_))}
|
|
81
|
-
/>
|
|
82
|
-
) : null}
|
|
83
|
-
</FormControl>
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
ConfigCRON.propTypes = {
|
|
89
|
-
themeType: PropTypes.string,
|
|
90
|
-
themeName: PropTypes.string,
|
|
91
|
-
style: PropTypes.object,
|
|
92
|
-
className: PropTypes.string,
|
|
93
|
-
data: PropTypes.object.isRequired,
|
|
94
|
-
schema: PropTypes.object,
|
|
95
|
-
onError: PropTypes.func,
|
|
96
|
-
onChange: PropTypes.func,
|
|
97
|
-
dateFormat: PropTypes.string,
|
|
98
|
-
isFloatComma: PropTypes.bool,
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
export default withStyles(styles)(ConfigCRON);
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { withStyles } from '@mui/styles';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
InputLabel,
|
|
7
|
-
MenuItem,
|
|
8
|
-
FormControl,
|
|
9
|
-
Select,
|
|
10
|
-
FormHelperText,
|
|
11
|
-
} from '@mui/material';
|
|
12
|
-
|
|
13
|
-
import { I18n } from '@iobroker/adapter-react-v5';
|
|
14
|
-
import type { ConfigItemCertCollection } from '#JC/types';
|
|
15
|
-
import ConfigGeneric, {type ConfigGenericProps, type ConfigGenericState} from './ConfigGeneric';
|
|
16
|
-
|
|
17
|
-
const styles: Record<string, any> = {
|
|
18
|
-
fullWidth: {
|
|
19
|
-
width: '100%',
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
interface ConfigCertCollectionProps extends ConfigGenericProps {
|
|
24
|
-
schema: ConfigItemCertCollection;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
interface ConfigCertCollectionState extends ConfigGenericState {
|
|
28
|
-
collectionsOptions?: string[];
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
interface CertCollection {
|
|
32
|
-
/** Source of the certificate */
|
|
33
|
-
from: string;
|
|
34
|
-
key: string;
|
|
35
|
-
cert: string;
|
|
36
|
-
chain: string[],
|
|
37
|
-
domains: string[],
|
|
38
|
-
staging?: boolean,
|
|
39
|
-
tsExpires?: number;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
class ConfigCertCollection extends ConfigGeneric<ConfigCertCollectionProps, ConfigCertCollectionState> {
|
|
43
|
-
async componentDidMount() {
|
|
44
|
-
super.componentDidMount();
|
|
45
|
-
|
|
46
|
-
let collectionsOptions: string[];
|
|
47
|
-
const collectionsOptionsObj = await this.props.socket.getObject('system.certificates');
|
|
48
|
-
if (collectionsOptionsObj?.native?.collections) {
|
|
49
|
-
collectionsOptions = Object.keys(collectionsOptionsObj.native.collections as Record<string, CertCollection>);
|
|
50
|
-
} else {
|
|
51
|
-
collectionsOptions = [];
|
|
52
|
-
}
|
|
53
|
-
this.setState({ collectionsOptions });
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
renderItem(error: unknown, disabled: boolean /* , defaultValue */) {
|
|
57
|
-
if (!this.state.collectionsOptions) {
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
const leCollection = (ConfigGeneric.getValue(this.props.data, this.props.schema.leCollectionName || 'leCollection') || 'false').toString();
|
|
61
|
-
|
|
62
|
-
return <FormControl className={this.props.classes.fullWidth} variant="standard">
|
|
63
|
-
{this.props.schema.label ? <InputLabel shrink>{this.getText(this.props.schema.label)}</InputLabel> : null}
|
|
64
|
-
<Select
|
|
65
|
-
variant="standard"
|
|
66
|
-
error={!!error}
|
|
67
|
-
displayEmpty
|
|
68
|
-
disabled={!!disabled}
|
|
69
|
-
value={leCollection}
|
|
70
|
-
onChange={e => this.onChange(
|
|
71
|
-
this.props.schema.leCollectionName || 'leCollection',
|
|
72
|
-
e.target.value === 'false' ? false : (e.target.value === 'true' ? true : e.target.value),
|
|
73
|
-
)}
|
|
74
|
-
>
|
|
75
|
-
<MenuItem
|
|
76
|
-
key="_false"
|
|
77
|
-
value="false"
|
|
78
|
-
style={{ fontWeight: 'bold' }}
|
|
79
|
-
>
|
|
80
|
-
{I18n.t('ra_Do not use let\'s encrypt')}
|
|
81
|
-
</MenuItem>
|
|
82
|
-
<MenuItem
|
|
83
|
-
key="_true"
|
|
84
|
-
value="true"
|
|
85
|
-
style={{ fontWeight: 'bold' }}
|
|
86
|
-
>
|
|
87
|
-
{I18n.t('ra_Use all available let\'s encrypt certificates')}
|
|
88
|
-
</MenuItem>
|
|
89
|
-
{this.state.collectionsOptions?.map(item =>
|
|
90
|
-
<MenuItem
|
|
91
|
-
key={item}
|
|
92
|
-
value={item}
|
|
93
|
-
>
|
|
94
|
-
{item}
|
|
95
|
-
</MenuItem>)}
|
|
96
|
-
</Select>
|
|
97
|
-
{this.props.schema.help ? <FormHelperText>{this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation)}</FormHelperText> : null}
|
|
98
|
-
</FormControl>;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export default withStyles(styles)(ConfigCertCollection);
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { withStyles } from '@mui/styles';
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
InputLabel,
|
|
6
|
-
MenuItem,
|
|
7
|
-
FormControl,
|
|
8
|
-
Select,
|
|
9
|
-
FormHelperText,
|
|
10
|
-
} from '@mui/material';
|
|
11
|
-
|
|
12
|
-
import { I18n } from '@iobroker/adapter-react-v5';
|
|
13
|
-
import type { ConfigItemCertificateSelect } from '#JC/types';
|
|
14
|
-
import ConfigGeneric, {type ConfigGenericProps, type ConfigGenericState} from './ConfigGeneric';
|
|
15
|
-
|
|
16
|
-
const styles: Record<string, any> = {
|
|
17
|
-
fullWidth: {
|
|
18
|
-
width: '100%',
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
interface ConfigCertificateSelectProps extends ConfigGenericProps {
|
|
23
|
-
schema: ConfigItemCertificateSelect;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
interface ConfigCertificateSelectState extends ConfigGenericState {
|
|
27
|
-
selectOptions?: { label: string; value: string }[];
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
class ConfigCertificateSelect extends ConfigGeneric<ConfigCertificateSelectProps, ConfigCertificateSelectState> {
|
|
31
|
-
async componentDidMount() {
|
|
32
|
-
super.componentDidMount();
|
|
33
|
-
const value = ConfigGeneric.getValue(this.props.data, this.props.attr);
|
|
34
|
-
const certificates = await this.props.socket.getCertificates();
|
|
35
|
-
|
|
36
|
-
const selectOptions: { label: string; value: string }[] = certificates
|
|
37
|
-
.filter(el => {
|
|
38
|
-
const name = this.props.attr.toLowerCase();
|
|
39
|
-
|
|
40
|
-
if (name.includes(el.type)) {
|
|
41
|
-
return true;
|
|
42
|
-
}
|
|
43
|
-
if (el.type === 'public' && name.includes('cert')) {
|
|
44
|
-
return true;
|
|
45
|
-
}
|
|
46
|
-
if (el.type === 'private' && (name.includes('priv') || name.includes('key'))) {
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
return !!(el.type === 'chained' && (name.includes('chain') || name.includes('ca')));
|
|
50
|
-
})
|
|
51
|
-
.map(el => ({ label: el.name, value: el.name }));
|
|
52
|
-
|
|
53
|
-
selectOptions.unshift({ label: I18n.t(ConfigGeneric.NONE_LABEL), value: ConfigGeneric.NONE_VALUE });
|
|
54
|
-
|
|
55
|
-
this.setState({ value, selectOptions });
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
renderItem(error: unknown, disabled: boolean /* , defaultValue */) {
|
|
59
|
-
if (!this.state.selectOptions) {
|
|
60
|
-
return null;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const item = this.state.selectOptions?.find(item => item.value === this.state.value);
|
|
64
|
-
|
|
65
|
-
return <FormControl className={this.props.classes.fullWidth} variant="standard">
|
|
66
|
-
{this.props.schema.label ? <InputLabel shrink>{this.getText(this.props.schema.label)}</InputLabel> : null}
|
|
67
|
-
<Select
|
|
68
|
-
variant="standard"
|
|
69
|
-
error={!!error}
|
|
70
|
-
displayEmpty
|
|
71
|
-
disabled={!!disabled}
|
|
72
|
-
value={this.state.value}
|
|
73
|
-
renderValue={() => this.getText(item?.label, this.props.schema.noTranslation !== false)}
|
|
74
|
-
onChange={e =>
|
|
75
|
-
this.setState({ value: e.target.value }, () =>
|
|
76
|
-
this.onChange(this.props.attr, this.state.value))}
|
|
77
|
-
>
|
|
78
|
-
{this.state.selectOptions?.map(item_ =>
|
|
79
|
-
<MenuItem
|
|
80
|
-
key={item_.value}
|
|
81
|
-
value={item_.value}
|
|
82
|
-
style={item_.value === ConfigGeneric.NONE_VALUE ? { opacity: 0.5 } : {}}
|
|
83
|
-
>
|
|
84
|
-
{this.getText(item_.label, this.props.schema.noTranslation !== false)}
|
|
85
|
-
</MenuItem>)}
|
|
86
|
-
</Select>
|
|
87
|
-
{this.props.schema.help ? <FormHelperText>{this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation)}</FormHelperText> : null}
|
|
88
|
-
</FormControl>;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export default withStyles(styles)(ConfigCertificateSelect);
|
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { withStyles } from '@mui/styles';
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
InputLabel,
|
|
6
|
-
MenuItem,
|
|
7
|
-
FormControl,
|
|
8
|
-
Select,
|
|
9
|
-
} from '@mui/material';
|
|
10
|
-
|
|
11
|
-
import { I18n } from '@iobroker/adapter-react-v5';
|
|
12
|
-
import type { ConfigItemCertificates } from '#JC/types';
|
|
13
|
-
import ConfigGeneric, {type ConfigGenericProps, type ConfigGenericState} from './ConfigGeneric';
|
|
14
|
-
|
|
15
|
-
const styles: Record<string, any> = {
|
|
16
|
-
fullWidth: {
|
|
17
|
-
width: '100%',
|
|
18
|
-
},
|
|
19
|
-
leWidth: {
|
|
20
|
-
width: 620,
|
|
21
|
-
marginBottom: 10,
|
|
22
|
-
},
|
|
23
|
-
certWidth: {
|
|
24
|
-
width: 200,
|
|
25
|
-
marginRight: 10,
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
interface ConfigCertificatesProps extends ConfigGenericProps {
|
|
30
|
-
schema: ConfigItemCertificates;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
interface ConfigCertificatesState extends ConfigGenericState {
|
|
34
|
-
certsPublicOptions?: { label: string; value: string }[];
|
|
35
|
-
certsChainOptions?: { label: string; value: string }[];
|
|
36
|
-
certsPrivateOptions?: { label: string; value: string }[];
|
|
37
|
-
collectionsOptions?: string[];
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
class ConfigCertificates extends ConfigGeneric<ConfigCertificatesProps, ConfigCertificatesState> {
|
|
41
|
-
async componentDidMount() {
|
|
42
|
-
super.componentDidMount();
|
|
43
|
-
const certificates = await this.props.socket.getCertificates();
|
|
44
|
-
const certsPublicOptions: { label: string; value: string }[] = [];
|
|
45
|
-
const certsPrivateOptions: { label: string; value: string }[] = [];
|
|
46
|
-
const certsChainOptions: { label: string; value: string }[] = [];
|
|
47
|
-
|
|
48
|
-
let collectionsOptions: string[] | null = [];
|
|
49
|
-
const collectionsOptionsObj = await this.props.socket.getObject('system.certificates');
|
|
50
|
-
if (collectionsOptionsObj?.native?.collections) {
|
|
51
|
-
collectionsOptions = Object.keys(collectionsOptionsObj.native.collections);
|
|
52
|
-
} else {
|
|
53
|
-
collectionsOptions = null;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
certificates
|
|
57
|
-
.forEach(el => {
|
|
58
|
-
if (el.type === 'public') {
|
|
59
|
-
certsPublicOptions.push({ label: el.name, value: el.name });
|
|
60
|
-
} else if (el.type === 'private') {
|
|
61
|
-
certsPrivateOptions.push({ label: el.name, value: el.name });
|
|
62
|
-
} else if (el.type === 'chained') {
|
|
63
|
-
certsChainOptions.push({ label: el.name, value: el.name });
|
|
64
|
-
} else {
|
|
65
|
-
certsPublicOptions.push({ label: el.name, value: el.name });
|
|
66
|
-
certsPrivateOptions.push({ label: el.name, value: el.name });
|
|
67
|
-
certsChainOptions.push({ label: el.name, value: el.name });
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
certsPublicOptions.unshift({ label: I18n.t(ConfigGeneric.NONE_LABEL), value: ConfigGeneric.NONE_VALUE });
|
|
72
|
-
certsPrivateOptions.unshift({ label: I18n.t(ConfigGeneric.NONE_LABEL), value: ConfigGeneric.NONE_VALUE });
|
|
73
|
-
certsChainOptions.unshift({ label: I18n.t(ConfigGeneric.NONE_LABEL), value: ConfigGeneric.NONE_VALUE });
|
|
74
|
-
|
|
75
|
-
this.setState({
|
|
76
|
-
certsPublicOptions,
|
|
77
|
-
certsChainOptions,
|
|
78
|
-
certsPrivateOptions,
|
|
79
|
-
collectionsOptions,
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
renderItem(error: unknown, disabled: boolean /* , defaultValue */) {
|
|
84
|
-
if (!this.state.certsPublicOptions || !this.state.certsPrivateOptions || !this.state.certsChainOptions) {
|
|
85
|
-
return null;
|
|
86
|
-
}
|
|
87
|
-
const leCollection = (ConfigGeneric.getValue(this.props.data, this.props.schema.leCollectionName || 'leCollection') || 'false').toString();
|
|
88
|
-
const certPublic = ConfigGeneric.getValue(this.props.data, this.props.schema.certPublicName || 'certPublic');
|
|
89
|
-
const certPrivate = ConfigGeneric.getValue(this.props.data, this.props.schema.certPrivateName || 'certPrivate');
|
|
90
|
-
const certChained = ConfigGeneric.getValue(this.props.data, this.props.schema.certChainedName || 'certChained');
|
|
91
|
-
|
|
92
|
-
const itemCertPublic = this.state.certsPublicOptions?.find(item => item.value === certPublic);
|
|
93
|
-
const itemCertPrivate = this.state.certsPrivateOptions?.find(item => item.value === certPrivate);
|
|
94
|
-
const itemCertChained = this.state.certsChainOptions?.find(item => item.value === certChained);
|
|
95
|
-
|
|
96
|
-
return <div className={this.props.classes.fullWidth}>
|
|
97
|
-
{this.state.collectionsOptions ? <FormControl className={this.props.classes.leWidth} variant="standard">
|
|
98
|
-
<InputLabel shrink>Let's encrypt</InputLabel>
|
|
99
|
-
<Select
|
|
100
|
-
variant="standard"
|
|
101
|
-
error={!!error}
|
|
102
|
-
displayEmpty
|
|
103
|
-
disabled={!!disabled}
|
|
104
|
-
value={leCollection}
|
|
105
|
-
onChange={e => this.onChange(
|
|
106
|
-
this.props.schema.leCollectionName || 'leCollection',
|
|
107
|
-
e.target.value === 'false' ? false : (e.target.value === 'true' ? true : e.target.value),
|
|
108
|
-
)}
|
|
109
|
-
>
|
|
110
|
-
<MenuItem
|
|
111
|
-
key="_false"
|
|
112
|
-
value="false"
|
|
113
|
-
style={{ fontWeight: 'bold' }}
|
|
114
|
-
>
|
|
115
|
-
{I18n.t('ra_Do not use let\'s encrypt')}
|
|
116
|
-
</MenuItem>
|
|
117
|
-
<MenuItem
|
|
118
|
-
key="_true"
|
|
119
|
-
value="true"
|
|
120
|
-
style={{ fontWeight: 'bold' }}
|
|
121
|
-
>
|
|
122
|
-
{I18n.t('ra_Use all available let\'s encrypt certificates')}
|
|
123
|
-
</MenuItem>
|
|
124
|
-
{this.state.collectionsOptions?.map(item =>
|
|
125
|
-
<MenuItem
|
|
126
|
-
key={item}
|
|
127
|
-
value={item}
|
|
128
|
-
>
|
|
129
|
-
{item}
|
|
130
|
-
</MenuItem>)}
|
|
131
|
-
</Select>
|
|
132
|
-
</FormControl> : null}
|
|
133
|
-
{this.state.collectionsOptions ? <br /> : null}
|
|
134
|
-
{this.state.collectionsOptions && leCollection !== 'false' ? <div>{I18n.t('ra_Fallback custom certificates')}</div> : null}
|
|
135
|
-
<FormControl className={this.props.classes.certWidth} variant="standard">
|
|
136
|
-
<InputLabel shrink>{I18n.t('ra_Public certificate')}</InputLabel>
|
|
137
|
-
<Select
|
|
138
|
-
variant="standard"
|
|
139
|
-
error={!!error}
|
|
140
|
-
displayEmpty
|
|
141
|
-
disabled={!!disabled}
|
|
142
|
-
value={certPublic || ''}
|
|
143
|
-
renderValue={() => this.getText(itemCertPublic?.label)}
|
|
144
|
-
onChange={e => this.onChange(this.props.schema.certPublicName || 'certPublic', e.target.value)}
|
|
145
|
-
>
|
|
146
|
-
{this.state.certsPublicOptions?.map((item, i) =>
|
|
147
|
-
<MenuItem
|
|
148
|
-
key={`${item.value}_${i}`}
|
|
149
|
-
value={item.value}
|
|
150
|
-
style={item.value === ConfigGeneric.NONE_VALUE ? { opacity: 0.5 } : {}}
|
|
151
|
-
>
|
|
152
|
-
{this.getText(item.label)}
|
|
153
|
-
</MenuItem>)}
|
|
154
|
-
</Select>
|
|
155
|
-
</FormControl>
|
|
156
|
-
<FormControl className={this.props.classes.certWidth} variant="standard">
|
|
157
|
-
<InputLabel shrink>{I18n.t('ra_Private certificate')}</InputLabel>
|
|
158
|
-
<Select
|
|
159
|
-
variant="standard"
|
|
160
|
-
error={!!error}
|
|
161
|
-
displayEmpty
|
|
162
|
-
disabled={!!disabled}
|
|
163
|
-
value={certPrivate || ''}
|
|
164
|
-
renderValue={() => this.getText(itemCertPrivate?.label)}
|
|
165
|
-
onChange={e => this.onChange(this.props.schema.certPrivateName || 'certPrivate', e.target.value)}
|
|
166
|
-
>
|
|
167
|
-
{this.state.certsPrivateOptions?.map((item, i) =>
|
|
168
|
-
<MenuItem
|
|
169
|
-
key={`${item.value}_${i}`}
|
|
170
|
-
value={item.value}
|
|
171
|
-
style={item.value === ConfigGeneric.NONE_VALUE ? { opacity: 0.5 } : {}}
|
|
172
|
-
>
|
|
173
|
-
{this.getText(item.label)}
|
|
174
|
-
</MenuItem>)}
|
|
175
|
-
</Select>
|
|
176
|
-
</FormControl>
|
|
177
|
-
<FormControl className={this.props.classes.certWidth} variant="standard">
|
|
178
|
-
<InputLabel shrink>{I18n.t('ra_Chained certificate')}</InputLabel>
|
|
179
|
-
<Select
|
|
180
|
-
variant="standard"
|
|
181
|
-
error={!!error}
|
|
182
|
-
displayEmpty
|
|
183
|
-
disabled={!!disabled}
|
|
184
|
-
value={certChained || ''}
|
|
185
|
-
renderValue={() => this.getText(itemCertChained?.label)}
|
|
186
|
-
onChange={e => this.onChange(this.props.schema.certChainedName || 'certChained', e.target.value)}
|
|
187
|
-
>
|
|
188
|
-
{this.state.certsChainOptions?.map((item, i) =>
|
|
189
|
-
<MenuItem
|
|
190
|
-
key={`${item.value}_${i}`}
|
|
191
|
-
value={item.value}
|
|
192
|
-
style={item.value === ConfigGeneric.NONE_VALUE ? { opacity: 0.5 } : {}}
|
|
193
|
-
>
|
|
194
|
-
{this.getText(item.label)}
|
|
195
|
-
</MenuItem>)}
|
|
196
|
-
</Select>
|
|
197
|
-
</FormControl>
|
|
198
|
-
</div>;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
export default withStyles(styles)(ConfigCertificates);
|