diff --git a/src/core_plugins/timelion/public/app.js b/src/core_plugins/timelion/public/app.js index 3541a4c408bf2..0bfa81d266720 100644 --- a/src/core_plugins/timelion/public/app.js +++ b/src/core_plugins/timelion/public/app.js @@ -4,6 +4,7 @@ import moment from 'moment-timezone'; import { DocTitleProvider } from 'ui/doc_title'; import { SavedObjectRegistryProvider } from 'ui/saved_objects/saved_object_registry'; import { notify } from 'ui/notify'; +import { timezoneProvider } from 'ui/vis/lib/timezone'; require('plugins/timelion/directives/cells/cells'); require('plugins/timelion/directives/fixed_element'); @@ -75,7 +76,7 @@ app.controller('timelion', function ( }); const savedVisualizations = Private(SavedObjectRegistryProvider).byLoaderPropertiesName.visualizations; - const timezone = Private(require('plugins/timelion/services/timezone'))(); + const timezone = Private(timezoneProvider)(); const docTitle = Private(DocTitleProvider); const defaultExpression = '.es(*)'; diff --git a/src/core_plugins/timelion/public/vis/timelion_request_handler.js b/src/core_plugins/timelion/public/vis/timelion_request_handler.js index 978c7d4163cd1..1b9767ef8a97a 100644 --- a/src/core_plugins/timelion/public/vis/timelion_request_handler.js +++ b/src/core_plugins/timelion/public/vis/timelion_request_handler.js @@ -1,8 +1,9 @@ import _ from 'lodash'; import { dashboardContextProvider } from 'plugins/kibana/dashboard/dashboard_context'; +import { timezoneProvider } from 'ui/vis/lib/timezone'; const TimelionRequestHandlerProvider = function (Private, Notifier, $http, $rootScope, timefilter) { - const timezone = Private(require('plugins/timelion/services/timezone'))(); + const timezone = Private(timezoneProvider)(); const dashboardContext = Private(dashboardContextProvider); const notify = new Notifier({ diff --git a/src/core_plugins/timelion/public/services/timezone.js b/src/ui/public/vis/lib/timezone.js similarity index 89% rename from src/core_plugins/timelion/public/services/timezone.js rename to src/ui/public/vis/lib/timezone.js index a99a55afc5abc..38094cf499217 100644 --- a/src/core_plugins/timelion/public/services/timezone.js +++ b/src/ui/public/vis/lib/timezone.js @@ -1,7 +1,7 @@ const tzDetect = require('jstimezonedetect').jstz; import moment from 'moment'; -export default function timezoneFn(config) { +export function timezoneProvider(config) { return function () { if (config.isDefault('dateFormat:tz')) { @@ -14,3 +14,4 @@ export default function timezoneFn(config) { }; } +