Skip to content

Commit

Permalink
Merge pull request #715 from nextcloud/parse-fixes
Browse files Browse the repository at this point in the history
Fix pasting log lines
  • Loading branch information
icewind1991 authored May 11, 2022
2 parents 77885a9 + f6df978 commit bcf6f22
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 26 deletions.
2 changes: 1 addition & 1 deletion js/logreader-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/logreader-main.js.map

Large diffs are not rendered by default.

13 changes: 8 additions & 5 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class App extends Component {
this.logProvider = this.props.logProvider;
this.logProvider.on('entries', entries => {
if (this.state.provider === this.logProvider) {
this.setState({entries});
this.setState({entries, loading: false});
}
});
this.saveRelative = _.debounce(this.logProvider.setRelative, 100);
Expand Down Expand Up @@ -62,17 +62,20 @@ export class App extends Component {
async setLevel (level, newState) {
let levels = this.state.levels;
levels[level] = newState;
this.setState({levels});
this.setState({levels, entries: [], loading: true});
await this.logProvider.setLevels(levels);
this.logProvider.reset();
this.logProvider.load();
this.state.provider.reset();
await this.state.provider.load();
this.setState({loading: false});
}

onLogFile = async (content) => {
this.setState({loading: true});

const logFile = new LogFile(content);
logFile.on('entries', entries => {
if (this.state.provider === logFile) {
this.setState({entries});
this.setState({entries, loading: false});
}
});
try {
Expand Down
20 changes: 2 additions & 18 deletions src/Components/ToggleEntry.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,6 @@ export class ToggleEntry extends Component {
static idCounter = 0;
_id = null;

state = {
active: false
};

constructor (props) {
super();
this.state.active = props.active || false;
}

getCheckBoxId = ()=> {
if (!this._id) {
this._id = this.props.id || '__checkbox_' + (++ToggleEntry.idCounter);
Expand All @@ -24,25 +15,18 @@ export class ToggleEntry extends Component {

onClick = (e) => {
e.preventDefault();
let active = !this.state.active;
this.setState({active});
let active = !this.props.active;
if (this.props.onChange) {
this.props.onChange(active);
}
};

componentWillReceiveProps = (props) => {
if(props.active != this.state.active) {
this.setState({active: props.active});
}
};

render () {
return (
<li className={style.toggleEntry}>
<a className={style['checkbox-holder']} onClick={this.onClick}>
<input id={this.getCheckBoxId()} type="checkbox"
checked={this.state.active}
checked={this.props.active}
className="checkbox"
readOnly/>
<label
Expand Down
2 changes: 1 addition & 1 deletion webpack/dev.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = {
context: path.resolve(__dirname, '..'),
entry: {
'logreader-main': [
'./js/index.js'
'./src/index.js'
]
},
output: {
Expand Down

0 comments on commit bcf6f22

Please sign in to comment.