文件操作 - AlignmentPeriods.tsx
返回文件管理
返回主菜单
删除本文件
文件: /usr/share/grafana/public/app/plugins/datasource/cloud-monitoring/components/AlignmentPeriods.tsx
编辑文件内容
import React, { FC } from 'react'; import _ from 'lodash'; import { TemplateSrv } from 'app/features/templating/template_srv'; import kbn from 'app/core/utils/kbn'; import { SelectableValue } from '@grafana/data'; import { Segment } from '@grafana/ui'; import { alignmentPeriods, alignOptions } from '../constants'; export interface Props { onChange: (alignmentPeriod: string) => void; templateSrv: TemplateSrv; templateVariableOptions: Array<SelectableValue<string>>; alignmentPeriod: string; perSeriesAligner: string; usedAlignmentPeriod: string; } export const AlignmentPeriods: FC<Props> = ({ alignmentPeriod, templateSrv, templateVariableOptions, onChange, perSeriesAligner, usedAlignmentPeriod, }) => { const alignment = alignOptions.find(ap => ap.value === templateSrv.replace(perSeriesAligner)); const formatAlignmentText = `${kbn.secondsToHms(usedAlignmentPeriod)} interval (${alignment ? alignment.text : ''})`; const options = alignmentPeriods.map(ap => ({ ...ap, label: ap.text, })); const visibleOptions = options.filter(ap => !ap.hidden); return ( <> <div className="gf-form-inline"> <label className="gf-form-label query-keyword width-9">Alignment Period</label> <Segment onChange={({ value }) => onChange(value!)} value={[...options, ...templateVariableOptions].find(s => s.value === alignmentPeriod)} options={[ { label: 'Template Variables', options: templateVariableOptions, }, { label: 'Aggregations', expanded: true, options: visibleOptions, }, ]} placeholder="Select Alignment" ></Segment> <div className="gf-form gf-form--grow"> {usedAlignmentPeriod && <label className="gf-form-label gf-form-label--grow">{formatAlignmentText}</label>} </div> </div> </> ); };
修改文件时间
将文件时间修改为当前时间的前一年
删除文件