Skip to content

Commit c20a48c

Browse files
Revert "Visualize Refactor (#11786)" (#12711)
This reverts commit 3000221. This change broke Xpack, due to some modules being moved to a different location.
1 parent 363a065 commit c20a48c

File tree

170 files changed

+2992
-2826
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

170 files changed

+2992
-2826
lines changed
Lines changed: 82 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
import { VisFactoryProvider } from 'ui/vis/vis_factory';
2-
import { VisSchemasProvider } from 'ui/vis/editors/default/schemas';
3-
import { CATEGORY } from 'ui/vis/vis_category';
1+
import { VisVisTypeProvider } from 'ui/vis/vis_type';
2+
import { VislibVisTypeVislibVisTypeProvider } from 'ui/vislib_vis_type/vislib_vis_type';
3+
import { VisSchemasProvider } from 'ui/vis/schemas';
44
import pointSeriesTemplate from 'plugins/kbn_vislib_vis_types/editors/point_series.html';
55
import image from './images/icon-area.svg';
66

77
export default function PointSeriesVisType(Private) {
8-
const VisFactory = Private(VisFactoryProvider);
8+
const VisType = Private(VisVisTypeProvider);
9+
const VislibVisType = Private(VislibVisTypeVislibVisTypeProvider);
910
const Schemas = Private(VisSchemasProvider);
1011

11-
return VisFactory.createVislibVisualization({
12+
return new VislibVisType({
1213
name: 'area',
1314
title: 'Area',
1415
image,
1516
description: 'Emphasize the quantity beneath a line chart',
16-
category: CATEGORY.BASIC,
17-
visConfig: {
17+
category: VisType.CATEGORY.BASIC,
18+
params: {
1819
defaults: {
19-
type: 'area',
2020
grid: {
2121
categoryLines: false,
2222
style: {
@@ -29,7 +29,8 @@ export default function PointSeriesVisType(Private) {
2929
type: 'category',
3030
position: 'bottom',
3131
show: true,
32-
style: {},
32+
style: {
33+
},
3334
scale: {
3435
type: 'linear'
3536
},
@@ -47,7 +48,8 @@ export default function PointSeriesVisType(Private) {
4748
type: 'value',
4849
position: 'left',
4950
show: true,
50-
style: {},
51+
style: {
52+
},
5153
scale: {
5254
type: 'linear',
5355
mode: 'normal'
@@ -82,34 +84,31 @@ export default function PointSeriesVisType(Private) {
8284
times: [],
8385
addTimeMarker: false,
8486
},
85-
},
86-
editorConfig: {
87-
collections: {
88-
positions: ['top', 'left', 'right', 'bottom'],
89-
chartTypes: [{
90-
value: 'line',
91-
text: 'line'
92-
}, {
93-
value: 'area',
94-
text: 'area'
95-
}, {
96-
value: 'histogram',
97-
text: 'bar'
98-
}],
99-
axisModes: ['normal', 'percentage', 'wiggle', 'silhouette'],
100-
scaleTypes: ['linear', 'log', 'square root'],
101-
chartModes: ['normal', 'stacked'],
102-
interpolationModes: [{
103-
value: 'linear',
104-
text: 'straight',
105-
}, {
106-
value: 'cardinal',
107-
text: 'smoothed',
108-
}, {
109-
value: 'step-after',
110-
text: 'stepped',
111-
}],
112-
},
87+
positions: ['top', 'left', 'right', 'bottom'],
88+
chartTypes: [{
89+
value: 'line',
90+
text: 'line'
91+
}, {
92+
value: 'area',
93+
text: 'area'
94+
}, {
95+
value: 'histogram',
96+
text: 'bar'
97+
}],
98+
axisModes: ['normal', 'percentage', 'wiggle', 'silhouette'],
99+
scaleTypes: ['linear', 'log', 'square root'],
100+
chartModes: ['normal', 'stacked'],
101+
interpolationModes: [{
102+
value: 'linear',
103+
text: 'straight',
104+
}, {
105+
value: 'cardinal',
106+
text: 'smoothed',
107+
}, {
108+
value: 'step-after',
109+
text: 'stepped',
110+
}],
111+
editor: pointSeriesTemplate,
113112
optionTabs: [
114113
{
115114
name: 'advanced',
@@ -119,50 +118,50 @@ export default function PointSeriesVisType(Private) {
119118
},
120119
{ name: 'options', title: 'Panel Settings', editor: pointSeriesTemplate },
121120
],
122-
schemas: new Schemas([
123-
{
124-
group: 'metrics',
125-
name: 'metric',
126-
title: 'Y-Axis',
127-
aggFilter: ['!geo_centroid'],
128-
min: 1,
129-
defaults: [
130-
{ schema: 'metric', type: 'count' }
131-
]
132-
},
133-
{
134-
group: 'metrics',
135-
name: 'radius',
136-
title: 'Dot Size',
137-
min: 0,
138-
max: 1,
139-
aggFilter: ['count', 'avg', 'sum', 'min', 'max', 'cardinality']
140-
},
141-
{
142-
group: 'buckets',
143-
name: 'segment',
144-
title: 'X-Axis',
145-
min: 0,
146-
max: 1,
147-
aggFilter: '!geohash_grid'
148-
},
149-
{
150-
group: 'buckets',
151-
name: 'group',
152-
title: 'Split Series',
153-
min: 0,
154-
max: 1,
155-
aggFilter: '!geohash_grid'
156-
},
157-
{
158-
group: 'buckets',
159-
name: 'split',
160-
title: 'Split Chart',
161-
min: 0,
162-
max: 1,
163-
aggFilter: '!geohash_grid'
164-
}
165-
])
166-
}
121+
},
122+
schemas: new Schemas([
123+
{
124+
group: 'metrics',
125+
name: 'metric',
126+
title: 'Y-Axis',
127+
aggFilter: ['!geo_centroid'],
128+
min: 1,
129+
defaults: [
130+
{ schema: 'metric', type: 'count' }
131+
]
132+
},
133+
{
134+
group: 'metrics',
135+
name: 'radius',
136+
title: 'Dot Size',
137+
min: 0,
138+
max: 1,
139+
aggFilter: ['count', 'avg', 'sum', 'min', 'max', 'cardinality']
140+
},
141+
{
142+
group: 'buckets',
143+
name: 'segment',
144+
title: 'X-Axis',
145+
min: 0,
146+
max: 1,
147+
aggFilter: '!geohash_grid'
148+
},
149+
{
150+
group: 'buckets',
151+
name: 'group',
152+
title: 'Split Series',
153+
min: 0,
154+
max: 1,
155+
aggFilter: '!geohash_grid'
156+
},
157+
{
158+
group: 'buckets',
159+
name: 'split',
160+
title: 'Split Chart',
161+
min: 0,
162+
max: 1,
163+
aggFilter: '!geohash_grid'
164+
}
165+
])
167166
});
168167
}

src/core_plugins/kbn_vislib_vis_types/public/controls/gauge_options.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
id="gaugeType"
99
class="kuiSelect kuiSideBarSelect"
1010
ng-model="vis.params.gauge.gaugeType"
11-
ng-options="mode for mode in collections.gaugeTypes"
11+
ng-options="mode for mode in vis.type.params.gaugeTypes"
1212
></select>
1313
</div>
1414
</div>
@@ -183,7 +183,7 @@
183183
id="colorSchema"
184184
class="kuiSelect kuiSideBarSelect"
185185
ng-model="vis.params.gauge.colorSchema"
186-
ng-options="mode for mode in collections.colorSchemas"
186+
ng-options="mode for mode in vis.type.params.colorSchemas"
187187
></select>
188188
</div>
189189
<div class="text-info text-center" ng-show="customColors" ng-click="resetColors()">reset colors</div>
@@ -255,7 +255,7 @@
255255
id="gaugeColorMode"
256256
class="kuiSelect kuiSideBarSelect"
257257
ng-model="vis.params.gauge.gaugeColorMode"
258-
ng-options="mode for mode in collections.gaugeColorMode"
258+
ng-options="mode for mode in vis.type.params.gaugeColorMode"
259259
></select>
260260
</div>
261261
</div>

src/core_plugins/kbn_vislib_vis_types/public/controls/gauge_options.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module.directive('gaugeOptions', function () {
99
template: gaugeOptionsTemplate,
1010
replace: true,
1111
link: function ($scope) {
12-
$scope.collections = $scope.vis.type.editorConfig.collections;
12+
1313
$scope.showColorRange = true;
1414

1515
$scope.$watch('vis.params.gauge.gaugeType', type => {

src/core_plugins/kbn_vislib_vis_types/public/controls/heatmap_options.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
id="colorSchema"
99
class="kuiSelect kuiSideBarSelect"
1010
ng-model="vis.params.colorSchema"
11-
ng-options="mode for mode in collections.colorSchemas"
11+
ng-options="mode for mode in vis.type.params.colorSchemas"
1212
></select>
1313
</div>
1414
<div
@@ -39,7 +39,7 @@
3939
id="axisScale"
4040
class="kuiSelect kuiSideBarSelect"
4141
ng-model="vis.params.valueAxes[0].scale.type"
42-
ng-options="mode for mode in collections.scales"
42+
ng-options="mode for mode in vis.type.params.scales"
4343
></select>
4444
</div>
4545
</div>
@@ -141,15 +141,15 @@
141141
ng-click="removeRange($index)"
142142
class="kuiButton kuiButton--danger kuiButton--small"
143143
>
144-
<span class="kuiIcon fa-times"></span>
144+
<span class="kuiIcon fa-times"><span>
145145
</button>
146146
</td>
147147
</tr>
148148
</table>
149149

150150
<div class="hintbox" ng-show="!vis.params.colorsRange.length">
151151
<p>
152-
<span class="kuiIcon fa-danger text-danger"></span>
152+
<span class="kuiIcon fa-danger text-danger"><span>
153153
<strong>Required:</strong> You must specify at least one range.
154154
</p>
155155
</div>

src/core_plugins/kbn_vislib_vis_types/public/controls/heatmap_options.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ module.directive('heatmapOptions', function () {
99
template: heatmapOptionsTemplate,
1010
replace: true,
1111
link: function ($scope) {
12-
13-
$scope.collections = $scope.vis.type.editorConfig.collections;
14-
1512
const verticalRotation = 270;
1613
$scope.showColorRange = false;
1714
$scope.showLabels = false;

src/core_plugins/kbn_vislib_vis_types/public/controls/point_series/category_axis.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
id="categoryAxisPosition"
2626
class="kuiSelect kuiSideBarSelect"
2727
ng-model="vis.params.categoryAxes[0].position"
28-
ng-options="mode for mode in vis.type.editorConfig.collections.positions"
28+
ng-options="mode for mode in vis.type.params.positions"
2929
></select>
3030
</div>
3131
</div>

src/core_plugins/kbn_vislib_vis_types/public/controls/point_series/series.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
id="{{ 'seriesType' + $index }}"
4141
class="kuiSelect kuiSideBarSelect"
4242
ng-model="chart.type"
43-
ng-options="mode.value as mode.text for mode in vis.type.editorConfig.collections.chartTypes"
43+
ng-options="mode.value as mode.text for mode in vis.type.params.chartTypes"
4444
></select>
4545
</div>
4646
</div>
@@ -54,7 +54,7 @@
5454
id="{{ 'seriesMode' + $index }}"
5555
class="kuiSelect kuiSideBarSelect"
5656
ng-model="chart.mode"
57-
ng-options="mode for mode in vis.type.editorConfig.collections.chartModes"
57+
ng-options="mode for mode in vis.type.params.chartModes"
5858
></select>
5959
</div>
6060
</div>
@@ -86,7 +86,7 @@
8686
id="{{ 'lineMode' + $index }}"
8787
class="kuiSelect kuiSideBarSelect"
8888
ng-model="chart.interpolate"
89-
ng-options="mode.value as mode.text for mode in vis.type.editorConfig.collections.interpolationModes"
89+
ng-options="mode.value as mode.text for mode in vis.type.params.interpolationModes"
9090
>
9191
</select>
9292
</div>

src/core_plugins/kbn_vislib_vis_types/public/controls/point_series/series.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ module.directive('vislibSeries', function () {
6161
return $scope.vis.params.seriesParams.map(series => series.type).join();
6262
}, () => {
6363
const types = _.uniq(_.map($scope.vis.params.seriesParams, 'type'));
64-
$scope.vis.type.type = types.length === 1 ? types[0] : 'histogram';
64+
$scope.savedVis.type = types.length === 1 ? types[0] : 'histogram';
6565
});
6666

6767
$scope.$watch('vis.params.valueAxes.length', () => {

src/core_plugins/kbn_vislib_vis_types/public/controls/point_series/value_axes.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
class="kuiSelect kuiSideBarSelect"
8585
ng-change="updateAxisName(axis)"
8686
ng-model="axis.position"
87-
ng-options="mode disable when isPositionDisabled(mode) for mode in vis.type.editorConfig.collections.positions"
87+
ng-options="mode disable when isPositionDisabled(mode) for mode in vis.type.params.positions"
8888
></select>
8989
</div>
9090
</div>
@@ -98,7 +98,7 @@
9898
id="{{ 'valueAxisMode' + $index }}"
9999
class="kuiSelect kuiSideBarSelect"
100100
ng-model="axis.scale.mode"
101-
ng-options="mode for mode in vis.type.editorConfig.collections.axisModes"
101+
ng-options="mode for mode in vis.type.params.axisModes"
102102
></select>
103103
</div>
104104
</div>
@@ -112,7 +112,7 @@
112112
id="{{ 'valueAxisScaleType' + $index }}"
113113
class="kuiSelect kuiSideBarSelect"
114114
ng-model="axis.scale.type"
115-
ng-options="type for type in vis.type.editorConfig.collections.scaleTypes"
115+
ng-options="type for type in vis.type.params.scaleTypes"
116116
></select>
117117
</div>
118118
</div>

src/core_plugins/kbn_vislib_vis_types/public/controls/vislib_basic_options.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<select
77
class="form-control"
88
ng-model="vis.params.legendPosition"
9-
ng-options="position.value as position.text for position in vis.type.editorConfig.collections.legendPositions"
9+
ng-options="position.value as position.text for position in vis.type.params.legendPositions"
1010
>
1111
</select>
1212
</div>

0 commit comments

Comments
 (0)