文件操作 - DashLinksEditorCtrl.ts
返回文件管理
返回主菜单
删除本文件
文件: /usr/share/grafana/public/app/features/dashboard/components/DashLinks/DashLinksEditorCtrl.ts
编辑文件内容
import angular from 'angular'; import _ from 'lodash'; import { DashboardModel } from 'app/features/dashboard/state'; import { GrafanaRootScope } from 'app/routes/GrafanaCtrl'; import { CoreEvents } from 'app/types'; export let iconMap: { [key: string]: string } = { 'external link': 'external-link-alt', dashboard: 'apps', question: 'question-circle', info: 'info-circle', bolt: 'bolt', doc: 'file-alt', cloud: 'cloud', }; export class DashLinksEditorCtrl { dashboard: DashboardModel; iconMap: any; mode: any; link: any; emptyListCta = { title: 'There are no dashboard links added yet', buttonIcon: 'link', buttonTitle: 'Add Dashboard Link', infoBox: { __html: `<p> Dashboard Links allow you to place links to other dashboards and web sites directly below the dashboard header. </p>`, }, infoBoxTitle: 'What are Dashboard Links?', }; /** @ngInject */ constructor($scope: any, $rootScope: GrafanaRootScope) { this.iconMap = iconMap; this.dashboard.links = this.dashboard.links || []; this.mode = 'list'; $scope.$on('$destroy', () => { $rootScope.appEvent(CoreEvents.dashLinksUpdated); }); } backToList() { this.mode = 'list'; } setupNew = () => { this.mode = 'new'; this.link = { type: 'dashboards', icon: 'external link' }; }; addLink() { this.dashboard.links = [...this.dashboard.links, this.link]; this.mode = 'list'; this.dashboard.updateSubmenuVisibility(); } editLink(link: any) { this.link = link; this.mode = 'edit'; } saveLink() { this.dashboard.links = _.cloneDeep(this.dashboard.links); this.backToList(); } moveLink(index: string | number, dir: string | number) { // @ts-ignore _.move(this.dashboard.links, index, index + dir); } deleteLink(index: number) { this.dashboard.links.splice(index, 1); this.dashboard.updateSubmenuVisibility(); } } function dashLinksEditor() { return { restrict: 'E', controller: DashLinksEditorCtrl, templateUrl: 'public/app/features/dashboard/components/DashLinks/editor.html', bindToController: true, controllerAs: 'ctrl', scope: { dashboard: '=', }, }; } angular.module('grafana.directives').directive('dashLinksEditor', dashLinksEditor);
修改文件时间
将文件时间修改为当前时间的前一年
删除文件