mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Simple implementation for preserve tags, closes #11627
This commit is contained in:
@@ -16,19 +16,19 @@ const template = `
|
|||||||
<form name="ctrl.saveForm" class="modal-content" novalidate>
|
<form name="ctrl.saveForm" class="modal-content" novalidate>
|
||||||
<div class="p-t-2">
|
<div class="p-t-2">
|
||||||
<div class="gf-form">
|
<div class="gf-form">
|
||||||
<label class="gf-form-label width-7">New name</label>
|
<label class="gf-form-label width-8">New name</label>
|
||||||
<input type="text" class="gf-form-input" ng-model="ctrl.clone.title" give-focus="true" required>
|
<input type="text" class="gf-form-input" ng-model="ctrl.clone.title" give-focus="true" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="gf-form">
|
<folder-picker initial-folder-id="ctrl.folderId"
|
||||||
<folder-picker initial-folder-id="ctrl.folderId"
|
|
||||||
on-change="ctrl.onFolderChange($folder)"
|
on-change="ctrl.onFolderChange($folder)"
|
||||||
enter-folder-creation="ctrl.onEnterFolderCreation()"
|
enter-folder-creation="ctrl.onEnterFolderCreation()"
|
||||||
exit-folder-creation="ctrl.onExitFolderCreation()"
|
exit-folder-creation="ctrl.onExitFolderCreation()"
|
||||||
enable-create-new="true"
|
enable-create-new="true"
|
||||||
label-class="width-7"
|
label-class="width-8"
|
||||||
dashboard-id="ctrl.clone.id">
|
dashboard-id="ctrl.clone.id">
|
||||||
</folder-picker>
|
</folder-picker>
|
||||||
</div>
|
<gf-form-switch class="gf-form" label="Preserve tags" label-class="width-8" checked="ctrl.preseveTags">
|
||||||
|
</gf-form-switch>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="gf-form-button-row text-center">
|
<div class="gf-form-button-row text-center">
|
||||||
@@ -44,6 +44,7 @@ export class SaveDashboardAsModalCtrl {
|
|||||||
folderId: any;
|
folderId: any;
|
||||||
dismiss: () => void;
|
dismiss: () => void;
|
||||||
isValidFolderSelection = true;
|
isValidFolderSelection = true;
|
||||||
|
preseveTags: boolean;
|
||||||
|
|
||||||
/** @ngInject */
|
/** @ngInject */
|
||||||
constructor(private dashboardSrv) {
|
constructor(private dashboardSrv) {
|
||||||
@@ -55,6 +56,7 @@ export class SaveDashboardAsModalCtrl {
|
|||||||
this.clone.editable = true;
|
this.clone.editable = true;
|
||||||
this.clone.hideControls = false;
|
this.clone.hideControls = false;
|
||||||
this.folderId = dashboard.meta.folderId;
|
this.folderId = dashboard.meta.folderId;
|
||||||
|
this.preseveTags = false;
|
||||||
|
|
||||||
// remove alerts if source dashboard is already persisted
|
// remove alerts if source dashboard is already persisted
|
||||||
// do not want to create alert dupes
|
// do not want to create alert dupes
|
||||||
@@ -71,6 +73,10 @@ export class SaveDashboardAsModalCtrl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
save() {
|
save() {
|
||||||
|
if (!this.preseveTags) {
|
||||||
|
this.clone.tags = [];
|
||||||
|
}
|
||||||
|
|
||||||
return this.dashboardSrv.save(this.clone, { folderId: this.folderId }).then(this.dismiss);
|
return this.dashboardSrv.save(this.clone, { folderId: this.folderId }).then(this.dismiss);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user