Skip to content

Commit

Permalink
[data views mgmt] Disable spaces UI in single space mode (#166576)
Browse files Browse the repository at this point in the history
## Summary

In data views management - checks `hasOnlyDefaultSpace` value and
renders spaces UI if value is false.

Added functional test to verify this is working as expected on
serverless.

Closes: #165804
#165796
#165425
  • Loading branch information
mattkime authored Oct 2, 2023
1 parent 66b1c7f commit 40c3ebb
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ export const IndexPatternTable = ({
name: i18n.translate('indexPatternManagement.dataViewTable.nameColumn', {
defaultMessage: 'Name',
}),
width: '70%',
width: spaces ? '70%' : '90%',
render: (name: string, dataView: IndexPatternTableItem) => (
<div>
<EuiLink
Expand Down Expand Up @@ -247,7 +247,10 @@ export const IndexPatternTable = ({
dataType: 'string' as const,
sortable: ({ sort }: { sort: string }) => sort,
},
{
];

if (spaces) {
columns.push({
field: 'namespaces',
name: i18n.translate('indexPatternManagement.dataViewTable.spacesColumn', {
defaultMessage: 'Spaces',
Expand All @@ -270,8 +273,8 @@ export const IndexPatternTable = ({
<></>
);
},
},
];
});
}

if (dataViews.getCanSaveSync()) {
columns.push(alertColumn);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export async function mountManagementSection(
fieldFormatEditors: dataViewFieldEditor.fieldFormatEditors,
IndexPatternEditor: dataViewEditor.IndexPatternEditorComponent,
fieldFormats,
spaces,
spaces: spaces?.hasOnlyDefaultSpace ? undefined : spaces,
theme,
savedObjectsManagement,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ import { FtrProviderContext } from '../../../ftr_provider_context';
const archivePath = 'test/api_integration/fixtures/es_archiver/index_patterns/basic_index';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['settings', 'common', 'header']);
const PageObjects = getPageObjects(['settings', 'common', 'header', 'svlCommonPage']);
const esArchiver = getService('esArchiver');
const supertest = getService('supertest');
const testSubjects = getService('testSubjects');

// FLAKY: https://github.com/elastic/kibana/issues/165804
// FLAKY: https://github.com/elastic/kibana/issues/165796
// FLAKY: https://github.com/elastic/kibana/issues/165425
describe.skip('Data View Management', function () {
describe('Data View Management', function () {
this.beforeAll(async () => {
await PageObjects.svlCommonPage.login();
});
describe('disables scripted fields', function () {
let dataViewId = '';

Expand Down Expand Up @@ -100,5 +100,43 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await testSubjects.missingOrFail('rollup-tag');
});
});

describe('when in single space mode', function () {
let dataViewId = '';
before(async () => {
await esArchiver.load(
'test/api_integration/fixtures/es_archiver/index_patterns/basic_index'
);

const response = await supertest
.post(DATA_VIEW_PATH)
.set('kbn-xsrf', 'some-xsrf-token')
.send({
data_view: {
title: 'basic_index',
},
override: true,
})
.set(ELASTIC_HTTP_VERSION_HEADER, INITIAL_REST_VERSION);
dataViewId = response.body.data_view.id;
});

after(async () => {
await esArchiver.unload(
'test/api_integration/fixtures/es_archiver/index_patterns/basic_index'
);
await supertest
.delete(`${DATA_VIEW_PATH}/${dataViewId}`)
.set('kbn-xsrf', 'some-xsrf-token');
});

it('hides spaces UI', async () => {
await PageObjects.common.navigateToUrl('management', 'kibana/dataViews', {
shouldUseHashForSubUrl: false,
});
await testSubjects.exists('detail-link-basic_index');
await testSubjects.missingOrFail('tableHeaderCell_namespaces_1');
});
});
});
}

0 comments on commit 40c3ebb

Please sign in to comment.