Skip to content

Commit bcf6f22

Browse files
authored
Merge pull request #715 from nextcloud/parse-fixes
Fix pasting log lines
2 parents 77885a9 + f6df978 commit bcf6f22

File tree

5 files changed

+13
-26
lines changed

5 files changed

+13
-26
lines changed

js/logreader-main.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/logreader-main.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/App.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class App extends Component {
2323
this.logProvider = this.props.logProvider;
2424
this.logProvider.on('entries', entries => {
2525
if (this.state.provider === this.logProvider) {
26-
this.setState({entries});
26+
this.setState({entries, loading: false});
2727
}
2828
});
2929
this.saveRelative = _.debounce(this.logProvider.setRelative, 100);
@@ -62,17 +62,20 @@ export class App extends Component {
6262
async setLevel (level, newState) {
6363
let levels = this.state.levels;
6464
levels[level] = newState;
65-
this.setState({levels});
65+
this.setState({levels, entries: [], loading: true});
6666
await this.logProvider.setLevels(levels);
67-
this.logProvider.reset();
68-
this.logProvider.load();
67+
this.state.provider.reset();
68+
await this.state.provider.load();
69+
this.setState({loading: false});
6970
}
7071

7172
onLogFile = async (content) => {
73+
this.setState({loading: true});
74+
7275
const logFile = new LogFile(content);
7376
logFile.on('entries', entries => {
7477
if (this.state.provider === logFile) {
75-
this.setState({entries});
78+
this.setState({entries, loading: false});
7679
}
7780
});
7881
try {

src/Components/ToggleEntry.js

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,6 @@ export class ToggleEntry extends Component {
66
static idCounter = 0;
77
_id = null;
88

9-
state = {
10-
active: false
11-
};
12-
13-
constructor (props) {
14-
super();
15-
this.state.active = props.active || false;
16-
}
17-
189
getCheckBoxId = ()=> {
1910
if (!this._id) {
2011
this._id = this.props.id || '__checkbox_' + (++ToggleEntry.idCounter);
@@ -24,25 +15,18 @@ export class ToggleEntry extends Component {
2415

2516
onClick = (e) => {
2617
e.preventDefault();
27-
let active = !this.state.active;
28-
this.setState({active});
18+
let active = !this.props.active;
2919
if (this.props.onChange) {
3020
this.props.onChange(active);
3121
}
3222
};
3323

34-
componentWillReceiveProps = (props) => {
35-
if(props.active != this.state.active) {
36-
this.setState({active: props.active});
37-
}
38-
};
39-
4024
render () {
4125
return (
4226
<li className={style.toggleEntry}>
4327
<a className={style['checkbox-holder']} onClick={this.onClick}>
4428
<input id={this.getCheckBoxId()} type="checkbox"
45-
checked={this.state.active}
29+
checked={this.props.active}
4630
className="checkbox"
4731
readOnly/>
4832
<label

webpack/dev.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module.exports = {
77
context: path.resolve(__dirname, '..'),
88
entry: {
99
'logreader-main': [
10-
'./js/index.js'
10+
'./src/index.js'
1111
]
1212
},
1313
output: {

0 commit comments

Comments
 (0)