Skip to content

Commit

Permalink
Introducing uiCapabilities, removing config providers & user profile (e…
Browse files Browse the repository at this point in the history
…lastic#25387)

## Summary
Introduces the concept of "UI Capabilities", which allows Kibana applications to declare capabilities via the `uiCapabilities` injected var, and then use them client-side via the `ui/capabilities` module to inform their rendering decisions.
  • Loading branch information
legrego committed Nov 28, 2018
1 parent a95035a commit 839d99d
Show file tree
Hide file tree
Showing 22 changed files with 9 additions and 339 deletions.
32 changes: 0 additions & 32 deletions src/core_plugins/kibana/public/discover/discover_config.js

This file was deleted.

1 change: 0 additions & 1 deletion src/core_plugins/kibana/public/discover/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* under the License.
*/

import './discover_config';
import './saved_searches/saved_searches';
import './directives';
import 'ui/collapsible_sidebar';
Expand Down
34 changes: 0 additions & 34 deletions src/ui/public/chrome/api/config.js

This file was deleted.

2 changes: 0 additions & 2 deletions src/ui/public/chrome/chrome.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import { initChromeNavApi } from './api/nav';
import { initBreadcrumbsApi } from './api/breadcrumbs';
import templateApi from './api/template';
import { initChromeThemeApi } from './api/theme';
import { initConfig } from './api/config';
import { initChromeXsrfApi } from './api/xsrf';
import { initUiSettingsApi } from './api/ui_settings';
import { initLoadingCountApi } from './api/loading_count';
Expand All @@ -62,7 +61,6 @@ const internals = _.defaults(
}
);

initConfig();
initUiSettingsApi(chrome);
initSavedObjectClient(chrome);
appsApi(chrome, internals);
Expand Down
4 changes: 0 additions & 4 deletions x-pack/plugins/security/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ import { createAuthorizationService, registerPrivilegesWithCluster } from './ser
import { watchStatusAndLicenseToInitialize } from '../../server/lib/watch_status_and_license_to_initialize';
import { SecureSavedObjectsClientWrapper } from './server/lib/saved_objects_client/secure_saved_objects_client_wrapper';
import { deepFreeze } from './server/lib/deep_freeze';
import { capabilityDecorator } from './server/lib/capability_decorator';
import { registerUserProfileCapabilityDecorator } from '../xpack_main/server/lib/user_profile';

