mirror of
https://github.com/grafana/grafana.git
synced 2024-12-02 13:39:19 -06:00
Merge pull request #14989 from grafana/hugoh/bug-folder-name-appears-misleadingly-when-using-viewers-can-edit
fixes:#14282 - Do not change folder for persisted dashboards
This commit is contained in:
commit
2264c27504
@ -21,6 +21,7 @@ export class FolderPickerCtrl {
|
|||||||
hasValidationError: boolean;
|
hasValidationError: boolean;
|
||||||
validationError: any;
|
validationError: any;
|
||||||
isEditor: boolean;
|
isEditor: boolean;
|
||||||
|
dashboardId?: number;
|
||||||
|
|
||||||
/** @ngInject */
|
/** @ngInject */
|
||||||
constructor(private backendSrv, private validationSrv, private contextSrv) {
|
constructor(private backendSrv, private validationSrv, private contextSrv) {
|
||||||
@ -144,7 +145,13 @@ export class FolderPickerCtrl {
|
|||||||
if (this.isEditor) {
|
if (this.isEditor) {
|
||||||
folder = rootFolder;
|
folder = rootFolder;
|
||||||
} else {
|
} else {
|
||||||
folder = result.length > 0 ? result[0] : resetFolder;
|
// We shouldn't assign a random folder without the user actively choosing it on a persisted dashboard
|
||||||
|
const isPersistedDashBoard = this.dashboardId ? true : false;
|
||||||
|
if (isPersistedDashBoard) {
|
||||||
|
folder = resetFolder;
|
||||||
|
} else {
|
||||||
|
folder = result.length > 0 ? result[0] : resetFolder;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,6 +183,7 @@ export function folderPicker() {
|
|||||||
exitFolderCreation: '&',
|
exitFolderCreation: '&',
|
||||||
enableCreateNew: '@',
|
enableCreateNew: '@',
|
||||||
enableReset: '@',
|
enableReset: '@',
|
||||||
|
dashboardId: '<?',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,8 @@ const template = `
|
|||||||
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-7"
|
||||||
|
dashboard-id="ctrl.clone.id">
|
||||||
</folder-picker>
|
</folder-picker>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -51,7 +51,8 @@
|
|||||||
on-change="ctrl.onFolderChange($folder)"
|
on-change="ctrl.onFolderChange($folder)"
|
||||||
enable-create-new="true"
|
enable-create-new="true"
|
||||||
is-valid-selection="true"
|
is-valid-selection="true"
|
||||||
label-class="width-7">
|
label-class="width-7"
|
||||||
|
dashboard-id="ctrl.dashboard.id">
|
||||||
</folder-picker>
|
</folder-picker>
|
||||||
<gf-form-switch class="gf-form" label="Editable" tooltip="Uncheck, then save and reload to disable all dashboard editing" checked="ctrl.dashboard.editable" label-class="width-7">
|
<gf-form-switch class="gf-form" label="Editable" tooltip="Uncheck, then save and reload to disable all dashboard editing" checked="ctrl.dashboard.editable" label-class="width-7">
|
||||||
</gf-form-switch>
|
</gf-form-switch>
|
||||||
|
Loading…
Reference in New Issue
Block a user