Skip to content

Commit

Permalink
remove angular from Vis (#50402) (#50640)
Browse files Browse the repository at this point in the history
  • Loading branch information
ppisljar authored Nov 14, 2019
1 parent 87625dc commit 3382f17
Show file tree
Hide file tree
Showing 28 changed files with 255 additions and 305 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import chrome from 'ui/chrome';
import React from 'react';
import { render, unmountComponentAtNode } from 'react-dom';
// @ts-ignore
import { VisProvider } from '../../../../ui/public/visualize/loader/vis';
import { Vis } from '../../../../ui/public/visualize/loader/vis';
import { Visualization } from '../../../../ui/public/visualize/components';

export const visualization = () => ({
Expand All @@ -33,8 +33,6 @@ export const visualization = () => ({
const visType = config.visType || visConfig.type;
const $injector = await chrome.dangerouslyGetActiveInjector();
const $rootScope = $injector.get('$rootScope') as any;
const Private = $injector.get('Private') as any;
const Vis = Private(VisProvider);

if (handlers.vis) {
// special case in visualize, we need to render first (without executing the expression), for maps to work
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ import {
subscribeWithScope,
tabifyAggResponse,
vislibSeriesResponseHandlerProvider,
VisProvider,
Vis,
SavedObjectSaveModal,
} from '../kibana_services';

Expand Down Expand Up @@ -190,7 +190,6 @@ function discoverController(
localStorage,
uiCapabilities
) {
const Vis = Private(VisProvider);
const responseHandler = vislibSeriesResponseHandlerProvider().handler;
const getUnhashableStates = Private(getUnhashableStatesProvider);
const shareContextMenuExtensions = Private(ShareContextMenuExtensionsRegistryProvider);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export { tabifyAggResponse } from 'ui/agg_response/tabify';
export { vislibSeriesResponseHandlerProvider } from 'ui/vis/response_handlers/vislib';

// EXPORT types
export { VisProvider } from 'ui/vis';
export { Vis } from 'ui/vis';
export { StaticIndexPattern, IndexPatterns, IndexPattern, FieldType } from 'ui/index_patterns';
export { SearchSource } from 'ui/courier';
export { ElasticSearchHit } from 'ui/registry/doc_views_types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* NOTE: It's a type of SavedObject, but specific to visualizations.
*/

import { VisProvider } from 'ui/vis';
import { Vis } from 'ui/vis';
import { uiModules } from 'ui/modules';
import { updateOldState } from 'ui/vis/vis_update_state';
import { VisualizeConstants } from '../visualize_constants';
Expand All @@ -39,7 +39,6 @@ import {
uiModules
.get('app/visualize')
.factory('SavedVis', function (Promise, savedSearches, Private) {
const Vis = Private(VisProvider);
const SavedObject = Private(SavedObjectProvider);
createLegacyClass(SavedVis).inherits(SavedObject);
function SavedVis(opts) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import ngMock from 'ng_mock';
import _ from 'lodash';
import ChoroplethLayer from '../choropleth_layer';
import LogstashIndexPatternStubProvider from 'fixtures/stubbed_logstash_index_pattern';
import * as visModule from 'ui/vis';
import { Vis } from 'ui/vis';
import { ImageComparator } from 'test_utils/image_comparator';
import worldJson from './world.json';
import EMS_CATALOGUE from '../../../../ui/public/vis/__tests__/map/ems_mocks/sample_manifest.json';
Expand Down Expand Up @@ -50,7 +50,6 @@ const PIXEL_DIFF = 96;
describe('RegionMapsVisualizationTests', function () {
let domNode;
let RegionMapsVisualization;
let Vis;
let indexPattern;
let vis;
let dependencies;
Expand Down Expand Up @@ -113,7 +112,6 @@ describe('RegionMapsVisualizationTests', function () {
visualizationsSetup.types.registerVisualization(() => createRegionMapTypeDefinition(dependencies));
}

Vis = Private(visModule.VisProvider);
RegionMapsVisualization = createRegionMapVisualization(dependencies);
indexPattern = Private(LogstashIndexPatternStubProvider);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import expect from '@kbn/expect';
import ngMock from 'ng_mock';
import LogstashIndexPatternStubProvider from 'fixtures/stubbed_logstash_index_pattern';
import * as visModule from 'ui/vis';
import { Vis } from 'ui/vis';
import { ImageComparator } from 'test_utils/image_comparator';
import dummyESResponse from './dummy_es_response.json';
import initial from './initial.png';
Expand Down Expand Up @@ -65,7 +65,6 @@ let visRegComplete = false;
describe('CoordinateMapsVisualizationTest', function () {
let domNode;
let CoordinateMapsVisualization;
let Vis;
let indexPattern;
let vis;
let dependencies;
Expand All @@ -91,7 +90,6 @@ describe('CoordinateMapsVisualizationTest', function () {
}


Vis = Private(visModule.VisProvider);
CoordinateMapsVisualization = createTileMapVisualization(dependencies);
indexPattern = Private(LogstashIndexPatternStubProvider);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import $ from 'jquery';
import ngMock from 'ng_mock';
import expect from '@kbn/expect';

import { VisProvider } from 'ui/vis';
import { Vis } from 'ui/vis';
import LogstashIndexPatternStubProvider from 'fixtures/stubbed_logstash_index_pattern';

import { createMetricVisTypeDefinition } from '../metric_vis_type';
Expand All @@ -34,7 +34,6 @@ describe('metric_vis - createMetricVisTypeDefinition', () => {
beforeEach(
ngMock.inject(Private => {
setup = () => {
const Vis = Private(VisProvider);
const metricVisType = createMetricVisTypeDefinition();
const indexPattern = Private(LogstashIndexPatternStubProvider);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import $ from 'jquery';
import expect from '@kbn/expect';
import ngMock from 'ng_mock';
import { legacyResponseHandlerProvider } from 'ui/vis/response_handlers/legacy';
import { VisProvider } from 'ui/vis';
import { Vis } from 'ui/vis';
import { VisFactoryProvider } from 'ui/vis/vis_factory';
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
import { AppStateProvider } from 'ui/state_management/app_state';
Expand All @@ -36,7 +36,6 @@ describe('Table Vis - Controller', async function () {
let Private;
let $scope;
let $el;
let Vis;
let fixtures;
let AppState;
let tableAggResponse;
Expand All @@ -63,7 +62,6 @@ describe('Table Vis - Controller', async function () {
$compile = $injector.get('$compile');
fixtures = require('fixtures/fake_hierarchical_data');
AppState = Private(AppStateProvider);
Vis = Private(VisProvider);
tableAggResponse = legacyResponseHandlerProvider().handler;
})
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import fixtures from 'fixtures/fake_hierarchical_data';
import sinon from 'sinon';
import { legacyResponseHandlerProvider } from 'ui/vis/response_handlers/legacy';
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
import { VisProvider } from 'ui/vis';
import { Vis } from 'ui/vis';
import { tabifyAggResponse } from 'ui/agg_response/tabify';
import { round } from 'lodash';

Expand All @@ -36,7 +36,6 @@ import { setup as visualizationsSetup } from '../../../../visualizations/public/
describe('Table Vis - AggTable Directive', function () {
let $rootScope;
let $compile;
let Vis;
let indexPattern;
let settings;
let tableAggResponse;
Expand Down Expand Up @@ -113,7 +112,6 @@ describe('Table Vis - AggTable Directive', function () {
ngMock.inject(function ($injector, Private, config) {
tableAggResponse = legacyResponseHandlerProvider().handler;
indexPattern = Private(FixturesStubbedLogstashIndexPatternProvider);
Vis = Private(VisProvider);
settings = config;

$rootScope = $injector.get('$rootScope');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,12 @@ import expect from '@kbn/expect';
import fixtures from 'fixtures/fake_hierarchical_data';
import { legacyResponseHandlerProvider } from 'ui/vis/response_handlers/legacy';
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
import { VisProvider } from 'ui/vis';
import { Vis } from 'ui/vis';
import { tabifyAggResponse } from 'ui/agg_response/tabify';

describe('Table Vis - AggTableGroup Directive', function () {
let $rootScope;
let $compile;
let Vis;
let indexPattern;
let tableAggResponse;
const tabifiedData = {};
Expand Down Expand Up @@ -69,7 +68,6 @@ describe('Table Vis - AggTableGroup Directive', function () {

tableAggResponse = legacyResponseHandlerProvider().handler;
indexPattern = Private(FixturesStubbedLogstashIndexPatternProvider);
Vis = Private(VisProvider);

$rootScope = $injector.get('$rootScope');
$compile = $injector.get('$compile');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import expect from '@kbn/expect';
import ngMock from 'ng_mock';
import LogstashIndexPatternStubProvider from 'fixtures/stubbed_logstash_index_pattern';
import * as visModule from 'ui/vis';
import { Vis } from 'ui/vis';
import { ImageComparator } from 'test_utils/image_comparator';
import { TagCloudVisualization } from '../tag_cloud_visualization';
import basicdrawPng from './basicdraw.png';
Expand All @@ -33,7 +33,6 @@ const PIXEL_DIFF = 64;
describe('TagCloudVisualizationTest', function () {

let domNode;
let Vis;
let indexPattern;
let vis;
let imageComparator;
Expand All @@ -57,7 +56,6 @@ describe('TagCloudVisualizationTest', function () {

beforeEach(ngMock.module('kibana'));
beforeEach(ngMock.inject((Private) => {
Vis = Private(visModule.VisProvider);
indexPattern = Private(LogstashIndexPatternStubProvider);
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ const APP_NAME = 'VisEditor';
export class VisEditor extends Component {
constructor(props) {
super(props);
const { vis } = props;
this.appState = vis.API.getAppState();
this.appState = props.appState;
this.localStorage = new Storage(window.localStorage);
this.state = {
model: props.visParams,
Expand Down Expand Up @@ -183,7 +182,6 @@ export class VisEditor extends Component {
dirty={this.state.dirty}
autoApply={this.state.autoApply}
model={model}
appState={this.appState}
savedObj={this.props.savedObj}
timeRange={this.props.timeRange}
uiState={this.uiState}
Expand Down Expand Up @@ -239,4 +237,5 @@ VisEditor.propTypes = {
isEditorMode: PropTypes.bool,
savedObj: PropTypes.object,
timeRange: PropTypes.object,
appState: PropTypes.object,
};
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import ngMock from 'ng_mock';
import $ from 'jquery';
import { createVegaVisualization } from '../vega_visualization';
import LogstashIndexPatternStubProvider from 'fixtures/stubbed_logstash_index_pattern';
import * as visModule from 'ui/vis';
import { Vis } from 'ui/vis';
import { ImageComparator } from 'test_utils/image_comparator';

import vegaliteGraph from '!!raw-loader!./vegalite_graph.hjson';
Expand All @@ -50,7 +50,6 @@ const PIXEL_DIFF = 30;
describe('VegaVisualizations', () => {
let domNode;
let VegaVisualization;
let Vis;
let indexPattern;
let vis;
let imageComparator;
Expand All @@ -73,7 +72,6 @@ describe('VegaVisualizations', () => {
);
}

Vis = Private(visModule.VisProvider);

VegaVisualization = createVegaVisualization(vegaVisualizationDependencies);
indexPattern = Private(LogstashIndexPatternStubProvider);
Expand Down
1 change: 0 additions & 1 deletion src/legacy/core_plugins/visualizations/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export { DefaultEditorSize } from 'ui/vis/editor_size';
import * as types from 'ui/vis/vis';
export type Vis = types.Vis;
export type VisParams = types.VisParams;
export type VisProvider = types.VisProvider;
export type VisState = types.VisState;
export { VisualizationController } from 'ui/vis/vis_types/vis_type';
export { Status } from 'ui/vis/update_status';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,13 @@
import expect from '@kbn/expect';
import ngMock from 'ng_mock';
import { tabifyGetColumns } from '../_get_columns';
import { VisProvider } from '../../../vis';
import { Vis } from '../../../vis';
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
describe('get columns', function () {
let Vis;
let indexPattern;

beforeEach(ngMock.module('kibana'));
beforeEach(ngMock.inject(function (Private) {
Vis = Private(VisProvider);
indexPattern = Private(FixturesStubbedLogstashIndexPatternProvider);
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,14 @@ import fixtures from 'fixtures/fake_hierarchical_data';
import expect from '@kbn/expect';
import ngMock from 'ng_mock';
import { tabifyAggResponse } from '../tabify';
import { VisProvider } from '../../../vis';
import { Vis } from '../../../vis';
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';

describe('tabifyAggResponse Integration', function () {
let Vis;
let indexPattern;

beforeEach(ngMock.module('kibana'));
beforeEach(ngMock.inject(function (Private) {
Vis = Private(VisProvider);
indexPattern = Private(FixturesStubbedLogstashIndexPatternProvider);
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,17 @@
import expect from '@kbn/expect';
import ngMock from 'ng_mock';
import { TabbedAggResponseWriter } from '../_response_writer';
import { VisProvider } from '../../../vis';
import { Vis } from '../../../vis';
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';

describe('TabbedAggResponseWriter class', function () {
let Vis;
let Private;
let indexPattern;

beforeEach(ngMock.module('kibana'));
beforeEach(ngMock.inject(function ($injector) {
Private = $injector.get('Private');

Vis = Private(VisProvider);
indexPattern = Private(FixturesStubbedLogstashIndexPatternProvider);
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import expect from '@kbn/expect';
import ngMock from 'ng_mock';
import { buildOtherBucketAgg, mergeOtherBucketAggResponse, updateMissingBucket } from '../../buckets/_terms_other_bucket_helper';
import { VisProvider } from '../../../vis';
import { Vis } from '../../../vis';
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';

const visConfigSingleTerm = {
Expand Down Expand Up @@ -158,7 +158,6 @@ describe('Terms Agg Other bucket helper', () => {
function init(aggConfig) {
ngMock.module('kibana');
ngMock.inject((Private) => {
const Vis = Private(VisProvider);
const indexPattern = Private(FixturesStubbedLogstashIndexPatternProvider);

vis = new Vis(indexPattern, aggConfig);
Expand Down
4 changes: 1 addition & 3 deletions src/legacy/ui/public/vis/__tests__/_agg_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,18 @@
import sinon from 'sinon';
import expect from '@kbn/expect';
import ngMock from 'ng_mock';
import { VisProvider } from '..';
import { Vis } from '..';
import { AggType } from '../../agg_types/agg_type';
import { AggConfig } from '../../agg_types/agg_config';
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
import { fieldFormats } from '../../registry/field_formats';

describe('AggConfig', function () {

let Vis;
let indexPattern;

beforeEach(ngMock.module('kibana'));
beforeEach(ngMock.inject(function (Private) {
Vis = Private(VisProvider);
indexPattern = Private(FixturesStubbedLogstashIndexPatternProvider);
}));

Expand Down
Loading

0 comments on commit 3382f17

Please sign in to comment.