mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Changed functions to arrow functions for only-arrow-functions rule. (#13131)
This commit is contained in:
committed by
Torkel Ödegaard
parent
7c88436a9b
commit
72ab24f300
@@ -54,13 +54,13 @@ const panelTemplate = `
|
||||
</div>
|
||||
`;
|
||||
|
||||
module.directive('grafanaPanel', function($rootScope, $document, $timeout) {
|
||||
module.directive('grafanaPanel', ($rootScope, $document, $timeout) => {
|
||||
return {
|
||||
restrict: 'E',
|
||||
template: panelTemplate,
|
||||
transclude: true,
|
||||
scope: { ctrl: '=' },
|
||||
link: function(scope, elem) {
|
||||
link: (scope, elem) => {
|
||||
const panelContainer = elem.find('.panel-container');
|
||||
const panelContent = elem.find('.panel-content');
|
||||
const cornerInfoElem = elem.find('.panel-info-corner');
|
||||
@@ -184,7 +184,7 @@ module.directive('grafanaPanel', function($rootScope, $document, $timeout) {
|
||||
|
||||
infoDrop = new Drop({
|
||||
target: cornerInfoElem[0],
|
||||
content: function() {
|
||||
content: () => {
|
||||
return ctrl.getInfoContent({ mode: 'tooltip' });
|
||||
},
|
||||
classes: ctrl.error ? 'drop-error' : 'drop-help',
|
||||
@@ -208,7 +208,7 @@ module.directive('grafanaPanel', function($rootScope, $document, $timeout) {
|
||||
scope.$watchGroup(['ctrl.error', 'ctrl.panel.description'], updatePanelCornerInfo);
|
||||
scope.$watchCollection('ctrl.panel.links', updatePanelCornerInfo);
|
||||
|
||||
cornerInfoElem.on('click', function() {
|
||||
cornerInfoElem.on('click', () => {
|
||||
infoDrop.close();
|
||||
scope.$apply(ctrl.openInspector.bind(ctrl));
|
||||
});
|
||||
@@ -216,7 +216,7 @@ module.directive('grafanaPanel', function($rootScope, $document, $timeout) {
|
||||
elem.on('mouseenter', mouseEnter);
|
||||
elem.on('mouseleave', mouseLeave);
|
||||
|
||||
scope.$on('$destroy', function() {
|
||||
scope.$on('$destroy', () => {
|
||||
elem.off();
|
||||
cornerInfoElem.off();
|
||||
|
||||
@@ -232,7 +232,7 @@ module.directive('grafanaPanel', function($rootScope, $document, $timeout) {
|
||||
};
|
||||
});
|
||||
|
||||
module.directive('panelHelpCorner', function($rootScope) {
|
||||
module.directive('panelHelpCorner', $rootScope => {
|
||||
return {
|
||||
restrict: 'E',
|
||||
template: `
|
||||
@@ -242,6 +242,6 @@ module.directive('panelHelpCorner', function($rootScope) {
|
||||
</span>
|
||||
</span>
|
||||
`,
|
||||
link: function(scope, elem) {},
|
||||
link: (scope, elem) => {},
|
||||
};
|
||||
});
|
||||
|
||||
@@ -85,12 +85,12 @@ function panelHeader($compile) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
template: template,
|
||||
link: function(scope, elem, attrs) {
|
||||
link: (scope, elem, attrs) => {
|
||||
const menuElem = elem.find('.panel-menu');
|
||||
let menuScope;
|
||||
let isDragged;
|
||||
|
||||
elem.click(function(evt) {
|
||||
elem.click(evt => {
|
||||
const targetClass = evt.target.className;
|
||||
|
||||
// remove existing scope
|
||||
|
||||
@@ -170,8 +170,8 @@ export function queryTroubleshooter() {
|
||||
panelCtrl: '=',
|
||||
isOpen: '=',
|
||||
},
|
||||
link: function(scope, elem, attrs, ctrl) {
|
||||
ctrl.renderJsonExplorer = function(data) {
|
||||
link: (scope, elem, attrs, ctrl) => {
|
||||
ctrl.renderJsonExplorer = data => {
|
||||
const jsonElem = elem.find('.query-troubleshooter-json');
|
||||
|
||||
ctrl.jsonExplorer = new JsonExplorer(data, 3, {
|
||||
|
||||
@@ -7,7 +7,7 @@ export class SoloPanelCtrl {
|
||||
constructor($scope, $routeParams, $location, dashboardLoaderSrv, contextSrv, backendSrv) {
|
||||
let panelId;
|
||||
|
||||
$scope.init = function() {
|
||||
$scope.init = () => {
|
||||
contextSrv.sidemenu = false;
|
||||
appEvents.emit('toggle-sidemenu-hidden');
|
||||
|
||||
@@ -27,13 +27,13 @@ export class SoloPanelCtrl {
|
||||
return;
|
||||
}
|
||||
|
||||
dashboardLoaderSrv.loadDashboard($routeParams.type, $routeParams.slug, $routeParams.uid).then(function(result) {
|
||||
dashboardLoaderSrv.loadDashboard($routeParams.type, $routeParams.slug, $routeParams.uid).then(result => {
|
||||
result.meta.soloMode = true;
|
||||
$scope.initDashboard(result, $scope);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.initPanelScope = function() {
|
||||
$scope.initPanelScope = () => {
|
||||
const panelInfo = $scope.dashboard.getPanelInfoById(panelId);
|
||||
|
||||
// fake row ctrl scope
|
||||
|
||||
Reference in New Issue
Block a user