mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
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:
@@ -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',
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ export interface DashboardMeta {
|
||||
canMakeEditable?: boolean;
|
||||
submenuEnabled?: boolean;
|
||||
provisioned?: boolean;
|
||||
provisionedExternalId?: string;
|
||||
focusPanelId?: number;
|
||||
isStarred?: boolean;
|
||||
showSettings?: boolean;
|
||||
|
||||
Reference in New Issue
Block a user