mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[Index Management][Serverless] Remove primaries and replicas in indices list (#169259)
## Summary
Fixes https://github.com/elastic/kibana/issues/165905
This PR hides the columns "primaries" and "replicas" in the indices list
on Serverless. I decided to reuse the config value
`xpack.index_management.enableIndexStats` because these values fall
closely together with other hidden columns on Serverless like "health",
"storage size" etc. I also removed the width css for the index name
column in that case to fix the table view, otherwise the column would
stay always the 25% width of the table.
### Screeenshots
<img width="1130" alt="Screenshot 2023-10-18 at 16 00 19"
src="29a9eb83
-ad46-48a4-8102-684570f51733">
### How to test
1. Start ES and Kibana in Serverless mode with `yarn es serverless
--ssl` and `yarn serverless-es --ssl`
2. Navigate to Index Management and toggle the switch to display hidden
indices because those have data stream names.
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
d4c86e733c
commit
b3863024ff
3 changed files with 12 additions and 19 deletions
|
@ -12,19 +12,11 @@ import { setupEnvironment, nextTick } from '../helpers';
|
|||
import { IndicesTestBed, setup } from './indices_tab.helpers';
|
||||
import { createDataStreamPayload, createNonDataStreamIndex } from './data_streams_tab.helpers';
|
||||
|
||||
/**
|
||||
* The below import is required to avoid a console error warn from the "brace" package
|
||||
* console.warn ../node_modules/brace/index.js:3999
|
||||
Could not load worker ReferenceError: Worker is not defined
|
||||
at createWorker (/<path-to-repo>/node_modules/brace/index.js:17992:5)
|
||||
*/
|
||||
import { stubWebWorker } from '@kbn/test-jest-helpers';
|
||||
import { createMemoryHistory } from 'history';
|
||||
import {
|
||||
breadcrumbService,
|
||||
IndexManagementBreadcrumb,
|
||||
} from '../../../public/application/services/breadcrumbs';
|
||||
stubWebWorker();
|
||||
|
||||
describe('<IndexManagementHome />', () => {
|
||||
let testBed: IndicesTestBed;
|
||||
|
@ -399,7 +391,7 @@ describe('<IndexManagementHome />', () => {
|
|||
const { table } = testBed;
|
||||
const { tableCellsValues } = table.getMetaData('indexTable');
|
||||
|
||||
expect(tableCellsValues).toEqual([['', 'test', '1', '1', '']]);
|
||||
expect(tableCellsValues).toEqual([['', 'test', '']]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -65,17 +65,15 @@ const getHeaders = ({ showIndexStats }) => {
|
|||
headers.status = i18n.translate('xpack.idxMgmt.indexTable.headers.statusHeader', {
|
||||
defaultMessage: 'Status',
|
||||
});
|
||||
}
|
||||
|
||||
headers.primary = i18n.translate('xpack.idxMgmt.indexTable.headers.primaryHeader', {
|
||||
defaultMessage: 'Primaries',
|
||||
});
|
||||
headers.primary = i18n.translate('xpack.idxMgmt.indexTable.headers.primaryHeader', {
|
||||
defaultMessage: 'Primaries',
|
||||
});
|
||||
|
||||
headers.replica = i18n.translate('xpack.idxMgmt.indexTable.headers.replicaHeader', {
|
||||
defaultMessage: 'Replicas',
|
||||
});
|
||||
headers.replica = i18n.translate('xpack.idxMgmt.indexTable.headers.replicaHeader', {
|
||||
defaultMessage: 'Replicas',
|
||||
});
|
||||
|
||||
if (showIndexStats) {
|
||||
headers.documents = i18n.translate('xpack.idxMgmt.indexTable.headers.documentsHeader', {
|
||||
defaultMessage: 'Docs count',
|
||||
});
|
||||
|
@ -265,13 +263,16 @@ export class IndexTable extends Component {
|
|||
const headers = getHeaders({ showIndexStats: config.enableIndexStats });
|
||||
return Object.entries(headers).map(([fieldName, label]) => {
|
||||
const isSorted = sortField === fieldName;
|
||||
// we only want to make index name column 25% width when there are more columns displayed
|
||||
const widthClassName =
|
||||
fieldName === 'name' && config.enableIndexStats ? 'indTable__header__width' : '';
|
||||
return (
|
||||
<EuiTableHeaderCell
|
||||
key={fieldName}
|
||||
onSort={() => this.onSort(fieldName)}
|
||||
isSorted={isSorted}
|
||||
isSortAscending={isSortAscending}
|
||||
className={'indTable__header--' + fieldName}
|
||||
className={widthClassName}
|
||||
data-test-subj={`indexTableHeaderCell-${fieldName}`}
|
||||
>
|
||||
{label}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
.indTable {
|
||||
// The index table is a bespoke table and can't make use of EuiBasicTable's width settings
|
||||
thead th.indTable__header--name { // stylelint-disable-line selector-no-qualifying-type
|
||||
thead th.indTable__header__width { // stylelint-disable-line selector-no-qualifying-type
|
||||
width: 25%;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue