Add refresh button to querylog page

Closes 
This commit is contained in:
Ildar Kamalov 2018-09-17 17:44:32 +03:00
parent c2aa39efe5
commit df12038f33
2 changed files with 28 additions and 12 deletions
client/src/components/Logs

View file

@ -12,10 +12,7 @@ const DOWNLOAD_LOG_FILENAME = 'dns-logs.txt';
class Logs extends Component {
componentDidMount() {
// get logs on initialization if queryLogIsEnabled
if (this.props.dashboard.queryLogEnabled) {
this.props.getLogs();
}
this.getLogs();
}
componentDidUpdate(prevProps) {
@ -25,6 +22,13 @@ class Logs extends Component {
}
}
getLogs = () => {
// get logs on initialization if queryLogIsEnabled
if (this.props.dashboard.queryLogEnabled) {
this.props.getLogs();
}
}
renderTooltip(isFiltered, rule) {
if (rule) {
return (isFiltered && <Tooltip text={rule}/>);
@ -144,11 +148,19 @@ class Logs extends Component {
onClick={() => this.props.toggleLogStatus(queryLogEnabled)}
>{queryLogEnabled ? 'Disable log' : 'Enable log'}</button>
{queryLogEnabled &&
<button
className="btn btn-primary btn-standart"
type="submit"
onClick={this.handleDownloadButton}
>Download log file</button> }
<button
className="btn btn-primary btn-standart mr-2"
type="submit"
onClick={this.handleDownloadButton}
>Download log file</button>
}
{queryLogEnabled &&
<button
className="btn btn-outline-primary btn-standart"
type="submit"
onClick={this.getLogs}
>Refresh</button>
}
</div>);
}