Commit 60272d8a by Torkel Ödegaard

Simple implementation for preserve tags, closes #11627

parent 2bc573c8
......@@ -16,19 +16,19 @@ const template = `
<form name="ctrl.saveForm" class="modal-content" novalidate>
<div class="p-t-2">
<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>
</div>
<div class="gf-form">
<folder-picker initial-folder-id="ctrl.folderId"
<folder-picker initial-folder-id="ctrl.folderId"
on-change="ctrl.onFolderChange($folder)"
enter-folder-creation="ctrl.onEnterFolderCreation()"
exit-folder-creation="ctrl.onExitFolderCreation()"
enable-create-new="true"
label-class="width-7"
label-class="width-8"
dashboard-id="ctrl.clone.id">
</folder-picker>
</div>
<gf-form-switch class="gf-form" label="Preserve tags" label-class="width-8" checked="ctrl.preseveTags">
</gf-form-switch>
</div>
<div class="gf-form-button-row text-center">
......@@ -44,6 +44,7 @@ export class SaveDashboardAsModalCtrl {
folderId: any;
dismiss: () => void;
isValidFolderSelection = true;
preseveTags: boolean;
/** @ngInject */
constructor(private dashboardSrv) {
......@@ -55,6 +56,7 @@ export class SaveDashboardAsModalCtrl {
this.clone.editable = true;
this.clone.hideControls = false;
this.folderId = dashboard.meta.folderId;
this.preseveTags = false;
// remove alerts if source dashboard is already persisted
// do not want to create alert dupes
......@@ -71,6 +73,10 @@ export class SaveDashboardAsModalCtrl {
}
save() {
if (!this.preseveTags) {
this.clone.tags = [];
}
return this.dashboardSrv.save(this.clone, { folderId: this.folderId }).then(this.dismiss);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment