1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-16 22:50:10 +03:00

F #5862: Minor fixes for labels (#2172)

This commit is contained in:
Sergio Betanzos 2022-06-23 12:52:00 +02:00 committed by GitHub
parent 535e8e1d87
commit 92f97d7878
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 5 deletions

View File

@ -80,6 +80,7 @@ const MarketplaceAppCard = memo(
() =>
getUniqueLabels(LABELS).map((label) => ({
text: label,
dataCy: `label-${label}`,
stateColor: getColorFromString(label),
onClick: onClickLabel,
onDelete: enableEditLabels && onDeleteLabel,

View File

@ -111,6 +111,7 @@ const EnhancedTable = ({
autoResetSelectedRows: false,
autoResetSortBy: false,
autoResetPage: false,
autoResetGlobalFilter: false,
// -------------------------------------
initialState: { pageSize, ...initialState },
},
@ -125,7 +126,7 @@ const EnhancedTable = ({
getTableProps,
prepareRow,
toggleAllRowsSelected,
preFilteredRows,
preGlobalFilteredRowsById,
rows,
page,
gotoPage,
@ -148,10 +149,11 @@ const EnhancedTable = ({
?.scrollIntoView({ behavior: 'smooth', block: 'center' })
}
const selectedRows = useMemo(
() => preFilteredRows.filter((row) => !!state.selectedRowIds[row.id]),
[data, state.selectedRowIds]
)
const selectedRows = useMemo(() => {
const selectedIds = Object.keys(state.selectedRowIds ?? {})
return selectedIds.map((id) => preGlobalFilteredRowsById[id])
}, [state.selectedRowIds])
useMountedLayoutEffect(() => {
onSelectedRowsChange?.(

View File

@ -121,9 +121,15 @@ const Settings = () => {
</Typography>
</Box>
<Stack height={1} gap="0.5rem" p="0.5rem" overflow="auto">
{labels.length === 0 && (
<Typography variant="subtitle2">
<Translate word={T.NoLabels} />
</Typography>
)}
{result?.map((label) => (
<LabelWrapper
key={label}
data-cy={`wrapper-${label}`}
// highlight the label when it is added
ownerState={{ highlight: data === label }}
>