Skip to content

Commit

Permalink
#10053: Add support for PCI Endorsement workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
amgciadev committed Dec 9, 2024
1 parent 3ca56c3 commit f2d6f77
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,22 @@ <h1 class="flex-grow-1">{{ isNewService ? ('ldn-create-service.title' | translat
</div>
</div>

<!-- In the usesActorEmailId section -->
<div class="mb-5 mt-5">
<label class="status-label font-weight-bold" for="usesActorEmailId">{{ 'ldn-service-usesActorEmailId' | translate }}</label>
<div>
<input formControlName="usesActorEmailId" hidden id="usesActorEmailId"
name="usesActorEmailId" type="checkbox">
<div (click)="toggleUsesActorEmailId()"
[class.checked]="formModel.get('usesActorEmailId').value" class="toggle-switch">
<div class="slider"></div>
</div>
<div class="text-muted">
{{ 'ldn-service-usesActorEmailId-description' | translate }}
</div>
</div>
</div>


<!-- In the Inbound Patterns Labels section -->
<div class="row mb-1 mt-5" *ngIf="areControlsInitialized">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ export class LdnServiceFormComponent implements OnInit, OnDestroy {
score: ['', [Validators.required, Validators.pattern('^0*(\.[0-9]+)?$|^1(\.0+)?$')]], inboundPattern: [''],
constraintPattern: [''],
enabled: [''],
usesActorEmailId: [''],
type: LDN_SERVICE.value,
});
}
Expand Down Expand Up @@ -184,7 +185,8 @@ export class LdnServiceFormComponent implements OnInit, OnDestroy {
return rest;
});

const values = { ...this.formModel.value, enabled: true };
const values = { ...this.formModel.value, enabled: true,
usesActorEmailId: this.formModel.get('usesActorEmailId').value };

const ldnServiceData = this.ldnServicesService.create(values);

Expand Down Expand Up @@ -243,6 +245,7 @@ export class LdnServiceFormComponent implements OnInit, OnDestroy {
ldnUrl: this.ldnService.ldnUrl,
type: this.ldnService.type,
enabled: this.ldnService.enabled,
usesActorEmailId: this.ldnService.usesActorEmailId,
lowerIp: this.ldnService.lowerIp,
upperIp: this.ldnService.upperIp,
});
Expand Down Expand Up @@ -390,6 +393,32 @@ export class LdnServiceFormComponent implements OnInit, OnDestroy {
);
}

/**
* Toggles the usesActorEmailId field of the LDN service by sending a patch request
*/
toggleUsesActorEmailId() {
const newStatus = !this.formModel.get('usesActorEmailId').value;

Check warning on line 400 in src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.ts

View check run for this annotation

Codecov / codecov/patch

src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.ts#L400

Added line #L400 was not covered by tests
if (!this.isNewService) {
const patchOperation: Operation = {

Check warning on line 402 in src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.ts

View check run for this annotation

Codecov / codecov/patch

src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.ts#L402

Added line #L402 was not covered by tests
op: 'replace',
path: '/usesActorEmailId',
value: newStatus,
};

this.ldnServicesService.patch(this.ldnService, [patchOperation]).pipe(

Check warning on line 408 in src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.ts

View check run for this annotation

Codecov / codecov/patch

src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.ts#L408

Added line #L408 was not covered by tests
getFirstCompletedRemoteData(),
).subscribe(
() => {
this.formModel.get('usesActorEmailId').setValue(newStatus);
this.cdRef.detectChanges();

Check warning on line 413 in src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.ts

View check run for this annotation

Codecov / codecov/patch

src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.ts#L412-L413

Added lines #L412 - L413 were not covered by tests
},
);
} else {
this.formModel.get('usesActorEmailId').setValue(newStatus);
this.cdRef.detectChanges();

Check warning on line 418 in src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.ts

View check run for this annotation

Codecov / codecov/patch

src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.ts#L417-L418

Added lines #L417 - L418 were not covered by tests
}
}

