pass showSpyPanel to Editor (#15283) (#15382)

This commit is contained in:
Nathan Reese 2017-12-04 13:17:00 -07:00 committed by GitHub
parent da5b9ef0f8
commit 8e5eb46536
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 77 additions and 5 deletions

View file

@ -10,5 +10,5 @@
data-title="{{vis.title}}"
data-description="{{vis.description}}"
>
<visualization vis="vis" vis-data="visData" ui-state="uiState" search-source="searchSource" show-spy-panel="true" />
<visualization vis="vis" vis-data="visData" ui-state="uiState" search-source="searchSource" show-spy-panel="showSpyPanel" />
</div>

View file

@ -12,9 +12,10 @@ const defaultEditor = function ($rootScope, $compile) {
return class DefaultEditor {
static key = 'default';
constructor(el, vis) {
constructor(el, vis, showSpyPanel) {
this.el = $(el);
this.vis = vis;
this.showSpyPanel = showSpyPanel;
if (!this.vis.type.editorConfig.optionTabs && this.vis.type.editorConfig.optionsTemplate) {
this.vis.type.editorConfig.optionTabs = [
@ -27,8 +28,8 @@ const defaultEditor = function ($rootScope, $compile) {
let $scope;
const updateScope = () => {
$scope.showSpyPanel = this.showSpyPanel;
$scope.vis = this.vis;
$scope.savedObj = this.savedObj;
$scope.visData = visData;
$scope.uiState = this.vis.getUiState();
$scope.searchSource = searchSource;

View file

@ -14,6 +14,7 @@ uiModules
return {
restrict: 'E',
scope: {
showSpyPanel: '=',
vis: '=',
visData: '=',
uiState: '=?',
@ -24,7 +25,7 @@ uiModules
const vis = $scope.vis;
const Editor = typeof vis.type.editor === 'function' ? vis.type.editor :
editorTypes.find(editor => editor.key === vis.type.editor);
const editor = new Editor(element[0], vis);
const editor = new Editor(element[0], vis, $scope.showSpyPanel);
$scope.renderFunction = () => {
if (!$scope.vis) return;

View file

@ -104,6 +104,11 @@ export default function ({ getService, getPageObjects }) {
});
});
it('should display spy panel toggle button', async function () {
const spyToggleExists = await PageObjects.visualize.getSpyToggleExists();
expect(spyToggleExists).to.be(true);
});
it('should show correct chart, take screenshot', function () {
const xAxisLabels = [ '2015-09-20 00:00', '2015-09-21 00:00',
'2015-09-22 00:00', '2015-09-23 00:00'

View file

@ -68,6 +68,11 @@ export default function ({ getService, getPageObjects }) {
});
});
it('should display spy panel toggle button', async function () {
const spyToggleExists = await PageObjects.visualize.getSpyToggleExists();
expect(spyToggleExists).to.be(true);
});
it('should show correct data, take screenshot', function () {
const expectedChartData = [
'0B', '2,088', '1.953KB', '2,748', '3.906KB', '2,707', '5.859KB', '2,876', '7.813KB',

View file

@ -27,6 +27,11 @@ export default function ({ getService, getPageObjects }) {
describe('gauge chart', function indexPatternCreation() {
it('should display spy panel toggle button', async function () {
const spyToggleExists = await PageObjects.visualize.getSpyToggleExists();
expect(spyToggleExists).to.be(true);
});
it('should show Count', function () {
const expectedCount = ['14,004', 'Count'];

View file

@ -70,6 +70,11 @@ export default function ({ getService, getPageObjects }) {
});
});
it('should display spy panel toggle button', async function () {
const spyToggleExists = await PageObjects.visualize.getSpyToggleExists();
expect(spyToggleExists).to.be(true);
});
it('should show correct chart, take screenshot', async function () {
const expectedChartValues = ['0 - 400', '0 - 400', '400 - 800', '1,200 - 1,600',
'1,200 - 1,600', '400 - 800', '0 - 400', '0 - 400', '0 - 400', '0 - 400', '400 - 800',

View file

@ -7,7 +7,7 @@ export default function ({ getService, getPageObjects }) {
const FIELD_NAME = 'machine.os.raw';
describe('visualize control app', () => {
describe('visualize app', () => {
before(async () => {
await PageObjects.common.navigateToUrl('visualize', 'new');
await PageObjects.visualize.clickInputControlVis();
@ -23,6 +23,11 @@ export default function ({ getService, getPageObjects }) {
describe('input control visualization', () => {
it('should not display spy panel toggle button', async function () {
const spyToggleExists = await PageObjects.visualize.getSpyToggleExists();
expect(spyToggleExists).to.be(false);
});
describe('updateFiltersOnChange is false', () => {
it('should contain dropdown with terms aggregation results as options', async () => {

View file

@ -74,6 +74,11 @@ export default function ({ getService, getPageObjects }) {
});
});
it('should display spy panel toggle button', async function () {
const spyToggleExists = await PageObjects.visualize.getSpyToggleExists();
expect(spyToggleExists).to.be(true);
});
it('should show correct chart order by Term', function () {

View file

@ -19,6 +19,11 @@ export default function ({ getPageObjects }) {
describe('markdown vis', async () => {
it('should not display spy panel toggle button', async function () {
const spyToggleExists = await PageObjects.visualize.getSpyToggleExists();
expect(spyToggleExists).to.be(false);
});
it('should render markdown as html', async function () {
const h1Txt = await PageObjects.visualize.getMarkdownBodyDescendentText('h1');
expect(h1Txt).to.equal('Heading 1');

View file

@ -28,6 +28,11 @@ export default function ({ getService, getPageObjects }) {
describe('metric chart', function indexPatternCreation() {
it('should display spy panel toggle button', async function () {
const spyToggleExists = await PageObjects.visualize.getSpyToggleExists();
expect(spyToggleExists).to.be(true);
});
it('should show Count', function () {
const expectedCount = ['14,004', 'Count'];

View file

@ -78,6 +78,11 @@ export default function ({ getService, getPageObjects }) {
});
});
it('should display spy panel toggle button', async function () {
const spyToggleExists = await PageObjects.visualize.getSpyToggleExists();
expect(spyToggleExists).to.be(true);
});
it('should show 10 slices in pie chart, take screenshot', function () {
const expectedPieChartSliceCount = 10;

View file

@ -49,6 +49,11 @@ export default function ({ getService, getPageObjects }) {
describe('vector map', function indexPatternCreation() {
it('should display spy panel toggle button', async function () {
const spyToggleExists = await PageObjects.visualize.getSpyToggleExists();
expect(spyToggleExists).to.be(true);
});
it('should show results after clicking play (join on states)', async function () {
const expectedData = 'CN,2,592,IN,2,373,US,1,194,ID,489,BR,415';
await PageObjects.visualize.openSpyPanel();

View file

@ -55,6 +55,11 @@ export default function ({ getService, getPageObjects }) {
describe('tag cloud chart', function () {
const vizName1 = 'Visualization tagCloud';
it('should display spy panel toggle button', async function () {
const spyToggleExists = await PageObjects.visualize.getSpyToggleExists();
expect(spyToggleExists).to.be(true);
});
it('should show correct tag cloud data', async function () {
const data = await PageObjects.visualize.getTextTag();
log.debug(data);

View file

@ -96,6 +96,11 @@ export default function ({ getService, getPageObjects }) {
});
describe('tile map chart', function indexPatternCreation() {
it('should display spy panel toggle button', async function () {
const spyToggleExists = await PageObjects.visualize.getSpyToggleExists();
expect(spyToggleExists).to.be(true);
});
it('should show correct tile map data on default zoom level', async function () {
const expectedTableData = ['9 5,787 { "lat": 37.22448418632405, "lon": -103.01935195013255 }',
'd 5,600 { "lat": 37.44271478370398, "lon": -81.72692197253595 }',

View file

@ -36,6 +36,11 @@ export default function ({ getService, getPageObjects }) {
describe('Visual Builder chart', function indexPatternCreation() {
it('should not display spy panel toggle button', async function () {
const spyToggleExists = await PageObjects.visualize.getSpyToggleExists();
expect(spyToggleExists).to.be(false);
});
it('should show correct data', function () {
const expectedMetricValue = '156';

View file

@ -70,6 +70,11 @@ export default function ({ getService, getPageObjects }) {
});
});
it('should display spy panel toggle button', async function () {
const spyToggleExists = await PageObjects.visualize.getSpyToggleExists();
expect(spyToggleExists).to.be(true);
});
it('should show correct chart, take screenshot', async function () {
const expectedChartValues = [37, 202, 740, 1437, 1371, 751, 188, 31, 42, 202, 683,
1361, 1415, 707, 177, 27, 32, 175, 707, 1408, 1355, 726, 201, 29