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

Allow any type of saved object to import / export #34896

Merged
merged 86 commits into from
May 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
3623f1c
Modify the relationships API and UI
mikecote Apr 9, 2019
2fffe8e
Remove type validation on export
mikecote Apr 9, 2019
c6c78dc
Update relationship test snapshots
mikecote Apr 9, 2019
e2f034f
Change relationships table titles
mikecote Apr 9, 2019
3e89333
Change relationships UI to share one table
mikecote Apr 9, 2019
68edcd3
Add server side logic to inject meta data into saved objects from plu…
mikecote Apr 10, 2019
8817048
Manually enable each type of saved object to support
mikecote Apr 10, 2019
d59ccf8
Use injected vars to determine what types are import / exportable
mikecote Apr 10, 2019
d7fa0be
Fix some broken tests
mikecote Apr 10, 2019
89fdbf7
Remove unused translations
mikecote Apr 10, 2019
d2f8d96
Fix relationships mocha tests
mikecote Apr 11, 2019
9b0a952
Remove tests that ensured types are restricted, functionality removed
mikecote Apr 11, 2019
f7ef3fe
Move kfetch logic into separate file
mikecote Apr 11, 2019
6e1f089
Add inAppUrl to missing types
mikecote Apr 11, 2019
b21ad76
Merge branch 'master' of github.com:elastic/kibana into saved-object/…
mikecote Apr 11, 2019
cfc796a
Add tooltip to management table titles that aren't links
mikecote Apr 11, 2019
a60a07e
Make relationships screen support filtering by type
mikecote Apr 11, 2019
50f1712
Fix failing tests
mikecote Apr 11, 2019
9f67554
Add refresh support for inAppUrls
mikecote Apr 11, 2019
f2671a1
Add error notifications when export API call fails
mikecote Apr 11, 2019
735db3f
Add relationship direction
mikecote Apr 11, 2019
042e9b3
Fix broken tests
mikecote Apr 11, 2019
f78fd91
Merge branch 'master' of github.com:elastic/kibana into saved-object/…
mikecote Apr 12, 2019
1d9cdc7
Remove graph workspace from import / export
mikecote Apr 12, 2019
26549ae
Use parent / child terminology for relationships
mikecote Apr 12, 2019
6f6c8b2
Use direct relationship terminology
mikecote Apr 12, 2019
942a41e
Flip view / edit logic in saved object management app
mikecote Apr 12, 2019
da5b3ff
Make config saved object redirect to advanced settings
mikecote Apr 12, 2019
8102ac4
Fix broken tests
mikecote Apr 12, 2019
065780a
Remove unused translations
mikecote Apr 12, 2019
63e8251
Code cleanup
mikecote Apr 12, 2019
32f8b4f
Add tests
mikecote Apr 12, 2019
0a2c977
Add fallback overwrite confirmation object title
mikecote Apr 13, 2019
a8a58a8
Enforce supported types on import, export and resolve import errors
mikecote Apr 13, 2019
40dc343
Fix broken tests
mikecote Apr 14, 2019
c3f171f
Fix broken tests pt2
mikecote Apr 14, 2019
62ae4d9
Fix broken tests pt3
mikecote Apr 14, 2019
0b1bb3d
Test cleanup
mikecote Apr 15, 2019
23e2e45
Use server.decorate to access savedobjectschemas
mikecote Apr 15, 2019
1b5fa7e
Fix some broken tests
mikecote Apr 15, 2019
041cca0
Fix broken tests, add new title to relationships screen
mikecote Apr 15, 2019
fed3f90
Merge with master
mikecote Apr 16, 2019
bc9f1b8
Merge branch 'master' of github.com:elastic/kibana into saved-object/…
mikecote Apr 16, 2019
31e74a8
Fix some broken tests
mikecote Apr 16, 2019
856b308
Handle dynamic versions
mikecote Apr 17, 2019
475b7af
Merge branch 'master' of github.com:elastic/kibana into saved-object/…
mikecote Apr 17, 2019
e6a5f81
Fix inAppUrl structure in tests
mikecote Apr 17, 2019
0d61e12
Merge branch 'master' of github.com:elastic/kibana into saved-object/…
mikecote Apr 18, 2019
0da163a
Re-use generic canGoInApp
mikecote Apr 18, 2019
10ea75a
Merge branch 'master' of github.com:elastic/kibana into saved-object/…
mikecote Apr 19, 2019
1e28f5f
Fix broken tests
mikecote Apr 20, 2019
9f10c34
Merge branch 'master' of github.com:elastic/kibana into saved-object/…
mikecote Apr 23, 2019
e53089e
Apply maps PR feedback
mikecote Apr 23, 2019
d7b7f66
Apply PR feedback pt1
mikecote Apr 23, 2019
184eb41
Apply PR feedback pt2
mikecote Apr 23, 2019
54b0a76
Add savedObjectsManagement to uiExports
mikecote Apr 24, 2019
f94386d
Fix broken tests
mikecote Apr 24, 2019
a71d713
Merge branch 'master' of github.com:elastic/kibana into saved-object/…
mikecote Apr 24, 2019
344b4cb
Merge branch 'master' of github.com:elastic/kibana into saved-object/…
mikecote Apr 24, 2019
1eb18d8
Fix encodeURIComponent implementation
mikecote Apr 24, 2019
38b402b
Merge
mikecote Apr 25, 2019
99aea10
Merge 403 and unsupported type errors into single error
mikecote Apr 26, 2019
884f566
Apply suggestion
mikecote Apr 26, 2019
e517fab
Remove import / exportable by default, opt-in instead
mikecote Apr 26, 2019
60167ca
Merge
mikecote Apr 26, 2019
affd7d7
Fix type config to show up properly in the table
mikecote Apr 26, 2019
3b46e09
Merge branch 'master' of github.com:elastic/kibana into saved-object/…
mikecote Apr 26, 2019
6ba7017
Merge branch 'master' of github.com:elastic/kibana into saved-object/…
mikecote Apr 26, 2019
0daebdf
Change config type title and fix tests
mikecote Apr 26, 2019
59973d0
Merge with master
mikecote May 1, 2019
f3505f7
Remove isImportableAndExportable where set to false (new default)
mikecote May 1, 2019
9618c2c
Remove comments referencing to authorization
mikecote May 1, 2019
2674a9d
Add unit tests for spaces
mikecote May 1, 2019
6287a8c
Add unit tests for security plugin
mikecote May 1, 2019
b657ac8
Change can* signature to be the same as their equivalent function, ap…
mikecote May 1, 2019
b7e4f52
Cleanup git diff
mikecote May 1, 2019
daa16f6
Revert "Change can* signature to be the same as their equivalent func…
mikecote May 3, 2019
5c6d2ea
Revert "Add unit tests for security plugin"
mikecote May 3, 2019
fa04161
Revert "Add unit tests for spaces"
mikecote May 3, 2019
e92890b
Revert "Remove comments referencing to authorization"
mikecote May 3, 2019
6534987
Revert "Merge 403 and unsupported type errors into single error"
mikecote May 3, 2019
56ced9b
Merge with master
mikecote May 6, 2019
898bcb2
Add CUSTOM_ELEMENT_TYPE for import / export
mikecote May 6, 2019
c68a3c7
Fix broken tests
mikecote May 6, 2019
a1c3b74
Fix broken tests pt2
mikecote May 6, 2019
a1dcf59
Prevent crashing app when inAppUrl is undefined
mikecote May 6, 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
95 changes: 93 additions & 2 deletions src/legacy/core_plugins/kibana/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,101 @@ export default function (kibana) {
},
],

