Skip to content

Commit

Permalink
cleanup visualizations api (#59958) (#60959)
Browse files Browse the repository at this point in the history
  • Loading branch information
ppisljar authored Mar 24, 2020
1 parent a524c00 commit 80a7fc3
Show file tree
Hide file tree
Showing 92 changed files with 1,245 additions and 1,495 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [AggConfigOptions](./kibana-plugin-plugins-data-public.aggconfigoptions.md) &gt; [enabled](./kibana-plugin-plugins-data-public.aggconfigoptions.enabled.md)

## AggConfigOptions.enabled property

<b>Signature:</b>

```typescript
enabled?: boolean;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [AggConfigOptions](./kibana-plugin-plugins-data-public.aggconfigoptions.md) &gt; [id](./kibana-plugin-plugins-data-public.aggconfigoptions.id.md)

## AggConfigOptions.id property

<b>Signature:</b>

```typescript
id?: string;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [AggConfigOptions](./kibana-plugin-plugins-data-public.aggconfigoptions.md)

## AggConfigOptions interface

<b>Signature:</b>

```typescript
export interface AggConfigOptions
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [enabled](./kibana-plugin-plugins-data-public.aggconfigoptions.enabled.md) | <code>boolean</code> | |
| [id](./kibana-plugin-plugins-data-public.aggconfigoptions.id.md) | <code>string</code> | |
| [params](./kibana-plugin-plugins-data-public.aggconfigoptions.params.md) | <code>Record&lt;string, any&gt;</code> | |
| [schema](./kibana-plugin-plugins-data-public.aggconfigoptions.schema.md) | <code>string</code> | |
| [type](./kibana-plugin-plugins-data-public.aggconfigoptions.type.md) | <code>IAggType</code> | |

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [AggConfigOptions](./kibana-plugin-plugins-data-public.aggconfigoptions.md) &gt; [params](./kibana-plugin-plugins-data-public.aggconfigoptions.params.md)

## AggConfigOptions.params property

<b>Signature:</b>

```typescript
params?: Record<string, any>;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [AggConfigOptions](./kibana-plugin-plugins-data-public.aggconfigoptions.md) &gt; [schema](./kibana-plugin-plugins-data-public.aggconfigoptions.schema.md)

## AggConfigOptions.schema property

<b>Signature:</b>

```typescript
schema?: string;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [AggConfigOptions](./kibana-plugin-plugins-data-public.aggconfigoptions.md) &gt; [type](./kibana-plugin-plugins-data-public.aggconfigoptions.type.md)

## AggConfigOptions.type property

<b>Signature:</b>

```typescript
type: IAggType;
```
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@

| Interface | Description |
| --- | --- |
| [AggConfigOptions](./kibana-plugin-plugins-data-public.aggconfigoptions.md) | |
| [AggParamOption](./kibana-plugin-plugins-data-public.aggparamoption.md) | |
| [DataPublicPluginSetup](./kibana-plugin-plugins-data-public.datapublicpluginsetup.md) | |
| [DataPublicPluginStart](./kibana-plugin-plugins-data-public.datapublicpluginstart.md) | |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import { i18n } from '@kbn/i18n';
import { createInputControlVisController } from './vis_controller';
import { getControlsTab } from './components/editor/controls_tab';
import { OptionsTab } from './components/editor/options_tab';
import { Status } from '../../visualizations/public';
import { InputControlVisDependencies } from './plugin';
import { defaultFeedbackMessage } from '../../../../plugins/kibana_utils/common';

Expand All @@ -40,7 +39,6 @@ export function createInputControlVisTypeDefinition(deps: InputControlVisDepende
defaultMessage: 'Create interactive controls for easy dashboard manipulation.',
}),
stage: 'experimental',
requiresUpdateStatus: [Status.PARAMS, Status.TIME],
feedbackMessage: defaultFeedbackMessage,
visualization: InputControlVisController,
visConfig: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const createInputControlVisController = (deps: InputControlVisDependencie
.subscribe(this.queryBarUpdateHandler);
}

async render(visData: any, visParams: VisParams, status: any) {
async render(visData: any, visParams: VisParams) {
this.visParams = visParams;
this.controls = [];
this.controls = await this.initControls();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ function discoverController(
// no timefield, no vis, nothing to update
if (!getTimeField() || !$scope.vis) return;

const buckets = $scope.vis.getAggConfig().byTypeName('buckets');
const buckets = $scope.vis.data.aggs.byTypeName('buckets');

if (buckets && buckets.length === 1) {
$scope.bucketInterval = buckets[0].buckets.getInterval();
Expand Down Expand Up @@ -876,11 +876,11 @@ function discoverController(
inspectorRequest.stats(getResponseInspectorStats($scope.searchSource, resp)).ok({ json: resp });

if (getTimeField()) {
const tabifiedData = tabifyAggResponse($scope.vis.aggs, resp);
const tabifiedData = tabifyAggResponse($scope.vis.data.aggs, resp);
$scope.searchSource.rawResponse = resp;
$scope.histogramData = discoverResponseHandler(
tabifiedData,
getDimensions($scope.vis.aggs.aggs, $scope.timeRange)
getDimensions($scope.vis.data.aggs.aggs, $scope.timeRange)
);
}

Expand Down Expand Up @@ -1023,41 +1023,27 @@ function discoverController(
},
];

if ($scope.vis) {
const visState = $scope.vis.getEnabledState();
visState.aggs = visStateAggs;

$scope.vis.setState(visState);
return;
}

const visSavedObject = {
indexPattern: $scope.indexPattern.id,
visState: {
type: 'histogram',
title: savedSearch.title,
params: {
addLegend: false,
addTimeMarker: true,
},
$scope.vis = visualizations.createVis('histogram', {
title: savedSearch.title,
params: {
addLegend: false,
addTimeMarker: true,
},
data: {
aggs: visStateAggs,
indexPattern: $scope.searchSource.getField('index').id,
searchSource: $scope.searchSource,
},
};

$scope.vis = visualizations.createVis(
$scope.searchSource.getField('index'),
visSavedObject.visState
);
visSavedObject.vis = $scope.vis;
});

$scope.searchSource.onRequestStart((searchSource, options) => {
if (!$scope.vis) return;
return $scope.vis.getAggConfig().onSearchRequestStart(searchSource, options);
return $scope.vis.data.aggs.onSearchRequestStart(searchSource, options);
});

$scope.searchSource.setField('aggs', function() {
if (!$scope.vis) return;
return $scope.vis.getAggConfig().toDsl();
return $scope.vis.data.aggs.toDsl();
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export function getEditBreadcrumbs($route: any) {
return [
...getLandingBreadcrumbs(),
{
text: $route.current.locals.savedVis.title,
text: $route.current.locals.resolved.savedVis.title,
},
];
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@
<visualization-embedded
ng-if="!isVisible"
class="visualize"
saved-obj="savedVis"
vis="vis"
embeddable-handler="embeddableHandler"
ui-state="uiState"
time-range="timeRange"
filters="filters"
Expand All @@ -89,13 +90,15 @@
</h1>
<visualization-editor
ng-if="isVisible"
saved-obj="savedVis"
vis="vis"
saved-search="savedSearch"
embeddable-handler="embeddableHandler"
event-emitter="eventEmitter"
ui-state="uiState"
time-range="timeRange"
filters="filters"
query="query"
class="visEditor__content"
app-state="appState"
/>

</visualize-app>
Loading

0 comments on commit 80a7fc3

Please sign in to comment.