Skip to content

Commit

Permalink
Merge pull request #1556 from GluuFederation/admin-ui-test-1547
Browse files Browse the repository at this point in the history
feat(admin-ui): export client summary in json format #1547
  • Loading branch information
duttarnab authored Jan 31, 2024
2 parents 600454a + ccf4536 commit 941d5f5
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 2 deletions.
1 change: 1 addition & 0 deletions admin-ui/app/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
"introspection_encrypted_response_alg": "Introspection Encrypted Response Alg",
"http_request_body": "Request Body",
"webhook_name": "Webhook Name",
"download_summary": "Download Summary",
"metadata_location": "Metadata Location",
"released_attributes": "Released Attributes",
"metadata_file": "Metadata File",
Expand Down
1 change: 1 addition & 0 deletions admin-ui/app/locales/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
"ssl_key_store_password": "Mot de passe du magasin de clés SSL",
"metadata_location": "Emplacement des métadonnées",
"released_attributes": "Attributs publiés",
"download_summary": "Télécharger le résumé",
"metadata_file": "Fichier de métadonnées",
"metadata_url": "URL des métadonnées",
"driver_class_name": "Nom de la classe du pilote",
Expand Down
1 change: 1 addition & 0 deletions admin-ui/app/locales/pt/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
"introspection_signed_response_alg": "Algoritmo de assinatura da resposta de introspeção",
"introspection_encrypted_response_alg": "Algoritmo de criptografia da resposta de introspeção",
"aui_feature_ids": "Recursos da interface do administrador",
"download_summary": "Baixar Resumo",
"introspection_encrypted_response_enc": "Algoritmo de criptografia da resposta de introspeção",
"issuer": "Emissor",
"metadata_location": "Localização dos Metadados",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,25 @@ function ClientWizardForm({
}
}

const downloadClientData = (values) => {
const jsonData = JSON.stringify(values, null, 2)

const blob = new Blob([jsonData], { type: 'application/json' })

const link = document.createElement('a')
link.href = URL.createObjectURL(blob)
link.download = values.displayName
? `${values.displayName}.json`
: 'client-summary.json'

document.body.appendChild(link)

link.click()

document.body.removeChild(link)
URL.revokeObjectURL(link.href)
}

return (
<React.Fragment>
<Card style={applicationStyle.mainCard}>
Expand All @@ -306,7 +325,23 @@ function ClientWizardForm({
{(formik) => (
<Form onSubmit={formik.handleSubmit} onKeyDown={onKeyDown}>
<Card>
<CardBody className='d-flex justify-content-center pt-5 wizard-wrapper'>
<div className='d-flex justify-content-end pt-3 pe-3'>
<Button
color={`primary-${selectedTheme}`}
style={{
...applicationStyle.buttonStyle,
...applicationStyle.buttonFlexIconStyles,
margin: 0,
}}
type='button'
onClick={() => downloadClientData(formik.values)}
className='d-flex m-1'
>
<i className='fa fa-download'></i>
{t('fields.download_summary')}
</Button>
</div>
<CardBody className='d-flex justify-content-center pt-3 wizard-wrapper'>
<Wizard activeStep={currentStep} onStepChanged={changeStep}>
<Wizard.Step
data-testid={sequence[0]}
Expand Down Expand Up @@ -463,6 +498,6 @@ ClientWizardForm.propTypes = {
customOnSubmit: PropTypes.func,
oidcConfiguration: PropTypes.object,
umaResources: PropTypes.array,
};
}

export default ClientWizardForm

0 comments on commit 941d5f5

Please sign in to comment.