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

[NP] Timelion #44039

Merged
merged 69 commits into from
Sep 26, 2019
Merged
Changes from 1 commit
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
6a249bf
Move index.js to index.ts
Aug 26, 2019
f8d6c16
Merge remote-tracking branch 'upstream/master' into timelion-new-plat…
Aug 27, 2019
ce99228
Merge remote-tracking branch 'upstream/master' into timelion-new-plat…
Aug 28, 2019
c11faa4
Merge remote-tracking branch 'upstream/master' into timelion-new-plat…
Aug 28, 2019
a8bde3e
Migrate Vis, interpreter, home and 2 hacks to setup() and start()
Aug 28, 2019
69887c7
Move Timechart hack to start()
Aug 28, 2019
ca5bcc9
Add featureCatalogueRegistryProvider to an interface
Aug 28, 2019
446b96c
Add types to a server param
Aug 28, 2019
ec021e6
Merge remote-tracking branch 'upstream/master' into timelion-new-plat…
Aug 29, 2019
4cb9c06
Move some .js to .ts
Aug 29, 2019
e7b5c07
Merge remote-tracking branch 'upstream/master' into timelion-new-plat…
Aug 30, 2019
ffd604c
Add ExpressionFunction<> to interpreter
Aug 30, 2019
1369f6d
Remove Feature Provider
Aug 30, 2019
1716d1d
Merge remote-tracking branch 'upstream/master' into timelion-new-plat…
Sep 2, 2019
8c178f2
Remove extra export
Sep 2, 2019
630e0b0
Add an interface to a timelion response
Sep 2, 2019
e40b399
Add an inteface to the panel
Sep 2, 2019
a621257
Add IPrivate interface
Sep 2, 2019
0abd64d
Make nit notes
Sep 2, 2019
fc89dd0
Edit uiCapabilities() type
Sep 3, 2019
63b5bcc
Merge remote-tracking branch 'upstream/master' into timelion-new-plat…
Sep 3, 2019
1738161
Shim Timelion plugin
Sep 3, 2019
a482260
Shim start() plugin method
Sep 3, 2019
8672082
Merge remote-tracking branch 'upstream/master' into timelion-new-plat…
Sep 4, 2019
5308ca7
Change InternalCoreStart to LegacyCoreStart
Sep 4, 2019
29eea85
Move Angular dependencies to a separate module
Sep 4, 2019
8a0a6bc
Merge remote-tracking branch 'upstream/master' into timelion-new-plat…
Sep 4, 2019
4ae00b7
Merge remote-tracking branch 'upstream/master' into timelion-new-plat…
Sep 5, 2019
eae077a
Change visualizations import path due to recent changes
Sep 5, 2019
1573bb3
Merge remote-tracking branch 'upstream/master' into timelion-new-plat…
Sep 6, 2019
b8bd9ea
Rename directives
Sep 6, 2019
60f2a5d
Take a common property out
Sep 6, 2019
afe69c4
Get rid of require in schema
Sep 6, 2019
8539357
Use core.uiSettings
Sep 6, 2019
81fde15
Refactor timelion request handler
Sep 6, 2019
a967b0f
Merge remote-tracking branch 'upstream/master' into timelion-new-plat…
Sep 9, 2019
c505be3
Remove Private from tests
Sep 9, 2019
78680f1
Remove redundant dependencies from tests
Sep 9, 2019
013712d
Merge remote-tracking branch 'upstream/master' into timelion-new-plat…
Sep 9, 2019
5ab195f
Merge remote-tracking branch 'upstream/master' into timelion-new-plat…
Sep 10, 2019
c4abb62
Merge remote-tracking branch 'upstream/master' into timelion-new-plat…
Sep 11, 2019
b51082b
Update visualizations paths
Sep 11, 2019
74f5888
Merge remote-tracking branch 'upstream/master' into timelion-new-plat…
Sep 12, 2019
fab6f32
Merge remote-tracking branch 'upstream/master' into timelion-new-plat…
Sep 13, 2019
c215ac3
Merge remote-tracking branch 'upstream/master' into timelion-new-plat…
Sep 13, 2019
bb3b87d
Change expressions paths due to expessions movement
Sep 13, 2019
0506a34
Merge remote-tracking branch 'upstream/master' into timelion-new-plat…
Sep 16, 2019
45db215
Merge remote-tracking branch 'upstream/master' into timelion-new-plat…
Sep 17, 2019
fff5604
Refactoring according to reviews
Sep 17, 2019
186f39f
Merge remote-tracking branch 'upstream/master' into timelion-new-plat…
Sep 19, 2019
6ff49f6
Add a comment over the uiCapabilities field
Sep 19, 2019
db2d6e1
Merge branch 'timelion-new-platform' of github.com:Avinar-24/kibana i…
Sep 19, 2019
8300bf9
Edit the comment
Sep 19, 2019
2bad9c1
Merge remote-tracking branch 'upstream/master' into timelion-new-plat…
Sep 20, 2019
a8821c2
Ignore uiCapabilities issue
Sep 20, 2019
a6d3bfc
Merge remote-tracking branch 'upstream/master' into timelion-new-plat…
Sep 23, 2019
3d12714
Take angular controller out
Sep 23, 2019
c90c7a0
Get rid of
Sep 23, 2019
7a8ff51
Get rid of config
Sep 23, 2019
9653ddb
Get rid of config in start
Sep 23, 2019
feed318
Merge remote-tracking branch 'upstream/master' into timelion-new-plat…
Sep 24, 2019
7b4b104
Unwrap handler from redundant promise
Sep 24, 2019
68ae787
Move npSetup npStart dependencies in a high level
Sep 24, 2019
bb3ec7a
Rename some details
Sep 24, 2019
9708804
Fix reviews
Sep 24, 2019
dff86b3
fix CI
alexwizp Sep 24, 2019
f37d54c
Merge remote-tracking branch 'upstream/master' into timelion-new-plat…
Sep 25, 2019
68f7127
Merge remote-tracking branch 'upstream/master' into timelion-new-plat…
Sep 26, 2019
bb28ce8
Take visFactory out
Sep 26, 2019
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
Prev Previous commit
Next Next commit
Move Angular dependencies to a separate module
  • Loading branch information
