Skip to content

Commit

Permalink
Changes for source attr release
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed Sep 2, 2021
1 parent c097f0c commit c6ff686
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 36 deletions.
74 changes: 43 additions & 31 deletions ui/public/assets/schema/source/metadata-source.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
"serviceEnabled": {
"title": "label.enable-this-service",
"description": "tooltip.enable-this-service-upon-saving",
"type": "boolean",
"default": false
"type": "boolean"
},
"organization": {
"$ref": "#/definitions/Organization"
Expand Down Expand Up @@ -76,8 +75,7 @@
},
"properties": {
"x509CertificateAvailable": {
"type": "boolean",
"default": true
"type": "boolean"
},
"authenticationRequestsSigned": {
"title": "label.authentication-requests-signed",
Expand Down Expand Up @@ -161,21 +159,32 @@
"type": "boolean",
"default": false
},
"dontSignResponse": {
"title": "label.dont-sign-the-response",
"description": "tooltip.dont-sign-response",
"type": "boolean",
"default": false
"nameIdFormats": {
"$ref": "#/definitions/nameIdFormats"
},
"responderId": {
"title": "label.responder-id",
"description": "tooltip.responder-id",
"type": "string"
},
"authenticationMethods": {
"$ref": "#/definitions/authenticationMethods"
},
"turnOffEncryption": {
"title": "label.turn-off-encryption-of-response",
"description": "tooltip.turn-off-encryption",
"type": "boolean",
"default": false
},
"useSha": {
"title": "label.use-sha1-signing-algorithm",
"description": "tooltip.usa-sha-algorithm",
"forceAuthn": {
"title": "label.force-authn",
"description": "tooltip.force-authn",
"type": "boolean",
"default": false
},
"dontSignResponse": {
"title": "label.dont-sign-the-response",
"description": "tooltip.dont-sign-response",
"type": "boolean",
"default": false
},
Expand All @@ -185,27 +194,15 @@
"type": "boolean",
"default": false
},
"omitNotBefore": {
"title": "label.omit-not-before-condition",
"description": "tooltip.omit-not-before-condition",
"useSha": {
"title": "label.use-sha1-signing-algorithm",
"description": "tooltip.usa-sha-algorithm",
"type": "boolean",
"default": false
},
"responderId": {
"title": "label.responder-id",
"description": "tooltip.responder-id",
"type": "string",
"default": ""
},
"nameIdFormats": {
"$ref": "#/definitions/nameIdFormats"
},
"authenticationMethods": {
"$ref": "#/definitions/authenticationMethods"
},
"forceAuthn": {
"title": "label.force-authn",
"description": "tooltip.force-authn",
"omitNotBefore": {
"title": "label.omit-not-before-condition",
"description": "tooltip.omit-not-before-condition",
"type": "boolean",
"default": false
}
Expand All @@ -218,8 +215,19 @@
"items": {
"type": "string",
"enum": [
[
"givenName",
"eduPersonAffiliation",
"eduPersonScopedAffiliation",
"employeeNumber"
],
[
"uid",
"surname",
"eduPersonAffiliation",
"employeeNumber"
],
"eduPersonPrincipalName",
{"name": "foo", "attributes": []},
"uid",
"mail",
"surname",
Expand All @@ -231,6 +239,10 @@
"eduPersonAssurance",
"eduPersonUniqueId",
"employeeNumber"
],
"enumNames": [
"Bundle 1",
"Bundle 2"
]
},
"uniqueItems": true
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/dashboard/view/SourcesTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export function SourcesTab () {
<MetadataActions type="source">
{(enable, remove) =>
<SourceList
entities={sources}
entities={searched}
onDelete={(id) => remove(id, loadSources)}
onEnable={(s, e) => enable(s, e, loadSources) }
onChangeGroup={changeSourceGroup} />
Expand Down
27 changes: 25 additions & 2 deletions ui/src/app/form/component/widgets/AttributeReleaseWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Translate from "../../../i18n/components/translate";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faCheck, faTimes } from "@fortawesome/free-solid-svg-icons";
import Button from 'react-bootstrap/Button';
import { useTranslator } from "../../../i18n/hooks";

const selectValue = (value, selected, all) => {
const at = all.indexOf(value);
Expand Down Expand Up @@ -59,6 +60,17 @@ const AttributeReleaseWidget = ({

onChange(update);
}

const onCheckBundle = (option) => {
const all = (enumOptions).map(({ value }) => value);
let update = [
...value
];
(option.value).forEach(v => update = selectValue(v, update, all));

onChange(update);
}

const onClearAll = () => {
onChange([]);
}
Expand All @@ -78,11 +90,21 @@ const AttributeReleaseWidget = ({
const checked = value.indexOf(option.value) !== -1;
const itemDisabled =
enumDisabled && (enumDisabled).indexOf(option.value) !== -1;
const bundled = typeof option.value === 'string' ? false : true;
return (
<tr key={index}>
<td><Translate value={`label.attribute-${option.label}`} /></td>
<tr key={index} className={bundled ? 'bg-secondary border-bottom py-4 text-white' : ''}>
<td className="align-middle">{bundled ?
<strong>{option.label}</strong>
:
<Translate value={`label.attribute-${option.label}`}>{option.label}</Translate>
}</td>
<td className="">
<fieldset className="d-flex justify-content-end">
{bundled ?
<Button variant="outline-primary bg-light" size="sm"
onClick={() => onCheckBundle(option)}
>Select</Button>
:
<div className="custom-control custom-checkbox">
<Form.Check
custom
Expand All @@ -98,6 +120,7 @@ const AttributeReleaseWidget = ({
disabled={disabled || itemDisabled || readonly}
/>
</div>
}
</fieldset>
</td>
</tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ export const SourceBase = {
label: 'Metadata Source',
type: '@MetadataProvider',
steps: [],
schema: `${API_BASE_PATH}/ui/MetadataSources`,
//schema: `${API_BASE_PATH}/ui/MetadataSources`,
schema: `/assets/schema/source/metadata-source.json`,

parser: (data) => removeNull(data, true),

Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/metadata/wizard/Wizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const WizardContext = React.createContext();
const { Provider, Consumer } = WizardContext;

const initialState = {
current: 'common',
current: 'attribute',
disabled: false,
loading: false
};
Expand Down

0 comments on commit c6ff686

Please sign in to comment.