diff --git a/src/app/features/analytics/components/view-duplicates/view-duplicates.component.html b/src/app/features/analytics/components/view-duplicates/view-duplicates.component.html index 42599a247..4f3926234 100644 --- a/src/app/features/analytics/components/view-duplicates/view-duplicates.component.html +++ b/src/app/features/analytics/components/view-duplicates/view-duplicates.component.html @@ -1,6 +1,6 @@ diff --git a/src/app/features/analytics/components/view-duplicates/view-duplicates.component.ts b/src/app/features/analytics/components/view-duplicates/view-duplicates.component.ts index 54c04300c..f6f789ba1 100644 --- a/src/app/features/analytics/components/view-duplicates/view-duplicates.component.ts +++ b/src/app/features/analytics/components/view-duplicates/view-duplicates.component.ts @@ -42,7 +42,7 @@ import { IS_SMALL } from '@osf/shared/helpers'; import { ToolbarResource } from '@osf/shared/models'; import { Duplicate } from '@osf/shared/models/duplicates'; import { CustomDialogService } from '@osf/shared/services'; -import { ClearDuplicates, DuplicatesSelectors, GetAllDuplicates } from '@osf/shared/stores'; +import { ClearDuplicates, CurrentResourceSelectors, DuplicatesSelectors, GetAllDuplicates } from '@osf/shared/stores'; @Component({ selector: 'osf-view-duplicates', @@ -76,6 +76,7 @@ export class ViewDuplicatesComponent { duplicates = select(DuplicatesSelectors.getDuplicates); isDuplicatesLoading = select(DuplicatesSelectors.getDuplicatesLoading); totalDuplicates = select(DuplicatesSelectors.getDuplicatesTotalCount); + hasNoPermissions = select(CurrentResourceSelectors.hasNoPermissions); readonly pageSize = 10; readonly UserPermissions = UserPermissions; diff --git a/src/app/features/metadata/metadata.component.html b/src/app/features/metadata/metadata.component.html index 55e98a3ee..9eba5487f 100644 --- a/src/app/features/metadata/metadata.component.html +++ b/src/app/features/metadata/metadata.component.html @@ -76,14 +76,14 @@ [resourceType]="resourceType()" /> - @if (showRegistrationDoi()) { + @if (isRegistrationType()) { } this.resourceType() === ResourceType.Registration); + isRegistrationType = computed(() => this.resourceType() === ResourceType.Registration); bibliographicContributors = computed(() => this.contributors().filter((contributor) => contributor.isBibliographic)); diff --git a/src/app/features/project/overview/components/overview-toolbar/overview-toolbar.component.html b/src/app/features/project/overview/components/overview-toolbar/overview-toolbar.component.html index 5c702e0fe..7c79576ec 100644 --- a/src/app/features/project/overview/components/overview-toolbar/overview-toolbar.component.html +++ b/src/app/features/project/overview/components/overview-toolbar/overview-toolbar.component.html @@ -37,87 +37,89 @@ } } -
-
- @if (resource.storage && !isCollectionsRoute()) { -

- {{ +resource.storage.storageUsage | fileSize }} -

- } - -
- @if (showViewOnlyLinks() && canEdit()) { - - {{ resource.viewOnlyLinksCount }} - - + @if (!hasNoPermissions()) { +
+
+ @if (resource.storage && !isCollectionsRoute()) { +

+ {{ +resource.storage.storageUsage | fileSize }} +

} - @if (resource.resourceType === ResourceType.Project && !hasViewOnly()) { - - {{ resource.forksCount }} - - - - - {{ item.label | translate }} - - - - - } +
+ @if (showViewOnlyLinks() && canEdit()) { + + {{ resource.viewOnlyLinksCount }} + + + } - @if (!hasViewOnly()) { - - @if (!isBookmarksLoading() && !isBookmarksSubmitting()) { - - } - - } + @if (resource.resourceType === ResourceType.Project && !hasViewOnly()) { + + {{ resource.forksCount }} + + + + + {{ item.label | translate }} + + + + + } - @if (resource.isPublic && !hasViewOnly()) { - - {{ socialsActionItems().length }} - - - - - - {{ item.label | translate }} - - - - - } + @if (!hasViewOnly()) { + + @if (!isBookmarksLoading() && !isBookmarksSubmitting()) { + + } + + } + + @if (resource.isPublic && !hasViewOnly()) { + + {{ socialsActionItems().length }} + + + + + + {{ item.label | translate }} + + + + + } +
-
+ }
} diff --git a/src/app/features/project/overview/components/overview-toolbar/overview-toolbar.component.ts b/src/app/features/project/overview/components/overview-toolbar/overview-toolbar.component.ts index f41b112c7..f39edf8e9 100644 --- a/src/app/features/project/overview/components/overview-toolbar/overview-toolbar.component.ts +++ b/src/app/features/project/overview/components/overview-toolbar/overview-toolbar.component.ts @@ -78,6 +78,7 @@ export class OverviewToolbarComponent { bookmarksCollectionId = select(BookmarksSelectors.getBookmarksCollectionId); bookmarkedProjects = select(MyResourcesSelectors.getBookmarks); duplicatedProject = select(ProjectOverviewSelectors.getDuplicatedProject); + hasNoPermissions = select(ProjectOverviewSelectors.hasNoPermissions); socialsActionItems = computed(() => { const shareableContent = this.createShareableContent(); return shareableContent ? this.buildSocialActionItems(shareableContent) : []; diff --git a/src/app/features/project/settings/components/settings-project-affiliation/settings-project-affiliation.component.html b/src/app/features/project/settings/components/settings-project-affiliation/settings-project-affiliation.component.html index f4107a9c1..086caf3e4 100644 --- a/src/app/features/project/settings/components/settings-project-affiliation/settings-project-affiliation.component.html +++ b/src/app/features/project/settings/components/settings-project-affiliation/settings-project-affiliation.component.html @@ -26,14 +26,16 @@

{{ 'myProjects.settings.projectAffiliation' | translate

{{ affiliation.name }}

- + @if (canEdit()) { + + } } diff --git a/src/app/features/project/settings/components/settings-project-affiliation/settings-project-affiliation.component.ts b/src/app/features/project/settings/components/settings-project-affiliation/settings-project-affiliation.component.ts index 693cadb10..ae02b0440 100644 --- a/src/app/features/project/settings/components/settings-project-affiliation/settings-project-affiliation.component.ts +++ b/src/app/features/project/settings/components/settings-project-affiliation/settings-project-affiliation.component.ts @@ -18,6 +18,7 @@ import { Institution } from '@osf/shared/models'; export class SettingsProjectAffiliationComponent { affiliations = input([]); removed = output(); + canEdit = input(false); removeAffiliation(affiliation: Institution) { this.removed.emit(affiliation); diff --git a/src/app/features/project/settings/settings.component.html b/src/app/features/project/settings/settings.component.html index 35665d69d..c460d6d31 100644 --- a/src/app/features/project/settings/settings.component.html +++ b/src/app/features/project/settings/settings.component.html @@ -5,7 +5,7 @@ } @else {
- @if (canWrite()) { + @if (hasWriteAccess()) { - @if (isAdmin()) { + @if (hasAdminAccess()) { diff --git a/src/app/features/project/settings/settings.component.ts b/src/app/features/project/settings/settings.component.ts index 66a8effd1..288f6f049 100644 --- a/src/app/features/project/settings/settings.component.ts +++ b/src/app/features/project/settings/settings.component.ts @@ -97,8 +97,8 @@ export class SettingsComponent implements OnInit { title = signal(''); userPermissions = computed(() => this.projectDetails()?.currentUserPermissions || []); - isAdmin = computed(() => this.userPermissions().includes(UserPermissions.Admin)); - canWrite = computed(() => this.userPermissions().includes(UserPermissions.Write)); + hasAdminAccess = computed(() => this.userPermissions().includes(UserPermissions.Admin)); + hasWriteAccess = computed(() => this.userPermissions().includes(UserPermissions.Write)); constructor() { this.setupEffects(); @@ -255,7 +255,7 @@ export class SettingsComponent implements OnInit { effect(() => { const id = this.projectId(); - if (id && this.isAdmin()) { + if (id && this.hasAdminAccess()) { this.actions.getViewOnlyLinks(id, ResourceType.Project); } }); diff --git a/src/app/features/registry/components/registration-links-card/registration-links-card.component.html b/src/app/features/registry/components/registration-links-card/registration-links-card.component.html index 6c0d081f4..926313ed1 100644 --- a/src/app/features/registry/components/registration-links-card/registration-links-card.component.html +++ b/src/app/features/registry/components/registration-links-card/registration-links-card.component.html @@ -40,7 +40,10 @@
{{ 'common.labels.contributors' | translate }}: - +
diff --git a/src/app/features/registry/mappers/registry-components.mapper.ts b/src/app/features/registry/mappers/registry-components.mapper.ts index af272a2fc..6d61f983d 100644 --- a/src/app/features/registry/mappers/registry-components.mapper.ts +++ b/src/app/features/registry/mappers/registry-components.mapper.ts @@ -15,11 +15,7 @@ export class RegistryComponentsMapper { registrationSupplement: apiComponent.attributes.registration_supplement, tags: apiComponent.attributes.tags, isPublic: apiComponent.attributes.public, - contributors: ContributorsMapper.getContributors(apiComponent.embeds.bibliographic_contributors.data) || [], + contributors: ContributorsMapper.getContributors(apiComponent.embeds?.bibliographic_contributors?.data || []), }; } - - static fromApiResponseArray(apiComponents: RegistryComponentJsonApi[]): RegistryComponentModel[] { - return apiComponents.map(this.fromApiResponse); - } } diff --git a/src/app/shared/stores/current-resource/current-resource.selectors.ts b/src/app/shared/stores/current-resource/current-resource.selectors.ts index 1bf13ad6f..ac8497c2b 100644 --- a/src/app/shared/stores/current-resource/current-resource.selectors.ts +++ b/src/app/shared/stores/current-resource/current-resource.selectors.ts @@ -24,17 +24,17 @@ export class CurrentResourceSelectors { @Selector([CurrentResourceState]) static hasWriteAccess(state: CurrentResourceStateModel): boolean { - return state.resourceDetails.data?.currentUserPermissions?.includes(UserPermissions.Write) || false; + return state.currentResource.data?.permissions?.includes(UserPermissions.Write) || false; } @Selector([CurrentResourceState]) static hasAdminAccess(state: CurrentResourceStateModel): boolean { - return state.resourceDetails.data?.currentUserPermissions?.includes(UserPermissions.Admin) || false; + return state.currentResource.data?.permissions?.includes(UserPermissions.Admin) || false; } @Selector([CurrentResourceState]) static hasNoPermissions(state: CurrentResourceStateModel): boolean { - return !state.resourceDetails.data?.currentUserPermissions?.length; + return !state.currentResource.data?.permissions?.length; } @Selector([CurrentResourceState])