Skip to content

Commit

Permalink
feat(admin-ui): fix bugs #363 #361 #362
Browse files Browse the repository at this point in the history
  • Loading branch information
syntrydy committed Jan 21, 2022
1 parent fdc5d14 commit aedc9ab
Show file tree
Hide file tree
Showing 3 changed files with 151 additions and 128 deletions.
10 changes: 5 additions & 5 deletions app/routes/Apps/Gluu/styles/applicationstyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ export default {
buttonStyle: {
background: 'linear-gradient(90deg, #00C9FF 0%, #92FE9D 100%)',
},
healthDown:{
background: 'linear-gradient(90deg, #fc575e 0%, #f7b42c 100%)'
healthDown: {
background: 'linear-gradient(90deg, #fc575e 0%, #f7b42c 100%)',
},
healthUp: {
content: '',
},
healthUp:{
content: ''
}
}
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@
"isomorphic-fetch": "^3.0.0",
"jans_config_api": "file:jans_config_api",
"lodash": "^4.17.21",
"material-table": "^1.69.3",
"moment": "^2.24.0",
"node-fetch": "^2.6.0",
"npm-force-resolutions": "0.0.10",
Expand Down
268 changes: 146 additions & 122 deletions plugins/auth-server/components/Configuration/Defaults/LoggingPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import {
Form,
Button,
FormGroup,
Card,
CardBody,
Col,
CustomInput,
} from '../../../../../app/components'
Expand All @@ -12,6 +14,7 @@ import GluuLoader from '../../../../../app/routes/Apps/Gluu/GluuLoader'
import GluuViewWrapper from '../../../../../app/routes/Apps/Gluu/GluuViewWrapper'
import { JSON_CONFIG } from '../../../../../app/utils/ApiResources'
import GluuTooltip from '../../../../../app/routes/Apps/Gluu/GluuTooltip'
import GluuRibbon from '../../../../../app/routes/Apps/Gluu/GluuRibbon'
import applicationStyle from '../../../../../app/routes/Apps/Gluu/styles/applicationstyle'
import { connect } from 'react-redux'
import { Formik } from 'formik'
Expand Down Expand Up @@ -43,131 +46,152 @@ function LoggingPage({ logging, dispatch, permissions, loading }) {
const logLayouts = ['text', 'json']
return (
<GluuLoader blocking={loading}>
<GluuViewWrapper canShow={hasPermission(permissions, LOGGING_READ)}>
<Formik
initialValues={initialValues}
onSubmit={(values) => {
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
<Card>
<GluuRibbon title="Logging" fromLeft doTranslate />
<CardBody style={{ minHeight: 500 }}>
<FormGroup row></FormGroup>
<FormGroup row></FormGroup>
<FormGroup row></FormGroup>
<GluuViewWrapper canShow={hasPermission(permissions, LOGGING_READ)}>
<Formik
initialValues={initialValues}
onSubmit={(values) => {
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)
dispatch(editLoggingConfig(opts))
}}
>
{(formik) => (
<Form onSubmit={formik.handleSubmit}>
<FormGroup row></FormGroup>
<GluuTooltip doc_category={JSON_CONFIG} doc_entry="loggingLevel">
<FormGroup row>
<GluuLabel label="fields.log_level" size={4} />
<Col sm={8}>
<CustomInput
type="select"
id="loggingLevel"
name="loggingLevel"
data-testid="loggingLevel"
value={logging.loggingLevel}
onChange={(e) => {
logging.loggingLevel = e.target.value
formik.setFieldValue('loggingLevel', e.target.value)
}}
>
<option value="">{t('actions.choose')}...</option>
{levels.map((item, key) => (
<option value={item} key={key}>
{item}
</option>
))}
</CustomInput>
</Col>
</FormGroup>
</GluuTooltip>
<GluuTooltip doc_category={JSON_CONFIG} doc_entry="loggingLayout">
<FormGroup row>
<GluuLabel label="fields.log_layout" size={4} />
<Col sm={8}>
<CustomInput
type="select"
id="loggingLayout"
name="loggingLayout"
data-testid="loggingLayout"
value={logging.loggingLayout}
onChange={(e) => {
logging.loggingLayout = e.target.value
formik.setFieldValue('loggingLayout', e.target.value)
}}
>
<option value="">{t('actions.choose')}...</option>
{logLayouts.map((item, key) => (
<option value={item} key={key}>
{item}
</option>
))}
</CustomInput>
</Col>
</FormGroup>
</GluuTooltip>
<GluuCheckBoxRow
label="fields.http_logging_enabled"
name="httpLoggingEnabled"
handleOnChange={(e) => {
formik.setFieldValue('httpLoggingEnabled', e.target.checked)
}}
lsize={5}
rsize={7}
value={logging.httpLoggingEnabled}
doc_category={JSON_CONFIG}
></GluuCheckBoxRow>
<GluuCheckBoxRow
label="fields.disable_jdk_logger"
name="disableJdkLogger"
handleOnChange={(e) => {
formik.setFieldValue('disableJdkLogger', e.target.checked)
}}
lsize={5}
rsize={7}
doc_category={JSON_CONFIG}
value={logging.disableJdkLogger}
></GluuCheckBoxRow>
<GluuCheckBoxRow
label="fields.enabled_oAuth_audit_logging"
name="enabledOAuthAuditLogging"
handleOnChange={(e) => {
formik.setFieldValue(
'enabledOAuthAuditLogging',
e.target.checked,
)
}}
lsize={5}
rsize={7}
doc_category={JSON_CONFIG}
value={logging.enabledOAuthAuditLogging}
></GluuCheckBoxRow>
const opts = {}
opts['loggingConfiguration'] = JSON.stringify(values)
dispatch(editLoggingConfig(opts))
}}
>
{(formik) => (
<Form onSubmit={formik.handleSubmit}>
<FormGroup row></FormGroup>
<GluuTooltip
doc_category={JSON_CONFIG}
doc_entry="loggingLevel"
>
<FormGroup row>
<GluuLabel label="fields.log_level" size={4} />
<Col sm={8}>
<CustomInput
type="select"
id="loggingLevel"
name="loggingLevel"
data-testid="loggingLevel"
value={logging.loggingLevel}
onChange={(e) => {
logging.loggingLevel = e.target.value
formik.setFieldValue('loggingLevel', e.target.value)
}}
>
<option value="">{t('actions.choose')}...</option>
{levels.map((item, key) => (
<option value={item} key={key}>
{item}
</option>
))}
</CustomInput>
</Col>
</FormGroup>
</GluuTooltip>
<GluuTooltip
doc_category={JSON_CONFIG}
doc_entry="loggingLayout"
>
<FormGroup row>
<GluuLabel label="fields.log_layout" size={4} />
<Col sm={8}>
<CustomInput
type="select"
id="loggingLayout"
name="loggingLayout"
data-testid="loggingLayout"
value={logging.loggingLayout}
onChange={(e) => {
logging.loggingLayout = e.target.value
formik.setFieldValue(
'loggingLayout',
e.target.value,
)
}}
>
<option value="">{t('actions.choose')}...</option>
{logLayouts.map((item, key) => (
<option value={item} key={key}>
{item}
</option>
))}
</CustomInput>
</Col>
</FormGroup>
</GluuTooltip>
<GluuCheckBoxRow
label="fields.http_logging_enabled"
name="httpLoggingEnabled"
handleOnChange={(e) => {
formik.setFieldValue(
'httpLoggingEnabled',
e.target.checked,
)
}}
lsize={5}
rsize={7}
value={logging.httpLoggingEnabled}
doc_category={JSON_CONFIG}
></GluuCheckBoxRow>
<GluuCheckBoxRow
label="fields.disable_jdk_logger"
name="disableJdkLogger"
handleOnChange={(e) => {
formik.setFieldValue('disableJdkLogger', e.target.checked)
}}
lsize={5}
rsize={7}
doc_category={JSON_CONFIG}
value={logging.disableJdkLogger}
></GluuCheckBoxRow>
<GluuCheckBoxRow
label="fields.enabled_oAuth_audit_logging"
name="enabledOAuthAuditLogging"
handleOnChange={(e) => {
formik.setFieldValue(
'enabledOAuthAuditLogging',
e.target.checked,
)
}}
lsize={5}
rsize={7}
doc_category={JSON_CONFIG}
value={logging.enabledOAuthAuditLogging}
></GluuCheckBoxRow>

{hasPermission(permissions, LOGGING_WRITE) && (
<Button
color="primary"
type="submit"
style={applicationStyle.buttonStyle}
>
{t('actions.save')}
</Button>
{hasPermission(permissions, LOGGING_WRITE) && (
<Button
color="primary"
type="submit"
style={applicationStyle.buttonStyle}
>
<i className="fa fa-check-circle mr-2"></i>
{t('actions.save')}
</Button>
)}
</Form>
)}
</Form>
)}
</Formik>
</GluuViewWrapper>
</Formik>
</GluuViewWrapper>
</CardBody>
</Card>
</GluuLoader>
)
}
Expand Down

0 comments on commit aedc9ab

Please sign in to comment.