From a70eafb732136df893dd9633dfd7ccbd5d2498bd Mon Sep 17 00:00:00 2001 From: Ashley Harrison Date: Fri, 16 Jul 2021 11:29:46 +0100 Subject: [PATCH] Angular cleanup: Remove unused + controller (#36838) --- public/app/features/panel/all.ts | 1 - .../app/features/panel/panellinks/module.html | 70 ------------------- .../app/features/panel/panellinks/module.ts | 63 ----------------- 3 files changed, 134 deletions(-) delete mode 100644 public/app/features/panel/panellinks/module.html delete mode 100644 public/app/features/panel/panellinks/module.ts diff --git a/public/app/features/panel/all.ts b/public/app/features/panel/all.ts index d691575ccfc..38add665728 100644 --- a/public/app/features/panel/all.ts +++ b/public/app/features/panel/all.ts @@ -2,4 +2,3 @@ import './panel_directive'; import './query_ctrl'; import './panel_editor_tab'; import './query_editor_row'; -import './panellinks/module'; diff --git a/public/app/features/panel/panellinks/module.html b/public/app/features/panel/panellinks/module.html deleted file mode 100644 index 0d4a2557e8d..00000000000 --- a/public/app/features/panel/panellinks/module.html +++ /dev/null @@ -1,70 +0,0 @@ -
-
-
-
- Type -
- -
-
- -
- Dashboard - - - Url - -
- -
-
Title
- -
-
- -
-
- Url params - -
- - - - -
- -
-
- -
-
-
-
- -
- -
diff --git a/public/app/features/panel/panellinks/module.ts b/public/app/features/panel/panellinks/module.ts deleted file mode 100644 index 0bce9838482..00000000000 --- a/public/app/features/panel/panellinks/module.ts +++ /dev/null @@ -1,63 +0,0 @@ -import angular from 'angular'; -import { map, find, without } from 'lodash'; -import './link_srv'; -import { backendSrv } from 'app/core/services/backend_srv'; - -function panelLinksEditor() { - return { - scope: { - panel: '=', - }, - restrict: 'E', - controller: 'PanelLinksEditorCtrl', - templateUrl: 'public/app/features/panel/panellinks/module.html', - link: () => {}, - }; -} - -export class PanelLinksEditorCtrl { - /** @ngInject */ - constructor($scope: any) { - $scope.panel.links = $scope.panel.links || []; - - $scope.addLink = () => { - $scope.panel.links.push({ - type: 'dashboard', - }); - }; - - $scope.searchDashboards = (queryStr: string, callback: Function) => { - backendSrv.search({ query: queryStr }).then((hits) => { - const dashboards = map(hits, (dash) => { - return dash.title; - }); - - callback(dashboards); - }); - }; - - $scope.dashboardChanged = (link: any) => { - backendSrv.search({ query: link.dashboard }).then((hits) => { - const dashboard: any = find(hits, { title: link.dashboard }); - if (dashboard) { - if (dashboard.url) { - link.url = dashboard.url; - } else { - // To support legacy url's - link.dashUri = dashboard.uri; - } - link.title = dashboard.title; - } - }); - }; - - $scope.deleteLink = (link: any) => { - $scope.panel.links = without($scope.panel.links, link); - }; - } -} - -angular - .module('grafana.directives') - .directive('panelLinksEditor', panelLinksEditor) - .controller('PanelLinksEditorCtrl', PanelLinksEditorCtrl);