dashboard: CPU graph selection consistency

This commit is contained in:
Stephan de Wit 2024-08-16 09:04:56 +02:00
parent 2cd07c3273
commit f8b0c49b9a
3 changed files with 6 additions and 5 deletions

View File

@ -665,7 +665,7 @@ class WidgetManager {
buttons: [{
label: this.gettext.ok,
hotkey: 13,
action: (dialog) => {
action: async (dialog) => {
let values = {};
for (const [key, value] of Object.entries(options)) {
switch (value.type) {
@ -681,7 +681,7 @@ class WidgetManager {
}
widget.setWidgetConfig(values);
widget.onWidgetOptionsChanged(values);
await widget.onWidgetOptionsChanged(values);
$('#save-grid').show();
dialog.close();
}

View File

@ -75,9 +75,10 @@ export default class Cpu extends BaseWidget {
}
}
onWidgetOptionsChanged(options) {
async onWidgetOptionsChanged(options) {
this.graphs.filter(x => !options.graphs.includes(x)).forEach(graph => $(`#cpu-${graph}`).hide());
this.graphs = options.graphs;
const config = await this.getWidgetConfig();
this.graphs = config.graphs
this.graphs.forEach(graph => $(`#cpu-${graph}`).show());
}

View File

@ -235,7 +235,7 @@ export default class Traffic extends BaseWidget {
};
}
onWidgetOptionsChanged(options) {
async onWidgetOptionsChanged(options) {
this.configChanged = true;
}