mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
prettier: change to single quoting
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { coreModule, appEvents, contextSrv } from "app/core/core";
|
||||
import { DashboardModel } from "../dashboard_model";
|
||||
import $ from "jquery";
|
||||
import _ from "lodash";
|
||||
import { coreModule, appEvents, contextSrv } from 'app/core/core';
|
||||
import { DashboardModel } from '../dashboard_model';
|
||||
import $ from 'jquery';
|
||||
import _ from 'lodash';
|
||||
|
||||
export class SettingsCtrl {
|
||||
dashboard: DashboardModel;
|
||||
@@ -25,9 +25,9 @@ export class SettingsCtrl {
|
||||
// that rely on inherited scope
|
||||
$scope.dashboard = this.dashboard;
|
||||
|
||||
this.$scope.$on("$destroy", () => {
|
||||
this.$scope.$on('$destroy', () => {
|
||||
this.dashboard.updateSubmenuVisibility();
|
||||
this.$rootScope.$broadcast("refresh");
|
||||
this.$rootScope.$broadcast('refresh');
|
||||
});
|
||||
|
||||
this.canSaveAs = contextSrv.isEditor;
|
||||
@@ -37,7 +37,7 @@ export class SettingsCtrl {
|
||||
this.onRouteUpdated();
|
||||
|
||||
$rootScope.onAppEvent(
|
||||
"$routeUpdate",
|
||||
'$routeUpdate',
|
||||
this.onRouteUpdated.bind(this),
|
||||
$scope
|
||||
);
|
||||
@@ -48,47 +48,47 @@ export class SettingsCtrl {
|
||||
|
||||
if (this.dashboard.meta.canEdit) {
|
||||
this.sections.push({
|
||||
title: "General",
|
||||
id: "settings",
|
||||
icon: "gicon gicon-preferences"
|
||||
title: 'General',
|
||||
id: 'settings',
|
||||
icon: 'gicon gicon-preferences',
|
||||
});
|
||||
this.sections.push({
|
||||
title: "Annotations",
|
||||
id: "annotations",
|
||||
icon: "gicon gicon-annotation"
|
||||
title: 'Annotations',
|
||||
id: 'annotations',
|
||||
icon: 'gicon gicon-annotation',
|
||||
});
|
||||
this.sections.push({
|
||||
title: "Variables",
|
||||
id: "templating",
|
||||
icon: "gicon gicon-variable"
|
||||
title: 'Variables',
|
||||
id: 'templating',
|
||||
icon: 'gicon gicon-variable',
|
||||
});
|
||||
this.sections.push({
|
||||
title: "Links",
|
||||
id: "links",
|
||||
icon: "gicon gicon-link"
|
||||
title: 'Links',
|
||||
id: 'links',
|
||||
icon: 'gicon gicon-link',
|
||||
});
|
||||
}
|
||||
|
||||
if (this.dashboard.id && this.dashboard.meta.canSave) {
|
||||
this.sections.push({
|
||||
title: "Versions",
|
||||
id: "versions",
|
||||
icon: "fa fa-fw fa-history"
|
||||
title: 'Versions',
|
||||
id: 'versions',
|
||||
icon: 'fa fa-fw fa-history',
|
||||
});
|
||||
}
|
||||
|
||||
if (this.dashboard.meta.canMakeEditable) {
|
||||
this.sections.push({
|
||||
title: "Make Editable",
|
||||
icon: "fa fa-fw fa-edit",
|
||||
id: "make_editable"
|
||||
title: 'Make Editable',
|
||||
icon: 'fa fa-fw fa-edit',
|
||||
id: 'make_editable',
|
||||
});
|
||||
}
|
||||
|
||||
this.sections.push({
|
||||
title: "View JSON",
|
||||
id: "view_json",
|
||||
icon: "gicon gicon-json"
|
||||
title: 'View JSON',
|
||||
id: 'view_json',
|
||||
icon: 'gicon gicon-json',
|
||||
});
|
||||
|
||||
const params = this.$location.search();
|
||||
@@ -96,7 +96,7 @@ export class SettingsCtrl {
|
||||
|
||||
for (let section of this.sections) {
|
||||
const sectionParams = _.defaults({ editview: section.id }, params);
|
||||
section.url = url + "?" + $.param(sectionParams);
|
||||
section.url = url + '?' + $.param(sectionParams);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,18 +107,18 @@ export class SettingsCtrl {
|
||||
this.json = JSON.stringify(this.dashboard.getSaveModelClone(), null, 2);
|
||||
}
|
||||
|
||||
if (this.viewId === "settings" && this.dashboard.meta.canMakeEditable) {
|
||||
this.viewId = "make_editable";
|
||||
if (this.viewId === 'settings' && this.dashboard.meta.canMakeEditable) {
|
||||
this.viewId = 'make_editable';
|
||||
}
|
||||
|
||||
const currentSection = _.find(this.sections, { id: this.viewId });
|
||||
if (!currentSection) {
|
||||
this.sections.unshift({
|
||||
title: "Not found",
|
||||
id: "404",
|
||||
icon: "fa fa-fw fa-warning"
|
||||
title: 'Not found',
|
||||
id: '404',
|
||||
icon: 'fa fa-fw fa-warning',
|
||||
});
|
||||
this.viewId = "404";
|
||||
this.viewId = '404';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ export class SettingsCtrl {
|
||||
}
|
||||
|
||||
deleteDashboard() {
|
||||
var confirmText = "";
|
||||
var confirmText = '';
|
||||
var text2 = this.dashboard.title;
|
||||
|
||||
const alerts = _.sumBy(this.dashboard.panels, panel => {
|
||||
@@ -156,31 +156,31 @@ export class SettingsCtrl {
|
||||
});
|
||||
|
||||
if (alerts > 0) {
|
||||
confirmText = "DELETE";
|
||||
confirmText = 'DELETE';
|
||||
text2 = `This dashboard contains ${alerts} alerts. Deleting this dashboard will also delete those alerts`;
|
||||
}
|
||||
|
||||
appEvents.emit("confirm-modal", {
|
||||
title: "Delete",
|
||||
text: "Do you want to delete this dashboard?",
|
||||
appEvents.emit('confirm-modal', {
|
||||
title: 'Delete',
|
||||
text: 'Do you want to delete this dashboard?',
|
||||
text2: text2,
|
||||
icon: "fa-trash",
|
||||
icon: 'fa-trash',
|
||||
confirmText: confirmText,
|
||||
yesText: "Delete",
|
||||
yesText: 'Delete',
|
||||
onConfirm: () => {
|
||||
this.dashboard.meta.canSave = false;
|
||||
this.deleteDashboardConfirmed();
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
deleteDashboardConfirmed() {
|
||||
this.backendSrv.deleteDashboard(this.dashboard.meta.slug).then(() => {
|
||||
appEvents.emit("alert-success", [
|
||||
"Dashboard Deleted",
|
||||
this.dashboard.title + " has been deleted"
|
||||
appEvents.emit('alert-success', [
|
||||
'Dashboard Deleted',
|
||||
this.dashboard.title + ' has been deleted',
|
||||
]);
|
||||
this.$location.url("/");
|
||||
this.$location.url('/');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -193,14 +193,14 @@ export class SettingsCtrl {
|
||||
|
||||
export function dashboardSettings() {
|
||||
return {
|
||||
restrict: "E",
|
||||
templateUrl: "public/app/features/dashboard/settings/settings.html",
|
||||
restrict: 'E',
|
||||
templateUrl: 'public/app/features/dashboard/settings/settings.html',
|
||||
controller: SettingsCtrl,
|
||||
bindToController: true,
|
||||
controllerAs: "ctrl",
|
||||
controllerAs: 'ctrl',
|
||||
transclude: true,
|
||||
scope: { dashboard: "=" }
|
||||
scope: { dashboard: '=' },
|
||||
};
|
||||
}
|
||||
|
||||
coreModule.directive("dashboardSettings", dashboardSettings);
|
||||
coreModule.directive('dashboardSettings', dashboardSettings);
|
||||
|
||||
Reference in New Issue
Block a user