[8.16] [Spaces Mgmt] Ensure space ID is used for comparison logic (#196930) (#197135)

# Backport

This will backport the following commits from `main` to `8.16`:
- [[Spaces Mgmt] Ensure space ID is used for comparison logic
(#196930)](https://github.com/elastic/kibana/pull/196930)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Tim
Sullivan","email":"tsullivan@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-10-21T20:15:13Z","message":"[Spaces
Mgmt] Ensure space ID is used for comparison logic (#196930)\n\nCloses
https://github.com/elastic/kibana/issues/192811\r\n\r\n##
Summary\r\n\r\nWhen creating a space, if it's not the current, you
should be able to\r\nuse the switch icon from the table. This PR fixes a
bug that disabled\r\nthe switch icon for spaces that aren't the current,
if they have the\r\nsame name as the current.\r\n\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"a3d216f496d319ab41855711e88c4b9c80a57152","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","v8.16.0","backport:version","v8.17.0"],"title":"[Spaces
Mgmt] Ensure space ID is used for comparison
logic","number":196930,"url":"https://github.com/elastic/kibana/pull/196930","mergeCommit":{"message":"[Spaces
Mgmt] Ensure space ID is used for comparison logic (#196930)\n\nCloses
https://github.com/elastic/kibana/issues/192811\r\n\r\n##
Summary\r\n\r\nWhen creating a space, if it's not the current, you
should be able to\r\nuse the switch icon from the table. This PR fixes a
bug that disabled\r\nthe switch icon for spaces that aren't the current,
if they have the\r\nsame name as the current.\r\n\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"a3d216f496d319ab41855711e88c4b9c80a57152"}},"sourceBranch":"main","suggestedTargetBranches":["8.16","8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/196930","number":196930,"mergeCommit":{"message":"[Spaces
Mgmt] Ensure space ID is used for comparison logic (#196930)\n\nCloses
https://github.com/elastic/kibana/issues/192811\r\n\r\n##
Summary\r\n\r\nWhen creating a space, if it's not the current, you
should be able to\r\nuse the switch icon from the table. This PR fixes a
bug that disabled\r\nthe switch icon for spaces that aren't the current,
if they have the\r\nsame name as the current.\r\n\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"a3d216f496d319ab41855711e88c4b9c80a57152"}},{"branch":"8.16","label":"v8.16.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Tim Sullivan <tsullivan@users.noreply.github.com>
This commit is contained in:
Kibana Machine 2024-10-22 09:01:34 +11:00 committed by GitHub
parent 6820eb917b
commit ee0df4b71d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 7 deletions

View file

@ -240,7 +240,7 @@ describe('SpacesGridPage', () => {
wrapper.update();
const activeRow = wrapper.find('[data-test-subj="spacesListTableRow-custom-2"]');
const switchAction = activeRow.find('EuiButtonIcon[data-test-subj="Custom 2-switchSpace"]');
const switchAction = activeRow.find('EuiButtonIcon[data-test-subj="custom-2-switchSpace"]');
expect(switchAction.prop('isDisabled')).toBe(true);
});
@ -272,7 +272,7 @@ describe('SpacesGridPage', () => {
wrapper.update();
const nonActiveRow = wrapper.find('[data-test-subj="spacesListTableRow-default"]');
const switchAction = nonActiveRow.find('EuiButtonIcon[data-test-subj="Default-switchSpace"]');
const switchAction = nonActiveRow.find('EuiButtonIcon[data-test-subj="default-switchSpace"]');
expect(switchAction.prop('isDisabled')).toBe(false);
});

View file

@ -428,7 +428,7 @@ export class SpacesGridPage extends Component<Props, State> {
reactRouterNavigate(this.props.history, this.getEditSpacePath(rowRecord)).href,
onClick: (rowRecord) =>
reactRouterNavigate(this.props.history, this.getEditSpacePath(rowRecord)).onClick,
'data-test-subj': (rowRecord) => `${rowRecord.name}-editSpace`,
'data-test-subj': (rowRecord) => `${rowRecord.id}-editSpace`,
},
{
isPrimary: true,
@ -436,7 +436,7 @@ export class SpacesGridPage extends Component<Props, State> {
defaultMessage: 'Switch',
}),
description: (rowRecord) =>
activeSpace?.name !== rowRecord.name
activeSpace?.id !== rowRecord.id
? i18n.translate(
'xpack.spaces.management.spacesGridPage.switchSpaceActionDescription',
{
@ -460,8 +460,8 @@ export class SpacesGridPage extends Component<Props, State> {
rowRecord.id,
`${ENTER_SPACE_PATH}?next=/app/management/kibana/spaces/`
),
enabled: (rowRecord) => activeSpace?.name !== rowRecord.name,
'data-test-subj': (rowRecord) => `${rowRecord.name}-switchSpace`,
enabled: (rowRecord) => activeSpace?.id !== rowRecord.id,
'data-test-subj': (rowRecord) => `${rowRecord.id}-switchSpace`,
},
{
name: i18n.translate('xpack.spaces.management.spacesGridPage.deleteActionName', {
@ -485,7 +485,7 @@ export class SpacesGridPage extends Component<Props, State> {
color: 'danger',
onClick: (rowRecord: Space) => this.onDeleteSpaceClick(rowRecord),
enabled: (rowRecord: Space) => !isReservedSpace(rowRecord),
'data-test-subj': (rowRecord) => `${rowRecord.name}-deleteSpace`,
'data-test-subj': (rowRecord) => `${rowRecord.id}-deleteSpace`,
},
],
});