文件操作 - appNotification.ts
返回文件管理
返回主菜单
删除本文件
文件: /usr/share/grafana/public/app/core/copy/appNotification.ts
编辑文件内容
import { AppNotification, AppNotificationSeverity, AppNotificationTimeout } from 'app/types'; import { getMessageFromError } from 'app/core/utils/errors'; const defaultSuccessNotification = { title: '', text: '', severity: AppNotificationSeverity.Success, icon: 'check', timeout: AppNotificationTimeout.Success, }; const defaultWarningNotification = { title: '', text: '', severity: AppNotificationSeverity.Warning, icon: 'exclamation-triangle', timeout: AppNotificationTimeout.Warning, }; const defaultErrorNotification = { title: '', text: '', severity: AppNotificationSeverity.Error, icon: 'exclamation-triangle', timeout: AppNotificationTimeout.Error, }; export const createSuccessNotification = (title: string, text = ''): AppNotification => ({ ...defaultSuccessNotification, title: title, text: text, id: Date.now(), }); export const createErrorNotification = ( title: string, text: string | Error = '', component?: React.ReactElement ): AppNotification => { return { ...defaultErrorNotification, text: getMessageFromError(text), title, id: Date.now(), component, }; }; export const createWarningNotification = (title: string, text = ''): AppNotification => ({ ...defaultWarningNotification, title: title, text: text, id: Date.now(), });
修改文件时间
将文件时间修改为当前时间的前一年
删除文件