文件操作 - TimeSyncButton.tsx
返回文件管理
返回主菜单
删除本文件
文件: /usr/share/grafana/public/app/features/explore/TimeSyncButton.tsx
编辑文件内容
import React from 'react'; import classNames from 'classnames'; import { css } from 'emotion'; import { Tooltip, useTheme, stylesFactory, Icon } from '@grafana/ui'; import { GrafanaTheme } from '@grafana/data'; const getStyles = stylesFactory((theme: GrafanaTheme) => { return { noRightBorderStyle: css` label: noRightBorderStyle; border-right: 0; `, /* * Required top-padding, otherwise is fa-link icon in active state * cut off on top due to fontAwesome icon position */ topPadding: css` label: topPadding; padding-top: 1px; `, }; }); interface TimeSyncButtonProps { isSynced: boolean; onClick: () => void; } export function TimeSyncButton(props: TimeSyncButtonProps) { const { onClick, isSynced } = props; const theme = useTheme(); const styles = getStyles(theme); const syncTimesTooltip = () => { const { isSynced } = props; const tooltip = isSynced ? 'Unsync all views' : 'Sync all views to this time range'; return <>{tooltip}</>; }; return ( <Tooltip content={syncTimesTooltip} placement="bottom"> <button className={classNames('btn navbar-button navbar-button--attached', { [`explore-active-button`]: isSynced, })} aria-label={isSynced ? 'Synced times' : 'Unsynced times'} onClick={() => onClick()} > <Icon name="link" className={classNames(styles.topPadding, isSynced && 'icon-brand-gradient')} size="lg" /> </button> </Tooltip> ); }
修改文件时间
将文件时间修改为当前时间的前一年
删除文件