| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- 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';
- }
- addLink() {
- this.dashboard.links.push({ type: 'dashboard', icon: 'external link' });
- this.dashboard.updateSubmenuVisibility();
- this.updated();
- this.mode = 'new';
- }
- editLink(index) {
- }
- saveLink() {
- this.updated();
- this.backToList();
- }
- 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);
|