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

M #-: Remove text transform (#2791)

Labels are now natively displayed without applying any text transforms to them.
This commit is contained in:
vichansson 2023-10-26 12:17:18 +03:00 committed by GitHub
parent 313391b651
commit e4a26f947e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 10 deletions

View File

@ -56,6 +56,7 @@ const MultipleTags = ({ tags, limitTags = 1, clipboard = false }) => {
sx={{
paddingTop: '2.5px',
paddingBottom: '2.5px',
textTransform: 'none',
}}
{...(typeof tag === 'string' ? { text } : tag)}
/>

View File

@ -115,6 +115,7 @@ const StatusChip = memo(
ownerState={ownerState}
onClick={callAll(handleClick, clipboard && handleCopy)}
data-cy={dataCy}
sx={{ textTransform: 'none' }}
{...props}
>
{text}

View File

@ -31,7 +31,7 @@ import { areStringEqual, jsonToXml } from 'client/models/Helper'
export const LABEL_COLUMN_ID = 'label'
const toUpperCase = (label) => label?.trim()?.toUpperCase()
const toUpperCase = (label) => label?.trim()
const getLabelFromRows = (rows, flatting = true) => {
const labels = rows
@ -141,7 +141,7 @@ const GlobalLabel = ({
const template = USER_TEMPLATE ?? TEMPLATE
const currentLabels = template?.LABELS?.split(',') ?? []
const newLabels = currentLabels
.map((l) => l?.trim()?.toUpperCase())
.map((l) => l?.trim())
.filter((l) => labelsToRemove.indexOf(l) === -1)
.concat(labelsToAdd)

View File

@ -42,7 +42,7 @@ const COLUMNS = [
accessor: (row) => {
const labels = row?.USER_TEMPLATE?.LABELS?.split(',') ?? []
return labels.map((label) => label?.trim()?.toUpperCase()).join(',')
return labels.map((label) => label?.trim()).join(',')
},
filter: 'includesSome',
},

View File

@ -67,7 +67,6 @@ export const useAuth = () => {
return labels
.filter(Boolean)
.map((label) => label.toUpperCase())
.sort(areStringEqual({ numeric: true, ignorePunctuation: true }))
}, [user?.TEMPLATE?.LABELS])

View File

@ -132,13 +132,11 @@ const authApi = oneApi.injectEndpoints({
const authUser = getState().auth.user
const currentLabels = authUser?.TEMPLATE?.LABELS?.split(',') ?? []
const upperCaseLabels = currentLabels.map((l) => l.toUpperCase())
const upperCaseNewLabel = newLabel.toUpperCase()
const exists = upperCaseLabels.some((l) => l === upperCaseNewLabel)
if (exists) return { data: upperCaseNewLabel }
const exists = currentLabels.some((l) => l === newLabel)
if (exists) return { data: newLabel }
const newLabels = currentLabels.concat(upperCaseNewLabel).join()
const newLabels = currentLabels.concat(newLabel).join(',')
const template = jsonToXml({ LABELS: newLabels })
const queryData = { id: authUser.ID, template, replace: 1 }
@ -146,7 +144,7 @@ const authApi = oneApi.injectEndpoints({
userApi.endpoints.updateUser.initiate(queryData)
).unwrap()
return { data: upperCaseNewLabel }
return { data: newLabel }
} catch (error) {
return { error }
}