diff --git a/x-pack/plugins/spaces/public/management/edit_space/manage_space_page.test.tsx b/x-pack/plugins/spaces/public/management/edit_space/manage_space_page.test.tsx
index 3b82be30c6026..f169395688de1 100644
--- a/x-pack/plugins/spaces/public/management/edit_space/manage_space_page.test.tsx
+++ b/x-pack/plugins/spaces/public/management/edit_space/manage_space_page.test.tsx
@@ -237,6 +237,51 @@ describe('ManageSpacePage', () => {
expect(wrapper.find(EnabledFeatures)).toHaveLength(0);
});
+ it('hides feature visibility controls when solution view is not "classic"', async () => {
+ const spacesManager = spacesManagerMock.create();
+
+ const wrapper = mountWithIntl(
+
+ );
+
+ await waitFor(async () => {
+ await Promise.resolve();
+
+ wrapper.update();
+
+ // default for create space: expect visible features table to exist
+ expect(wrapper.find(EnabledFeatures)).toHaveLength(1);
+ });
+
+ await waitFor(() => {
+ // switch to observability view
+ updateSpace(wrapper, false, 'oblt');
+ // expect visible features table to not exist
+ expect(wrapper.find(EnabledFeatures)).toHaveLength(0);
+ });
+
+ await waitFor(() => {
+ // switch to classic
+ updateSpace(wrapper, false, 'classic');
+ // expect visible features table to exist again
+ expect(wrapper.find(EnabledFeatures)).toHaveLength(1);
+ });
+ });
+
it('allows a space to be updated', async () => {
const spaceToUpdate = {
id: 'existing-space',
diff --git a/x-pack/plugins/spaces/public/management/edit_space/manage_space_page.tsx b/x-pack/plugins/spaces/public/management/edit_space/manage_space_page.tsx
index b34d2eec88e48..cb81ae9304260 100644
--- a/x-pack/plugins/spaces/public/management/edit_space/manage_space_page.tsx
+++ b/x-pack/plugins/spaces/public/management/edit_space/manage_space_page.tsx
@@ -66,6 +66,7 @@ interface State {
features: KibanaFeature[];
originalSpace?: Partial;
showAlteringActiveSpaceDialog: boolean;
+ showVisibleFeaturesPicker: boolean;
haveDisabledFeaturesChanged: boolean;
hasSolutionViewChanged: boolean;
isLoading: boolean;
@@ -85,6 +86,7 @@ export class ManageSpacePage extends Component {
this.state = {
isLoading: true,
showAlteringActiveSpaceDialog: false,
+ showVisibleFeaturesPicker: !!props.allowFeatureVisibility,
saveInProgress: false,
space: {
color: getSpaceColor({}),
@@ -203,7 +205,7 @@ export class ManageSpacePage extends Component {
{
>
)}
- {this.props.allowFeatureVisibility && (
+ {this.state.showVisibleFeaturesPicker && (
<>
{
return null;
};
+ private onSolutionViewChange = (space: Partial) => {
+ if (this.props.allowFeatureVisibility) {
+ let showVisibleFeaturesPicker = false;
+ if (space.solution === 'classic' || space.solution == null) {
+ showVisibleFeaturesPicker = true;
+ }
+ this.setState((state) => ({ ...state, showVisibleFeaturesPicker }));
+ }
+ this.onSpaceChange(space);
+ };
+
public onSpaceChange = (updatedSpace: FormValues) => {
this.setState({
space: updatedSpace,