Skip to content

Commit

Permalink
Consolidated schema
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed May 17, 2021
1 parent 95d56d6 commit ad811a0
Show file tree
Hide file tree
Showing 15 changed files with 140 additions and 119 deletions.
26 changes: 18 additions & 8 deletions ui/public/assets/schema/provider/dynamic-http.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@
{
"properties": {
"@type": {
"enum": ["Regex"]
"enum": [
"Regex"
]
},
"match": {
"title": "label.match",
Expand Down Expand Up @@ -84,7 +86,10 @@
"widget": {
"id": "select"
},
"enum": ["MetadataQueryProtocol", "Regex"]
"enum": [
"MetadataQueryProtocol",
"Regex"
]
},
"content": {
"title": "label.md-request-value",
Expand Down Expand Up @@ -311,14 +316,12 @@
"tlsTrustEngineRef": {
"type": "string",
"title": "",
"description": "",
"widget": "hidden"
"description": ""
},
"httpClientSecurityParametersRef": {
"type": "string",
"title": "",
"description": "",
"widget": "hidden"
"description": ""
},
"proxyHost": {
"type": "string",
Expand Down Expand Up @@ -388,6 +391,7 @@
}
},
"metadataFilters": {
"$id": "metadataFilters",
"title": "",
"description": "",
"type": "array",
Expand Down Expand Up @@ -480,8 +484,14 @@
"id": "select"
},
"type": "string",
"enum": ["SPSSODescriptor", "AttributeAuthorityDescriptor"],
"enumNames": ["value.spdescriptor", "value.attr-auth-descriptor"]
"enum": [
"SPSSODescriptor",
"AttributeAuthorityDescriptor"
],
"enumNames": [
"value.spdescriptor",
"value.attr-auth-descriptor"
]
}
},
"removeRolelessEntityDescriptors": {
Expand Down
61 changes: 4 additions & 57 deletions ui/public/assets/schema/provider/filebacked-http.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,12 @@
"title": "label.xml-id",
"description": "tooltip.xml-id",
"type": "string",
"default": "",
"minLength": 1
},
"metadataURL": {
"title": "label.metadata-url",
"description": "tooltip.metadata-url",
"type": "string",
"default": "",
"minLength": 1
},
"initializeFromBackupFile": {
Expand Down Expand Up @@ -99,59 +97,9 @@
"type": "boolean"
},
"httpMetadataResolverAttributes": {
"$id": "httpMetadataResolverAttributes",
"order": [],
"type": "object",
"fieldsets": [
{
"title": "label.http-security-attributes",
"type": "section",
"class": "col-12",
"fields": [
"disregardTLSCertificate"
]
},
{
"title": "label.http-connection-attributes",
"type": "section",
"fields": [
"connectionRequestTimeout",
"connectionTimeout",
"socketTimeout"
]
},
{
"title": "label.http-proxy-attributes",
"type": "section",
"class": "col-12",
"fields": [
"proxyHost",
"proxyPort",
"proxyUser",
"proxyPassword"
]
},
{
"title": "label.http-caching-attributes",
"type": "section",
"class": "col-12",
"fields": [
"httpCaching",
"httpCacheDirectory",
"httpMaxCacheEntries",
"httpMaxCacheEntrySize"
]
},
{
"title": "",
"type": "hidden",
"class": "col-12",
"fields": [
"tlsTrustEngineRef",
"httpClientSecurityParametersRef",
"httpClientRef"
]
}
],
"properties": {
"disregardTLSCertificate": {
"type": "boolean",
Expand Down Expand Up @@ -227,14 +175,12 @@
"tlsTrustEngineRef": {
"type": "string",
"title": "",
"description": "",
"widget": "hidden"
"description": ""
},
"httpClientSecurityParametersRef": {
"type": "string",
"title": "",
"description": "",
"widget": "hidden"
"description": ""
},
"proxyHost": {
"type": "string",
Expand Down Expand Up @@ -330,6 +276,7 @@
}
},
"metadataFilters": {
"$id": "metadataFilters",
"title": "",
"description": "",
"type": "array",
Expand Down
15 changes: 0 additions & 15 deletions ui/public/assets/schema/provider/local-dynamic.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,21 +78,6 @@
"title": "label.cleanup-task-interval",
"description": "tooltip.cleanup-task-interval",
"type": "string",
"widget": {
"id": "datalist",
"data": [
"PT0S",
"PT30S",
"PT1M",
"PT10M",
"PT30M",
"PT1H",
"PT4H",
"PT8H",
"PT12H",
"PT24H"
]
},
"pattern": "^(R\\d*\\/)?P(?:\\d+(?:\\.\\d+)?Y)?(?:\\d+(?:\\.\\d+)?M)?(?:\\d+(?:\\.\\d+)?W)?(?:\\d+(?:\\.\\d+)?D)?(?:T(?:\\d+(?:\\.\\d+)?H)?(?:\\d+(?:\\.\\d+)?M)?(?:\\d+(?:\\.\\d+)?S)?)?$"
}
}
Expand Down
4 changes: 3 additions & 1 deletion ui/public/assets/schema/source/metadata-source.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@
}
},
"dependencies": {
"nameIdFormats": ["protocolSupportEnum"]
"nameIdFormats": [
"protocolSupportEnum"
]
}
},
"logoutEndpoints": {
Expand Down
14 changes: 0 additions & 14 deletions ui/src/app/form/component/templates/FieldTemplate.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from "react";

import Form from "react-bootstrap/Form";
import ListGroup from "react-bootstrap/ListGroup";

import {Translate} from '../../../i18n/components/translate';

Expand All @@ -25,19 +24,6 @@ export function FieldTemplate ({
{children}
</div>
<div>
{rawErrors.length > 0 && (
<ListGroup as="ul">
{rawErrors.map((error, i) => {
return (
<ListGroup.Item as="li" key={i} className={`border-0 m-0 p-0 bg-transparent ${i > 0 ? 'sr-only' : ''}`}>
<small className="m-0 text-danger">
<Translate value={error}>{error}</Translate>
</small>
</ListGroup.Item>
);
})}
</ListGroup>
)}
{rawHelp && rawErrors.length < 1 && (
<Form.Text className={rawErrors.length > 0 ? "text-danger" : "text-muted"} id={id}>
<Translate value={rawHelp} />
Expand Down
24 changes: 23 additions & 1 deletion ui/src/app/form/component/widgets/OptionWidget.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React from "react";

import ListGroup from "react-bootstrap/ListGroup";
import Form from "react-bootstrap/Form";

import Translate from "../../../i18n/components/translate";
import { InfoIcon } from "../InfoIcon";

Expand Down Expand Up @@ -51,6 +53,13 @@ const OptionWidget = ({

const translator = useTranslator();

const [touched, setTouched] = React.useState(false);

const onCustomBlur = (evt) => {
setTouched(true);
_onBlur(evt);
};

return (
<Form.Group className="mb-0">
<Form.Label className={`${rawErrors.length > 0 ? "text-danger" : ""}`}>
Expand All @@ -70,7 +79,7 @@ const OptionWidget = ({
placeholder={uiSchema['ui:placeholder'] ? translator(uiSchema['ui:placeholder'] ): ''}
disabled={disabled || readonly}
onChange={_onChange}
onBlur={_onBlur}
onBlur={onCustomBlur}
onFocus={_onFocus}
filterBy={(option, props) => true}
renderMenuItemChildren={(option, {options, text}, index) => {
Expand All @@ -80,6 +89,19 @@ const OptionWidget = ({
<ToggleButton isOpen={isMenuShown} onClick={e => toggleMenu()} disabled={disabled || readonly} />
)}
</Typeahead>
{rawErrors.length > 0 && touched && (
<ListGroup as="ul">
{rawErrors.map((error, i) => {
return (
<ListGroup.Item as="li" key={i} className={`border-0 m-0 p-0 bg-transparent ${i > 0 ? 'sr-only' : ''}`}>
<small className="m-0 text-danger">
<Translate value={error}>{error}</Translate>
</small>
</ListGroup.Item>
);
})}
</ListGroup>
)}
</Form.Group>
);
};
Expand Down
17 changes: 17 additions & 0 deletions ui/src/app/form/component/widgets/SelectWidget.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from "react";

import Form from "react-bootstrap/Form";
import ListGroup from "react-bootstrap/ListGroup";

import { utils } from "@rjsf/core";

Expand Down Expand Up @@ -81,6 +82,8 @@ const SelectWidget = ({
}
}

const [touched, setTouched] = React.useState(false);

return (
<Form.Group>
<Form.Label className={`${rawErrors.length > 0 ? "text-danger" : ""}`}>
Expand All @@ -106,6 +109,7 @@ const SelectWidget = ({
((event) => {
const newValue = getValue(event, multiple);
onBlur(id, processValue(schema, newValue));
setTouched(true);
})
}
onFocus={
Expand All @@ -128,6 +132,19 @@ const SelectWidget = ({
</option>
)}
</Form.Control>
{rawErrors.length > 0 && touched && (
<ListGroup as="ul">
{rawErrors.map((error, i) => {
return (
<ListGroup.Item as="li" key={i} className={`border-0 m-0 p-0 bg-transparent ${i > 0 ? 'sr-only' : ''}`}>
<small className="m-0 text-danger">
<Translate value={error}>{error}</Translate>
</small>
</ListGroup.Item>
);
})}
</ListGroup>
)}
</Form.Group>
);
};
Expand Down
17 changes: 16 additions & 1 deletion ui/src/app/form/component/widgets/TextWidget.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import React from "react";
import { faAsterisk } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import React from "react";

import ListGroup from "react-bootstrap/ListGroup";
import Form from "react-bootstrap/Form";

import Translate from "../../../i18n/components/translate";
import { InfoIcon } from "../InfoIcon";

Expand Down Expand Up @@ -71,6 +73,19 @@ const TextWidget = ({
})}
</datalist>
) : null}
{rawErrors.length > 0 && touched && (
<ListGroup as="ul">
{rawErrors.map((error, i) => {
return (
<ListGroup.Item as="li" key={i} className={`border-0 m-0 p-0 bg-transparent ${i > 0 ? 'sr-only' : ''}`}>
<small className="m-0 text-danger">
<Translate value={error}>{error}</Translate>
</small>
</ListGroup.Item>
);
})}
</ListGroup>
)}
</Form.Group>
);
};
Expand Down
Loading

0 comments on commit ad811a0

Please sign in to comment.