-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: remove Auth Server Defaults page #307
- Loading branch information
Showing
6 changed files
with
171 additions
and
243 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
119 changes: 119 additions & 0 deletions
119
admin-ui/plugins/auth-server/components/Configuration/DefaultAcrInput.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
import React, { useState, useEffect } from 'react' | ||
import GluuLabel from 'Routes/Apps/Gluu/GluuLabel' | ||
import GluuTooltip from 'Routes/Apps/Gluu/GluuTooltip' | ||
import { useTranslation } from 'react-i18next' | ||
import applicationStyle from 'Routes/Apps/Gluu/styles/applicationstyle' | ||
import { | ||
Col, | ||
InputGroup, | ||
CustomInput, | ||
FormGroup, | ||
Button, | ||
} from 'Components' | ||
|
||
function DefaultAcrInput({ | ||
label, | ||
name, | ||
value, | ||
required, | ||
lsize, | ||
rsize, | ||
isArray, | ||
handler, | ||
options, | ||
path, | ||
}) { | ||
const { t } = useTranslation() | ||
const VALUE = 'value' | ||
const PATH = 'path' | ||
const [show, setShow] = useState(false) | ||
const [correctValue, setCorrectValue] = useState([]) | ||
const [data, setData] = useState(value) | ||
|
||
useEffect(() => { | ||
setData(value) | ||
}, [value]) | ||
|
||
const onValueChanged = (data) => { | ||
setShow(true) | ||
setData(data) | ||
} | ||
const onAccept = () => { | ||
const put = {} | ||
put[PATH] = path | ||
if (isArray) { | ||
put[VALUE] = correctValue | ||
} else { | ||
put[VALUE] = document.getElementById(name).value | ||
} | ||
put['op'] = 'replace' | ||
handler(put) | ||
setShow(!show) | ||
setData(document.getElementById(name).value) | ||
} | ||
const onCancel = () => { | ||
setCorrectValue([]) | ||
setShow(!show) | ||
} | ||
return ( | ||
<FormGroup row> | ||
<Col sm={10}> | ||
<GluuTooltip doc_category="json_properties" doc_entry={name}> | ||
<FormGroup row> | ||
<GluuLabel | ||
label={label} | ||
size={lsize} | ||
required={required} | ||
withTooltip={false} | ||
/> | ||
<Col sm={rsize}> | ||
<InputGroup> | ||
<CustomInput | ||
type="select" | ||
data-testid={name} | ||
id={name} | ||
name={name} | ||
value={data} | ||
onChange={(e) => { onValueChanged(e.target.value) }} | ||
> | ||
<option value="">{t('actions.choose')}...</option> | ||
{options.map((item, key) => ( | ||
<option key={key}> | ||
{item} | ||
</option> | ||
))} | ||
</CustomInput> | ||
</InputGroup> | ||
</Col> | ||
</FormGroup> | ||
</GluuTooltip> | ||
</Col> | ||
<Col sm={2}> | ||
{show && ( | ||
<> | ||
<Button | ||
color="primary" | ||
style={applicationStyle.buttonStyle} | ||
size="sm" | ||
onClick={onAccept} | ||
> | ||
<i className="fa fa-check mr-2"></i> | ||
</Button>{' '} | ||
<Button color="danger" size="sm" onClick={onCancel}> | ||
<i className="fa fa-times mr-2"></i> | ||
</Button> | ||
</> | ||
)} | ||
</Col> | ||
</FormGroup> | ||
) | ||
} | ||
|
||
DefaultAcrInput.defaultProps = { | ||
type: 'text', | ||
lsize: 3, | ||
rsize: 9, | ||
required: false, | ||
} | ||
|
||
export default DefaultAcrInput |
119 changes: 0 additions & 119 deletions
119
admin-ui/plugins/auth-server/components/Configuration/Defaults/AcrsPage.js
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.