From 413ff01856003758dd767fe49a43b7a000f6af71 Mon Sep 17 00:00:00 2001 From: Thomas Gasmyr Date: Sat, 2 Oct 2021 12:04:47 +0100 Subject: [PATCH] fix(admin-ui): provide tooltip for config properties #189 --- app/locales/en/translation.json | 4 +- app/routes/Apps/Gluu/GluuInumInput.js | 29 +++ app/utils/ApiResources.js | 5 + .../CustomScripts/CustomScriptForm.js | 32 +-- .../components/Clients/ClientBasicPanel.js | 81 +++--- .../Configuration/Defaults/AcrsPage.js | 1 + .../Configuration/Defaults/LoggingPage.js | 29 ++- .../components/Scopes/ScopeForm.js | 245 +++++++++--------- .../schema/components/Person/AttributeForm.js | 228 ++++++++-------- 9 files changed, 361 insertions(+), 293 deletions(-) create mode 100644 app/routes/Apps/Gluu/GluuInumInput.js create mode 100644 app/utils/ApiResources.js diff --git a/app/locales/en/translation.json b/app/locales/en/translation.json index 23eeaab1..c488b72a 100644 --- a/app/locales/en/translation.json +++ b/app/locales/en/translation.json @@ -583,6 +583,8 @@ "openid_client": { "clientName": " The openid connect client name", "description": " A clear and precise description of the client" - } + }, + "scope": {}, + "script": {} } } diff --git a/app/routes/Apps/Gluu/GluuInumInput.js b/app/routes/Apps/Gluu/GluuInumInput.js new file mode 100644 index 00000000..6af29362 --- /dev/null +++ b/app/routes/Apps/Gluu/GluuInumInput.js @@ -0,0 +1,29 @@ +import React from 'react' +import { Col, FormGroup, Input } from '../../../components' +import GluuLabel from './GluuLabel' +import GluuTooltip from './GluuTooltip' + +function GluuInumInput({ label, name, value, lsize,rsize, doc_category }) { + return ( + + + + + + + + + ) +} +GluuInumInput.defaultProps = { + lsize: 4, + rsize: 8, +} + +export default GluuInumInput diff --git a/app/utils/ApiResources.js b/app/utils/ApiResources.js new file mode 100644 index 00000000..df9a4d58 --- /dev/null +++ b/app/utils/ApiResources.js @@ -0,0 +1,5 @@ +export const OIDC_CLIENT = 'openid_client' +export const SCOPE = 'scope' +export const ATTRIBUTE = 'attribute' +export const SCRIPT = 'script' +export const JSON_CONFIG = 'json_properties' diff --git a/plugins/admin/components/CustomScripts/CustomScriptForm.js b/plugins/admin/components/CustomScripts/CustomScriptForm.js index 3c42d81c..021d3cb1 100644 --- a/plugins/admin/components/CustomScripts/CustomScriptForm.js +++ b/plugins/admin/components/CustomScripts/CustomScriptForm.js @@ -7,14 +7,15 @@ import { CustomInput, Form, FormGroup, - Label, Input, } from '../../../../app/components' import GluuLabel from '../../../../app/routes/Apps/Gluu/GluuLabel' +import GluuInumInput from '../../../../app/routes/Apps/Gluu/GluuInumInput' import GluuProperties from '../../../../app/routes/Apps/Gluu/GluuProperties' import Counter from '../../../../app/components/Widgets/GroupedButtons/Counter' import GluuCommitFooter from '../../../../app/routes/Apps/Gluu/GluuCommitFooter' import GluuCommitDialog from '../../../../app/routes/Apps/Gluu/GluuCommitDialog' +import { SCRIPT } from '../../../../app/utils/ApiResources' import { useTranslation } from 'react-i18next' function CustomScriptForm({ item, scripts, handleSubmit }) { @@ -157,22 +158,15 @@ function CustomScriptForm({ item, scripts, handleSubmit }) { return (
- {/* START Input */} {item.inum && ( - - - - - - + )} @@ -349,7 +343,6 @@ function CustomScriptForm({ item, scripts, handleSubmit }) { )} - @@ -360,7 +353,6 @@ function CustomScriptForm({ item, scripts, handleSubmit }) { - - {formik.errors.script && formik.touched.script ? ( @@ -388,7 +379,6 @@ function CustomScriptForm({ item, scripts, handleSubmit }) { /> - @@ -401,9 +391,7 @@ function CustomScriptForm({ item, scripts, handleSubmit }) { /> - - {' '} { return ( {client.inum && ( - - - - - - + + + + + + + + )} { value={client.clientName || client.displayName} doc_category={DOC_CATEGORY} /> - - - -
- - + + + +
- {showClientSecret ? : } - -
- -
+ + + {showClientSecret ? : } + +
+ +
+ {(formik) => ( + diff --git a/plugins/auth-server/components/Configuration/Defaults/LoggingPage.js b/plugins/auth-server/components/Configuration/Defaults/LoggingPage.js index edf7d852..165572df 100644 --- a/plugins/auth-server/components/Configuration/Defaults/LoggingPage.js +++ b/plugins/auth-server/components/Configuration/Defaults/LoggingPage.js @@ -1,5 +1,11 @@ import React, { useEffect } from 'react' -import { Form, Button, FormGroup, Col, CustomInput } from '../../../../../app/components' +import { + Form, + Button, + FormGroup, + Col, + CustomInput, +} from '../../../../../app/components' import GluuLabel from '../../../../../app/routes/Apps/Gluu/GluuLabel' import GluuCheckBoxRow from '../../../../../app/routes/Apps/Gluu/GluuCheckBoxRow' import GluuLoader from '../../../../../app/routes/Apps/Gluu/GluuLoader' @@ -38,9 +44,18 @@ function LoggingPage({ logging, dispatch, permissions, loading }) { { - values.httpLoggingEnabled = values.httpLoggingEnabled != undefined ? values.httpLoggingEnabled : logging.httpLoggingEnabled; - values.disableJdkLogger = values.disableJdkLogger != undefined ? values.disableJdkLogger : logging.disableJdkLogger; - values.enabledOAuthAuditLogging = values.enabledOAuthAuditLogging != undefined ? values.enabledOAuthAuditLogging : logging.enabledOAuthAuditLogging; + values.httpLoggingEnabled = + values.httpLoggingEnabled != undefined + ? values.httpLoggingEnabled + : logging.httpLoggingEnabled + values.disableJdkLogger = + values.disableJdkLogger != undefined + ? values.disableJdkLogger + : logging.disableJdkLogger + values.enabledOAuthAuditLogging = + values.enabledOAuthAuditLogging != undefined + ? values.enabledOAuthAuditLogging + : logging.enabledOAuthAuditLogging const opts = {} opts['loggingConfiguration'] = JSON.stringify(values) @@ -49,6 +64,7 @@ function LoggingPage({ logging, dispatch, permissions, loading }) { > {(formik) => ( + @@ -117,7 +133,10 @@ function LoggingPage({ logging, dispatch, permissions, loading }) { label="fields.enabled_oAuth_audit_logging" name="enabledOAuthAuditLogging" handleOnChange={(e) => { - formik.setFieldValue('enabledOAuthAuditLogging', e.target.checked) + formik.setFieldValue( + 'enabledOAuthAuditLogging', + e.target.checked, + ) }} lsize={5} rsize={7} diff --git a/plugins/auth-server/components/Scopes/ScopeForm.js b/plugins/auth-server/components/Scopes/ScopeForm.js index cff983cb..222c4dc1 100644 --- a/plugins/auth-server/components/Scopes/ScopeForm.js +++ b/plugins/auth-server/components/Scopes/ScopeForm.js @@ -12,10 +12,13 @@ import { Accordion, } from '../../../../app/components' import GluuLabel from '../../../../app/routes/Apps/Gluu/GluuLabel' -import GluuToogle from '../../../../app/routes/Apps/Gluu/GluuToogle' +import GluuInumInput from '../../../../app/routes/Apps/Gluu/GluuInumInput' +import GluuToogleRow from '../../../../app/routes/Apps/Gluu/GluuToogleRow' import GluuTypeAheadForDn from '../../../../app/routes/Apps/Gluu/GluuTypeAheadForDn' import GluuCommitFooter from '../../../../app/routes/Apps/Gluu/GluuCommitFooter' import GluuCommitDialog from '../../../../app/routes/Apps/Gluu/GluuCommitDialog' +import GluuTooltip from '../../../../app/routes/Apps/Gluu/GluuTooltip' +import { SCOPE } from '../../../../app/utils/ApiResources' import { useTranslation } from 'react-i18next' function ScopeForm({ scope, scripts, attributes, handleSubmit }) { @@ -109,96 +112,92 @@ function ScopeForm({ scope, scripts, attributes, handleSubmit }) { {(formik) => ( {scope.inum && ( + + )} + - + + + {(msg) =>
{msg}
} +
- )} - - - - - - - {(msg) =>
{msg}
} -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - {(msg) =>
{msg}
} -
-
+
+ + + + + + + + + + + + + + + + + + + + + + + + + {(msg) =>
{msg}
} +
+
+
{showDynamicPanel && ( {t('fields.dynamic_scope_scripts').toUpperCase()} + + doc_category={SCOPE} + /> )} @@ -218,13 +218,15 @@ function ScopeForm({ scope, scripts, attributes, handleSubmit }) { {t('fields.claims').toUpperCase()} + + doc_category={SCOPE} + /> )} @@ -233,41 +235,51 @@ function ScopeForm({ scope, scripts, attributes, handleSubmit }) { {t('fields.ox_attributes').toUpperCase()} - - - - - - - - - - - + + + + + - - - - - - - + /> + +
+ + + + + + + + + + + + + + + doc_category={SCOPE} + /> diff --git a/plugins/schema/components/Person/AttributeForm.js b/plugins/schema/components/Person/AttributeForm.js index b5a7b28c..7c08ab04 100644 --- a/plugins/schema/components/Person/AttributeForm.js +++ b/plugins/schema/components/Person/AttributeForm.js @@ -7,12 +7,14 @@ import { CustomInput, Form, FormGroup, - Label, Input, } from '../../../../app/components' import GluuFooter from '../../../../app/routes/Apps/Gluu/GluuFooter' import GluuLabel from '../../../../app/routes/Apps/Gluu/GluuLabel' +import GluuInumInput from '../../../../app/routes/Apps/Gluu/GluuInumInput' import GluuToogle from '../../../../app/routes/Apps/Gluu/GluuToogle' +import GluuTooltip from '../../../../app/routes/Apps/Gluu/GluuTooltip' +import { ATTRIBUTE } from '../../../../app/utils/ApiResources' import { useTranslation } from 'react-i18next' function AttributeForm({ item, customOnSubmit, hideButtons }) { @@ -73,86 +75,84 @@ function AttributeForm({ item, customOnSubmit, hideButtons }) { > {(formik) => ( - {/* START Input */} {item.inum && ( + + )} + - + + + {(msg) =>
{msg}
} +
- )} - - - - - - {(msg) =>
{msg}
} -
- -
- - - - - - - - {(msg) =>
{msg}
} -
- -
- - - - - - - - {(msg) =>
{msg}
} -
- -
+
+ + + + + + + + + {(msg) =>
{msg}
} +
+ +
+
+ + + + + + + + + {(msg) =>
{msg}
} +
+ +
+
@@ -313,17 +313,19 @@ function AttributeForm({ item, customOnSubmit, hideButtons }) { {validation && ( - - - - - - + + + + + + + + )} {validation && ( @@ -349,32 +351,36 @@ function AttributeForm({ item, customOnSubmit, hideButtons }) { )} - - - - - - - - - - - - + + + + + + + + + + + + + + + + )}