Provisioning: Show file path of provisioning file in save/delete dialogs (#16706)

* Add file path to metadata and show it in dialogs

* Make path relative to config directory

* Fix tests

* Add test for the relative path

* Refactor to use path relative to provisioner path

* Change return types

* Rename attribute

* Small fixes from review
This commit is contained in:
Andrej Ocenas
2019-04-30 13:32:18 +02:00
committed by GitHub
parent 76ab0aa059
commit eb82a75668
23 changed files with 285 additions and 134 deletions

View File

@@ -192,6 +192,8 @@ export class SettingsCtrl {
text2: `
<i>See <a class="external-link" href="http://docs.grafana.org/administration/provisioning/#dashboards" target="_blank">
documentation</a> for more information about provisioning.</i>
</br>
File path: ${this.dashboard.meta.provisionedExternalId}
`,
text2htmlBind: true,
icon: 'fa-trash',

View File

@@ -1,6 +1,7 @@
import angular from 'angular';
import { saveAs } from 'file-saver';
import coreModule from 'app/core/core_module';
import { DashboardModel } from '../../state';
const template = `
<div class="modal-body">
@@ -21,6 +22,9 @@ const template = `
<i>See <a class="external-link" href="http://docs.grafana.org/administration/provisioning/#dashboards" target="_blank">
documentation</a> for more information about provisioning.</i>
</small>
<div class="p-t-1">
File path: {{ctrl.dashboardModel.meta.provisionedExternalId}}
</div>
<div class="p-t-2">
<div class="gf-form">
<code-editor content="ctrl.dashboardJson" data-mode="json" data-max-lines=15></code-editor>
@@ -41,12 +45,14 @@ const template = `
export class SaveProvisionedDashboardModalCtrl {
dash: any;
dashboardModel: DashboardModel;
dashboardJson: string;
dismiss: () => void;
/** @ngInject */
constructor(dashboardSrv) {
this.dash = dashboardSrv.getCurrent().getSaveModelClone();
this.dashboardModel = dashboardSrv.getCurrent();
this.dash = this.dashboardModel.getSaveModelClone();
delete this.dash.id;
this.dashboardJson = angular.toJson(this.dash, true);
}

View File

@@ -26,6 +26,7 @@ export interface DashboardMeta {
canMakeEditable?: boolean;
submenuEnabled?: boolean;
provisioned?: boolean;
provisionedExternalId?: string;
focusPanelId?: number;
isStarred?: boolean;
showSettings?: boolean;