prettier: change to single quoting

This commit is contained in:
Torkel Ödegaard
2017-12-20 12:33:33 +01:00
parent 2a360c45a2
commit 85879a7014
304 changed files with 10558 additions and 10519 deletions

View File

@ -1,12 +1,12 @@
import angular from "angular";
import _ from "lodash";
import angular from 'angular';
import _ from 'lodash';
import config from "app/core/config";
import coreModule from "app/core/core_module";
import { importPluginModule } from "./plugin_loader";
import config from 'app/core/config';
import coreModule from 'app/core/core_module';
import { importPluginModule } from './plugin_loader';
import { UnknownPanelCtrl } from "app/plugins/panel/unknown/module";
import { DashboardRowCtrl } from "./row_ctrl";
import { UnknownPanelCtrl } from 'app/plugins/panel/unknown/module';
import { DashboardRowCtrl } from './row_ctrl';
/** @ngInject **/
function pluginDirectiveLoader(
@ -34,10 +34,10 @@ function pluginDirectiveLoader(
if (!templateUrl) {
return undefined;
}
if (templateUrl.indexOf("public") === 0) {
if (templateUrl.indexOf('public') === 0) {
return templateUrl;
}
return baseUrl + "/" + templateUrl;
return baseUrl + '/' + templateUrl;
}
function getPluginComponentDirective(options) {
@ -51,9 +51,9 @@ function pluginDirectiveLoader(
return {
templateUrl: options.Component.templateUrl,
template: options.Component.template,
restrict: "E",
restrict: 'E',
controller: options.Component,
controllerAs: "ctrl",
controllerAs: 'ctrl',
bindToController: true,
scope: options.bindings,
link: (scope, elem, attrs, ctrl) => {
@ -63,29 +63,29 @@ function pluginDirectiveLoader(
if (ctrl.init) {
ctrl.init();
}
}
},
};
};
}
function loadPanelComponentInfo(scope, attrs) {
if (scope.panel.type === "row") {
if (scope.panel.type === 'row') {
return $q.when({
name: "dashboard-row",
bindings: { dashboard: "=", panel: "=" },
attrs: { dashboard: "ctrl.dashboard", panel: "panel" },
Component: DashboardRowCtrl
name: 'dashboard-row',
bindings: { dashboard: '=', panel: '=' },
attrs: { dashboard: 'ctrl.dashboard', panel: 'panel' },
Component: DashboardRowCtrl,
});
}
var componentInfo: any = {
name: "panel-plugin-" + scope.panel.type,
bindings: { dashboard: "=", panel: "=", row: "=" },
name: 'panel-plugin-' + scope.panel.type,
bindings: { dashboard: '=', panel: '=', row: '=' },
attrs: {
dashboard: "dashboard",
panel: "panel",
class: "panel-height-helper"
}
dashboard: 'dashboard',
panel: 'panel',
class: 'panel-height-helper',
},
};
let panelInfo = config.panels[scope.panel.type];
@ -131,7 +131,7 @@ function pluginDirectiveLoader(
function getModule(scope, attrs) {
switch (attrs.type) {
// QueryCtrl
case "query-ctrl": {
case 'query-ctrl': {
let datasource = scope.target.datasource || scope.ctrl.panel.datasource;
return datasourceSrv.get(datasource).then(ds => {
scope.datasource = ds;
@ -139,20 +139,20 @@ function pluginDirectiveLoader(
return importPluginModule(ds.meta.module).then(dsModule => {
return {
baseUrl: ds.meta.baseUrl,
name: "query-ctrl-" + ds.meta.id,
bindings: { target: "=", panelCtrl: "=", datasource: "=" },
name: 'query-ctrl-' + ds.meta.id,
bindings: { target: '=', panelCtrl: '=', datasource: '=' },
attrs: {
target: "target",
"panel-ctrl": "ctrl.panelCtrl",
datasource: "datasource"
target: 'target',
'panel-ctrl': 'ctrl.panelCtrl',
datasource: 'datasource',
},
Component: dsModule.QueryCtrl
Component: dsModule.QueryCtrl,
};
});
});
}
// QueryOptionsCtrl
case "query-options-ctrl": {
case 'query-options-ctrl': {
return datasourceSrv.get(scope.ctrl.panel.datasource).then(ds => {
return importPluginModule(ds.meta.module).then((dsModule): any => {
if (!dsModule.QueryOptionsCtrl) {
@ -161,34 +161,34 @@ function pluginDirectiveLoader(
return {
baseUrl: ds.meta.baseUrl,
name: "query-options-ctrl-" + ds.meta.id,
bindings: { panelCtrl: "=" },
attrs: { "panel-ctrl": "ctrl.panelCtrl" },
Component: dsModule.QueryOptionsCtrl
name: 'query-options-ctrl-' + ds.meta.id,
bindings: { panelCtrl: '=' },
attrs: { 'panel-ctrl': 'ctrl.panelCtrl' },
Component: dsModule.QueryOptionsCtrl,
};
});
});
}
// Annotations
case "annotations-query-ctrl": {
case 'annotations-query-ctrl': {
return importPluginModule(
scope.ctrl.currentDatasource.meta.module
).then(function(dsModule) {
return {
baseUrl: scope.ctrl.currentDatasource.meta.baseUrl,
name:
"annotations-query-ctrl-" + scope.ctrl.currentDatasource.meta.id,
bindings: { annotation: "=", datasource: "=" },
'annotations-query-ctrl-' + scope.ctrl.currentDatasource.meta.id,
bindings: { annotation: '=', datasource: '=' },
attrs: {
annotation: "ctrl.currentAnnotation",
datasource: "ctrl.currentDatasource"
annotation: 'ctrl.currentAnnotation',
datasource: 'ctrl.currentDatasource',
},
Component: dsModule.AnnotationsQueryCtrl
Component: dsModule.AnnotationsQueryCtrl,
};
});
}
// Datasource ConfigCtrl
case "datasource-config-ctrl": {
case 'datasource-config-ctrl': {
var dsMeta = scope.ctrl.datasourceMeta;
return importPluginModule(dsMeta.module).then(function(dsModule): any {
if (!dsModule.ConfigCtrl) {
@ -197,46 +197,46 @@ function pluginDirectiveLoader(
return {
baseUrl: dsMeta.baseUrl,
name: "ds-config-" + dsMeta.id,
bindings: { meta: "=", current: "=" },
attrs: { meta: "ctrl.datasourceMeta", current: "ctrl.current" },
Component: dsModule.ConfigCtrl
name: 'ds-config-' + dsMeta.id,
bindings: { meta: '=', current: '=' },
attrs: { meta: 'ctrl.datasourceMeta', current: 'ctrl.current' },
Component: dsModule.ConfigCtrl,
};
});
}
// AppConfigCtrl
case "app-config-ctrl": {
case 'app-config-ctrl': {
let model = scope.ctrl.model;
return importPluginModule(model.module).then(function(appModule) {
return {
baseUrl: model.baseUrl,
name: "app-config-" + model.id,
bindings: { appModel: "=", appEditCtrl: "=" },
attrs: { "app-model": "ctrl.model", "app-edit-ctrl": "ctrl" },
Component: appModule.ConfigCtrl
name: 'app-config-' + model.id,
bindings: { appModel: '=', appEditCtrl: '=' },
attrs: { 'app-model': 'ctrl.model', 'app-edit-ctrl': 'ctrl' },
Component: appModule.ConfigCtrl,
};
});
}
// App Page
case "app-page": {
case 'app-page': {
let appModel = scope.ctrl.appModel;
return importPluginModule(appModel.module).then(function(appModule) {
return {
baseUrl: appModel.baseUrl,
name: "app-page-" + appModel.id + "-" + scope.ctrl.page.slug,
bindings: { appModel: "=" },
attrs: { "app-model": "ctrl.appModel" },
Component: appModule[scope.ctrl.page.component]
name: 'app-page-' + appModel.id + '-' + scope.ctrl.page.slug,
bindings: { appModel: '=' },
attrs: { 'app-model': 'ctrl.appModel' },
Component: appModule[scope.ctrl.page.component],
};
});
}
// Panel
case "panel": {
case 'panel': {
return loadPanelComponentInfo(scope, attrs);
}
default: {
return $q.reject({
message: "Could not find component type: " + attrs.type
message: 'Could not find component type: ' + attrs.type,
});
}
}
@ -255,8 +255,8 @@ function pluginDirectiveLoader(
setTimeout(function() {
elem.append(child);
scope.$applyAsync(function() {
scope.$broadcast("component-did-mount");
scope.$broadcast("refresh");
scope.$broadcast('component-did-mount');
scope.$broadcast('refresh');
});
});
}
@ -270,7 +270,7 @@ function pluginDirectiveLoader(
if (!componentInfo.Component) {
throw {
message:
"Failed to find exported plugin component for " + componentInfo.name
'Failed to find exported plugin component for ' + componentInfo.name,
};
}
@ -285,21 +285,21 @@ function pluginDirectiveLoader(
}
return {
restrict: "E",
restrict: 'E',
link: function(scope, elem, attrs) {
getModule(scope, attrs)
.then(function(componentInfo) {
registerPluginComponent(scope, elem, attrs, componentInfo);
})
.catch(err => {
$rootScope.appEvent("alert-error", [
"Plugin Error",
err.message || err
$rootScope.appEvent('alert-error', [
'Plugin Error',
err.message || err,
]);
console.log("Plugin component error", err);
console.log('Plugin component error', err);
});
}
},
};
}
coreModule.directive("pluginComponent", pluginDirectiveLoader);
coreModule.directive('pluginComponent', pluginDirectiveLoader);