文件操作 - actions.ts
返回文件管理
返回主菜单
删除本文件
文件: /usr/share/grafana/public/app/features/variables/textbox/actions.ts
编辑文件内容
import { TextBoxVariableModel } from '../types'; import { ThunkResult } from '../../../types'; import { getVariable } from '../state/selectors'; import { variableAdapters } from '../adapters'; import { createTextBoxOptions } from './reducer'; import { toVariableIdentifier, toVariablePayload, VariableIdentifier } from '../state/types'; import { setOptionFromUrl } from '../state/actions'; import { UrlQueryValue } from '@grafana/data'; import { changeVariableProp } from '../state/sharedReducer'; export const updateTextBoxVariableOptions = (identifier: VariableIdentifier): ThunkResult<void> => { return async (dispatch, getState) => { await dispatch(createTextBoxOptions(toVariablePayload(identifier))); const variableInState = getVariable<TextBoxVariableModel>(identifier.id, getState()); await variableAdapters.get(identifier.type).setValue(variableInState, variableInState.options[0], true); }; }; export const setTextBoxVariableOptionsFromUrl = ( identifier: VariableIdentifier, urlValue: UrlQueryValue ): ThunkResult<void> => async (dispatch, getState) => { const variableInState = getVariable<TextBoxVariableModel>(identifier.id, getState()); dispatch(changeVariableProp(toVariablePayload(variableInState, { propName: 'query', propValue: urlValue }))); await dispatch(setOptionFromUrl(toVariableIdentifier(variableInState), urlValue)); };
修改文件时间
将文件时间修改为当前时间的前一年
删除文件