types#TManageValue TypeScript Examples

The following examples show how to use types#TManageValue. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: manageQuery.tsx    From grafana-weathermap-panel with Apache License 2.0 6 votes vote down vote up
/** edit value for default select manage value */
  onChangeSelectManageValue = (value: SelectableValue<TManageValue>) => {
    const newMainMetric: Metric = this.state.mainMetric;
    newMainMetric.manageValue = value.value || 'err';
    this.setState({
      mainMetric: newMainMetric,
      //selectDefaultManageValue: value,
    });
    this.callBack();
  };
Example #2
Source File: manageQuery.tsx    From grafana-weathermap-panel with Apache License 2.0 6 votes vote down vote up
/** edit value for default select manage value */
  onChangeSelectManageValueB = (value: SelectableValue<TManageValue>) => {
    const newMainMetric: Metric = this.state.mainMetricB;
    //const arrayOrientedLinks: OrientedLink = this.props.options.arrayOrientedLinks
    newMainMetric.manageValue = value.value || 'err';
    this.setState({
      mainMetricB: newMainMetric,
    });
    this.callBackB();
  };
Example #3
Source File: manageQuery.tsx    From grafana-weathermap-panel with Apache License 2.0 6 votes vote down vote up
private getDefaultManageValue = (): SelectableValue<TManageValue> => {
    let defaultValue: SelectableValue<TManageValue> = { label: 'avg', value: 'avg' };
    const mainMetric: Metric = this.state.mainMetric;
    for (const value of this.state.selectManageValue) {
      if (mainMetric.manageValue) {
        if (mainMetric.manageValue === value.value) {
          defaultValue = value;
        }
      }
    }
    return defaultValue;
  };
Example #4
Source File: manageQuery.tsx    From grafana-weathermap-panel with Apache License 2.0 6 votes vote down vote up
private getDefaultManageValueB = (): SelectableValue<TManageValue> => {
    let defaultValue: SelectableValue<TManageValue> = { label: 'avg', value: 'avg' };
    const mainMetricB: Metric = this.state.mainMetricB;
    for (const value of this.state.selectManageValue) {
      if (mainMetricB.manageValue) {
        if (mainMetricB.manageValue === value.value) {
          defaultValue = value;
        }
      }
    }
    return defaultValue;
  };
Example #5
Source File: manageQuery.tsx    From grafana-weathermap-panel with Apache License 2.0 6 votes vote down vote up
/** fill data when component mount */
  componentDidMount = () => {
    this.fillSelectQuery();
    const newSelectManageValue: Array<SelectableValue<TManageValue>> = [
      { value: 'avg', label: 'average' },
      { value: 'sum', label: 'total' },
      { value: 'err', label: 'error' },
    ];
    // let defaultValue: SelectableValue<TManageValue> = newSelectManageValue[0];
    // for (const line of newSelectManageValue) {
    //   if (line.value === this.state.mainMetric.manageValue) {
    //     defaultValue = line;
    //   }
    // }

    this.setState({
      selectManageValue: newSelectManageValue,
      //selectDefaultManageValue: defaultValue,
    });
  };