update encrypted value display on detail and form views

This commit is contained in:
John Mitchell
2020-02-19 14:57:27 -05:00
parent 0b5f892193
commit 42387166bf
2 changed files with 12 additions and 4 deletions

View File

@@ -14,7 +14,7 @@ const DetailName = styled(({ fullWidth, ...props }) => (
`} `}
`; `;
const DetailValue = styled(({ fullWidth, ...props }) => ( const DetailValue = styled(({ fullWidth, isEncrypted, ...props }) => (
<TextListItem {...props} /> <TextListItem {...props} />
))` ))`
word-break: break-all; word-break: break-all;
@@ -23,6 +23,11 @@ const DetailValue = styled(({ fullWidth, ...props }) => (
` `
grid-column: 2 / -1; grid-column: 2 / -1;
`} `}
${props => props.isEncrypted &&
`
text-transform: uppercase
color: var(--pf-global--Color--400);
`}
`; `;
const Detail = ({ const Detail = ({
@@ -32,6 +37,7 @@ const Detail = ({
className, className,
dataCy, dataCy,
alwaysVisible, alwaysVisible,
isEncrypted
}) => { }) => {
if (!value && typeof value !== 'number' && !alwaysVisible) { if (!value && typeof value !== 'number' && !alwaysVisible) {
return null; return null;
@@ -55,6 +61,7 @@ const Detail = ({
component={TextListItemVariants.dd} component={TextListItemVariants.dd}
fullWidth={fullWidth} fullWidth={fullWidth}
data-cy={valueCy} data-cy={valueCy}
isEncrypted={isEncrypted}
> >
{value} {value}
</DetailValue> </DetailValue>

View File

@@ -70,7 +70,7 @@ function CredentialDetail({ i18n, credential }) {
setHasContentLoading(false); setHasContentLoading(false);
}; };
const renderDetail = ({ id, label, type, secret }) => { const renderDetail = ({ id, label, type }) => {
let detail; let detail;
if (type === 'boolean') { if (type === 'boolean') {
@@ -81,8 +81,9 @@ function CredentialDetail({ i18n, credential }) {
value={<List>{inputs[id] && <ListItem>{label}</ListItem>}</List>} value={<List>{inputs[id] && <ListItem>{label}</ListItem>}</List>}
/> />
); );
} else if (secret === true) { } else if (inputs[id] === '$encrypted$') {
detail = null; const isEncrypted = true;
detail = <Detail key={id} label={label} value={i18n._(t`Encrypted`)} isEncrypted={isEncrypted} />;
} else { } else {
detail = <Detail key={id} label={label} value={inputs[id]} />; detail = <Detail key={id} label={label} value={inputs[id]} />;
} }