mirror of
https://github.com/cuigh/swirl
synced 2024-12-28 14:51:57 +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();
|
||||
}
|
||||
}
|
||||
save() {
|
||||
save(asDefault = false) {
|
||||
let charts = [];
|
||||
this.$panel.children().each((index, elem) => {
|
||||
let name = $(elem).data("name");
|
||||
@ -1554,7 +1554,7 @@ var Swirl;
|
||||
});
|
||||
let args = {
|
||||
name: this.opts.name,
|
||||
key: this.opts.key || '',
|
||||
key: asDefault ? '' : (this.opts.key || ''),
|
||||
charts: charts,
|
||||
};
|
||||
$ajax.post(`/system/chart/save_dashboard`, args).json((r) => {
|
||||
@ -1599,6 +1599,9 @@ var Swirl;
|
||||
$("#btn-save").click(() => {
|
||||
this.dashboard.save();
|
||||
});
|
||||
$("#btn-save-as-default").click(() => {
|
||||
this.dashboard.save(true);
|
||||
});
|
||||
}
|
||||
showAddDlg() {
|
||||
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 = [];
|
||||
this.$panel.children().each((index: number, elem: Element) => {
|
||||
let name = $(elem).data("name");
|
||||
@ -498,7 +498,7 @@ namespace Swirl.Core {
|
||||
});
|
||||
let args = {
|
||||
name: this.opts.name,
|
||||
key: this.opts.key || '',
|
||||
key: asDefault ? '' : (this.opts.key || ''),
|
||||
charts: charts,
|
||||
};
|
||||
$ajax.post(`/system/chart/save_dashboard`, args).json<AjaxResult>((r: AjaxResult) => {
|
||||
@ -550,6 +550,9 @@ namespace Swirl.Core {
|
||||
$("#btn-save").click(() => {
|
||||
this.dashboard.save();
|
||||
});
|
||||
$("#btn-save-as-default").click(() => {
|
||||
this.dashboard.save(true);
|
||||
});
|
||||
}
|
||||
|
||||
private showAddDlg() {
|
||||
|
@ -29,6 +29,7 @@ button.export: Export
|
||||
button.more: More
|
||||
button.connect: Connect
|
||||
button.disconnect: Disconnect
|
||||
button.save-as-default: Save as default
|
||||
|
||||
# field
|
||||
field.name: Name
|
||||
|
@ -29,6 +29,7 @@ button.export: 导出
|
||||
button.more: 更多
|
||||
button.connect: 连接
|
||||
button.disconnect: 断开
|
||||
button.save-as-default: 保存为默认
|
||||
|
||||
# field
|
||||
field.name: 名称
|
||||
|
@ -323,6 +323,11 @@ func serviceStats(ctx web.Context) error {
|
||||
if dashboard, err = biz.Chart.GetDashboard("service", name); err != nil {
|
||||
return err
|
||||
}
|
||||
if dashboard == nil {
|
||||
if dashboard, err = biz.Chart.GetDashboard("service", ""); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if dashboard == nil {
|
||||
charts, err = biz.Chart.GetServiceCharts(name)
|
||||
|
@ -87,6 +87,9 @@
|
||||
<button id="btn-save" class="button">
|
||||
<span class="icon"><i class="fas fa-save"></i></span><span>{{ i18n("button.save") }}</span>
|
||||
</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>
|
||||
|
Loading…
Reference in New Issue
Block a user