Format certificates/keys in setting detail and hide pendo when off

This commit is contained in:
Marliana Lara
2020-12-10 17:11:07 -05:00
parent bbde149ab1
commit 12f6c05a4a
4 changed files with 29 additions and 13 deletions

View File

@@ -18,6 +18,7 @@ import { SettingDetail } from '../../shared';
function SAMLDetail({ i18n }) { function SAMLDetail({ i18n }) {
const { me } = useConfig(); const { me } = useConfig();
const { GET: options } = useSettings(); const { GET: options } = useSettings();
options.SOCIAL_AUTH_SAML_SP_PUBLIC_CERT.type = 'certificate';
const { isLoading, error, request, result: saml } = useRequest( const { isLoading, error, request, result: saml } = useRequest(
useCallback(async () => { useCallback(async () => {

View File

@@ -76,7 +76,7 @@ describe('<SAMLDetail />', () => {
'https://towerhost/sso/metadata/saml/' 'https://towerhost/sso/metadata/saml/'
); );
assertDetail(wrapper, 'SAML Service Provider Entity ID', 'mock_id'); assertDetail(wrapper, 'SAML Service Provider Entity ID', 'mock_id');
assertDetail( assertVariableDetail(
wrapper, wrapper,
'SAML Service Provider Public Certificate', 'SAML Service Provider Public Certificate',
'mock_cert' 'mock_cert'

View File

@@ -72,26 +72,29 @@ function UIEdit() {
history.push('/settings/ui/details'); history.push('/settings/ui/details');
}; };
const initialValues = fields =>
Object.keys(fields).reduce((acc, key) => {
acc[key] = fields[key].value ?? '';
return acc;
}, {});
return ( return (
<CardBody> <CardBody>
{isLoading && <ContentLoading />} {isLoading && <ContentLoading />}
{!isLoading && error && <ContentError error={error} />} {!isLoading && error && <ContentError error={error} />}
{!isLoading && uiData && ( {!isLoading && uiData && (
<Formik initialValues={initialValues(uiData)} onSubmit={handleSubmit}> <Formik
initialValues={{
PENDO_TRACKING_STATE: uiData?.PENDO_TRACKING_STATE?.value ?? 'off',
CUSTOM_LOGIN_INFO: uiData?.CUSTOM_LOGIN_INFO?.value ?? '',
CUSTOM_LOGO: uiData?.CUSTOM_LOGO?.value ?? '',
}}
onSubmit={handleSubmit}
>
{formik => ( {formik => (
<Form autoComplete="off" onSubmit={formik.handleSubmit}> <Form autoComplete="off" onSubmit={formik.handleSubmit}>
<FormColumnLayout> <FormColumnLayout>
<ChoiceField {uiData?.PENDO_TRACKING_STATE?.value !== 'off' && (
name="PENDO_TRACKING_STATE" <ChoiceField
config={uiData.PENDO_TRACKING_STATE} name="PENDO_TRACKING_STATE"
isRequired config={uiData.PENDO_TRACKING_STATE}
/> isRequired
/>
)}
<TextAreaField <TextAreaField
name="CUSTOM_LOGIN_INFO" name="CUSTOM_LOGIN_INFO"
config={uiData.CUSTOM_LOGIN_INFO} config={uiData.CUSTOM_LOGIN_INFO}

View File

@@ -34,6 +34,18 @@ export default withI18n()(
/> />
); );
break; break;
case 'certificate':
detail = (
<CodeDetail
dataCy={id}
helpText={helpText}
label={label}
mode="javascript"
rows={4}
value={value}
/>
);
break;
case 'image': case 'image':
detail = ( detail = (
<Detail <Detail