savedObjectsManagement: {
'index-pattern': {
icon: 'indexPatternApp',
defaultSearchField: 'title',
isImportableAndExportable: true,
getTitle(obj) {
return obj.attributes.title;
},
getEditUrl(obj) {
return `/management/kibana/index_patterns/${encodeURIComponent(obj.id)}`;
},
getInAppUrl(obj) {
return {
path: `/app/kibana#/management/kibana/index_patterns/${encodeURIComponent(obj.id)}`,
uiCapabilitiesPath: 'management.kibana.index_patterns',
};
},
},
visualization: {
icon: 'visualizeApp',
defaultSearchField: 'title',
isImportableAndExportable: true,
getTitle(obj) {
return obj.attributes.title;
},
getEditUrl(obj) {
return `/management/kibana/objects/savedVisualizations/${encodeURIComponent(obj.id)}`;
},
getInAppUrl(obj) {
return {
path: `/app/kibana#/visualize/edit/${encodeURIComponent(obj.id)}`,
uiCapabilitiesPath: 'visualize.show',
};
},
},
search: {
icon: 'search',
defaultSearchField: 'title',
isImportableAndExportable: true,
getTitle(obj) {
return obj.attributes.title;
},
getEditUrl(obj) {
return `/management/kibana/objects/savedSearches/${encodeURIComponent(obj.id)}`;
},
getInAppUrl(obj) {
return {
path: `/app/kibana#/discover/${encodeURIComponent(obj.id)}`,
uiCapabilitiesPath: 'discover.show',
};
},
},
dashboard: {
icon: 'dashboardApp',
defaultSearchField: 'title',
isImportableAndExportable: true,
getTitle(obj) {
return obj.attributes.title;
},
getEditUrl(obj) {
return `/management/kibana/objects/savedDashboards/${encodeURIComponent(obj.id)}`;
},
getInAppUrl(obj) {
return {
path: `/app/kibana#/dashboard/${encodeURIComponent(obj.id)}`,
uiCapabilitiesPath: 'dashboard.show',
};
},
},
url: {
defaultSearchField: 'url',
isImportableAndExportable: true,
getTitle(obj) {
return obj.attributes.url;
},
},
config: {
isImportableAndExportable: true,
getInAppUrl() {
mikecote marked this conversation as resolved.
Show resolved Hide resolved
return {
path: `/app/kibana#/management/kibana/settings`,
uiCapabilitiesPath: 'advancedSettings.show',
};
},
getTitle(obj) {
return `Advanced Settings [${obj.id}]`;
},
},
},

