Created
August 22, 2017 23:28
-
-
Save anonymous/aa9a3af41b8489792df29fa1b45d33aa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/core_plugins/testbed/public/testbed.html b/src/core_plugins/testbed/public/testbed.html | |
index 3cb9fa9be..cc904d0ee 100644 | |
--- a/src/core_plugins/testbed/public/testbed.html | |
+++ b/src/core_plugins/testbed/public/testbed.html | |
@@ -1,7 +1,7 @@ | |
<div class="kuiViewContent"> | |
<div class="kuiViewContentItem"> | |
- <pre ng-if="testbed.data">{{ testbed.data }}</pre> | |
+ <pre ng-if="testbed.data">{{ testbed.data | json }}</pre> | |
<!-- All markup within the CONTENT section below can be deleted and replaced with whatever markup you need to demonstate your functionality. Nothing need be preserved. --> | |
<!-- CONTENT START --> | |
diff --git a/src/core_plugins/testbed/public/testbed.js b/src/core_plugins/testbed/public/testbed.js | |
index fc1d4b3a7..f768b6e81 100644 | |
--- a/src/core_plugins/testbed/public/testbed.js | |
+++ b/src/core_plugins/testbed/public/testbed.js | |
@@ -2,11 +2,29 @@ import uiRoutes from 'ui/routes'; | |
import template from './testbed.html'; | |
import './testbed.less'; | |
+import { map } from 'lodash'; | |
+import { VisTypesRegistryProvider } from 'ui/registry/vis_types'; | |
+import { AggTypesIndexProvider } from 'ui/agg_types'; | |
+ | |
uiRoutes.when('/testbed', { | |
template: template, | |
controllerAs: 'testbed', | |
controller: class TestbedController { | |
- constructor() { | |
+ constructor(Private, $filter) { | |
+ const filter = $filter('aggFilter'); | |
+ const aggTypes = Private(AggTypesIndexProvider); | |
+ const visTypes = Private(VisTypesRegistryProvider); | |
+ | |
+ const readSchema = schema => ({ | |
+ name: schema.title, | |
+ aggs: (filter(aggTypes.byType[schema.group], schema.aggFilter) || []).map(agg => agg.name), | |
+ }); | |
+ | |
+ this.data = visTypes.map(visType => ({ | |
+ name: visType.name, | |
+ metrics: map(visType.schemas.metrics, readSchema), | |
+ buckets: map(visType.schemas.buckets, readSchema), | |
+ })); | |
} | |
} | |
-}); | |
\ No newline at end of file | |
+}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment