Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
feef34c
Migrate registry to TypeScript
kertal Jan 7, 2020
eb45ab0
Adapt plugins
kertal Jan 7, 2020
139fcfc
Migrate management code
kertal Jan 7, 2020
f1f635f
Adapt VisualizeEmbeddableFactory to use createSavedVisLoader
kertal Jan 8, 2020
49bdf27
Merge remote-tracking branch 'upstream/master' into kertal-pr-2020-01…
kertal Jan 8, 2020
aa6ff7c
Improve VisualizeEmbeddableFactory code
kertal Jan 8, 2020
ebadc49
Migrate SavedObjectLoader services registration to management section
kertal Jan 8, 2020
f721047
Merge remote-tracking branch 'upstream/master' into kertal-pr-2020-01…
kertal Jan 8, 2020
a12e7aa
Replace Angular SavedSearchLoader in transform plugin
kertal Jan 8, 2020
efa7a1d
Add data plugin to transform plugin
kertal Jan 8, 2020
9f693c5
Merge remote-tracking branch 'upstream/master' into kertal-pr-2020-01…
kertal Jan 8, 2020
d45ad30
Fix types in transform plugin
kertal Jan 9, 2020
b2208cc
Merge branch 'master' into kertal-pr-2020-01-07-refactor-saved-object…
elasticmachine Jan 13, 2020
691351d
Address review comments
kertal Jan 15, 2020
22f586e
Merge branch 'kertal-pr-2020-01-07-refactor-saved-object-management-r…
kertal Jan 15, 2020
0bdf4df
Centralize getSavedVisualizations function
kertal Jan 20, 2020
f76aeea
Merge master/fix conflicts
kertal Jan 24, 2020
522c197
Migrate saved_visualizations from visualize to visualizations plugin
kertal Jan 24, 2020
2040176
Fix timelion
kertal Jan 24, 2020
0c7b1ac
Fix management objects _view.js angular rendering
kertal Jan 24, 2020
4eed031
Refactor savedVisualizations to getSavedVisualizationsLoader
kertal Jan 24, 2020
c0067da
Merge upstream/master, fix merge problems
kertal Jan 27, 2020
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
1 change: 0 additions & 1 deletion src/legacy/core_plugins/kibana/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ export default function(kibana) {
'plugins/kibana/visualize/legacy',
'plugins/kibana/dashboard/legacy',
],
savedObjectTypes: ['plugins/kibana/dashboard/saved_dashboard/saved_dashboard_register'],
app: {
id: 'kibana',
title: 'Kibana',
Expand Down

This file was deleted.

1 change: 1 addition & 0 deletions src/legacy/core_plugins/kibana/public/dashboard/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { PluginInitializerContext } from 'kibana/public';
import { DashboardPlugin } from './plugin';

export * from './np_ready/dashboard_constants';
export { createSavedDashboardLoader } from './saved_dashboard/saved_dashboards';

// Core will be looking for this when loading our plugin in the new platform
export const plugin = (context: PluginInitializerContext) => {
Expand Down
1 change: 0 additions & 1 deletion src/legacy/core_plugins/kibana/public/dashboard/legacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import { npSetup, npStart, legacyChrome } from './legacy_imports';
import { LegacyAngularInjectedDependencies } from './plugin';
import { start as data } from '../../../data/public/legacy';
import { start as embeddables } from '../../../embeddable_api/public/np_ready/public/legacy';
import './saved_dashboard/saved_dashboard_register';
import './dashboard_config';
import { plugin } from './index';

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
IndexPatternsContract,
DataPublicPluginStart,
} from 'src/plugins/data/public';
import { createSavedSearchesService } from './saved_searches';
import { createSavedSearchesLoader } from './saved_searches';
import { DiscoverStartPlugins } from './plugin';
import { EuiUtilsStart } from '../../../../../plugins/eui_utils/public';
import { SharePluginStart } from '../../../../../plugins/share/public';
Expand Down Expand Up @@ -68,7 +68,7 @@ export async function buildServices(
chrome: core.chrome,
overlays: core.overlays,
};
const savedObjectService = createSavedSearchesService(services);
const savedObjectService = createSavedSearchesLoader(services);
return {
addBasePath: core.http.basePath.prepend,
capabilities: core.application.capabilities,
Expand Down
2 changes: 1 addition & 1 deletion src/legacy/core_plugins/kibana/public/discover/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import { PluginInitializerContext } from 'kibana/public';
import { DiscoverPlugin } from './plugin';

export { createSavedSearchesService } from './saved_searches/saved_searches';
export { createSavedSearchesLoader } from './saved_searches/saved_searches';

// Core will be looking for this when loading our plugin in the new platform
export const plugin = (context: PluginInitializerContext) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@
*/

export * from './saved_searches';
import './saved_searches_register';
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { SavedObjectLoader } from 'ui/saved_objects';
import { SavedObjectKibanaServices } from 'ui/saved_objects/types';
import { createSavedSearchClass } from './_saved_search';

export function createSavedSearchesService(services: SavedObjectKibanaServices) {
export function createSavedSearchesLoader(services: SavedObjectKibanaServices) {
const SavedSearchClass = createSavedSearchClass(services);
const savedSearchLoader = new SavedObjectLoader(
SavedSearchClass,
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*
* 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 _ from 'lodash';
import { i18n } from '@kbn/i18n';
import { npStart } from 'ui/new_platform';
import { SavedObjectLoader } from 'ui/saved_objects';
import { createSavedDashboardLoader } from '../dashboard';
import { createSavedSearchesLoader } from '../discover';
import { TypesService, createSavedVisLoader } from '../../../visualizations/public';

/**
* This registry is used for the editing mode of Saved Searches, Visualizations,
* Dashboard and Time Lion saved objects.
*/
interface SavedObjectRegistryEntry {
id: string;
service: SavedObjectLoader;
title: string;
}

const registry: SavedObjectRegistryEntry[] = [];

export const savedObjectManagementRegistry = {
register: (service: SavedObjectRegistryEntry) => {
registry.push(service);
},
all: () => {
return registry;
},
get: (id: string) => {
return _.find(registry, { id });
},
};

const services = {
savedObjectsClient: npStart.core.savedObjects.client,
indexPatterns: npStart.plugins.data.indexPatterns,
chrome: npStart.core.chrome,
overlays: npStart.core.overlays,
};

savedObjectManagementRegistry.register({
id: 'savedVisualizations',
service: createSavedVisLoader({
...services,
...{ visualizationTypes: new TypesService().start() },
}),
title: 'visualizations',
});

savedObjectManagementRegistry.register({
id: 'savedDashboards',
service: createSavedDashboardLoader(services),
title: i18n.translate('kbn.dashboard.savedDashboardsTitle', {
defaultMessage: 'dashboards',
}),
});

savedObjectManagementRegistry.register({
id: 'savedSearches',
service: createSavedSearchesLoader(services),
title: 'searches',
});
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function updateObjectsTable($scope, $injector) {
const confirmModalPromise = $injector.get('confirmModalPromise');

const savedObjectsClient = npStart.core.savedObjects.client;
const services = savedObjectManagementRegistry.all().map(obj => $injector.get(obj.service));
const services = savedObjectManagementRegistry.all().map(obj => obj.service);
const uiCapabilites = npStart.core.application.capabilities;

$scope.$$postDigest(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,9 @@ uiModules
.directive('kbnManagementObjectsView', function(kbnIndex, confirmModal) {
return {
restrict: 'E',
controller: function(
$scope,
$injector,
$routeParams,
$location,
$window,
$rootScope,
uiCapabilities
) {
controller: function($scope, $routeParams, $location, $window, $rootScope, uiCapabilities) {
const serviceObj = savedObjectManagementRegistry.get($routeParams.service);
const service = $injector.get(serviceObj.service);
const service = serviceObj.service;
const savedObjectsClient = npStart.core.savedObjects.client;

/**
Expand Down Expand Up @@ -184,6 +176,7 @@ uiModules
return orderIndex > -1 ? orderIndex : Infinity;
});
});
$scope.$digest();
})
.catch(error => fatalError(error, location));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ export function getIndexBreadcrumbs() {
];
}

export function getViewBreadcrumbs($routeParams, $injector) {
export function getViewBreadcrumbs($routeParams) {
const serviceObj = savedObjectManagementRegistry.get($routeParams.service);
const service = $injector.get(serviceObj.service);
const { service } = serviceObj;

return [
...getIndexBreadcrumbs(),
Expand Down
3 changes: 1 addition & 2 deletions src/legacy/core_plugins/kibana/public/visualize/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ import { VisualizePlugin } from './plugin';

export * from './np_ready/visualize_constants';
export { showNewVisModal } from './np_ready/wizard';

export { createSavedVisLoader } from './saved_visualizations/saved_visualizations';
export { VisualizeConstants, createVisualizeEditUrl } from './np_ready/visualize_constants';

// Core will be looking for this when loading our plugin in the new platform
export const plugin = (context: PluginInitializerContext) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import angular from 'angular';
import _ from 'lodash';
import { Subscription } from 'rxjs';
import { i18n } from '@kbn/i18n';
import '../../saved_visualizations/saved_visualizations';

import React from 'react';
import { FormattedMessage } from '@kbn/i18n/react';
Expand Down
Loading