export const security = (kibana) => new kibana.Plugin({
id: 'security',
Expand Down Expand Up @@ -129,8 +127,6 @@ export const security = (kibana) => new kibana.Plugin({
}
});

registerUserProfileCapabilityDecorator(Number.MIN_SAFE_INTEGER, capabilityDecorator);

const auditLogger = new SecurityAuditLogger(server.config(), new AuditLogger(server, 'security'));

savedObjects.setScopedSavedObjectsClientFactory(({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import { shallow } from 'enzyme';
import React from 'react';
import { KibanaPrivilege } from '../../../../../../../../security/common/model/kibana_privilege';
import { UserProfile } from '../../../../../../../../xpack_main/common/user_profile';
import { RoleValidator } from '../../../lib/validate_role';
import { KibanaPrivileges } from './kibana_privileges';
import { SimplePrivilegeForm } from './simple_privilege_form';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ routes.when(`${EDIT_ROLES_PATH}/:name?`, {
}
},
controllerAs: 'editRole',
controller($injector, $scope, $http, enableSpaceAwarePrivileges, userProfile) {
controller($injector, $scope, $http, enableSpaceAwarePrivileges) {
const $route = $injector.get('$route');
const Private = $injector.get('Private');

Expand Down
10 changes: 3 additions & 7 deletions x-pack/plugins/spaces/public/views/management/page_routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import React from 'react';
import { render, unmountComponentAtNode } from 'react-dom';
// @ts-ignore
import routes from 'ui/routes';
import { UserProfile } from '../../../../xpack_main/common/user_profile';
import { SpacesManager } from '../../lib/spaces_manager';
import { ManageSpacePage } from './edit_space';
import { SpacesGridPage } from './spaces_grid';
Expand All @@ -28,8 +27,7 @@ routes.when('/management/spaces/list', {
$http: any,
chrome: any,
spacesNavState: SpacesNavState,
spaceSelectorURL: string,
userProfile: UserProfile
spaceSelectorURL: string
) {
$scope.$$postDigest(() => {
const domNode = document.getElementById(reactRootNodeId);
Expand Down Expand Up @@ -60,8 +58,7 @@ routes.when('/management/spaces/create', {
$http: any,
chrome: any,
spacesNavState: SpacesNavState,
spaceSelectorURL: string,
userProfile: UserProfile
spaceSelectorURL: string
) {
$scope.$$postDigest(() => {
const domNode = document.getElementById(reactRootNodeId);
Expand Down Expand Up @@ -98,8 +95,7 @@ routes.when('/management/spaces/edit/:spaceId', {
chrome: any,
Private: any,
spacesNavState: SpacesNavState,
spaceSelectorURL: string,
userProfile: UserProfile
spaceSelectorURL: string
) {
$scope.$$postDigest(() => {
const domNode = document.getElementById(reactRootNodeId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { uiModules } from 'ui/modules';
import { chromeHeaderNavControlsRegistry } from 'ui/registry/chrome_header_nav_controls';
// @ts-ignore
import { chromeNavControlsRegistry } from 'ui/registry/chrome_nav_controls';
import { UserProfile } from '../../../../xpack_main/common/user_profile';
import { Space } from '../../../common/model/space';
import { SpacesGlobalNavButton } from './components/spaces_global_nav_button';
import { SpacesHeaderNavButton } from './components/spaces_header_nav_button';
Expand Down Expand Up @@ -94,7 +93,7 @@ module.service('spacesNavState', (activeSpace: any) => {
});

chromeHeaderNavControlsRegistry.register(
($http: any, chrome: any, Private: any, activeSpace: any, userProfile: UserProfile) => ({
($http: any, chrome: any, Private: any, activeSpace: any) => ({
name: 'spaces',
order: 1000,
side: NavControlSide.Left,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import { mount, shallow } from 'enzyme';
import React from 'react';
import { UserProfile } from '../../../../xpack_main/common/user_profile';
import { SpaceAvatar } from '../../components';
import { SpacesManager } from '../../lib/spaces_manager';
import { SpacesGlobalNavButton } from './components/spaces_global_nav_button';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

export { userProfileMixin } from './user_profile_mixin';
export { registerUserProfileCapabilityDecorator } from './user_profile_capability_registry';
describe('toggleUiCapabilities', () => {
// TODO: implement tests once spaces have the concept of disabled features
it('should be tested', () => null);
});
7 changes: 0 additions & 7 deletions x-pack/plugins/xpack_main/common/index.ts

This file was deleted.

9 changes: 0 additions & 9 deletions x-pack/plugins/xpack_main/common/user_profile/capabilities.ts

This file was deleted.

7 changes: 0 additions & 7 deletions x-pack/plugins/xpack_main/common/user_profile/index.ts

This file was deleted.

38 changes: 0 additions & 38 deletions x-pack/plugins/xpack_main/common/user_profile/user_profile.ts

This file was deleted.

5 changes: 0 additions & 5 deletions x-pack/plugins/xpack_main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
CONFIG_TELEMETRY_DESC,
} from './common/constants';
import { settingsRoute } from './server/routes/api/v1/settings';
import { userProfileMixin } from './server/lib/user_profile';
import mappings from './mappings.json';

export { callClusterFactory } from './server/lib/call_cluster_factory';
Expand Down Expand Up @@ -103,8 +102,6 @@ export const xpackMain = (kibana) => {
'plugins/xpack_main/hacks/check_xpack_info_change',
'plugins/xpack_main/hacks/telemetry_opt_in',
'plugins/xpack_main/hacks/telemetry_trigger',
'plugins/xpack_main/hacks/user_profile',
'plugins/xpack_main/hacks/user_profile_config_decorators',
],
replaceInjectedVars,
__webpackPluginProvider__(webpack) {
Expand All @@ -125,8 +122,6 @@ export const xpackMain = (kibana) => {
setupXPackMain(server);
registerOssFeatures();

userProfileMixin(this.kbnServer, server);

// register routes
xpackInfoRoute(server);
telemetryRoute(server);
Expand Down
17 changes: 0 additions & 17 deletions x-pack/plugins/xpack_main/public/hacks/user_profile.ts

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ const buildRequest = (telemetryOptedIn = null, path = '/app/kibana') => {

return {
path,
getUserProfile: async () => ({
toJSON: () => ({})
}),
getSavedObjectsClient: () => {
return {
get,
Expand Down
Loading

0 comments on commit 839d99d

Please sign in to comment.