[aggTypes/paramTypes] naming cleanup (#14020)

This commit is contained in:
Spencer 2017-09-18 16:49:59 -07:00 committed by GitHub
parent 93a565c2ab
commit 199e5c3623
15 changed files with 156 additions and 156 deletions

View file

@ -1,18 +1,18 @@
import ngMock from 'ng_mock';
import expect from 'expect.js';
import { AggTypesAggParamsProvider } from 'ui/agg_types/agg_params';
import { AggTypesParamTypesBaseProvider } from 'ui/agg_types/param_types/base';
import { AggTypesParamTypesFieldProvider } from 'ui/agg_types/param_types/field';
import { AggTypesParamTypesOptionedProvider } from 'ui/agg_types/param_types/optioned';
import { AggTypesParamTypesRegexProvider } from 'ui/agg_types/param_types/regex';
import { BaseParamTypeProvider } from '../param_types/base';
import { FieldParamTypeProvider } from '../param_types/field';
import { OptionedParamTypeProvider } from '../param_types/optioned';
import { RegexParamTypeProvider } from '../param_types/regex';
describe('AggParams class', function () {
let AggParams;
let BaseAggParam;
let FieldAggParam;
let OptionedAggParam;
let RegexAggParam;
let BaseParamType;
let FieldParamType;
let OptionedParamType;
let RegexParamType;
beforeEach(ngMock.module('kibana'));
// stub out the param classes before we get the AggParams
@ -20,10 +20,10 @@ describe('AggParams class', function () {
// fetch out deps
beforeEach(ngMock.inject(function (Private) {
AggParams = Private(AggTypesAggParamsProvider);
BaseAggParam = Private(AggTypesParamTypesBaseProvider);
FieldAggParam = Private(AggTypesParamTypesFieldProvider);
OptionedAggParam = Private(AggTypesParamTypesOptionedProvider);
RegexAggParam = Private(AggTypesParamTypesRegexProvider);
BaseParamType = Private(BaseParamTypeProvider);
FieldParamType = Private(FieldParamTypeProvider);
OptionedParamType = Private(OptionedParamTypeProvider);
RegexParamType = Private(RegexParamTypeProvider);
}));
describe('constructor args', function () {
@ -41,17 +41,17 @@ describe('AggParams class', function () {
});
describe('AggParam creation', function () {
it('Uses the FieldAggParam class for params with the name "field"', function () {
it('Uses the FieldParamType class for params with the name "field"', function () {
const params = [
{ name: 'field' }
];
const aggParams = new AggParams(params);
expect(aggParams).to.have.length(params.length);
expect(aggParams[0]).to.be.a(FieldAggParam);
expect(aggParams[0]).to.be.a(FieldParamType);
});
it('Uses the OptionedAggParam class for params of type "optioned"', function () {
it('Uses the OptionedParamType class for params of type "optioned"', function () {
const params = [
{
name: 'interval',
@ -61,10 +61,10 @@ describe('AggParams class', function () {
const aggParams = new AggParams(params);
expect(aggParams).to.have.length(params.length);
expect(aggParams[0]).to.be.a(OptionedAggParam);
expect(aggParams[0]).to.be.a(OptionedParamType);
});
it('Uses the RegexAggParam class for params of type "regex"', function () {
it('Uses the RegexParamType class for params of type "regex"', function () {
const params = [
{
name: 'exclude',
@ -74,10 +74,10 @@ describe('AggParams class', function () {
const aggParams = new AggParams(params);
expect(aggParams).to.have.length(params.length);
expect(aggParams[0]).to.be.a(RegexAggParam);
expect(aggParams[0]).to.be.a(RegexParamType);
});
it('Always converts the params to a BaseAggParam', function () {
it('Always converts the params to a BaseParamType', function () {
const params = [
{
name: 'height',
@ -94,13 +94,13 @@ describe('AggParams class', function () {
];
const aggParams = new AggParams(params);
expect(BaseAggParam).to.have.property('callCount', params.length);
expect(FieldAggParam).to.have.property('callCount', 0);
expect(OptionedAggParam).to.have.property('callCount', 0);
expect(BaseParamType).to.have.property('callCount', params.length);
expect(FieldParamType).to.have.property('callCount', 0);
expect(OptionedParamType).to.have.property('callCount', 0);
expect(aggParams).to.have.length(params.length);
aggParams.forEach(function (aggParam) {
expect(aggParam).to.be.a(BaseAggParam);
expect(aggParam).to.be.a(BaseParamType);
});
});
});

View file

@ -2,36 +2,36 @@ import expect from 'expect.js';
import { reject } from 'lodash';
import ngMock from 'ng_mock';
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
import { AggTypesParamTypesBaseProvider } from 'ui/agg_types/param_types/base';
import { AggTypesParamTypesFieldProvider } from 'ui/agg_types/param_types/field';
import { BaseParamTypeProvider } from '../../param_types/base';
import { FieldParamTypeProvider } from '../../param_types/field';
describe('Field', function () {
let BaseAggParam;
let FieldAggParam;
let BaseParamType;
let FieldParamType;
let indexPattern;
beforeEach(ngMock.module('kibana'));
// fetch out deps
beforeEach(ngMock.inject(function (Private) {
BaseAggParam = Private(AggTypesParamTypesBaseProvider);
FieldAggParam = Private(AggTypesParamTypesFieldProvider);
BaseParamType = Private(BaseParamTypeProvider);
FieldParamType = Private(FieldParamTypeProvider);
indexPattern = Private(FixturesStubbedLogstashIndexPatternProvider);
}));
describe('constructor', function () {
it('it is an instance of BaseAggParam', function () {
const aggParam = new FieldAggParam({
it('it is an instance of BaseParamType', function () {
const aggParam = new FieldParamType({
name: 'field'
});
expect(aggParam).to.be.a(BaseAggParam);
expect(aggParam).to.be.a(BaseParamType);
});
});
describe('getFieldOptions', function () {
it('should return only aggregatable fields by default', function () {
const aggParam = new FieldAggParam({
const aggParam = new FieldParamType({
name: 'field'
});
@ -45,7 +45,7 @@ describe('Field', function () {
});
it('should return all fields if onlyAggregatable is false', function () {
const aggParam = new FieldAggParam({
const aggParam = new FieldParamType({
name: 'field'
});

View file

@ -1,26 +1,26 @@
import _ from 'lodash';
import expect from 'expect.js';
import ngMock from 'ng_mock';
import { AggTypesParamTypesBaseProvider } from 'ui/agg_types/param_types/base';
import { AggTypesParamTypesRawJsonProvider } from 'ui/agg_types/param_types/raw_json';
import { BaseParamTypeProvider } from '../../param_types/base';
import { JsonParamTypeProvider } from '../../param_types/json';
// eslint-disable-next-line kibana-custom/no-default-export
export default describe('JSON', function () {
const paramName = 'json_test';
let BaseAggParam;
let JsonAggParam;
let BaseParamType;
let JsonParamType;
let aggParam;
let aggConfig;
let output;
function initAggParam(config) {
function initParamType(config) {
config = config || {};
const defaults = {
name: paramName,
type: 'json'
};
aggParam = new JsonAggParam(_.defaults(config, defaults));
aggParam = new JsonParamType(_.defaults(config, defaults));
}
beforeEach(ngMock.module('kibana'));
@ -30,15 +30,15 @@ export default describe('JSON', function () {
aggConfig = { params: {} };
output = { params: {} };
BaseAggParam = Private(AggTypesParamTypesBaseProvider);
JsonAggParam = Private(AggTypesParamTypesRawJsonProvider);
BaseParamType = Private(BaseParamTypeProvider);
JsonParamType = Private(JsonParamTypeProvider);
initAggParam();
initParamType();
}));
describe('constructor', function () {
it('it is an instance of BaseAggParam', function () {
expect(aggParam).to.be.a(BaseAggParam);
it('it is an instance of BaseParamType', function () {
expect(aggParam).to.be.a(BaseParamType);
});
});

View file

@ -1,28 +1,28 @@
import expect from 'expect.js';
import ngMock from 'ng_mock';
import { AggTypesParamTypesBaseProvider } from 'ui/agg_types/param_types/base';
import { AggTypesParamTypesOptionedProvider } from 'ui/agg_types/param_types/optioned';
import { BaseParamTypeProvider } from '../../param_types/base';
import { OptionedParamTypeProvider } from '../../param_types/optioned';
describe('Optioned', function () {
let BaseAggParam;
let OptionedAggParam;
let BaseParamType;
let OptionedParamType;
beforeEach(ngMock.module('kibana'));
// fetch out deps
beforeEach(ngMock.inject(function (Private) {
BaseAggParam = Private(AggTypesParamTypesBaseProvider);
OptionedAggParam = Private(AggTypesParamTypesOptionedProvider);
BaseParamType = Private(BaseParamTypeProvider);
OptionedParamType = Private(OptionedParamTypeProvider);
}));
describe('constructor', function () {
it('it is an instance of BaseAggParam', function () {
const aggParam = new OptionedAggParam({
it('it is an instance of BaseParamType', function () {
const aggParam = new OptionedParamType({
name: 'some_param',
type: 'optioned'
});
expect(aggParam).to.be.a(BaseAggParam);
expect(aggParam).to.be.a(BaseParamType);
});
});
});

View file

@ -1,34 +1,34 @@
import expect from 'expect.js';
import ngMock from 'ng_mock';
import { AggTypesParamTypesBaseProvider } from 'ui/agg_types/param_types/base';
import { AggTypesParamTypesRegexProvider } from 'ui/agg_types/param_types/regex';
import { BaseParamTypeProvider } from '../../param_types/base';
import { RegexParamTypeProvider } from '../../param_types/regex';
import { VisProvider } from 'ui/vis';
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
describe('Regex', function () {
let BaseAggParam;
let RegexAggParam;
let BaseParamType;
let RegexParamType;
let Vis;
let indexPattern;
beforeEach(ngMock.module('kibana'));
// fetch out deps
beforeEach(ngMock.inject(function (Private) {
BaseAggParam = Private(AggTypesParamTypesBaseProvider);
RegexAggParam = Private(AggTypesParamTypesRegexProvider);
BaseParamType = Private(BaseParamTypeProvider);
RegexParamType = Private(RegexParamTypeProvider);
Vis = Private(VisProvider);
indexPattern = Private(FixturesStubbedLogstashIndexPatternProvider);
}));
describe('constructor', function () {
it('should be an instance of BaseAggParam', function () {
const aggParam = new RegexAggParam({
it('should be an instance of BaseParamType', function () {
const aggParam = new RegexParamType({
name: 'some_param',
type: 'regex'
});
expect(aggParam).to.be.a(BaseAggParam);
expect(aggParam).to.be.a(BaseParamType);
expect(aggParam).to.have.property('write');
});
});
@ -48,7 +48,7 @@ describe('Regex', function () {
});
aggConfig = vis.aggs[0];
aggParam = new RegexAggParam({
aggParam = new RegexParamType({
name: paramName,
type: 'regex'
});

View file

@ -1,14 +1,14 @@
import _ from 'lodash';
import expect from 'expect.js';
import ngMock from 'ng_mock';
import { AggTypesParamTypesBaseProvider } from 'ui/agg_types/param_types/base';
import { AggTypesParamTypesStringProvider } from 'ui/agg_types/param_types/string';
import { BaseParamTypeProvider } from '../../param_types/base';
import { StringParamTypeProvider } from '../../param_types/string';
// eslint-disable-next-line kibana-custom/no-default-export
export default describe('String', function () {
const paramName = 'json_test';
let BaseAggParam;
let StringAggParam;
let BaseParamType;
let StringParamType;
let aggParam;
let aggConfig;
let output;
@ -20,24 +20,24 @@ export default describe('String', function () {
type: 'string'
};
aggParam = new StringAggParam(_.defaults(config, defaults));
aggParam = new StringParamType(_.defaults(config, defaults));
}
beforeEach(ngMock.module('kibana'));
// fetch our deps
beforeEach(ngMock.inject(function (Private) {
BaseAggParam = Private(AggTypesParamTypesBaseProvider);
StringAggParam = Private(AggTypesParamTypesStringProvider);
BaseParamType = Private(BaseParamTypeProvider);
StringParamType = Private(StringParamTypeProvider);
aggConfig = { params: {} };
output = { params: {} };
}));
describe('constructor', function () {
it('it is an instance of BaseAggParam', function () {
it('it is an instance of BaseParamType', function () {
initAggParam();
expect(aggParam).to.be.a(BaseAggParam);
expect(aggParam).to.be.a(BaseParamType);
});
});

View file

@ -2,6 +2,6 @@ import './_field';
import './_optioned';
import './_regex';
import './_string';
import './_raw_json';
import './_json';
describe('ParamTypes', function () {
});

View file

@ -1,8 +1,8 @@
import _ from 'lodash';
import sinon from 'sinon';
import { AggTypesParamTypesBaseProvider } from 'ui/agg_types/param_types/base';
import { AggTypesParamTypesFieldProvider } from 'ui/agg_types/param_types/field';
import { AggTypesParamTypesOptionedProvider } from 'ui/agg_types/param_types/optioned';
import { BaseParamTypeProvider } from '../../param_types/base';
import { FieldParamTypeProvider } from '../../param_types/field';
import { OptionedParamTypeProvider } from '../../param_types/optioned';
function ParamClassStub(parent, body) {
const stub = sinon.spy(body || function () {
@ -29,19 +29,19 @@ function ParamClassStub(parent, body) {
// eslint-disable-next-line kibana-custom/no-default-export
export default function stubParamClasses(Private) {
const BaseAggParam = Private.stub(
AggTypesParamTypesBaseProvider,
BaseParamTypeProvider,
new ParamClassStub(null, function (config) {
_.assign(this, config);
})
);
Private.stub(
AggTypesParamTypesFieldProvider,
FieldParamTypeProvider,
new ParamClassStub(BaseAggParam)
);
Private.stub(
AggTypesParamTypesOptionedProvider,
OptionedParamTypeProvider,
new ParamClassStub(BaseAggParam)
);
}

View file

@ -1,21 +1,21 @@
import 'ui/filters/label';
import _ from 'lodash';
import { IndexedArray } from 'ui/indexed_array';
import { AggTypesParamTypesFieldProvider } from 'ui/agg_types/param_types/field';
import { AggTypesParamTypesOptionedProvider } from 'ui/agg_types/param_types/optioned';
import { AggTypesParamTypesRegexProvider } from 'ui/agg_types/param_types/regex';
import { AggTypesParamTypesStringProvider } from 'ui/agg_types/param_types/string';
import { AggTypesParamTypesRawJsonProvider } from 'ui/agg_types/param_types/raw_json';
import { AggTypesParamTypesBaseProvider } from 'ui/agg_types/param_types/base';
import { FieldParamTypeProvider } from './param_types/field';
import { OptionedParamTypeProvider } from './param_types/optioned';
import { RegexParamTypeProvider } from './param_types/regex';
import { StringParamTypeProvider } from './param_types/string';
import { JsonParamTypeProvider } from './param_types/json';
import { BaseParamTypeProvider } from './param_types/base';
export function AggTypesAggParamsProvider(Private) {
const paramTypeMap = {
field: Private(AggTypesParamTypesFieldProvider),
optioned: Private(AggTypesParamTypesOptionedProvider),
regex: Private(AggTypesParamTypesRegexProvider),
string: Private(AggTypesParamTypesStringProvider),
json: Private(AggTypesParamTypesRawJsonProvider),
_default: Private(AggTypesParamTypesBaseProvider)
field: Private(FieldParamTypeProvider),
optioned: Private(OptionedParamTypeProvider),
regex: Private(RegexParamTypeProvider),
string: Private(StringParamTypeProvider),
json: Private(JsonParamTypeProvider),
_default: Private(BaseParamTypeProvider)
};
/**

View file

@ -1,10 +1,10 @@
import _ from 'lodash';
export function AggTypesParamTypesBaseProvider() {
export function BaseParamTypeProvider() {
function BaseAggParam(config) {
function BaseParamType(config) {
_.assign(this, config);
}
return BaseAggParam;
return BaseParamType;
}

View file

@ -1,25 +1,25 @@
import { SavedObjectNotFound } from 'ui/errors';
import _ from 'lodash';
import editorHtml from 'ui/agg_types/controls/field.html';
import { AggTypesParamTypesBaseProvider } from 'ui/agg_types/param_types/base';
import editorHtml from '../controls/field.html';
import { BaseParamTypeProvider } from './base';
import 'ui/filters/field_type';
import { IndexedArray } from 'ui/indexed_array';
import { Notifier } from 'ui/notify/notifier';
export function AggTypesParamTypesFieldProvider(Private, $filter) {
const BaseAggParam = Private(AggTypesParamTypesBaseProvider);
export function FieldParamTypeProvider(Private, $filter) {
const BaseParamType = Private(BaseParamTypeProvider);
const notifier = new Notifier();
_.class(FieldAggParam).inherits(BaseAggParam);
function FieldAggParam(config) {
FieldAggParam.Super.call(this, config);
_.class(FieldParamType).inherits(BaseParamType);
function FieldParamType(config) {
FieldParamType.Super.call(this, config);
}
FieldAggParam.prototype.editor = editorHtml;
FieldAggParam.prototype.scriptable = true;
FieldAggParam.prototype.filterFieldTypes = '*';
FieldParamType.prototype.editor = editorHtml;
FieldParamType.prototype.scriptable = true;
FieldParamType.prototype.filterFieldTypes = '*';
// retain only the fields with the aggregatable property if the onlyAggregatable option is true
FieldAggParam.prototype.onlyAggregatable = true;
FieldParamType.prototype.onlyAggregatable = true;
/**
* Called to serialize values for saving an aggConfig object
@ -27,14 +27,14 @@ export function AggTypesParamTypesFieldProvider(Private, $filter) {
* @param {field} field - the field that was selected
* @return {string}
*/
FieldAggParam.prototype.serialize = function (field) {
FieldParamType.prototype.serialize = function (field) {
return field.name;
};
/**
* Get the options for this field from the indexPattern
*/
FieldAggParam.prototype.getFieldOptions = function (aggConfig) {
FieldParamType.prototype.getFieldOptions = function (aggConfig) {
const indexPattern = aggConfig.getIndexPattern();
let fields = indexPattern.fields.raw;
@ -70,7 +70,7 @@ export function AggTypesParamTypesFieldProvider(Private, $filter) {
* @param {string} fieldName
* @return {field}
*/
FieldAggParam.prototype.deserialize = function (fieldName, aggConfig) {
FieldParamType.prototype.deserialize = function (fieldName, aggConfig) {
const field = aggConfig.getIndexPattern().fields.byName[fieldName];
if (!field) {
@ -95,7 +95,7 @@ export function AggTypesParamTypesFieldProvider(Private, $filter) {
* for the agg
* @return {undefined}
*/
FieldAggParam.prototype.write = function (aggConfig, output) {
FieldParamType.prototype.write = function (aggConfig, output) {
const field = aggConfig.getField();
if (!field) {
@ -112,5 +112,5 @@ export function AggTypesParamTypesFieldProvider(Private, $filter) {
}
};
return FieldAggParam;
return FieldParamType;
}

View file

@ -1,19 +1,19 @@
import _ from 'lodash';
import editorHtml from 'ui/agg_types/controls/raw_json.html';
import { AggTypesParamTypesBaseProvider } from 'ui/agg_types/param_types/base';
import editorHtml from '../controls/raw_json.html';
import { BaseParamTypeProvider } from './base';
export function AggTypesParamTypesRawJsonProvider(Private) {
export function JsonParamTypeProvider(Private) {
const BaseAggParam = Private(AggTypesParamTypesBaseProvider);
const BaseParamType = Private(BaseParamTypeProvider);
_.class(RawJSONAggParam).inherits(BaseAggParam);
function RawJSONAggParam(config) {
_.class(JsonParamType).inherits(BaseParamType);
function JsonParamType(config) {
// force name override
config = _.defaults(config, { name: 'json' });
RawJSONAggParam.Super.call(this, config);
JsonParamType.Super.call(this, config);
}
RawJSONAggParam.prototype.editor = editorHtml;
JsonParamType.prototype.editor = editorHtml;
/**
* Write the aggregation parameter.
@ -25,17 +25,17 @@ export function AggTypesParamTypesRawJsonProvider(Private) {
* for the agg
* @return {undefined}
*/
RawJSONAggParam.prototype.write = function (aggConfig, output) {
let paramJSON;
JsonParamType.prototype.write = function (aggConfig, output) {
let paramJson;
const param = aggConfig.params[this.name];
if (!param) {
return;
}
// handle invalid JSON input
// handle invalid Json input
try {
paramJSON = JSON.parse(param);
paramJson = JSON.parse(param);
} catch (err) {
return;
}
@ -70,9 +70,9 @@ export function AggTypesParamTypesRawJsonProvider(Private) {
return compare(srcA, srcB);
}
output.params = filteredCombine(output.params, paramJSON);
output.params = filteredCombine(output.params, paramJson);
return;
};
return RawJSONAggParam;
return JsonParamType;
}

View file

@ -1,14 +1,14 @@
import _ from 'lodash';
import { IndexedArray } from 'ui/indexed_array';
import { AggTypesParamTypesBaseProvider } from 'ui/agg_types/param_types/base';
import { BaseParamTypeProvider } from './base';
export function AggTypesParamTypesOptionedProvider(Private) {
export function OptionedParamTypeProvider(Private) {
const BaseAggParam = Private(AggTypesParamTypesBaseProvider);
const BaseParamType = Private(BaseParamTypeProvider);
_.class(OptionedAggParam).inherits(BaseAggParam);
function OptionedAggParam(config) {
OptionedAggParam.Super.call(this, config);
_.class(OptionedParamType).inherits(BaseParamType);
function OptionedParamType(config) {
OptionedParamType.Super.call(this, config);
this.options = new IndexedArray({
index: ['val'],
@ -22,7 +22,7 @@ export function AggTypesParamTypesOptionedProvider(Private) {
* @param {object} selected - the option that was selected
* @return {any}
*/
OptionedAggParam.prototype.serialize = function (selected) {
OptionedParamType.prototype.serialize = function (selected) {
return selected.val;
};
@ -33,7 +33,7 @@ export function AggTypesParamTypesOptionedProvider(Private) {
* @param {any} val - the value that was saved
* @return {object}
*/
OptionedAggParam.prototype.deserialize = function (val) {
OptionedParamType.prototype.deserialize = function (val) {
return this.options.byVal[val];
};
@ -47,9 +47,9 @@ export function AggTypesParamTypesOptionedProvider(Private) {
* for the agg
* @return {undefined}
*/
OptionedAggParam.prototype.write = function (aggConfig, output) {
OptionedParamType.prototype.write = function (aggConfig, output) {
output.params[this.name] = aggConfig.params[this.name].val;
};
return OptionedAggParam;
return OptionedParamType;
}

View file

@ -1,25 +1,25 @@
import _ from 'lodash';
import editorHtml from 'ui/agg_types/controls/regular_expression.html';
import { AggTypesParamTypesBaseProvider } from 'ui/agg_types/param_types/base';
import editorHtml from '../controls/regular_expression.html';
import { BaseParamTypeProvider } from './base';
export function AggTypesParamTypesRegexProvider(Private) {
export function RegexParamTypeProvider(Private) {
const BaseAggParam = Private(AggTypesParamTypesBaseProvider);
const BaseParamType = Private(BaseParamTypeProvider);
_.class(RegexAggParam).inherits(BaseAggParam);
function RegexAggParam(config) {
_.class(RegexParamType).inherits(BaseParamType);
function RegexParamType(config) {
_.defaults(config, { pattern: '' });
RegexAggParam.Super.call(this, config);
RegexParamType.Super.call(this, config);
}
RegexAggParam.prototype.editor = editorHtml;
RegexParamType.prototype.editor = editorHtml;
/**
* Disabled state of the agg param
*
* @return {bool}
*/
RegexAggParam.prototype.disabled = function () {
RegexParamType.prototype.disabled = function () {
return false;
};
@ -33,7 +33,7 @@ export function AggTypesParamTypesRegexProvider(Private) {
* for the agg
* @return {undefined}
*/
RegexAggParam.prototype.write = function (aggConfig, output) {
RegexParamType.prototype.write = function (aggConfig, output) {
const param = aggConfig.params[this.name];
const paramType = aggConfig.type.params.byName[this.name];
@ -49,5 +49,5 @@ export function AggTypesParamTypesRegexProvider(Private) {
output.params[this.name] = obj;
};
return RegexAggParam;
return RegexParamType;
}

View file

@ -1,17 +1,17 @@
import _ from 'lodash';
import editorHtml from 'ui/agg_types/controls/string.html';
import { AggTypesParamTypesBaseProvider } from 'ui/agg_types/param_types/base';
import editorHtml from '../controls/string.html';
import { BaseParamTypeProvider } from './base';
export function AggTypesParamTypesStringProvider(Private) {
export function StringParamTypeProvider(Private) {
const BaseAggParam = Private(AggTypesParamTypesBaseProvider);
const BaseParamType = Private(BaseParamTypeProvider);
_.class(ScriptAggParam).inherits(BaseAggParam);
function ScriptAggParam(config) {
ScriptAggParam.Super.call(this, config);
_.class(StringParamType).inherits(BaseParamType);
function StringParamType(config) {
StringParamType.Super.call(this, config);
}
ScriptAggParam.prototype.editor = editorHtml;
StringParamType.prototype.editor = editorHtml;
/**
* Write the aggregation parameter.
@ -23,11 +23,11 @@ export function AggTypesParamTypesStringProvider(Private) {
* for the agg
* @return {undefined}
*/
ScriptAggParam.prototype.write = function (aggConfig, output) {
StringParamType.prototype.write = function (aggConfig, output) {
if (aggConfig.params[this.name] && aggConfig.params[this.name].length) {
output.params[this.name] = aggConfig.params[this.name];
}
};
return ScriptAggParam;
return StringParamType;
}