diff --git a/public/app/features/dashboard/settings/settings.html b/public/app/features/dashboard/settings/settings.html
index 382f2059fea..c21d8ce4375 100644
--- a/public/app/features/dashboard/settings/settings.html
+++ b/public/app/features/dashboard/settings/settings.html
@@ -64,5 +64,5 @@
-
-
Add link
+
+
diff --git a/public/app/features/dashlinks/editor.ts b/public/app/features/dashlinks/editor.ts
new file mode 100644
index 00000000000..6b27d38870e
--- /dev/null
+++ b/public/app/features/dashlinks/editor.ts
@@ -0,0 +1,82 @@
+import angular from 'angular';
+import _ from 'lodash';
+import appEvents from 'app/core/app_events';
+
+export var iconMap = {
+ "external link": "fa-external-link",
+ "dashboard": "fa-th-large",
+ "question": "fa-question",
+ "info": "fa-info",
+ "bolt": "fa-bolt",
+ "doc": "fa-file-text-o",
+ "cloud": "fa-cloud",
+};
+
+export class DashLinkEditorCtrl {
+ dashboard: any;
+ iconMap: any;
+ mode: any;
+ link: any;
+ currentLink: any;
+
+ /** @ngInject */
+ constructor($scope, $rootScope) {
+ this.iconMap = iconMap;
+ this.dashboard.links = this.dashboard.links || [];
+ this.mode = 'list';
+ }
+
+ backToList() {
+ this.mode = 'list';
+ }
+
+ addLinkMode() {
+ this.mode = 'new';
+ }
+
+ editLinkMode(index) {
+ this.currentLink = index;
+ this.mode = 'edit';
+ }
+
+ addLink(type, tags) {
+ this.dashboard.links.push({ type: type, tags: tags, icon: 'external link' });
+ this.dashboard.updateSubmenuVisibility();
+ this.updated();
+ this.mode = 'list';
+ }
+
+ editLink(index) {
+
+ }
+
+ moveLink(index, dir) {
+ _.move(this.dashboard.links, index, index+dir);
+ this.updated();
+ }
+
+ updated() {
+ appEvents.emit('dash-links-updated');
+ }
+
+ deleteLink(index) {
+ this.dashboard.links.splice(index, 1);
+ this.dashboard.updateSubmenuVisibility();
+ this.updated();
+ }
+}
+
+function dashLinksEditor() {
+ return {
+ restrict: 'E',
+ controller: DashLinkEditorCtrl,
+ templateUrl: 'public/app/features/dashlinks/editor.html',
+ bindToController: true,
+ controllerAs: 'ctrl',
+ scope: {
+ dashboard: "="
+ }
+ };
+}
+
+angular.module('grafana.directives').directive('dashLinksEditor', dashLinksEditor);
diff --git a/public/app/features/dashlinks/module.ts b/public/app/features/dashlinks/module.ts
index 9f3b4055cee..371087c4069 100644
--- a/public/app/features/dashlinks/module.ts
+++ b/public/app/features/dashlinks/module.ts
@@ -1,25 +1,6 @@
import angular from 'angular';
import _ from 'lodash';
-
-var iconMap = {
- "external link": "fa-external-link",
- "dashboard": "fa-th-large",
- "question": "fa-question",
- "info": "fa-info",
- "bolt": "fa-bolt",
- "doc": "fa-file-text-o",
- "cloud": "fa-cloud",
-};
-
-function dashLinksEditor() {
- return {
- restrict: 'E',
- controller: 'DashLinkEditorCtrl',
- templateUrl: 'public/app/features/dashlinks/editor.html',
- link: function() {
- }
- };
-}
+import {iconMap} from './editor';
function dashLinksContainer() {
return {
@@ -162,37 +143,6 @@ export class DashLinksContainerCtrl {
}
}
-export class DashLinkEditorCtrl {
- /** @ngInject */
- constructor($scope, $rootScope) {
- $scope.iconMap = iconMap;
- $scope.dashboard.links = $scope.dashboard.links || [];
-
- $scope.addLink = function() {
- $scope.dashboard.links.push({ type: 'dashboards', icon: 'external link' });
- $scope.dashboard.updateSubmenuVisibility();
- $scope.updated();
- };
-
- $scope.moveLink = function(index, dir) {
- _.move($scope.dashboard.links, index, index+dir);
- $scope.updated();
- };
-
- $scope.updated = function() {
- $rootScope.appEvent('dash-links-updated');
- };
-
- $scope.deleteLink = function(index) {
- $scope.dashboard.links.splice(index, 1);
- $scope.dashboard.updateSubmenuVisibility();
- $scope.updated();
- };
- }
-}
-
-angular.module('grafana.directives').directive('dashLinksEditor', dashLinksEditor);
angular.module('grafana.directives').directive('dashLinksContainer', dashLinksContainer);
angular.module('grafana.directives').directive('dashLink', dashLink);
angular.module('grafana.directives').controller("DashLinksContainerCtrl", DashLinksContainerCtrl);
-angular.module('grafana.directives').controller('DashLinkEditorCtrl', DashLinkEditorCtrl);