Skip to content

Commit

Permalink
Make action icons for the space consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
tsullivan committed Jul 8, 2024
1 parent 2a16ec9 commit 19dd7ff
Showing 1 changed file with 30 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -388,14 +388,26 @@ export class SpacesGridPage extends Component<Props, State> {
'data-test-subj': (rowRecord) => `${rowRecord.name}-editSpace`,
},
{
isPrimary: true,
name: i18n.translate('xpack.spaces.management.spacesGridPage.switchSpaceActionName', {
defaultMessage: 'Switch',
}),
description: (rowRecord) =>
i18n.translate('xpack.spaces.management.spacesGridPage.switchSpaceActionDescription', {
defaultMessage: 'Switch to {spaceName} space',
values: { spaceName: rowRecord.name },
}),
this.state.activeSpace?.name !== rowRecord.name
? i18n.translate(
'xpack.spaces.management.spacesGridPage.switchSpaceActionDescription',
{
defaultMessage: 'Switch to {spaceName}',
values: { spaceName: rowRecord.name },
}
)
: i18n.translate(
'xpack.spaces.management.spacesGridPage.switchSpaceActionDisabledDescription',
{
defaultMessage: '{spaceName} is the current space',
values: { spaceName: rowRecord.name },
}
),
type: 'icon',
icon: 'merge',
color: 'primary',
Expand All @@ -405,23 +417,31 @@ export class SpacesGridPage extends Component<Props, State> {
rowRecord.id,
`${ENTER_SPACE_PATH}?next=/app/management/kibana/spaces/`
),
available: (rowRecord) => this.state.activeSpace?.name !== rowRecord.name,
enabled: (rowRecord) => this.state.activeSpace?.name !== rowRecord.name,
'data-test-subj': (rowRecord) => `${rowRecord.name}-switchSpace`,
},
{
name: i18n.translate('xpack.spaces.management.spacesGridPage.deleteActionName', {
defaultMessage: `Delete`,
}),
description: (rowRecord) =>
i18n.translate('xpack.spaces.management.spacesGridPage.deleteActionDescription', {
defaultMessage: `Delete {spaceName}.`,
values: { spaceName: rowRecord.name },
}),
isReservedSpace(rowRecord)
? i18n.translate(
'xpack.spaces.management.spacesGridPage.deleteActionDisabledDescription',
{
defaultMessage: `{spaceName} is reserved`,
values: { spaceName: rowRecord.name },
}
)
: i18n.translate('xpack.spaces.management.spacesGridPage.deleteActionDescription', {
defaultMessage: `Delete {spaceName}`,
values: { spaceName: rowRecord.name },
}),
type: 'icon',
icon: 'trash',
color: 'danger',
onClick: (rowRecord) => this.onDeleteSpaceClick(rowRecord),
available: (rowRecord: Space) => !isReservedSpace(rowRecord),
enabled: (rowRecord: Space) => !isReservedSpace(rowRecord),
'data-test-subj': (rowRecord) => `${rowRecord.name}-deleteSpace`,
},
],
Expand Down

0 comments on commit 19dd7ff

Please sign in to comment.