mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2025-05-03 06:22:56 +03:00
parent
c2aa39efe5
commit
df12038f33
2 changed files with 28 additions and 12 deletions
client/src/components/Logs
|
@ -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>);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue