Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup visualizations api #59958

Merged
merged 28 commits into from
Mar 23, 2020
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -665,7 +665,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 @@ -869,11 +869,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 @@ -1016,41 +1016,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