Commit 4518604c by Torkel Ödegaard Committed by GitHub

Merge pull request #15446 from grafana/preserve-tags-option

Preserve tags switch option in Save As modal
parents 4f48ed33 04c88a22
...@@ -16,18 +16,20 @@ const template = ` ...@@ -16,18 +16,20 @@ 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 class="gf-form-inline">
<gf-form-switch class="gf-form" label="Copy tags" label-class="width-8" checked="ctrl.copyTags">
</gf-form-switch>
</div> </div>
</div> </div>
...@@ -44,6 +46,7 @@ export class SaveDashboardAsModalCtrl { ...@@ -44,6 +46,7 @@ export class SaveDashboardAsModalCtrl {
folderId: any; folderId: any;
dismiss: () => void; dismiss: () => void;
isValidFolderSelection = true; isValidFolderSelection = true;
copyTags: boolean;
/** @ngInject */ /** @ngInject */
constructor(private dashboardSrv) { constructor(private dashboardSrv) {
...@@ -55,6 +58,7 @@ export class SaveDashboardAsModalCtrl { ...@@ -55,6 +58,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.copyTags = 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 +75,10 @@ export class SaveDashboardAsModalCtrl { ...@@ -71,6 +75,10 @@ export class SaveDashboardAsModalCtrl {
} }
save() { save() {
if (!this.copyTags) {
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);
} }
......
...@@ -21,10 +21,8 @@ ...@@ -21,10 +21,8 @@
border-radius: 3px; border-radius: 3px;
text-shadow: none; text-shadow: none;
font-size: 13px; font-size: 13px;
padding: 3px 6px 1px 6px; padding: 2px 6px 2px 6px;
border-width: 1px; border: 1px solid lighten($purple, 10%);
border-style: solid;
box-shadow: 0 0 1px rgba($white, 0.2);
.icon-tag { .icon-tag {
position: relative; position: relative;
......
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