blob: 641a6a870c5ba88dec1722d86d0d309679d48d2e (
plain)
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
|
import React from 'react';
import { setLogLevel } from '../../api/system';
const LOG_LEVELS = ['INFO', 'DEBUG', 'TRACE'];
export default React.createClass({
getInitialState () {
return { level: this.props.value };
},
onChange() {
let newValue = this.refs.select.value;
setLogLevel(newValue).then(() => {
this.setState({ level: newValue });
});
},
render() {
let options = LOG_LEVELS.map(level => {
return <option key={level} value={level}>{level}</option>;
});
let warning = this.state.level !== 'INFO' ? (
<div className="alert alert-danger spacer-top" style={{ wordBreak: 'normal' }}>
{window.t('system.log_level.warning')}
</div>
) : null;
return <div>
<select ref="select"
onChange={this.onChange}
value={this.state.level}>{options}</select>
{warning}
</div>;
}
});
|