Skip to content
Snippets Groups Projects
Commit 28f21975 authored by Ashish Shetty's avatar Ashish Shetty Committed by Petar Hristov
Browse files

New: Hint user organization affiliation

parent 83330a57
No related branches found
No related tags found
2 merge requests!201Release: Sprint Feb 10, 2023 - Sprint Feb 23, 2023,!193New: Hint user organization affiliation
......@@ -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>
......
......@@ -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;
......
......@@ -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",
......
......@@ -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",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment