Skip to content

Commit

Permalink
M #-: Remove text transform (#2791)
Browse files Browse the repository at this point in the history
Labels are now natively displayed without applying any text transforms to them.
  • Loading branch information
vichansson committed Oct 26, 2023
1 parent 313391b commit e4a26f9
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 10 deletions.
1 change: 1 addition & 0 deletions src/fireedge/src/client/components/MultipleTags/index.js
Expand Up @@ -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)}
/>
Expand Down
1 change: 1 addition & 0 deletions src/fireedge/src/client/components/Status/Chip.js
Expand Up @@ -115,6 +115,7 @@ const StatusChip = memo(
ownerState={ownerState}
onClick={callAll(handleClick, clipboard && handleCopy)}
data-cy={dataCy}
sx={{ textTransform: 'none' }}
{...props}
>
{text}
Expand Down
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion src/fireedge/src/client/components/Tables/Vms/columns.js
Expand Up @@ -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',
},
Expand Down
1 change: 0 additions & 1 deletion src/fireedge/src/client/features/Auth/hooks.js
Expand Up @@ -67,7 +67,6 @@ export const useAuth = () => {

return labels
.filter(Boolean)
.map((label) => label.toUpperCase())
.sort(areStringEqual({ numeric: true, ignorePunctuation: true }))
}, [user?.TEMPLATE?.LABELS])

Expand Down
10 changes: 4 additions & 6 deletions src/fireedge/src/client/features/OneApi/auth.js
Expand Up @@ -132,21 +132,19 @@ 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 }

await dispatch(
userApi.endpoints.updateUser.initiate(queryData)
).unwrap()

return { data: upperCaseNewLabel }
return { data: newLabel }
} catch (error) {
return { error }
}
Expand Down

0 comments on commit e4a26f9

Please sign in to comment.