savedObjectSchemas: {
'kql-telemetry': {
'sample-data-telemetry': {
isNamespaceAgnostic: true,
},
'sample-data-telemetry': {
'kql-telemetry': {
isNamespaceAgnostic: true,
},
},
Expand Down Expand Up @@ -169,6 +259,7 @@ export default function (kibana) {
index_patterns: true,
},
advancedSettings: {
show: true,
save: true
},
indexPatterns: {
Expand Down
6 changes: 6 additions & 0 deletions src/legacy/core_plugins/kibana/inject_vars.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,17 @@ export function injectVars(server) {
// If url is set, old settings must be used for backward compatibility
const isOverridden = typeof tilemap.url === 'string' && tilemap.url !== '';

// Get types that are import and exportable, by default yes unless isImportableAndExportable is set to false
const { types: allTypes } = server.savedObjects;
const savedObjectsManagement = server.getSavedObjectsManagement();
const importAndExportableTypes = allTypes.filter(type => savedObjectsManagement.isImportAndExportable(type));

return {
kbnDefaultAppId: serverConfig.get('kibana.defaultAppId'),
disableWelcomeScreen: serverConfig.get('kibana.disableWelcomeScreen'),
regionmapsConfig: regionmap,
mapConfig: mapConfig,
importAndExportableTypes,
tilemapsConfig: {
deprecated: {
isOverridden: isOverridden,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,19 @@ import { savedObjectManagementRegistry } from '../../saved_object_registry';
import objectIndexHTML from './_objects.html';
import uiRoutes from 'ui/routes';
import chrome from 'ui/chrome';
import { toastNotifications } from 'ui/notify';
import { SavedObjectsClientProvider } from 'ui/saved_objects';
import { uiModules } from 'ui/modules';
import React from 'react';
import { render, unmountComponentAtNode } from 'react-dom';
import { ObjectsTable } from './components/objects_table';
import { canViewInApp, getInAppUrl } from './lib/in_app_url';
import { I18nContext } from 'ui/i18n';
import { get } from 'lodash';

import { getIndexBreadcrumbs } from './breadcrumbs';

const REACT_OBJECTS_TABLE_DOM_ELEMENT_ID = 'reactSavedObjectsTable';

function updateObjectsTable($scope, $injector, i18n) {
function updateObjectsTable($scope, $injector) {
const Private = $injector.get('Private');
const indexPatterns = $injector.get('indexPatterns');
const $http = $injector.get('$http');
Expand All @@ -44,10 +43,6 @@ function updateObjectsTable($scope, $injector, i18n) {

const savedObjectsClient = Private(SavedObjectsClientProvider);
const services = savedObjectManagementRegistry.all().map(obj => $injector.get(obj.service));
const allServices = savedObjectManagementRegistry.all();
const typeToServiceName = type => allServices.reduce((serviceName, service) => {
return service.title.includes(type) ? service.service : serviceName;
}, null);

$scope.$$postDigest(() => {
const node = document.getElementById(REACT_OBJECTS_TABLE_DOM_ELEMENT_ID);
Expand All @@ -66,27 +61,15 @@ function updateObjectsTable($scope, $injector, i18n) {
basePath={chrome.getBasePath()}
newIndexPatternUrl={kbnUrl.eval('#/management/kibana/index_pattern')}
uiCapabilities={uiCapabilites}
getEditUrl={(id, type) => {
if (type === 'index-pattern' || type === 'indexPatterns') {
return kbnUrl.eval(`#/management/kibana/index_patterns/${id}`);
goInspectObject={object => {
if (object.meta.editUrl) {
kbnUrl.change(object.meta.editUrl);
$scope.$apply();
}
const serviceName = typeToServiceName(type);
if (!serviceName) {
toastNotifications.addWarning(i18n('kbn.management.objects.unknownSavedObjectTypeNotificationMessage', {
defaultMessage: 'Unknown saved object type: {type}',
values: { type }
}));
return null;
}

return kbnUrl.eval(`#/management/kibana/objects/${serviceName}/${id}`);
}}
canGoInApp={(type) => {
return canViewInApp(uiCapabilites, type);
}}
goInApp={(id, type) => {
kbnUrl.change(getInAppUrl(id, type));
$scope.$apply();
canGoInApp={object => {
const { inAppUrl } = object.meta;
return inAppUrl && get(uiCapabilites, inAppUrl.uiCapabilitiesPath);
}}
/>
</I18nContext>,
Expand Down Expand Up @@ -114,8 +97,8 @@ uiModules.get('apps/management')
return {
restrict: 'E',
controllerAs: 'managementObjectsController',
controller: function ($scope, $injector, i18n) {
updateObjectsTable($scope, $injector, i18n);
controller: function ($scope, $injector) {
updateObjectsTable($scope, $injector);
$scope.$on('$destroy', destroyObjectsTable);
}
};
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading