Skip to content

Commit 0b2c1c2

Browse files
Fix/uat draft registration (#465)
* fix(draft): registries select component * fix(stepper): update stepper validation * fix(stepper): updated touched for metadata step * fix(withdrawn): hide make decision
1 parent 2d5698b commit 0b2c1c2

File tree

11 files changed

+35
-4
lines changed

11 files changed

+35
-4
lines changed

src/app/features/registries/services/registries.service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ export class RegistriesService {
158158
const params = {
159159
page,
160160
'page[size]': pageSize,
161+
'filter[parent]': null,
161162
embed: ['bibliographic_contributors', 'registration_schema', 'provider'],
162163
};
163164

src/app/features/registry/mappers/registry-overview.mapper.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,5 +75,6 @@ export function MapRegistryOverview(data: RegistryOverviewJsonApiData): Registry
7575
withdrawalJustification: data.attributes.withdrawal_justification,
7676
dateWithdrawn: data.attributes.date_withdrawn || null,
7777
embargoEndDate: data.attributes.embargo_end_date || null,
78+
rootParentId: data.relationships.root?.data?.id,
7879
} as RegistryOverview;
7980
}

src/app/features/registry/models/get-registry-overview-json-api.model.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,4 +160,10 @@ export interface RegistryOverviewJsonApiRelationships {
160160
};
161161
};
162162
};
163+
root: {
164+
data: {
165+
id: string;
166+
type: string;
167+
};
168+
};
163169
}

src/app/features/registry/models/registry-overview.models.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export interface RegistryOverview {
6969
withdrawn: boolean;
7070
withdrawalJustification?: string;
7171
dateWithdrawn: string | null;
72+
rootParentId: string | null;
7273
}
7374

7475
export interface RegistryOverviewWithMeta {

src/app/features/registry/pages/registry-overview/registry-overview.component.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
[showButton]="canMakeDecision()"
88
[buttonSeverity]="'success'"
99
[buttonLabel]="'moderation.makeDecision.header' | translate"
10+
[isButtonDisabled]="!isRootRegistration()"
1011
[isSubmitting]="areReviewActionsLoading()"
1112
(buttonClick)="handleOpenMakeDecisionDialog()"
1213
/>
@@ -69,7 +70,7 @@ <h4 class="mb-1">
6970
<div class="flex flex-column gap-4 md:flex-row resource">
7071
<osf-registry-statuses
7172
[registry]="registry()"
72-
[readonly]="hasNoPermissions() || hasReadAccess()"
73+
[readonly]="hasNoPermissions() || hasViewOnly()"
7374
[isModeration]="isModeration"
7475
></osf-registry-statuses>
7576

@@ -81,7 +82,7 @@ <h4 class="mb-1">
8182
(continueUpdate)="onContinueUpdateRegistration()"
8283
[isModeration]="isModeration"
8384
[isSubmitting]="isSchemaResponseLoading()"
84-
[readonly]="hasNoPermissions() || hasReadAccess()"
85+
[readonly]="hasNoPermissions() || hasViewOnly()"
8586
>
8687
</osf-registry-revisions>
8788
</div>

src/app/features/registry/pages/registry-overview/registry-overview.component.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ export class RegistryOverviewComponent {
9696

9797
readonly hasWriteAccess = select(RegistryOverviewSelectors.hasWriteAccess);
9898
readonly hasAdminAccess = select(RegistryOverviewSelectors.hasAdminAccess);
99-
readonly hasReadAccess = select(RegistryOverviewSelectors.hasReadAccess);
10099
readonly hasNoPermissions = select(RegistryOverviewSelectors.hasNoPermissions);
101100

102101
revisionInProgress: SchemaResponse | undefined;
@@ -114,6 +113,11 @@ export class RegistryOverviewComponent {
114113
return !this.registry()?.archiving && !this.registry()?.withdrawn && this.isModeration;
115114
});
116115

116+
isRootRegistration = computed(() => {
117+
const rootId = this.registry()?.rootParentId;
118+
return !rootId || rootId === this.registry()?.id;
119+
});
120+
117121
private registryId = toSignal(this.route.parent?.params.pipe(map((params) => params['id'])) ?? of(undefined));
118122

119123
readonly schemaResponse = computed(() => {

src/app/shared/components/registration-card/registration-card.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ <h2 class="align-self-center">
7777
routerLinkActive="router-link-active"
7878
[label]="'common.buttons.view' | translate"
7979
></p-button>
80-
@if (isAccepted || isPending || isEmbargo) {
80+
@if (showButtons) {
8181
@if (isApproved) {
8282
<p-button
8383
severity="secondary"

src/app/shared/components/registration-card/registration-card.component.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,15 @@ export class RegistrationCardComponent {
7575
return this.registrationData().reviewsState === RegistrationReviewStates.Embargo;
7676
}
7777

78+
get isRootRegistration(): boolean {
79+
const registration = this.registrationData();
80+
return !registration.rootParentId || registration.id === registration.rootParentId;
81+
}
82+
83+
get showButtons(): boolean {
84+
return this.isRootRegistration && (this.isAccepted || this.isPending || this.isEmbargo);
85+
}
86+
7887
updateRegistration(id: string): void {
7988
this.actions
8089
.createSchemaResponse(id)

src/app/shared/mappers/registration/registration.mapper.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ export class RegistrationMapper {
9797
id: contributor.embeds.users.data.id,
9898
fullName: contributor.embeds.users.data.attributes.full_name,
9999
})) || [],
100+
rootParentId: registration.relationships.root?.data?.id,
100101
};
101102
}
102103

src/app/shared/models/registration/registration-card.model.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ export interface RegistrationCard {
2121
hasMaterials?: boolean;
2222
hasPapers?: boolean;
2323
hasSupplements?: boolean;
24+
rootParentId?: string | null;
2425
}

0 commit comments

Comments
 (0)