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,10 +1,10 @@
|
||||
import $ from "jquery";
|
||||
import _ from "lodash";
|
||||
import $ from 'jquery';
|
||||
import _ from 'lodash';
|
||||
|
||||
import coreModule from "app/core/core_module";
|
||||
import appEvents from "app/core/app_events";
|
||||
import coreModule from 'app/core/core_module';
|
||||
import appEvents from 'app/core/app_events';
|
||||
|
||||
import Mousetrap from "mousetrap";
|
||||
import Mousetrap from 'mousetrap';
|
||||
|
||||
export class KeybindingSrv {
|
||||
helpModal: boolean;
|
||||
@@ -12,7 +12,7 @@ export class KeybindingSrv {
|
||||
/** @ngInject */
|
||||
constructor(private $rootScope, private $location) {
|
||||
// clear out all shortcuts on route change
|
||||
$rootScope.$on("$routeChangeSuccess", () => {
|
||||
$rootScope.$on('$routeChangeSuccess', () => {
|
||||
Mousetrap.reset();
|
||||
// rebind global shortcuts
|
||||
this.setupGlobal();
|
||||
@@ -22,42 +22,42 @@ export class KeybindingSrv {
|
||||
}
|
||||
|
||||
setupGlobal() {
|
||||
this.bind(["?", "h"], this.showHelpModal);
|
||||
this.bind("g h", this.goToHome);
|
||||
this.bind("g a", this.openAlerting);
|
||||
this.bind("g p", this.goToProfile);
|
||||
this.bind("s s", this.openSearchStarred);
|
||||
this.bind("s o", this.openSearch);
|
||||
this.bind("s t", this.openSearchTags);
|
||||
this.bind("f", this.openSearch);
|
||||
this.bind(['?', 'h'], this.showHelpModal);
|
||||
this.bind('g h', this.goToHome);
|
||||
this.bind('g a', this.openAlerting);
|
||||
this.bind('g p', this.goToProfile);
|
||||
this.bind('s s', this.openSearchStarred);
|
||||
this.bind('s o', this.openSearch);
|
||||
this.bind('s t', this.openSearchTags);
|
||||
this.bind('f', this.openSearch);
|
||||
}
|
||||
|
||||
openSearchStarred() {
|
||||
appEvents.emit("show-dash-search", { starred: true });
|
||||
appEvents.emit('show-dash-search', { starred: true });
|
||||
}
|
||||
|
||||
openSearchTags() {
|
||||
appEvents.emit("show-dash-search", { tagsMode: true });
|
||||
appEvents.emit('show-dash-search', { tagsMode: true });
|
||||
}
|
||||
|
||||
openSearch() {
|
||||
appEvents.emit("show-dash-search");
|
||||
appEvents.emit('show-dash-search');
|
||||
}
|
||||
|
||||
openAlerting() {
|
||||
this.$location.url("/alerting");
|
||||
this.$location.url('/alerting');
|
||||
}
|
||||
|
||||
goToHome() {
|
||||
this.$location.url("/");
|
||||
this.$location.url('/');
|
||||
}
|
||||
|
||||
goToProfile() {
|
||||
this.$location.url("/profile");
|
||||
this.$location.url('/profile');
|
||||
}
|
||||
|
||||
showHelpModal() {
|
||||
appEvents.emit("show-modal", { templateHtml: "<help-modal></help-modal>" });
|
||||
appEvents.emit('show-modal', { templateHtml: '<help-modal></help-modal>' });
|
||||
}
|
||||
|
||||
bind(keyArg, fn) {
|
||||
@@ -69,68 +69,68 @@ export class KeybindingSrv {
|
||||
evt.returnValue = false;
|
||||
return this.$rootScope.$apply(fn.bind(this));
|
||||
},
|
||||
"keydown"
|
||||
'keydown'
|
||||
);
|
||||
}
|
||||
|
||||
showDashEditView() {
|
||||
var search = _.extend(this.$location.search(), { editview: "settings" });
|
||||
var search = _.extend(this.$location.search(), { editview: 'settings' });
|
||||
this.$location.search(search);
|
||||
}
|
||||
|
||||
setupDashboardBindings(scope, dashboard) {
|
||||
this.bind("mod+o", () => {
|
||||
this.bind('mod+o', () => {
|
||||
dashboard.graphTooltip = (dashboard.graphTooltip + 1) % 3;
|
||||
appEvents.emit("graph-hover-clear");
|
||||
this.$rootScope.$broadcast("refresh");
|
||||
appEvents.emit('graph-hover-clear');
|
||||
this.$rootScope.$broadcast('refresh');
|
||||
});
|
||||
|
||||
this.bind("mod+s", e => {
|
||||
scope.appEvent("save-dashboard");
|
||||
this.bind('mod+s', e => {
|
||||
scope.appEvent('save-dashboard');
|
||||
});
|
||||
|
||||
this.bind("t z", () => {
|
||||
scope.appEvent("zoom-out", 2);
|
||||
this.bind('t z', () => {
|
||||
scope.appEvent('zoom-out', 2);
|
||||
});
|
||||
|
||||
this.bind("ctrl+z", () => {
|
||||
scope.appEvent("zoom-out", 2);
|
||||
this.bind('ctrl+z', () => {
|
||||
scope.appEvent('zoom-out', 2);
|
||||
});
|
||||
|
||||
this.bind("t left", () => {
|
||||
scope.appEvent("shift-time-backward");
|
||||
this.bind('t left', () => {
|
||||
scope.appEvent('shift-time-backward');
|
||||
});
|
||||
|
||||
this.bind("t right", () => {
|
||||
scope.appEvent("shift-time-forward");
|
||||
this.bind('t right', () => {
|
||||
scope.appEvent('shift-time-forward');
|
||||
});
|
||||
|
||||
// edit panel
|
||||
this.bind("e", () => {
|
||||
this.bind('e', () => {
|
||||
if (dashboard.meta.focusPanelId && dashboard.meta.canEdit) {
|
||||
this.$rootScope.appEvent("panel-change-view", {
|
||||
this.$rootScope.appEvent('panel-change-view', {
|
||||
fullscreen: true,
|
||||
edit: true,
|
||||
panelId: dashboard.meta.focusPanelId,
|
||||
toggle: true
|
||||
toggle: true,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// view panel
|
||||
this.bind("v", () => {
|
||||
this.bind('v', () => {
|
||||
if (dashboard.meta.focusPanelId) {
|
||||
this.$rootScope.appEvent("panel-change-view", {
|
||||
this.$rootScope.appEvent('panel-change-view', {
|
||||
fullscreen: true,
|
||||
edit: null,
|
||||
panelId: dashboard.meta.focusPanelId,
|
||||
toggle: true
|
||||
toggle: true,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// delete panel
|
||||
this.bind("p r", () => {
|
||||
this.bind('p r', () => {
|
||||
if (dashboard.meta.focusPanelId && dashboard.meta.canEdit) {
|
||||
var panelInfo = dashboard.getPanelInfoById(dashboard.meta.focusPanelId);
|
||||
panelInfo.row.removePanel(panelInfo.panel);
|
||||
@@ -139,22 +139,22 @@ export class KeybindingSrv {
|
||||
});
|
||||
|
||||
// share panel
|
||||
this.bind("p s", () => {
|
||||
this.bind('p s', () => {
|
||||
if (dashboard.meta.focusPanelId) {
|
||||
var shareScope = scope.$new();
|
||||
var panelInfo = dashboard.getPanelInfoById(dashboard.meta.focusPanelId);
|
||||
shareScope.panel = panelInfo.panel;
|
||||
shareScope.dashboard = dashboard;
|
||||
|
||||
appEvents.emit("show-modal", {
|
||||
src: "public/app/features/dashboard/partials/shareModal.html",
|
||||
scope: shareScope
|
||||
appEvents.emit('show-modal', {
|
||||
src: 'public/app/features/dashboard/partials/shareModal.html',
|
||||
scope: shareScope,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// delete row
|
||||
this.bind("r r", () => {
|
||||
this.bind('r r', () => {
|
||||
if (dashboard.meta.focusPanelId && dashboard.meta.canEdit) {
|
||||
var panelInfo = dashboard.getPanelInfoById(dashboard.meta.focusPanelId);
|
||||
dashboard.removeRow(panelInfo.row);
|
||||
@@ -163,7 +163,7 @@ export class KeybindingSrv {
|
||||
});
|
||||
|
||||
// collapse row
|
||||
this.bind("r c", () => {
|
||||
this.bind('r c', () => {
|
||||
if (dashboard.meta.focusPanelId) {
|
||||
var panelInfo = dashboard.getPanelInfoById(dashboard.meta.focusPanelId);
|
||||
panelInfo.row.toggleCollapse();
|
||||
@@ -172,47 +172,47 @@ export class KeybindingSrv {
|
||||
});
|
||||
|
||||
// collapse all rows
|
||||
this.bind("d shift+c", () => {
|
||||
this.bind('d shift+c', () => {
|
||||
for (let row of dashboard.rows) {
|
||||
row.collapse = true;
|
||||
}
|
||||
});
|
||||
|
||||
// expand all rows
|
||||
this.bind("d shift+e", () => {
|
||||
this.bind('d shift+e', () => {
|
||||
for (let row of dashboard.rows) {
|
||||
row.collapse = false;
|
||||
}
|
||||
});
|
||||
|
||||
this.bind("d n", e => {
|
||||
this.$location.url("/dashboard/new");
|
||||
this.bind('d n', e => {
|
||||
this.$location.url('/dashboard/new');
|
||||
});
|
||||
|
||||
this.bind("d r", () => {
|
||||
this.$rootScope.$broadcast("refresh");
|
||||
this.bind('d r', () => {
|
||||
this.$rootScope.$broadcast('refresh');
|
||||
});
|
||||
|
||||
this.bind("d s", () => {
|
||||
this.bind('d s', () => {
|
||||
this.showDashEditView();
|
||||
});
|
||||
|
||||
this.bind("d k", () => {
|
||||
appEvents.emit("toggle-kiosk-mode");
|
||||
this.bind('d k', () => {
|
||||
appEvents.emit('toggle-kiosk-mode');
|
||||
});
|
||||
|
||||
this.bind("d v", () => {
|
||||
appEvents.emit("toggle-view-mode");
|
||||
this.bind('d v', () => {
|
||||
appEvents.emit('toggle-view-mode');
|
||||
});
|
||||
|
||||
this.bind("esc", () => {
|
||||
var popups = $(".popover.in");
|
||||
this.bind('esc', () => {
|
||||
var popups = $('.popover.in');
|
||||
if (popups.length > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
scope.appEvent("hide-modal");
|
||||
scope.appEvent("panel-change-view", { fullscreen: false, edit: false });
|
||||
scope.appEvent('hide-modal');
|
||||
scope.appEvent('panel-change-view', { fullscreen: false, edit: false });
|
||||
|
||||
// close settings view
|
||||
var search = this.$location.search();
|
||||
@@ -224,4 +224,4 @@ export class KeybindingSrv {
|
||||
}
|
||||
}
|
||||
|
||||
coreModule.service("keybindingSrv", KeybindingSrv);
|
||||
coreModule.service('keybindingSrv', KeybindingSrv);
|
||||
|
||||
Reference in New Issue
Block a user