From 5595b0b373ba3d2181e73735022f147144163791 Mon Sep 17 00:00:00 2001 From: Okke Harsta Date: Tue, 12 Dec 2023 17:52:39 +0100 Subject: [PATCH] Styling --- client/package.json | 2 +- client/src/index.js | 2 + client/src/locale/en.js | 4 ++ client/src/locale/nl.js | 4 ++ client/src/pages/InvitationForm.js | 61 +++++++++++++------ client/src/pages/InvitationForm.scss | 7 +++ client/yarn.lock | 8 +-- server/src/main/java/access/model/Role.java | 1 + .../src/main/resources/manage/oidc10_rp.json | 6 +- .../src/main/resources/manage/saml20_sp.json | 12 ++-- welcome/package.json | 2 +- welcome/yarn.lock | 8 +-- 12 files changed, 81 insertions(+), 36 deletions(-) diff --git a/client/package.json b/client/package.json index 3e4a2c06..b470ce91 100644 --- a/client/package.json +++ b/client/package.json @@ -3,7 +3,7 @@ "version": "0.1.0", "private": true, "dependencies": { - "@surfnet/sds": "^0.0.88", + "@surfnet/sds": "^0.0.93", "dompurify": "^3.0.3", "i18n-js": "^4.2.3", "isomorphic-dompurify": "^1.5.0", diff --git a/client/src/index.js b/client/src/index.js index e80d63ed..e1e3bb0b 100644 --- a/client/src/index.js +++ b/client/src/index.js @@ -5,6 +5,8 @@ import {BrowserRouter,Routes, Route} from "react-router-dom"; //Always keep these two last import './index.scss'; import '@surfnet/sds/styles/sds.css'; +//Do not change the order of @surfnet.sds style imports +import '@surfnet/sds/cjs/index.css'; const root = ReactDOM.createRoot(document.getElementById("app")); root.render( diff --git a/client/src/locale/en.js b/client/src/locale/en.js index 2ab254d3..fd0a241f 100644 --- a/client/src/locale/en.js +++ b/client/src/locale/en.js @@ -200,7 +200,10 @@ const en = { inviterRoles: "Select the roles for the new invitation", rolesPlaceHolder: "Choose one or more roles", expiryDate: "Invitation expiry date", + expiryDateQuestion: "Invitation acceptance period", roleExpiryDate: "Role expiry date", + roleExpiryDateQuestion: "Use a user specific role expiry date?", + withinThreeMonths: "Within 1 month", createdAt: "Sent", message: "Message", messagePlaceholder: "Personal message for the invitee included in the invitation", @@ -233,6 +236,7 @@ const en = { edit: "Edit", cancel: "Cancel", save: "Save", + specificDate: "Set specific date", and: "and", more: "More", less: "Less", diff --git a/client/src/locale/nl.js b/client/src/locale/nl.js index 6f4b9a60..673ac022 100644 --- a/client/src/locale/nl.js +++ b/client/src/locale/nl.js @@ -200,7 +200,10 @@ const nl = { inviterRoles: "Selecteer de rollen voor de nieuwe uitnodiging", rolesPlaceHolder: "Kies een of meer rollen", expiryDate: "Verloopdatum uitnodiging", + expiryDateQuestion: "Uitnodiging acceptatie periode", roleExpiryDate: "Verloopdatum rol", + roleExpiryDateQuestion: "Zet een specifieke gebruikers verloopdatum?", + withinThreeMonths: "Binnen 1 maand", createdAt: "Verstuurd", message: "Bericht", messagePlaceholder: "Persoonlijk bericht voor de genodigde dat wordt opgenomen in de uitnodiging", @@ -233,6 +236,7 @@ const nl = { edit: "Bewerken", cancel: "Annuleren", save: "Opslaan", + specificDate: "Zet specifieke datum", and: "en", more: "Meer", less: "Minder", diff --git a/client/src/pages/InvitationForm.js b/client/src/pages/InvitationForm.js index b615371e..52f1b258 100644 --- a/client/src/pages/InvitationForm.js +++ b/client/src/pages/InvitationForm.js @@ -13,7 +13,7 @@ import {ReactComponent as UserIcon} from "@surfnet/sds/icons/functional-icons/id import {ReactComponent as UpIcon} from "@surfnet/sds/icons/functional-icons/arrow-up-2.svg"; import {ReactComponent as DownIcon} from "@surfnet/sds/icons/functional-icons/arrow-down-2.svg"; import {newInvitation, rolesByApplication} from "../api"; -import {Button, ButtonType, Checkbox, Loader, Tooltip} from "@surfnet/sds"; +import {Button, ButtonType, Checkbox, Loader, RadioOptions, Tooltip} from "@surfnet/sds"; import "./InvitationForm.scss"; import {UnitHeader} from "../components/UnitHeader"; import InputField from "../components/InputField"; @@ -28,6 +28,9 @@ import {RoleCard} from "../components/RoleCard"; export const InvitationForm = () => { const location = useLocation(); const navigate = useNavigate(); + + const {user, setFlash, config} = useAppStore(state => state); + const [guest, setGuest] = useState(false); const [roles, setRoles] = useState([]); const [selectedRoles, setSelectedRoles] = useState([]); @@ -39,8 +42,9 @@ export const InvitationForm = () => { intendedAuthority: AUTHORITIES.GUEST }); const [displayAdvancedSettings, setDisplayAdvancedSettings] = useState(false); - const {user, setFlash, config} = useAppStore(state => state); const [loading, setLoading] = useState(true); + const [customExpiryDate, setCustomExpiryDate] = useState(false); + const [customRoleExpiryDate, setCustomRoleExpiryDate] = useState(false); const [initial, setInitial] = useState(true); const required = ["intendedAuthority", "invites"]; @@ -264,15 +268,6 @@ export const InvitationForm = () => { {I18n.t("roles.hideAdvancedSettings")} - setInvitation({...invitation, expiryDate: e})} - showYearDropdown={true} - pastDatesAllowed={config.pastDateAllowed} - minDate={futureDate(1)} - maxDate={futureDate(30)} - name={I18n.t("invitations.expiryDate")} - toolTip={I18n.t("tooltips.expiryDateTooltip")}/> - setInvitation({...invitation, enforceEmailEquality: e.target.checked})} @@ -296,16 +291,42 @@ export const InvitationForm = () => { readOnly={invitation.intendedAuthority === AUTHORITIES.GUEST} tooltip={I18n.t("tooltips.guestRoleIncludedTooltip")} /> + setCustomRoleExpiryDate(!customRoleExpiryDate)} + label={I18n.t("invitations.roleExpiryDateQuestion")} + falseLabel={I18n.t("forms.no")} + reverse={false} + trueLabel={I18n.t("forms.specificDate")} + /> + {customRoleExpiryDate && + setInvitation({...invitation, roleExpiryDate: e})} + showYearDropdown={true} + disabled={selectedRoles.some(role => !role.overrideSettingsAllowed)} + pastDatesAllowed={config.pastDateAllowed} + allowNull={selectedRoles.every(role => role.overrideSettingsAllowed) && invitation.intendedAuthority !== AUTHORITIES.GUEST} + minDate={futureDate(1, invitation.expiryDate)} + name={I18n.t("invitations.roleExpiryDate")} + toolTip={I18n.t("tooltips.roleExpiryDateTooltip")}/>} - setInvitation({...invitation, roleExpiryDate: e})} - showYearDropdown={true} - disabled={selectedRoles.some(role => !role.overrideSettingsAllowed)} - pastDatesAllowed={config.pastDateAllowed} - allowNull={selectedRoles.every(role => role.overrideSettingsAllowed) && invitation.intendedAuthority !== AUTHORITIES.GUEST} - minDate={futureDate(1, invitation.expiryDate)} - name={I18n.t("invitations.roleExpiryDate")} - toolTip={I18n.t("tooltips.roleExpiryDateTooltip")}/> + setCustomExpiryDate(!customExpiryDate)} + label={I18n.t("invitations.expiryDateQuestion")} + falseLabel={I18n.t("invitations.withinThreeMonths")} + reverse={false} + trueLabel={I18n.t("forms.specificDate")} + /> + {customExpiryDate && + setInvitation({...invitation, expiryDate: e})} + showYearDropdown={true} + pastDatesAllowed={config.pastDateAllowed} + minDate={futureDate(1)} + maxDate={futureDate(30)} + name={I18n.t("invitations.expiryDate")} + toolTip={I18n.t("tooltips.expiryDateTooltip")}/>} }
diff --git a/client/src/pages/InvitationForm.scss b/client/src/pages/InvitationForm.scss index 8e807bd5..f084ce1a 100644 --- a/client/src/pages/InvitationForm.scss +++ b/client/src/pages/InvitationForm.scss @@ -28,6 +28,13 @@ margin-left: 15px; } } + .sds--radio-options { + width: 320px; + + .sds--text-field-container div:last-child { + margin-left: auto; + } + } } diff --git a/client/yarn.lock b/client/yarn.lock index 2129fbe8..e731d55c 100644 --- a/client/yarn.lock +++ b/client/yarn.lock @@ -1876,10 +1876,10 @@ dependencies: "@sinonjs/commons" "^1.7.0" -"@surfnet/sds@^0.0.88": - version "0.0.88" - resolved "https://registry.yarnpkg.com/@surfnet/sds/-/sds-0.0.88.tgz#721962e3e3d24f8488f74a9d3280df55ca1eb719" - integrity sha512-fU4DYt2ncwGr0IsC8DB0MHHPhmv4PB5qTj0Z544jtccpKeUqdoU7sz3JwYuFeqzUM2jWL7TQvJSpunQwR0b8Qw== +"@surfnet/sds@^0.0.93": + version "0.0.93" + resolved "https://registry.yarnpkg.com/@surfnet/sds/-/sds-0.0.93.tgz#68f0a4a7aa80ce6888a1e87e38bee19fb6238b21" + integrity sha512-KG4BqFFxhgASnJ4YbzTthH1BEh5Bkqe7z5pFPoLHb6sVhXt+Vz7OxqMoTzMZKkB7Q83O78R/GyCABSe85kQxXA== "@surma/rollup-plugin-off-main-thread@^2.2.3": version "2.2.3" diff --git a/server/src/main/java/access/model/Role.java b/server/src/main/java/access/model/Role.java index 24b67797..95d79457 100644 --- a/server/src/main/java/access/model/Role.java +++ b/server/src/main/java/access/model/Role.java @@ -70,6 +70,7 @@ public class Role implements Serializable, Provisionable { name = "roles_applications", joinColumns = @JoinColumn(name = "role_id"), inverseJoinColumns = @JoinColumn(name = "application_id")) + //TODO https://www.baeldung.com/hibernate-persisting-maps, store landingpage per applications private Set applications = new HashSet<>(); @OneToMany(mappedBy = "role", diff --git a/server/src/main/resources/manage/oidc10_rp.json b/server/src/main/resources/manage/oidc10_rp.json index 68155ed5..6bbe235b 100644 --- a/server/src/main/resources/manage/oidc10_rp.json +++ b/server/src/main/resources/manage/oidc10_rp.json @@ -10,7 +10,8 @@ "name:nl": "Calendar NL", "OrganizationName:en": "SURF bv", "logo:0:url": "https://static.surfconext.nl/media/idp/surfconext.png", - "coin:institution_guid": "ad93daef-0911-e511-80d0-005056956c1a" + "coin:institution_guid": "ad93daef-0911-e511-80d0-005056956c1a", + "coin:application_url": "https://default-url-from-manage.org" } } }, @@ -24,7 +25,8 @@ "name:en": "Cloud EN", "name:nl": "Cloud NL", "OrganizationName:en": "SURF bv", - "logo:0:url": "https://static.surfconext.nl/media/idp/surfconext.png" + "logo:0:url": "https://static.surfconext.nl/media/idp/surfconext.png", + "coin:application_url": "https://default-url-from-manage.org" } } } diff --git a/server/src/main/resources/manage/saml20_sp.json b/server/src/main/resources/manage/saml20_sp.json index 1c2a8cf2..a94895e0 100644 --- a/server/src/main/resources/manage/saml20_sp.json +++ b/server/src/main/resources/manage/saml20_sp.json @@ -9,7 +9,8 @@ "name:en": "Wiki EN", "name:nl": "Wiki NL", "OrganizationName:en": "SURF bv", - "coin:institution_guid": "ad93daef-0911-e511-80d0-005056956c1a" + "coin:institution_guid": "ad93daef-0911-e511-80d0-005056956c1a", + "coin:application_url": "https://default-url-from-manage.org" } } }, @@ -24,7 +25,8 @@ "name:nl": "Network NL", "OrganizationName:en": "SURF bv", "logo:0:url": "https://static.surfconext.nl/media/idp/surfconext.png", - "coin:institution_guid": "ad93daef-0911-e511-80d0-005056956c1a" + "coin:institution_guid": "ad93daef-0911-e511-80d0-005056956c1a", + "coin:application_url": "https://default-url-from-manage.org" } } }, @@ -38,7 +40,8 @@ "name:en": "Storage EN", "name:nl": "Storage NL", "OrganizationName:en": "SURF bv", - "logo:0:url": "https://static.surfconext.nl/media/idp/surfconext.png" + "logo:0:url": "https://static.surfconext.nl/media/idp/surfconext.png", + "coin:application_url": "https://default-url-from-manage.org" } } }, @@ -52,7 +55,8 @@ "name:en": "Research EN", "name:nl": "Research NL", "OrganizationName:en": "SURF bv", - "logo:0:url": "https://static.surfconext.nl/media/idp/surfconext.png" + "logo:0:url": "https://static.surfconext.nl/media/idp/surfconext.png", + "coin:application_url": "https://default-url-from-manage.org" } } } diff --git a/welcome/package.json b/welcome/package.json index ef39838e..8669643e 100644 --- a/welcome/package.json +++ b/welcome/package.json @@ -3,7 +3,7 @@ "version": "0.1.0", "private": true, "dependencies": { - "@surfnet/sds": "^0.0.88", + "@surfnet/sds": "^0.0.93", "dompurify": "^3.0.3", "i18n-js": "^4.2.3", "isomorphic-dompurify": "^1.5.0", diff --git a/welcome/yarn.lock b/welcome/yarn.lock index cf00c197..f086d821 100644 --- a/welcome/yarn.lock +++ b/welcome/yarn.lock @@ -1860,10 +1860,10 @@ dependencies: "@sinonjs/commons" "^1.7.0" -"@surfnet/sds@^0.0.88": - version "0.0.88" - resolved "https://registry.yarnpkg.com/@surfnet/sds/-/sds-0.0.88.tgz#721962e3e3d24f8488f74a9d3280df55ca1eb719" - integrity sha512-fU4DYt2ncwGr0IsC8DB0MHHPhmv4PB5qTj0Z544jtccpKeUqdoU7sz3JwYuFeqzUM2jWL7TQvJSpunQwR0b8Qw== +"@surfnet/sds@^0.0.93": + version "0.0.93" + resolved "https://registry.yarnpkg.com/@surfnet/sds/-/sds-0.0.93.tgz#68f0a4a7aa80ce6888a1e87e38bee19fb6238b21" + integrity sha512-KG4BqFFxhgASnJ4YbzTthH1BEh5Bkqe7z5pFPoLHb6sVhXt+Vz7OxqMoTzMZKkB7Q83O78R/GyCABSe85kQxXA== "@surma/rollup-plugin-off-main-thread@^2.2.3": version "2.2.3"