Skip to content

Commit

Permalink
Move Spaces plugin to a separate TS project.
Browse files Browse the repository at this point in the history
  • Loading branch information
azasypkin committed Jan 14, 2021
1 parent 6ec868b commit a56edc9
Show file tree
Hide file tree
Showing 19 changed files with 36 additions and 165 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@

export { ConfirmDeleteModal } from './confirm_delete_modal';
export { UnauthorizedPrompt } from './unauthorized_prompt';
export { SecureSpaceMessage } from './secure_space_message';

This file was deleted.

This file was deleted.

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

Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ describe('EnabledFeatures', () => {
name: 'my space',
disabledFeatures: ['feature-1', 'feature-2'],
}}
securityEnabled={true}
onChange={jest.fn()}
getUrlForApp={getUrlForApp}
/>
Expand All @@ -61,7 +60,6 @@ describe('EnabledFeatures', () => {
name: 'my space',
disabledFeatures: ['feature-1', 'feature-2'],
}}
securityEnabled={true}
onChange={changeHandler}
getUrlForApp={getUrlForApp}
/>
Expand Down Expand Up @@ -96,7 +94,6 @@ describe('EnabledFeatures', () => {
name: 'my space',
disabledFeatures: [],
}}
securityEnabled={true}
onChange={changeHandler}
getUrlForApp={getUrlForApp}
/>
Expand Down Expand Up @@ -134,7 +131,6 @@ describe('EnabledFeatures', () => {
name: 'my space',
disabledFeatures: [],
}}
securityEnabled={true}
onChange={changeHandler}
getUrlForApp={getUrlForApp}
/>
Expand Down Expand Up @@ -165,7 +161,6 @@ describe('EnabledFeatures', () => {
name: 'my space',
disabledFeatures: ['feature-1', 'feature-2'],
}}
securityEnabled={true}
onChange={changeHandler}
getUrlForApp={getUrlForApp}
/>
Expand Down Expand Up @@ -194,7 +189,6 @@ describe('EnabledFeatures', () => {
name: 'my space',
disabledFeatures: ['feature-1'],
}}
securityEnabled={true}
onChange={jest.fn()}
getUrlForApp={getUrlForApp}
/>
Expand All @@ -214,7 +208,6 @@ describe('EnabledFeatures', () => {
name: 'my space',
disabledFeatures: [],
}}
securityEnabled={true}
onChange={changeHandler}
getUrlForApp={getUrlForApp}
/>
Expand Down Expand Up @@ -243,7 +236,6 @@ describe('EnabledFeatures', () => {
name: 'my space',
disabledFeatures: [],
}}
securityEnabled={true}
onChange={changeHandler}
getUrlForApp={getUrlForApp}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { EuiFlexGroup, EuiFlexItem, EuiLink, EuiSpacer, EuiText, EuiTitle } from '@elastic/eui';
import { EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiText, EuiTitle } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import React, { Component, Fragment, ReactNode } from 'react';
Expand All @@ -18,7 +18,6 @@ import { FeatureTable } from './feature_table';
interface Props {
space: Partial<Space>;
features: KibanaFeatureConfig[];
securityEnabled: boolean;
onChange: (space: Partial<Space>) => void;
getUrlForApp: ApplicationStart['getUrlForApp'];
}
Expand Down Expand Up @@ -129,27 +128,6 @@ export class EnabledFeatures extends Component<Props, {}> {
defaultMessage="The feature is hidden in the UI, but is not disabled."
/>
</p>
{this.props.securityEnabled && (
<p>
<FormattedMessage
id="xpack.spaces.management.enabledSpaceFeatures.goToRolesLink"
defaultMessage="If you wish to secure access to features, please {manageSecurityRoles}."
values={{
manageSecurityRoles: (
<EuiLink
data-test-subj="goToRoles"
href={this.props.getUrlForApp('management', { path: 'security/roles' })}
>
<FormattedMessage
id="xpack.spaces.management.enabledSpaceFeatures.rolesLinkText"
defaultMessage="manage security roles"
/>
</EuiLink>
),
}}
/>
</p>
)}
</EuiText>
</Fragment>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ describe('ManageSpacePage', () => {
spacesManager={(spacesManager as unknown) as SpacesManager}
getFeatures={featuresStart.getFeatures}
notifications={notificationServiceMock.createStartContract()}
securityEnabled={true}
getUrlForApp={getUrlForApp}
history={history}
capabilities={{
Expand Down Expand Up @@ -120,7 +119,6 @@ describe('ManageSpacePage', () => {
onLoadSpace={onLoadSpace}
getFeatures={featuresStart.getFeatures}
notifications={notificationServiceMock.createStartContract()}
securityEnabled={true}
getUrlForApp={getUrlForApp}
history={history}
capabilities={{
Expand Down Expand Up @@ -173,7 +171,6 @@ describe('ManageSpacePage', () => {
spacesManager={(spacesManager as unknown) as SpacesManager}
getFeatures={() => Promise.reject(error)}
notifications={notifications}
securityEnabled={true}
getUrlForApp={getUrlForApp}
history={history}
capabilities={{
Expand Down Expand Up @@ -211,7 +208,6 @@ describe('ManageSpacePage', () => {
spacesManager={(spacesManager as unknown) as SpacesManager}
getFeatures={featuresStart.getFeatures}
notifications={notificationServiceMock.createStartContract()}
securityEnabled={true}
getUrlForApp={getUrlForApp}
history={history}
capabilities={{
Expand Down Expand Up @@ -273,7 +269,6 @@ describe('ManageSpacePage', () => {
spacesManager={(spacesManager as unknown) as SpacesManager}
getFeatures={featuresStart.getFeatures}
notifications={notificationServiceMock.createStartContract()}
securityEnabled={true}
getUrlForApp={getUrlForApp}
history={history}
capabilities={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { Space } from '../../../../../../src/plugins/spaces_oss/common';
import { KibanaFeature, FeaturesPluginStart } from '../../../../features/public';
import { isReservedSpace } from '../../../common';
import { SpacesManager } from '../../spaces_manager';
import { SecureSpaceMessage, UnauthorizedPrompt } from '../components';
import { UnauthorizedPrompt } from '../components';
import { toSpaceIdentifier } from '../lib';
import { SpaceValidator } from '../lib/validate_space';
import { ConfirmAlterActiveSpaceModal } from './confirm_alter_active_space_modal';
Expand All @@ -39,7 +39,6 @@ interface Props {
spaceId?: string;
onLoadSpace?: (space: Space) => void;
capabilities: Capabilities;
securityEnabled: boolean;
history: ScopedHistory;
getUrlForApp: ApplicationStart['getUrlForApp'];
}
Expand Down Expand Up @@ -107,7 +106,6 @@ export class ManageSpacePage extends Component<Props, State> {
return (
<Fragment>
<EuiPageContentBody>{content}</EuiPageContentBody>
{this.maybeGetSecureSpacesMessage()}
</Fragment>
);
}
Expand Down Expand Up @@ -157,7 +155,6 @@ export class ManageSpacePage extends Component<Props, State> {
features={this.state.features}
onChange={this.onSpaceChange}
getUrlForApp={this.props.getUrlForApp}
securityEnabled={this.props.securityEnabled}
/>

<EuiSpacer />
Expand Down Expand Up @@ -201,13 +198,6 @@ export class ManageSpacePage extends Component<Props, State> {
);
};

public maybeGetSecureSpacesMessage = () => {
if (this.editingExistingSpace() && this.props.securityEnabled) {
return <SecureSpaceMessage getUrlForApp={this.props.getUrlForApp} />;
}
return null;
};

public getFormButtons = () => {
const createSpaceText = i18n.translate(
'xpack.spaces.management.manageSpacePage.createSpaceButton',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import { StartServicesAccessor } from 'src/core/public';
import { ManagementSetup, ManagementApp } from '../../../../../src/plugins/management/public';
import { SecurityLicense } from '../../../security/public';
import { SpacesManager } from '../spaces_manager';
import { PluginsStart } from '../plugin';
import { spacesManagementApp } from './spaces_management_app';
Expand All @@ -15,15 +14,14 @@ interface SetupDeps {
management: ManagementSetup;
getStartServices: StartServicesAccessor<PluginsStart>;
spacesManager: SpacesManager;
securityLicense?: SecurityLicense;
}

export class ManagementService {
private registeredSpacesManagementApp?: ManagementApp;

public setup({ getStartServices, management, spacesManager, securityLicense }: SetupDeps) {
public setup({ getStartServices, management, spacesManager }: SetupDeps) {
this.registeredSpacesManagementApp = management.sections.section.kibana.registerApp(
spacesManagementApp.create({ getStartServices, spacesManager, securityLicense })
spacesManagementApp.create({ getStartServices, spacesManager })
);
}

Expand Down

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

Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ import { isReservedSpace } from '../../../common';
import { DEFAULT_SPACE_ID } from '../../../common/constants';
import { SpaceAvatar } from '../../space_avatar';
import { getSpacesFeatureDescription } from '../../constants';
import { SpacesManager } from '../..//spaces_manager';
import { ConfirmDeleteModal } from '../components/confirm_delete_modal';
import { SecureSpaceMessage } from '../components/secure_space_message';
import { UnauthorizedPrompt } from '../components/unauthorized_prompt';
import { SpacesManager } from '../../spaces_manager';
import { ConfirmDeleteModal, UnauthorizedPrompt } from '../components';
import { getEnabledFeatures } from '../lib/feature_utils';
import { reactRouterNavigate } from '../../../../../../src/plugins/kibana_react/public';

Expand All @@ -39,7 +37,6 @@ interface Props {
notifications: NotificationsStart;
getFeatures: FeaturesPluginStart['getFeatures'];
capabilities: Capabilities;
securityEnabled: boolean;
history: ScopedHistory;
getUrlForApp: ApplicationStart['getUrlForApp'];
}
Expand Down Expand Up @@ -74,9 +71,6 @@ export class SpacesGridPage extends Component<Props, State> {
return (
<div className="spcGridPage" data-test-subj="spaces-grid-page">
<EuiPageContent horizontalPosition="center">{this.getPageContent()}</EuiPageContent>
{this.props.securityEnabled && (
<SecureSpaceMessage getUrlForApp={this.props.getUrlForApp} />
)}
{this.getConfirmDeleteModal()}
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ describe('SpacesGridPage', () => {
spacesManager={(spacesManager as unknown) as SpacesManager}
getFeatures={featuresStart.getFeatures}
notifications={notificationServiceMock.createStartContract()}
securityEnabled={true}
getUrlForApp={getUrlForApp}
history={history}
capabilities={{
Expand All @@ -88,7 +87,6 @@ describe('SpacesGridPage', () => {
spacesManager={(spacesManager as unknown) as SpacesManager}
getFeatures={featuresStart.getFeatures}
notifications={notificationServiceMock.createStartContract()}
securityEnabled={true}
getUrlForApp={getUrlForApp}
history={history}
capabilities={{
Expand Down Expand Up @@ -122,7 +120,6 @@ describe('SpacesGridPage', () => {
spacesManager={(spacesManager as unknown) as SpacesManager}
getFeatures={featuresStart.getFeatures}
notifications={notifications}
securityEnabled={true}
getUrlForApp={getUrlForApp}
history={history}
capabilities={{
Expand Down Expand Up @@ -157,7 +154,6 @@ describe('SpacesGridPage', () => {
spacesManager={(spacesManager as unknown) as SpacesManager}
getFeatures={() => Promise.reject(error)}
notifications={notifications}
securityEnabled={true}
getUrlForApp={getUrlForApp}
history={history}
capabilities={{
Expand Down
Loading

0 comments on commit a56edc9

Please sign in to comment.