文件操作 - Stats.tsx
返回文件管理
返回主菜单
删除本文件
文件: /usr/share/grafana/public/app/plugins/datasource/cloudwatch/components/Stats.tsx
编辑文件内容
import React, { FunctionComponent } from 'react'; import { SelectableStrings } from '../types'; import { SelectableValue } from '@grafana/data'; import { Segment, Icon } from '@grafana/ui'; export interface Props { values: string[]; onChange: (values: string[]) => void; variableOptionGroup: SelectableValue<string>; stats: SelectableStrings; } const removeText = '-- remove stat --'; const removeOption: SelectableValue<string> = { label: removeText, value: removeText }; export const Stats: FunctionComponent<Props> = ({ stats, values, onChange, variableOptionGroup }) => ( <> {values && values.map((value, index) => ( <Segment allowCustomValue key={value + index} value={value} options={[removeOption, ...stats, variableOptionGroup]} onChange={({ value }) => onChange( value === removeText ? values.filter((_, i) => i !== index) : values.map((v, i) => (i === index ? value : v)) ) } /> ))} <Segment Component={ <a className="gf-form-label query-part"> <Icon name="plus" /> </a> } allowCustomValue onChange={({ value }) => onChange([...values, value])} options={[...stats.filter(({ value }) => !values.includes(value)), variableOptionGroup]} /> </> );
修改文件时间
将文件时间修改为当前时间的前一年
删除文件