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

Visualize Refactor #11786

Merged
merged 40 commits into from
Jul 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
439b6bb
converting Vis to es6 class
ppisljar Mar 31, 2017
87257bf
<visualize>, <visualization> and <visualization-editor>
ppisljar Jun 7, 2017
faadd4c
editor, responseHandler and requestHandler registries
ppisljar Jun 7, 2017
3789a71
updating visualize editor app
ppisljar Jun 7, 2017
edc4cfe
vis, default editor, request handlers and vis types
ppisljar Jun 7, 2017
d6cf0f8
updating vis types
ppisljar Jun 7, 2017
814eccc
updating kibana to work with new visualize
ppisljar Jun 7, 2017
071f0c0
migrating existing visualizations
ppisljar Jun 7, 2017
d44c398
fixing bugs with rebase
ppisljar Jun 7, 2017
ebc5870
fixing tests
ppisljar Jun 26, 2017
9d27c3f
fixing renderComplete issues with editor
ppisljar Jun 27, 2017
707e348
map updates
thomasneirynck Jun 28, 2017
fb6b745
fixing maps zoom
ppisljar Jun 28, 2017
c9a80ee
fixing based on nathans review
ppisljar Jun 29, 2017
375a7c9
fixing render complete issue and doulbe rendering with maps
ppisljar Jun 29, 2017
75bbf4d
trying to get maps in order .... wip
ppisljar Jun 29, 2017
a03aa98
fixing metric chart type auto changing
ppisljar Jun 29, 2017
70b02ce
changing the rendering process a bit
ppisljar Jun 29, 2017
0aa8df0
removing resize method from visualizations
thomasneirynck Jun 29, 2017
aff2da8
minor simplifications in coordinate map viz
thomasneirynck Jun 30, 2017
fb333e2
more simplications now we only have single render
thomasneirynck Jun 30, 2017
acd9a4c
minor fixes
thomasneirynck Jun 30, 2017
72b3c76
do not recreate layer when not necessary
thomasneirynck Jun 30, 2017
b771715
minor changes
thomasneirynck Jun 30, 2017
3742d69
fixing maps bounding box filter
ppisljar Jul 3, 2017
0dbaf47
fixing desaturation option
ppisljar Jul 3, 2017
8f1854b
fix zoom settings when toggling between WMS/basemap
thomasneirynck Jul 4, 2017
8f65a37
adding status to the render method (to figure out what changed)
ppisljar Jul 4, 2017
82cc61e
fixing legend open icon going out of page
ppisljar Jul 5, 2017
642eb2c
skip index selection for timelion
ppisljar Jul 5, 2017
4f2c4c2
timelion brush fix
ppisljar Jul 5, 2017
e6bf076
fixing circular json issue
ppisljar Jul 5, 2017
d9df865
fix faulty rebase
thomasneirynck Jul 6, 2017
34df16f
fixing updateStatus
ppisljar Jul 6, 2017
b7099f2
removing timelion requesthandler registration
ppisljar Jul 6, 2017
03f4cc8
removing double slash
ppisljar Jul 6, 2017
3d5ed4a
fixing maps
ppisljar Jul 6, 2017
fa192c3
add debug statement
thomasneirynck Jul 7, 2017
51b093a
test CI with guard statement
thomasneirynck Jul 7, 2017
033806a
fixing rebase
ppisljar Jul 7, 2017
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
165 changes: 83 additions & 82 deletions src/core_plugins/kbn_vislib_vis_types/public/area.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import { VisVisTypeProvider } from 'ui/vis/vis_type';
import { VislibVisTypeVislibVisTypeProvider } from 'ui/vislib_vis_type/vislib_vis_type';
import { VisSchemasProvider } from 'ui/vis/schemas';
import { VisFactoryProvider } from 'ui/vis/vis_factory';
import { VisSchemasProvider } from 'ui/vis/editors/default/schemas';
import { CATEGORY } from 'ui/vis/vis_category';
import pointSeriesTemplate from 'plugins/kbn_vislib_vis_types/editors/point_series.html';
import image from './images/icon-area.svg';

