コード例 #1
0
 it('parses a mix of results and errors', () => {
   const response = {"results":[{"series":[{"name":"m1","columns":["fieldKey"],"values":[["f1"],["f2"]]}]},{"error": "measurement not found: m2"}]};
   const result = parseShowFieldKeys(response);
   expect(result.errors).to.eql(['measurement not found: m2']);
   expect(result.fieldSets).to.eql({
     m1: ['f1', 'f2'],
   });
 });
コード例 #2
0
  it('parses a single result', () => {
    const response = {"results":[{"series":[{"name":"m1","columns":["fieldKey"],"values":[["f1"],["f2"]]}]}]};

    const result = parseShowFieldKeys(response);
    expect(result.errors).to.eql([]);
    expect(result.fieldSets).to.eql({
      m1: ['f1', 'f2'],
    });
  });
コード例 #3
0
ファイル: FieldList.js プロジェクト: lukehuang/chronograf
    showFieldKeys(proxySource, database, measurement, retentionPolicy).then((resp) => {
      const {errors, fieldSets} = showFieldKeysParser(resp.data);
      if (errors.length) {
        // TODO: do something
      }

      this.setState({
        fields: fieldSets[measurement].map((f) => {
          return {field: f, funcs: []};
        }),
      });
    });
コード例 #4
0
 it('parses multiple errors', () => {
   const response = {"results":[{"error": "measurement not found: m1"}, {"error": "measurement not found: m2"}]};
   const result = parseShowFieldKeys(response);
   expect(result.errors).to.eql(['measurement not found: m1', 'measurement not found: m2']);
   expect(result.fieldSets).to.eql({});
 });