/**
* Closes the modal
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { LdnService } from '../ldn-services-model/ldn-services.model';
export const mockLdnService: LdnService = {
uuid: '1',
enabled: false,
usesActorEmailId: false,
score: 0,
id: 1,
lowerIp: '192.0.2.146',
Expand Down Expand Up @@ -49,6 +50,7 @@ export const mockLdnServiceRD$ = createSuccessfulRemoteDataObject$(mockLdnServic
export const mockLdnServices: LdnService[] = [{
uuid: '1',
enabled: false,
usesActorEmailId: false,
score: 0,
id: 1,
lowerIp: '192.0.2.146',
Expand Down Expand Up @@ -81,6 +83,7 @@ export const mockLdnServices: LdnService[] = [{
}, {
uuid: '2',
enabled: false,
usesActorEmailId: false,
score: 0,
id: 2,
lowerIp: '192.0.2.146',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ export class LdnService extends CacheableObject {
@autoserialize
enabled: boolean;

@autoserialize
usesActorEmailId: boolean;

@autoserialize
ldnUrl: string;

Expand Down
3 changes: 2 additions & 1 deletion src/app/core/data/signposting-links.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
export interface SignpostingLink {
href?: string,
rel?: string,
type?: string
type?: string,
profile?: string
}
8 changes: 7 additions & 1 deletion src/app/item-page/simple/item-page.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ export class ItemPageComponent implements OnInit, OnDestroy {
this.signpostingLinks = signpostingLinks;

signpostingLinks.forEach((link: SignpostingLink) => {
links = links + (isNotEmpty(links) ? ', ' : '') + `<${link.href}> ; rel="${link.rel}"` + (isNotEmpty(link.type) ? ` ; type="${link.type}" ` : ' ');
links = links + (isNotEmpty(links) ? ', ' : '') + `<${link.href}> ; rel="${link.rel}"` + (isNotEmpty(link.type) ? ` ; type="${link.type}" ` : ' ')
+ (isNotEmpty(link.profile) ? ` ; profile="${link.profile}" ` : '');
let tag: LinkDefinition = {
href: link.href,
rel: link.rel,
Expand All @@ -178,6 +179,11 @@ export class ItemPageComponent implements OnInit, OnDestroy {
type: link.type,
});
}
if (isNotEmpty(link.profile)) {
tag = Object.assign(tag, {

Check warning on line 183 in src/app/item-page/simple/item-page.component.ts

View check run for this annotation

Codecov / codecov/patch

src/app/item-page/simple/item-page.component.ts#L183

Added line #L183 was not covered by tests
profile: link.profile,
});
}
this.linkHeadService.addTag(tag);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ export enum RequestStatusEnum {
ACCEPTED = 'ACCEPTED',
REJECTED = 'REJECTED',
REQUESTED = 'REQUESTED',
TENTATIVE_REJECT = 'TENTATIVE_REJECT',
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ export class RequestStatusAlertBoxComponent implements OnInit {
};
break;

case RequestStatusEnum.TENTATIVE_REJECT:
this.displayOptions = {

Check warning on line 78 in src/app/item-page/simple/notify-requests-status/request-status-alert-box/request-status-alert-box.component.ts

View check run for this annotation

Codecov / codecov/patch

src/app/item-page/simple/notify-requests-status/request-status-alert-box/request-status-alert-box.component.ts#L78

Added line #L78 was not covered by tests
alertType: 'alert-warning',
text: 'request-status-alert-box.tentative_rejected',
};
break;

Check warning on line 82 in src/app/item-page/simple/notify-requests-status/request-status-alert-box/request-status-alert-box.component.ts

View check run for this annotation

Codecov / codecov/patch

src/app/item-page/simple/notify-requests-status/request-status-alert-box/request-status-alert-box.component.ts#L82

Added line #L82 was not covered by tests

case RequestStatusEnum.REQUESTED:
this.displayOptions = {
alertType: 'alert-warning',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
<div *ngIf="(filterServices(ldnPattern.pattern ) | async)?.length > 0">
<label class="row col-form-label">
{{'submission.section.section-coar-notify.control.' + ldnPattern.pattern + '.label' | translate }}
</label
>
</label>
<div *ngIf="ldnServiceByPattern[ldnPattern.pattern]?.services.length">
<div
*ngFor="
Expand Down
8 changes: 6 additions & 2 deletions src/assets/i18n/en.json5
Original file line number Diff line number Diff line change
Expand Up @@ -5630,8 +5630,6 @@

"supervision.search.results.head": "Workflow and Workspace tasks",

"orgunit.search.results.head": "Organizational Unit Search Results",

"workflow-item.edit.breadcrumbs": "Edit workflowitem",

"workflow-item.edit.title": "Edit workflowitem",
Expand Down Expand Up @@ -6348,6 +6346,8 @@

"request-status-alert-box.rejected": "The requested {{ offerType }} for <a href='{{serviceUrl}}' target='_blank'> {{ serviceName }} </a> has been rejected.",

"request-status-alert-box.tentative_rejected": "The requested {{ offerType }} for <a href='{{serviceUrl}}' target='_blank'> {{ serviceName }} </a> has been tentatively rejected. Revisions are required",

"request-status-alert-box.requested": "The requested {{ offerType }} for <a href='{{serviceUrl}}' target='_blank'> {{ serviceName }} </a> is pending.",

"ldn-service-button-mark-inbound-deletion": "Mark supported pattern for deletion",
Expand All @@ -6364,6 +6364,10 @@

"ldn-service-overview-close-modal": "Close modal",

"ldn-service-usesActorEmailId": "Requires actor email in notifications",

"ldn-service-usesActorEmailId-description": "If enabled, initial notifications sent will include the submitter email rather than the repository URL. This is usually the case for endorsement or review services.",

"a-common-or_statement.label": "Item type is Journal Article or Dataset",

"always_true_filter.label": "Always true",
Expand Down

0 comments on commit f2d6f77

Please sign in to comment.