UNPKG

kibana-riya

Version:

Kibana is an open source (Apache Licensed), browser based analytics and search dashboard for Elasticsearch. Kibana is a snap to setup and start using. Kibana strives to be easy to get started with, while also being flexible and powerful, just like Elastic

63 lines (55 loc) 1.61 kB
import _ from 'lodash'; import IndexedArray from 'ui/indexed_array'; import AggTypesAggParamsProvider from 'ui/agg_types/agg_params'; export default function VisTypeSchemasFactory(Private) { let AggParams = Private(AggTypesAggParamsProvider); function Schemas(schemas) { let self = this; _(schemas || []) .map(function (schema) { if (!schema.name) throw new Error('all schema must have a unique name'); if (schema.name === 'split') { schema.params = [ { name: 'row', default: true } ]; schema.editor = require('plugins/kbn_vislib_vis_types/controls/rows_or_columns.html'); } else if (schema.name === 'radius') { schema.editor = require('plugins/kbn_vislib_vis_types/controls/radius_ratio_option.html'); } _.defaults(schema, { min: 0, max: Infinity, group: 'buckets', title: schema.name, aggFilter: '*', editor: false, params: [], deprecate: false }); // convert the params into a params registry schema.params = new AggParams(schema.params); return schema; }) .tap(function (schemas) { self.all = new IndexedArray({ index: ['name'], group: ['group'], immutable: true, initialSet: schemas }); }) .groupBy('group') .forOwn(function (group, groupName) { self[groupName] = new IndexedArray({ index: ['name'], immutable: true, initialSet: group }); }) .commit(); } return Schemas; };