art.gospodarsky committed Sep 4, 2019
commit 29eea85987c433af4ac5c5bab4387f05db471337
79 changes: 38 additions & 41 deletions src/legacy/core_plugins/timelion/public/directives/chart/chart.js
Original file line number Diff line number Diff line change
@@ -17,55 +17,52 @@
* under the License.
*/
import panelRegistryProvider from '../../lib/panel_registry';
gospodarsky marked this conversation as resolved.
Show resolved Hide resolved

import { i18n } from '@kbn/i18n';

require('ui/modules')
.get('apps/timelion', [])
.directive('chart', function (Private) {
return {
restrict: 'A',
scope: {
seriesList: '=chart', // The flot object, data, config and all
search: '=', // The function to execute to kick off a search
interval: '=', // Required for formatting x-axis ticks
rerenderTrigger: '=',
},
link: function ($scope, $elem) {

const panelRegistry = Private(panelRegistryProvider);
let panelScope = $scope.$new(true);

function render() {
panelScope.$destroy();
export function makeChart(Private) {
gospodarsky marked this conversation as resolved.
Show resolved Hide resolved
return {
restrict: 'A',
scope: {
seriesList: '=chart', // The flot object, data, config and all
search: '=', // The function to execute to kick off a search
interval: '=', // Required for formatting x-axis ticks
rerenderTrigger: '=',
},
link: function ($scope, $elem) {

if (!$scope.seriesList) return;
const panelRegistry = Private(panelRegistryProvider);
let panelScope = $scope.$new(true);

$scope.seriesList.render = $scope.seriesList.render || {
type: 'timechart'
};
function render() {
panelScope.$destroy();

const panelSchema = panelRegistry.byName[$scope.seriesList.render.type];
if (!$scope.seriesList) return;

if (!panelSchema) {
$elem.text(
i18n.translate('timelion.chart.seriesList.noSchemaWarning', {
defaultMessage: 'No such panel type: {renderType}',
values: { renderType: $scope.seriesList.render.type },
})
);
return;
}
$scope.seriesList.render = $scope.seriesList.render || {
type: 'timechart'
};

panelScope = $scope.$new(true);
panelScope.seriesList = $scope.seriesList;
panelScope.interval = $scope.interval;
panelScope.search = $scope.search;
const panelSchema = panelRegistry.byName[$scope.seriesList.render.type];

panelSchema.render(panelScope, $elem);
if (!panelSchema) {
$elem.text(
i18n.translate('timelion.chart.seriesList.noSchemaWarning', {
defaultMessage: 'No such panel type: {renderType}',
values: { renderType: $scope.seriesList.render.type },
})
);
return;
}

$scope.$watchGroup(['seriesList', 'rerenderTrigger'], render);
panelScope = $scope.$new(true);
panelScope.seriesList = $scope.seriesList;
panelScope.interval = $scope.interval;
panelScope.search = $scope.search;

panelSchema.render(panelScope, $elem);
}
};
});

$scope.$watchGroup(['seriesList', 'rerenderTrigger'], render);
}
};
}
Original file line number Diff line number Diff line change
@@ -43,9 +43,7 @@
import _ from 'lodash';
import $ from 'jquery';
import PEG from 'pegjs';

import grammar from 'raw-loader!../chain.peg';
import './timelion_expression_suggestions/timelion_expression_suggestions';
import timelionExpressionInputTemplate from './timelion_expression_input.html';
import {
SUGGESTION_TYPE,
@@ -57,9 +55,8 @@ import { comboBoxKeyCodes } from '@elastic/eui';
import { ArgValueSuggestionsProvider } from './timelion_expression_suggestions/arg_value_suggestions';

const Parser = PEG.generate(grammar);
const app = require('ui/modules').get('apps/timelion', []);

app.directive('timelionExpressionInput', function ($http, $timeout, Private) {
export function makeTimelionExpInput($http, $timeout, Private) {
return {
restrict: 'E',
scope: {
@@ -276,4 +273,4 @@ app.directive('timelionExpressionInput', function ($http, $timeout, Private) {
init();
}
};
});
}
Original file line number Diff line number Diff line change
@@ -19,9 +19,7 @@

import template from './timelion_expression_suggestions.html';

const app = require('ui/modules').get('apps/timelion', []);

app.directive('timelionExpressionSuggestions', () => {
export function makeTimelionExpressionSuggestions() {
return {
restrict: 'E',
scope: {
@@ -38,4 +36,4 @@ app.directive('timelionExpressionSuggestions', () => {
scope.onMouseDown = e => e.preventDefault();
}
};
});
}
Original file line number Diff line number Diff line change
@@ -19,11 +19,9 @@

import _ from 'lodash';
import $ from 'jquery';

const app = require('ui/modules').get('apps/timelion', []);
import template from './timelion_interval.html';

app.directive('timelionInterval', function ($timeout) {
export function makeTimelionInterval($timeout) {
return {
restrict: 'E',
scope: {
@@ -81,4 +79,5 @@ app.directive('timelionInterval', function ($timeout) {
});
}
};
});
}

Original file line number Diff line number Diff line change
@@ -22,6 +22,7 @@ import 'ui/es'; // required for $injector.get('es') below
import { Plugin } from 'kibana/public';
// @ts-ignore
import { VisFactoryProvider } from 'ui/vis/vis_factory';
import { initTimelionLegacyModule } from './timelion_legacy_module';

/** @internal */
export interface LegacyDependenciesPluginSetup {
gospodarsky marked this conversation as resolved.
Show resolved Hide resolved
@@ -41,6 +42,9 @@ export class LegacyDependenciesPlugin
implements
Plugin<Promise<LegacyDependenciesPluginSetup>, Promise<LegacyDependenciesPluginStart>> {
public async setup() {
// Init kibana/timelion_vis AngularJS module.
initTimelionLegacyModule();

const $injector = await chrome.dangerouslyGetActiveInjector();
const Private = $injector.get('Private');

Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import 'ngreact';
import 'brace/mode/hjson';
import 'brace/ext/searchbox';
import 'ui/accessibility/kbn_ui_ace_keyboard_mode';
import 'ui/vis/map/service_settings';

import { once } from 'lodash';
// @ts-ignore
import { uiModules } from 'ui/modules';
// @ts-ignore
import { makeChart } from '../directives/chart/chart';
// @ts-ignore
import { makeTimelionInterval } from '../directives/timelion_interval/timelion_interval';
// @ts-ignore
import { makeTimelionExpInput } from '../directives/timelion_expression_input';
// @ts-ignore
import { makeTimelionExpressionSuggestions } from '../directives/timelion_expression_suggestions/timelion_expression_suggestions';

/** @internal */
export const initTimelionLegacyModule = once((): void => {
require('ui/state_management/app_state');

uiModules
.get('kibana/timelion_vis', ['kibana'])
.controller('TimelionVisController', function($scope: any) {
$scope.$on('timelionChartRendered', (event: any) => {
event.stopPropagation();
$scope.renderComplete();
});
})
.directive('chart', makeChart)
.directive('timelionInterval', makeTimelionInterval)
.directive('timelionExpressionSuggestions', makeTimelionExpressionSuggestions)
.directive('timelionExpressionInput', makeTimelionExpInput);
});
3 changes: 0 additions & 3 deletions src/legacy/core_plugins/timelion/public/vis/index.ts
Original file line number Diff line number Diff line change
@@ -21,9 +21,6 @@
import { i18n } from '@kbn/i18n';
// @ts-ignore
import { DefaultEditorSize } from 'ui/vis/editor_size';
// we also need to load the controller and directive used by the template
import './timelion_vis_controller';
import '../directives/timelion_expression_input';
import { getTimelionRequestProvider } from './timelion_request_handler';
import visConfigTemplate from './timelion_vis.html';
import editorConfigTemplate from './timelion_vis_params.html';

This file was deleted.