mirror of
https://github.com/cuigh/swirl
synced 2025-01-01 00:32:09 +00:00
Support setting default dashboard to services
This commit is contained in:
parent
d47ab7974d
commit
61465d8d55
@ -1536,7 +1536,7 @@ var Swirl;
|
|||||||
$elem.remove();
|
$elem.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
save() {
|
save(asDefault = false) {
|
||||||
let charts = [];
|
let charts = [];
|
||||||
this.$panel.children().each((index, elem) => {
|
this.$panel.children().each((index, elem) => {
|
||||||
let name = $(elem).data("name");
|
let name = $(elem).data("name");
|
||||||
@ -1554,7 +1554,7 @@ var Swirl;
|
|||||||
});
|
});
|
||||||
let args = {
|
let args = {
|
||||||
name: this.opts.name,
|
name: this.opts.name,
|
||||||
key: this.opts.key || '',
|
key: asDefault ? '' : (this.opts.key || ''),
|
||||||
charts: charts,
|
charts: charts,
|
||||||
};
|
};
|
||||||
$ajax.post(`/system/chart/save_dashboard`, args).json((r) => {
|
$ajax.post(`/system/chart/save_dashboard`, args).json((r) => {
|
||||||
@ -1599,6 +1599,9 @@ var Swirl;
|
|||||||
$("#btn-save").click(() => {
|
$("#btn-save").click(() => {
|
||||||
this.dashboard.save();
|
this.dashboard.save();
|
||||||
});
|
});
|
||||||
|
$("#btn-save-as-default").click(() => {
|
||||||
|
this.dashboard.save(true);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
showAddDlg() {
|
showAddDlg() {
|
||||||
let $panel = $("#nav-charts");
|
let $panel = $("#nav-charts");
|
||||||
|
File diff suppressed because one or more lines are too long
@ -480,7 +480,7 @@ namespace Swirl.Core {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
save() {
|
save(asDefault: boolean = false) {
|
||||||
let charts: any = [];
|
let charts: any = [];
|
||||||
this.$panel.children().each((index: number, elem: Element) => {
|
this.$panel.children().each((index: number, elem: Element) => {
|
||||||
let name = $(elem).data("name");
|
let name = $(elem).data("name");
|
||||||
@ -498,7 +498,7 @@ namespace Swirl.Core {
|
|||||||
});
|
});
|
||||||
let args = {
|
let args = {
|
||||||
name: this.opts.name,
|
name: this.opts.name,
|
||||||
key: this.opts.key || '',
|
key: asDefault ? '' : (this.opts.key || ''),
|
||||||
charts: charts,
|
charts: charts,
|
||||||
};
|
};
|
||||||
$ajax.post(`/system/chart/save_dashboard`, args).json<AjaxResult>((r: AjaxResult) => {
|
$ajax.post(`/system/chart/save_dashboard`, args).json<AjaxResult>((r: AjaxResult) => {
|
||||||
@ -550,6 +550,9 @@ namespace Swirl.Core {
|
|||||||
$("#btn-save").click(() => {
|
$("#btn-save").click(() => {
|
||||||
this.dashboard.save();
|
this.dashboard.save();
|
||||||
});
|
});
|
||||||
|
$("#btn-save-as-default").click(() => {
|
||||||
|
this.dashboard.save(true);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private showAddDlg() {
|
private showAddDlg() {
|
||||||
|
@ -29,6 +29,7 @@ button.export: Export
|
|||||||
button.more: More
|
button.more: More
|
||||||
button.connect: Connect
|
button.connect: Connect
|
||||||
button.disconnect: Disconnect
|
button.disconnect: Disconnect
|
||||||
|
button.save-as-default: Save as default
|
||||||
|
|
||||||
# field
|
# field
|
||||||
field.name: Name
|
field.name: Name
|
||||||
|
@ -29,6 +29,7 @@ button.export: 导出
|
|||||||
button.more: 更多
|
button.more: 更多
|
||||||
button.connect: 连接
|
button.connect: 连接
|
||||||
button.disconnect: 断开
|
button.disconnect: 断开
|
||||||
|
button.save-as-default: 保存为默认
|
||||||
|
|
||||||
# field
|
# field
|
||||||
field.name: 名称
|
field.name: 名称
|
||||||
|
@ -323,6 +323,11 @@ func serviceStats(ctx web.Context) error {
|
|||||||
if dashboard, err = biz.Chart.GetDashboard("service", name); err != nil {
|
if dashboard, err = biz.Chart.GetDashboard("service", name); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if dashboard == nil {
|
||||||
|
if dashboard, err = biz.Chart.GetDashboard("service", ""); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if dashboard == nil {
|
if dashboard == nil {
|
||||||
charts, err = biz.Chart.GetServiceCharts(name)
|
charts, err = biz.Chart.GetServiceCharts(name)
|
||||||
|
@ -87,6 +87,9 @@
|
|||||||
<button id="btn-save" class="button">
|
<button id="btn-save" class="button">
|
||||||
<span class="icon"><i class="fas fa-save"></i></span><span>{{ i18n("button.save") }}</span>
|
<span class="icon"><i class="fas fa-save"></i></span><span>{{ i18n("button.save") }}</span>
|
||||||
</button>
|
</button>
|
||||||
|
<button id="btn-save-as-default" class="button">
|
||||||
|
<span class="icon"><i class="fas fa-save"></i></span><span>{{ i18n("button.save-as-default") }}</span>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user