diff --git a/src/components/coscine/CoscineFormGroup.vue b/src/components/coscine/CoscineFormGroup.vue index a36f622cf812d61c7e991d3f75e5cb2af8cb42ad..53b653fcb7b5462410c28fcf8fcadc809ecd480d 100644 --- a/src/components/coscine/CoscineFormGroup.vue +++ b/src/components/coscine/CoscineFormGroup.vue @@ -34,6 +34,11 @@ </b-popover> </div> </template> + + <!-- Hint Text --> + <div id="hint" class="small text-muted"> + <slot name="hint" /> + </div> </b-form-group> </template> diff --git a/src/modules/resource/components/create-resource/Configuration.vue b/src/modules/resource/components/create-resource/Configuration.vue index adc1f181c62f5ac35b7dba20f1b6f97b6333de02..ae33a8e5c9bc81554bd59266a035342deaa6f591 100644 --- a/src/modules/resource/components/create-resource/Configuration.vue +++ b/src/modules/resource/components/create-resource/Configuration.vue @@ -57,6 +57,30 @@ v-model="selectedResourceType.iDisplayName" disabled /> + + <!-- Hint --> + <template #hint> + <!-- Logged in with ORCID --> + <i18n + v-if="externalUser" + path="page.createResource.configuration.labels.hintTextORCiD" + tag="span" + > + <template #userProfile> + <b-link :to="{ name: 'userprofile' }"> + {{ $t("breadcrumbs.user.profile") }} + </b-link> + </template> + </i18n> + <!-- Logged in with SSO --> + <span v-else> + {{ + $t("page.createResource.configuration.labels.hintTextSSO", { + organizationName: organizations[0], + }) + }} + </span> + </template> </CoscineFormGroup> <!-- Resource Description --> @@ -128,6 +152,8 @@ import type { ResourceTypeObject, } from "@coscine/api-client/dist/types/Coscine.Api.Resources"; import type { LabeledResourceObject, ResourceTypeOption } from "../../types"; +import useUserStore from "@/modules/user/store"; +import type { OrganizationObject } from "@coscine/api-client/dist/types/Coscine.Api.Organization"; export default defineComponent({ components: { @@ -156,8 +182,9 @@ export default defineComponent({ const mainStore = useMainStore(); const projectStore = useProjectStore(); const resourceStore = useResourceStore(); + const userStore = useUserStore(); - return { mainStore, projectStore, resourceStore }; + return { mainStore, projectStore, resourceStore, userStore }; }, data() { @@ -171,6 +198,24 @@ export default defineComponent({ isOwner(): boolean | undefined { return this.projectStore.currentUserRoleIsOwner; }, + organizations(): string[] { + if (this.userMemberships) { + return this.userMemberships + .filter((organization) => !(organization.url?.indexOf("#") !== -1)) // If does contain "#" it's a sub level organization, otherwise top level + .map((org) => (org.displayName ? org.displayName : "")) // Extract organization display name, could contain empty strings + .filter((n) => n); // Filter out empty strings, if any; + } + return []; + }, + organizationsSet(): boolean { + return this.organizations && this.organizations.length > 0; + }, + externalUser(): boolean { + return !this.organizationsSet; + }, + userMemberships(): null | OrganizationObject[] { + return this.userStore.userProfile.userMemberships; + }, resourceTypes(): LabeledResourceObject[] | null { const labeledResourceTypes: LabeledResourceObject[] = []; const resourceTypes = this.resourceStore.enabledResourceTypes; diff --git a/src/modules/resource/i18n/de.ts b/src/modules/resource/i18n/de.ts index 51554379f918607336a471242f04b95239b79859..972be52aa501c0ca3ae98da09b001285b92f4a69 100644 --- a/src/modules/resource/i18n/de.ts +++ b/src/modules/resource/i18n/de.ts @@ -20,6 +20,10 @@ export default { "Für weitere Informationen zu Ressourcentypen siehe", resourceTypePopoverUrl: "https://docs.coscine.de/de/rdm/resources/about/", + hintTextSSO: + "Die von Ihnen erstellbaren Ressourcentypen werden durch Ihre Zugehörigkeit zu Organisation {organizationName} beeinflusst. Bedienen Sie das Dropdown-Menü, um die für Sie verfügbaren Optionen zu sehen.", + hintTextORCiD: + "Die von Ihnen erstellbaren Ressourcentypen werden durch Ihre Zugehörigkeit zu einer Organisation beeinflusst. Verknüpfen Sie Ihr Organisationskonto unter {userProfile}, um mehr Optionen zu sehen", }, popover: { title: "Quota nicht ausreichend", diff --git a/src/modules/resource/i18n/en.ts b/src/modules/resource/i18n/en.ts index 6e92be96f7efee604f2c9f6451c7193d03a96096..9191a70fd75f453626f9fbb97f0a212e9310bdfd 100644 --- a/src/modules/resource/i18n/en.ts +++ b/src/modules/resource/i18n/en.ts @@ -20,6 +20,10 @@ export default { resourceTypePopover: "For more information on resource types see", resourceTypePopoverUrl: "https://docs.coscine.de/en/rdm/resources/about/", + hintTextSSO: + "The resource types you can create are impacted by your affiliation with {organizationName}. Check the dropdown menu to see the options available to you.", + hintTextORCiD: + "The resource types you can create are impacted by your affiliation. Merge your organization account under {userProfile} to make more options available to you", }, popover: { title: "Quota not sufficient",