export default function PointSeriesVisType(Private) {
const VisType = Private(VisVisTypeProvider);
const VislibVisType = Private(VislibVisTypeVislibVisTypeProvider);
const VisFactory = Private(VisFactoryProvider);
const Schemas = Private(VisSchemasProvider);

return new VislibVisType({
return VisFactory.createVislibVisualization({
name: 'area',
title: 'Area',
image,
description: 'Emphasize the quantity beneath a line chart',
category: VisType.CATEGORY.BASIC,
params: {
category: CATEGORY.BASIC,
visConfig: {
defaults: {
type: 'area',
grid: {
categoryLines: false,
style: {
Expand All @@ -29,8 +29,7 @@ export default function PointSeriesVisType(Private) {
type: 'category',
position: 'bottom',
show: true,
style: {
},
style: {},
scale: {
type: 'linear'
},
Expand All @@ -48,8 +47,7 @@ export default function PointSeriesVisType(Private) {
type: 'value',
position: 'left',
show: true,
style: {
},
style: {},
scale: {
type: 'linear',
mode: 'normal'
Expand Down Expand Up @@ -84,31 +82,34 @@ export default function PointSeriesVisType(Private) {
times: [],
addTimeMarker: false,
},
positions: ['top', 'left', 'right', 'bottom'],
chartTypes: [{
value: 'line',
text: 'line'
}, {
value: 'area',
text: 'area'
}, {
value: 'histogram',
text: 'bar'
}],
axisModes: ['normal', 'percentage', 'wiggle', 'silhouette'],
scaleTypes: ['linear', 'log', 'square root'],
chartModes: ['normal', 'stacked'],
interpolationModes: [{
value: 'linear',
text: 'straight',
}, {
value: 'cardinal',
text: 'smoothed',
}, {
value: 'step-after',
text: 'stepped',
}],
editor: pointSeriesTemplate,
},
editorConfig: {
collections: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

collections is too vague of a name and does not provide any description of what these values are or how they will be used. How about calling it something like editorParams or editorOptions or options.

positions: ['top', 'left', 'right', 'bottom'],
chartTypes: [{
value: 'line',
text: 'line'
}, {
value: 'area',
text: 'area'
}, {
value: 'histogram',
text: 'bar'
}],
axisModes: ['normal', 'percentage', 'wiggle', 'silhouette'],
scaleTypes: ['linear', 'log', 'square root'],
chartModes: ['normal', 'stacked'],
interpolationModes: [{
value: 'linear',
text: 'straight',
}, {
value: 'cardinal',
text: 'smoothed',
}, {
value: 'step-after',
text: 'stepped',
}],
},
optionTabs: [
{
name: 'advanced',
Expand All @@ -118,50 +119,50 @@ export default function PointSeriesVisType(Private) {
},
{ name: 'options', title: 'Panel Settings', editor: pointSeriesTemplate },
],
},
schemas: new Schemas([
{
group: 'metrics',
name: 'metric',
title: 'Y-Axis',
aggFilter: ['!geo_centroid'],
min: 1,
defaults: [
{ schema: 'metric', type: 'count' }
]
},
{
group: 'metrics',
name: 'radius',
title: 'Dot Size',
min: 0,
max: 1,
aggFilter: ['count', 'avg', 'sum', 'min', 'max', 'cardinality']
},
{
group: 'buckets',
name: 'segment',
title: 'X-Axis',
min: 0,
max: 1,
aggFilter: '!geohash_grid'
},
{
group: 'buckets',
name: 'group',
title: 'Split Series',
min: 0,
max: 1,
aggFilter: '!geohash_grid'
},
{
group: 'buckets',
name: 'split',
title: 'Split Chart',
min: 0,
max: 1,
aggFilter: '!geohash_grid'
}
])
schemas: new Schemas([
{
group: 'metrics',
name: 'metric',
title: 'Y-Axis',
aggFilter: ['!geo_centroid'],
min: 1,
defaults: [
{ schema: 'metric', type: 'count' }
]
},
{
group: 'metrics',
name: 'radius',
title: 'Dot Size',
min: 0,
max: 1,
aggFilter: ['count', 'avg', 'sum', 'min', 'max', 'cardinality']
},
{
group: 'buckets',
name: 'segment',
title: 'X-Axis',
min: 0,
max: 1,
aggFilter: '!geohash_grid'
},
{
group: 'buckets',
name: 'group',
title: 'Split Series',
min: 0,
max: 1,
aggFilter: '!geohash_grid'
},
{
group: 'buckets',
name: 'split',
title: 'Split Chart',
min: 0,
max: 1,
aggFilter: '!geohash_grid'
}
])
}
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
id="gaugeType"
class="kuiSelect kuiSideBarSelect"
ng-model="vis.params.gauge.gaugeType"
ng-options="mode for mode in vis.type.params.gaugeTypes"
ng-options="mode for mode in collections.gaugeTypes"
></select>
</div>
</div>
Expand Down Expand Up @@ -183,7 +183,7 @@
id="colorSchema"
class="kuiSelect kuiSideBarSelect"
ng-model="vis.params.gauge.colorSchema"
ng-options="mode for mode in vis.type.params.colorSchemas"
ng-options="mode for mode in collections.colorSchemas"
></select>
</div>
<div class="text-info text-center" ng-show="customColors" ng-click="resetColors()">reset colors</div>
Expand Down Expand Up @@ -255,7 +255,7 @@
id="gaugeColorMode"
class="kuiSelect kuiSideBarSelect"
ng-model="vis.params.gauge.gaugeColorMode"
ng-options="mode for mode in vis.type.params.gaugeColorMode"
ng-options="mode for mode in collections.gaugeColorMode"
></select>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.directive('gaugeOptions', function () {
template: gaugeOptionsTemplate,
replace: true,
link: function ($scope) {

$scope.collections = $scope.vis.type.editorConfig.collections;
$scope.showColorRange = true;

$scope.$watch('vis.params.gauge.gaugeType', type => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
id="colorSchema"
class="kuiSelect kuiSideBarSelect"
ng-model="vis.params.colorSchema"
ng-options="mode for mode in vis.type.params.colorSchemas"
ng-options="mode for mode in collections.colorSchemas"
></select>
</div>
<div
Expand Down Expand Up @@ -39,7 +39,7 @@
id="axisScale"
class="kuiSelect kuiSideBarSelect"
ng-model="vis.params.valueAxes[0].scale.type"
ng-options="mode for mode in vis.type.params.scales"
ng-options="mode for mode in collections.scales"
></select>
</div>
</div>
Expand Down Expand Up @@ -141,15 +141,15 @@
ng-click="removeRange($index)"
class="kuiButton kuiButton--danger kuiButton--small"
>
<span class="kuiIcon fa-times"><span>
<span class="kuiIcon fa-times"></span>
</button>
</td>
</tr>
</table>

<div class="hintbox" ng-show="!vis.params.colorsRange.length">
<p>
<span class="kuiIcon fa-danger text-danger"><span>
<span class="kuiIcon fa-danger text-danger"></span>
<strong>Required:</strong> You must specify at least one range.
</p>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ module.directive('heatmapOptions', function () {
template: heatmapOptionsTemplate,
replace: true,
link: function ($scope) {

$scope.collections = $scope.vis.type.editorConfig.collections;

const verticalRotation = 270;
$scope.showColorRange = false;
$scope.showLabels = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
id="categoryAxisPosition"
class="kuiSelect kuiSideBarSelect"
ng-model="vis.params.categoryAxes[0].position"
ng-options="mode for mode in vis.type.params.positions"
ng-options="mode for mode in vis.type.editorConfig.collections.positions"
></select>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
id="{{ 'seriesType' + $index }}"
class="kuiSelect kuiSideBarSelect"
ng-model="chart.type"
ng-options="mode.value as mode.text for mode in vis.type.params.chartTypes"
ng-options="mode.value as mode.text for mode in vis.type.editorConfig.collections.chartTypes"
></select>
</div>
</div>
Expand All @@ -54,7 +54,7 @@
id="{{ 'seriesMode' + $index }}"
class="kuiSelect kuiSideBarSelect"
ng-model="chart.mode"
ng-options="mode for mode in vis.type.params.chartModes"
ng-options="mode for mode in vis.type.editorConfig.collections.chartModes"
></select>
</div>
</div>
Expand Down Expand Up @@ -86,7 +86,7 @@
id="{{ 'lineMode' + $index }}"
class="kuiSelect kuiSideBarSelect"
ng-model="chart.interpolate"
ng-options="mode.value as mode.text for mode in vis.type.params.interpolationModes"
ng-options="mode.value as mode.text for mode in vis.type.editorConfig.collections.interpolationModes"
>
</select>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ module.directive('vislibSeries', function () {
return $scope.vis.params.seriesParams.map(series => series.type).join();
}, () => {
const types = _.uniq(_.map($scope.vis.params.seriesParams, 'type'));
$scope.savedVis.type = types.length === 1 ? types[0] : 'histogram';
$scope.vis.type.type = types.length === 1 ? types[0] : 'histogram';
});

$scope.$watch('vis.params.valueAxes.length', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
class="kuiSelect kuiSideBarSelect"
ng-change="updateAxisName(axis)"
ng-model="axis.position"
ng-options="mode disable when isPositionDisabled(mode) for mode in vis.type.params.positions"
ng-options="mode disable when isPositionDisabled(mode) for mode in vis.type.editorConfig.collections.positions"
></select>
</div>
</div>
Expand All @@ -98,7 +98,7 @@
id="{{ 'valueAxisMode' + $index }}"
class="kuiSelect kuiSideBarSelect"
ng-model="axis.scale.mode"
ng-options="mode for mode in vis.type.params.axisModes"
ng-options="mode for mode in vis.type.editorConfig.collections.axisModes"
></select>
</div>
</div>
Expand All @@ -112,7 +112,7 @@
id="{{ 'valueAxisScaleType' + $index }}"
class="kuiSelect kuiSideBarSelect"
ng-model="axis.scale.type"
ng-options="type for type in vis.type.params.scaleTypes"
ng-options="type for type in vis.type.editorConfig.collections.scaleTypes"
></select>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<select
class="form-control"
ng-model="vis.params.legendPosition"
ng-options="position.value as position.text for position in vis.type.params.legendPositions"
ng-options="position.value as position.text for position in vis.type.editorConfig.collections.legendPositions"
>
</select>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('point series editor', function () {
function makeConfig() {
return {
type: 'line',
params: lineVisType.params.defaults,
params: lineVisType.visConfig.defaults,
aggs: [
{ type: 'count', schema: 'metric', params: { field: 'bytes' } },
{ type: 'terms', schema: 'segment', params: { field: 'machine.os' } },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
id="legendPosition"
class="kuiSelect kuiSideBarSelect"
ng-model="vis.params.legendPosition"
ng-options="position.value as position.text for position in vis.type.params.legendPositions"
ng-options="position.value as position.text for position in vis.type.editorConfig.collections.legendPositions"
></select>
</div>
</div>
Expand Down
Loading