CST-12174 Updated delete services to mark for deletion

This commit is contained in:
Mattia Vianelli
2023-10-24 12:56:31 +02:00
parent 2eb71604ee
commit 5cca15daec
10 changed files with 203 additions and 185 deletions

View File

@@ -1,5 +1,8 @@
<div class="container">
<form (ngSubmit)="onSubmit()" [formGroup]="formModel">
<div class="d-flex">
<h2 class="flex-grow-1">{{ 'ldn-edit-registered-service.title' | translate }}</h2>
</div>
<!-- In the toggle section -->
<div class="toggle-switch-container">
<label class="status-label" for="enabled">{{ 'ldn-service-status' | translate }}</label>
@@ -81,7 +84,9 @@
<ng-container [formGroupName]="i">
<div class="row">
<div [class.marked-for-deletion]="markedForDeletion.includes(i)" class="row mb-1">
<div class="col">
<select #inboundPattern formControlName="pattern" id="additionalInboundPattern{{i}}"
name="additionalInboundPattern{{i}}" required>
@@ -111,12 +116,16 @@
</div>
<div class="col-sm-1">
<button type="button" (click)="removeInboundPattern(i)" class="btn btn-outline-dark trash-button ml-2">
<div class="col-sm-1 btn-group">
<button type="button" (click)="markForDeletion(i)" class="btn btn-outline-dark trash-button">
<i class="fas fa-trash"></i>
</button>
<button *ngIf="markedForDeletion.includes(i)" type="button" (click)="unmarkForDeletion(i)" class="btn btn-outline-dark undo-button">
<i class="fas fa-undo"></i>
</button>
</div>
</div>
</ng-container>
</div>
@@ -148,7 +157,7 @@
<ng-container [formGroupName]="i">
<!-- Input elements in a separate row -->
<div class="row">
<div class="row mb-1">
<div class="col">
<select #outboundPattern formControlName="pattern" id="additionalOutboundPattern{{i}}"
name="additionalOutboundPattern{{i}}"
@@ -177,7 +186,7 @@
</div>
<div class="col-sm-1">
<button type="button" (click)="removeOutboundPattern(i)" class="btn btn-outline-dark trash-button ml-2">
<button type="button" (click)="removeOutboundPattern(i)" class="btn btn-outline-dark trash-button">
<i class="fas fa-trash"></i>
</button>
</div>
@@ -193,22 +202,25 @@
<div class="mb-5">
&nbsp;
</div>
<button class="btn btn-primary" type="submit">{{ 'ldn-new-service.form.label.submit' | translate }}</button>
<div class="">
<button type="button" class="btn btn-danger" (click)="this.openResetFormModal(this.resetFormModal)">
<i class="fas fa-trash"></i> {{ 'submission.general.discard.submit' | translate }}
<div class="submission-form-footer mt-1 mb-1 position-sticky" role="group" aria-label="Basic example">
<button class="btn btn-primary" type="submit">
<span><i class="fas fa-save"></i> {{ 'ldn-new-service.form.label.submit' | translate }}</span>
</button>
<div class="d-flex">
<button type="button" class="btn btn-danger" (click)="this.openResetFormModal(this.resetFormModal)">
<span><i class="fas fa-trash"></i> {{ 'submission.general.discard.submit' | translate }}</span>
</button>
</div>
</div>
</form>
</div>
<ng-template #confirmModal>
<div>
<div class="modal-header">
<div>
<h4>{{'service.overview.create.modal' | translate }}</h4>
<h4>{{'service.overview.edit.modal' | translate }}</h4>
</div>
<button (click)="closeModal()" aria-label="Close"
class="close" type="button">
@@ -218,14 +230,15 @@
<div class="modal-body">
<div>
{{ 'service.overview.delete.body' | translate }}
{{ 'service.overview.edit.body' | translate }}
</div>
<div class="mt-4">
<button (click)="this.patchService()"
class="btn btn-primary mr-2 custom-btn">{{ 'service.detail.update' | translate }}</button>
<button (click)="closeModal()" class="btn btn-danger"
<button (click)="closeModal()" class="btn btn-danger mr-2"
id="delete-confirm">{{ 'service.detail.return' | translate }}
</button>
<button (click)="this.patchService()"
class="btn btn-primary custom-btn">{{ 'service.detail.update' | translate }}
</button>
</div>
</div>
</div>
@@ -251,11 +264,12 @@
</div>
<div class="mt-4">
<button (click)="resetFormAndLeave()"
class="btn btn-primary mr-2 custom-btn" id="reset-confirm">{{ 'service.overview.reset-form.reset-confirm' | translate }}</button>
class="btn btn-primary mr-2 custom-btn" id="reset-confirm">{{ 'service.overview.reset-form.reset-return' | translate }}</button>
<button (click)="closeModal()" class="btn btn-danger"
id="reset-delete">{{ 'service.overview.reset-form.reset-return' | translate }}
id="reset-delete">{{ 'service.overview.reset-form.reset-confirm' | translate }}
</button>
</div>
</div>
</div>
</ng-template>

View File

@@ -1,7 +1,6 @@
form {
max-width: 800px;
font-size: 14px;
margin-left: 100px;
position: relative;
}
@@ -98,6 +97,8 @@ textarea {
.toggle-switch {
cursor: pointer;
margin-top: 3px;
margin-right: 3px
}
.label-box{
@@ -114,13 +115,21 @@ textarea {
form button.btn.btn-primary[type="submit"] {
position: absolute;
bottom: 0px;
right: -10px;
right: 8px;
}
.submission-form-footer {
border-radius: var(--bs-card-border-radius);
bottom: 0;
background-color: var(--bs-gray-400);
padding: calc(var(--bs-spacer) / 2);
z-index: var(--ds-submission-footer-z-index);
}
.marked-for-deletion {
background-color: #ffcccc;
}

View File

@@ -58,9 +58,13 @@ export class LdnServiceFormEditComponent implements OnInit {
@Input() public headerKey: string;
private originalInboundPatterns: any[] = [];
private originalOutboundPatterns: any[] = [];
private deletedInboundPatterns: number[] = [];
private deletedOutboundPatterns: number[] = [];
private modalRef: any;
private service: LdnService;
protected serviceId: string;
markedForDeletion: number[] = [];
constructor(
protected ldnServicesService: LdnServicesService,
@@ -104,13 +108,7 @@ export class LdnServiceFormEditComponent implements OnInit {
setItemfilters() {
this.itemfiltersRD$ = this.ldnItemfiltersService.findAll().pipe(
getFirstCompletedRemoteData());
console.log(this.itemfiltersRD$);
this.itemfiltersRD$.subscribe((rd: RemoteData<PaginatedList<Itemfilter>>) => {
if (rd.hasSucceeded) {
console.log(rd);
}
});
}
}
@@ -155,13 +153,8 @@ export class LdnServiceFormEditComponent implements OnInit {
});
this.originalInboundPatterns = [...this.service.notifyServiceInboundPatterns];
this.originalOutboundPatterns = [...this.service.notifyServiceOutboundPatterns];
} else {
console.error('Error fetching service data:', data.errorMessage);
}
},
(error) => {
console.error('Error fetching service data:', error);
}
);
}
@@ -174,9 +167,24 @@ export class LdnServiceFormEditComponent implements OnInit {
this.createReplaceOperation(patchOperations, 'url', '/url');
this.handlePatterns(patchOperations, 'notifyServiceInboundPatterns');
this.handlePatterns(patchOperations, 'notifyServiceOutboundPatterns');
this.deletedInboundPatterns.forEach(index => {
const removeOperation: Operation = {
op: 'remove',
path: `notifyServiceInboundPatterns[${index}]`
};
patchOperations.push(removeOperation);
});
this.deletedOutboundPatterns.forEach(index => {
const removeOperation: Operation = {
op: 'remove',
path: `notifyServiceOutboundPatterns[${index}]`
};
patchOperations.push(removeOperation);
});
return patchOperations;
}
@@ -189,43 +197,6 @@ export class LdnServiceFormEditComponent implements OnInit {
notifyServiceInboundPatternsArray.push(this.createInboundPatternFormGroup());
}
removeInboundPattern(index: number): void {
const patternsArray = this.formModel.get('notifyServiceInboundPatterns') as FormArray;
const patternGroup = patternsArray.at(index) as FormGroup;
const patternValue = patternGroup.value;
if (index < 0 || index >= patternsArray.length || patternValue.isNew) {
patternsArray.removeAt(index);
return;
}
const patchOperation: Operation = {
op: 'remove',
path: `notifyServiceInboundPatterns[${index}]`
};
this.ldnServicesService.patch(this.service, [patchOperation]).pipe(
getFirstCompletedRemoteData()
).subscribe(
(data: RemoteData<LdnService>) => {
if (data.hasSucceeded) {
this.notificationService.success(this.translateService.get('ldn-service.notification.remove-inbound-pattern.success.title'),
this.translateService.get('ldn-service.notification.remove-inbound-pattern.success.content'));
} else {
this.notificationService.error(this.translateService.get('ldn-service.notification.remove-inbound-pattern.error.title'),
this.translateService.get('ldn-service.notification.remove-inbound-pattern.error.content'));
}
patternsArray.removeAt(index);
this.cdRef.detectChanges();
},
(error) => {
console.error('Error removing pattern:', error);
}
);
}
addOutboundPattern() {
const notifyServiceOutboundPatternsArray = this.formModel.get('notifyServiceOutboundPatterns') as FormArray;
notifyServiceOutboundPatternsArray.push(this.createOutboundPatternFormGroup());
@@ -241,29 +212,11 @@ export class LdnServiceFormEditComponent implements OnInit {
return;
}
const patchOperation: Operation = {
op: 'remove',
path: `notifyServiceOutboundPatterns[${index}]`
};
this.ldnServicesService.patch(this.service, [patchOperation]).pipe(
getFirstCompletedRemoteData()
).subscribe(
(data: RemoteData<LdnService>) => {
if (data.hasSucceeded) {
this.notificationService.success(this.translateService.get('ldn-service.notification.remove-outbound-pattern.success.title'),
this.translateService.get('ldn-service.notification.remove-outbound-pattern.success.content'));
} else {
this.notificationService.error(this.translateService.get('ldn-service.notification.remove-outbound-pattern.error.title'),
this.translateService.get('ldn-service.notification.remove-outbound-pattern.error.content'));
}
patternsArray.removeAt(index);
this.cdRef.detectChanges();
},
(error) => {
console.error('Error removing pattern:', error);
}
);
this.deletedOutboundPatterns.push(index);
patternsArray.removeAt(index);
this.cdRef.detectChanges();
}
@@ -276,7 +229,6 @@ export class LdnServiceFormEditComponent implements OnInit {
toggleEnabled() {
const newStatus = !this.formModel.get('enabled').value;
const serviceId = this.formModel.get('id').value;
const patchOperation: Operation = {
op: 'replace',
@@ -288,12 +240,9 @@ export class LdnServiceFormEditComponent implements OnInit {
getFirstCompletedRemoteData()
).subscribe(
() => {
console.log('Status updated successfully.');
this.formModel.get('enabled').setValue(newStatus);
this.cdRef.detectChanges();
},
(error) => {
console.error('Error updating status:', error);
}
);
}
@@ -313,8 +262,10 @@ export class LdnServiceFormEditComponent implements OnInit {
}
patchService() {
this.deleteMarkedPatterns();
const patchOperations = this.generatePatchOperations();
this.ldnServicesService.patch(this.service, patchOperations).pipe(
getFirstCompletedRemoteData()
).subscribe(
@@ -328,9 +279,9 @@ export class LdnServiceFormEditComponent implements OnInit {
(error) => {
this.notificationService.error(this.translateService.get('admin.registries.services-formats.modify.failure.head'),
this.translateService.get('admin.registries.services-formats.modify.failure.content'));
console.error('Error updating service:', error);
}
);
}
private createReplaceOperation(patchOperations: any[], formControlName: string, path: string): void {
@@ -411,4 +362,30 @@ export class LdnServiceFormEditComponent implements OnInit {
automatic: '',
});
}
markForDeletion(index: number) {
if (!this.markedForDeletion.includes(index)) {
this.markedForDeletion.push(index);
}
}
unmarkForDeletion(index: number) {
const i = this.markedForDeletion.indexOf(index);
if (i !== -1) {
this.markedForDeletion.splice(i, 1);
}
}
deleteMarkedPatterns() {
this.markedForDeletion.sort((a, b) => b - a);
const patternsArray = this.formModel.get('notifyServiceInboundPatterns') as FormArray;
for (const index of this.markedForDeletion) {
if (index >= 0 && index < patternsArray.length) {
this.deletedInboundPatterns.push(index);
patternsArray.removeAt(index);
}
}
this.markedForDeletion = [];
}
}

View File

@@ -1,5 +1,8 @@
<div class="container">
<form (ngSubmit)="onSubmit()" [formGroup]="formModel">
<div class="d-flex">
<h2 class="flex-grow-1">{{ 'ldn-create-service.title' | translate }}</h2>
</div>
<!-- In the name section -->
<div class="mb-2">
<label for="name">{{ 'ldn-new-service.form.label.name' | translate }}</label>
@@ -71,7 +74,7 @@
<ng-container [formGroupName]="i">
<div class="row">
<div class="row mb-1">
<div class="col">
<select #inboundPattern formControlName="pattern" id="additionalInboundPattern{{i}}"
name="additionalInboundPattern{{i}}" required>
@@ -102,7 +105,7 @@
</div>
<div class="col-sm-1">
<button (click)="removeInboundPattern(i)" class="btn btn-outline-dark trash-button ml-2">
<button (click)="removeInboundPattern(i)" class="btn btn-outline-dark trash-button">
<i class="fas fa-trash"></i>
</button>
</div>
@@ -138,7 +141,7 @@
<ng-container [formGroupName]="i">
<!-- Input elements in a separate row -->
<div class="row">
<div class="row mb-1">
<div class="col">
<select #outboundPattern formControlName="pattern" id="additionalOutboundPattern{{i}}"
name="additionalOutboundPattern{{i}}"
@@ -167,7 +170,7 @@
</div>
<div class="col-sm-1">
<button (click)="removeOutboundPattern(i)" class="btn btn-outline-dark trash-button ml-2">
<button (click)="removeOutboundPattern(i)" class="btn btn-outline-dark trash-button">
<i class="fas fa-trash"></i>
</button>
</div>
@@ -177,26 +180,33 @@
</div>
<span (click)="addOutboundPattern()"
class="add-pattern-link mb-2">{{ 'ldn-new-service.form.label.addPattern' | translate }}
class="add-pattern-link">{{ 'ldn-new-service.form.label.addPattern' | translate }}
</span>
<div class="mb-2">
<div class="mb-4">
&nbsp;
</div>
<button class="btn btn-primary" type="submit">{{ 'ldn-new-service.form.label.submit' | translate }}</button>
<div class="">
<button type="button" class="btn btn-danger" (click)="this.openResetFormModal(this.resetFormModal)">
<i class="fas fa-trash"></i> {{ 'submission.general.discard.submit' | translate }}
</button>
</div>
</form>
<div class="submission-form-footer mt-1 mb-1 position-sticky" role="group" aria-label="Basic example">
<button class="btn btn-primary" type="submit">
<span><i class="fas fa-save"></i> {{ 'ldn-new-service.form.label.submit' | translate }}</span>
</button>
<div class="d-flex">
<button type="button" class="btn btn-danger" (click)="this.openResetFormModal(this.resetFormModal)">
<span><i class="fas fa-trash"></i> {{ 'submission.general.discard.submit' | translate }}</span>
</button>
</div>
</div>
</form>
</div>
<ng-template #confirmModal>
<div>
<div class="modal-header">
<div>
<h4>{{'service.create..modal' | translate }}</h4>
<h4>{{'service.overview.create.modal' | translate }}</h4>
</div>
<button (click)="closeModal()" aria-label="Close"
class="close" type="button">
@@ -209,11 +219,12 @@
{{ 'service.create.body' | translate }}
</div>
<div class="mt-4">
<button (click)="createService()"
class="btn btn-primary mr-2 custom-btn">{{ 'service.confirm.create' | translate }}</button>
<button (click)="closeModal()" class="btn btn-danger"
id="delete-confirm">{{ 'service.refuse.create' | translate }}
</button>
<button (click)="createService()"
class="btn btn-primary mr-2 custom-btn">{{ 'service.confirm.create' | translate }}
</button>
</div>
</div>
</div>
@@ -239,9 +250,10 @@
</div>
<div class="mt-4">
<button (click)="resetFormAndLeave()"
class="btn btn-primary mr-2 custom-btn" id="reset-confirm">{{ 'service.overview.reset-form.reset-confirm' | translate }}</button>
class="btn btn-primary mr-2 custom-btn" id="reset-confirm">{{ 'service.overview.reset-form.reset-return' | translate }}
</button>
<button (click)="closeModal()" class="btn btn-danger"
id="reset-delete">{{ 'service.overview.reset-form.reset-return' | translate }}
id="reset-delete">{{ 'service.overview.reset-form.reset-confirm' | translate }}
</button>
</div>
</div>

View File

@@ -1,7 +1,6 @@
form {
max-width: 800px;
font-size: 14px;
margin-left: 100px;
position: relative;
}
@@ -118,7 +117,13 @@ form button.btn.btn-primary[type="submit"] {
right: -10px;
}
.submission-form-footer {
border-radius: var(--bs-card-border-radius);
bottom: 0;
background-color: var(--bs-gray-400);
padding: calc(var(--bs-spacer) / 2);
z-index: var(--ds-submission-footer-z-index);
}

View File

@@ -13,7 +13,6 @@ import { Router } from '@angular/router';
import { LdnServicesService } from '../ldn-services-data/ldn-services-data.service';
import { notifyPatterns } from '../ldn-services-patterns/ldn-service-coar-patterns';
import { LdnDirectoryService } from '../ldn-services-services/ldn-directory.service';
import { LDN_SERVICE } from '../ldn-services-model/ldn-service.resource-type';
import { animate, state, style, transition, trigger } from '@angular/animations';
import { getFirstCompletedRemoteData } from '../../../core/shared/operators';
@@ -27,7 +26,7 @@ import { Observable } from 'rxjs';
import { FindListOptions } from '../../../core/data/find-list-options.model';
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
import { LdnItemfiltersService } from '../ldn-services-data/ldn-itemfilters-data.service';
import { NgbModal } from "@ng-bootstrap/ng-bootstrap";
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
@Component({
@@ -110,43 +109,11 @@ export class LdnServiceFormComponent implements OnInit {
setItemfilters() {
this.itemfiltersRD$ = this.ldnItemfiltersService.findAll().pipe(
getFirstCompletedRemoteData());
console.log(this.itemfiltersRD$);
this.itemfiltersRD$.subscribe((rd: RemoteData<PaginatedList<Itemfilter>>) => {
if (rd.hasSucceeded) {
console.log(rd);
}
});
}
/*createLdnService(values: any) {
this.formModel.get('name').markAsTouched();
this.formModel.get('url').markAsTouched();
this.formModel.get('ldnUrl').markAsTouched();
const ldnServiceData = this.ldnServicesService.create(this.formModel.value);
ldnServiceData.subscribe((ldnNewService) => {
console.log(ldnNewService);
const name = ldnNewService.payload.name;
const url = ldnNewService.payload.url;
const ldnUrl = ldnNewService.payload.ldnUrl;
if (!name || !url || !ldnUrl) {
return;
}
ldnServiceData.pipe(
getFirstCompletedRemoteData()
).subscribe((rd: RemoteData<LdnService>) => {
if (rd.hasSucceeded) {
this.notificationsService.success(this.translateService.get('notification.created.success'));
this.onSubmit.emit(values);
} else {
this.notificationsService.error(this.translateService.get('notification.created.failure', ));
this.cancelForm.emit();
}
});
});
}*/
onSubmit() {
this.openConfirmModal(this.confirmModal);
@@ -159,7 +126,7 @@ export class LdnServiceFormComponent implements OnInit {
openResetFormModal(content) {
this.modalRef = this.modalService.open(content);
}
createService(){
createService() {
this.formModel.get('name').markAsTouched();
this.formModel.get('url').markAsTouched();
this.formModel.get('ldnUrl').markAsTouched();
@@ -175,21 +142,34 @@ export class LdnServiceFormComponent implements OnInit {
const values = this.formModel.value;
const inboundPatternValue = this.formModel.get('inboundPattern').value;
const outboundPatternValue = this.formModel.get('outboundPattern').value;
if (inboundPatternValue === '') {
values.notifyServiceInboundPatterns = [];
}
if (outboundPatternValue === '') {
values.notifyServiceOutboundPatterns = [];
}
const ldnServiceData = this.ldnServicesService.create(values);
ldnServiceData.pipe(
getFirstCompletedRemoteData()
).subscribe((rd: RemoteData<LdnService>) => {
if (rd.hasSucceeded) {
this.notificationsService.success(this.translateService.get('notification.created.success'));
this.notificationsService.success(this.translateService.get('ldn-service-notification.created.success.title'));
(this.translateService.get('ldn-service-notification.created.success.title'),
this.translateService.get('ldn-service-notification.created.success.body'));
this.sendBack();
this.closeModal();
} else {
this.notificationsService.error(this.translateService.get('notification.created.failure'));
}
});
}
resetFormAndLeave() {
this.sendBack();
this.closeModal();

View File

@@ -34,6 +34,7 @@
</span>
</td>
<td>
<div class="btn-group">
<button (click)="selectServiceToDelete(ldnService.id)" class="btn btn-outline-danger">
<i class="fas fa-trash"></i>
</button>
@@ -41,6 +42,7 @@
class="btn btn-outline-dark">
<i class="fas fa-edit"></i>
</button>
</div>
</td>
</tr>
</tbody>

View File

@@ -11,10 +11,10 @@ import { PaginationService } from 'src/app/core/pagination/pagination.service';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { hasValue } from '../../../shared/empty.util';
import { Operation } from 'fast-json-patch';
import { getAllCompletedRemoteData, getFirstCompletedRemoteData } from '../../../core/shared/operators';
import { getFirstCompletedRemoteData } from '../../../core/shared/operators';
import { NotificationsService } from '../../../shared/notifications/notifications.service';
import { TranslateService } from '@ngx-translate/core';
import { Router } from '@angular/router';
@Component({
selector: 'ds-ldn-services-directory',
@@ -38,6 +38,7 @@ export class LdnServicesOverviewComponent implements OnInit, OnDestroy {
isProcessingSub: Subscription;
private modalRef: any;
constructor(
protected ldnServicesService: LdnServicesService,
protected paginationService: PaginationService,
@@ -45,7 +46,6 @@ export class LdnServicesOverviewComponent implements OnInit, OnDestroy {
private cdRef: ChangeDetectorRef,
private notificationService: NotificationsService,
private translateService: TranslateService,
private router: Router,
) {
}
@@ -57,18 +57,8 @@ export class LdnServicesOverviewComponent implements OnInit, OnDestroy {
this.ldnServicesRD$ = this.paginationService.getFindListOptions(this.pageConfig.id, this.config).pipe(
switchMap((config) => this.ldnServicesService.findAll(config, false, false).pipe(
getFirstCompletedRemoteData()
))
);
this.ldnServicesRD$.subscribe((rd: RemoteData<PaginatedList<LdnService>>) => {
console.log(rd);
if (rd.hasSucceeded) {
this.notificationService.success(this.translateService.get('notification.loaded.success'));
} else {
this.notificationService.error(this.translateService.get('notification.loaded.failure'));
}
});
}
ngOnDestroy(): void {
@@ -107,9 +97,11 @@ export class LdnServicesOverviewComponent implements OnInit, OnDestroy {
);
this.cdRef.detectChanges();
this.closeModal();
this.notificationService.success(this.translateService.get('notification.created.success'));
this.notificationService.success(this.translateService.get('ldn-service-delete.notification.success.title'),
this.translateService.get('ldn-service-delete.notification.success.content'));
} else {
this.notificationService.error(this.translateService.get('notification.created.failure'));
this.notificationService.error(this.translateService.get('ldn-service-delete.notification.error.title'),
this.translateService.get('ldn-service-delete.notification.error.content'));
this.cdRef.detectChanges();
}
});
@@ -117,24 +109,32 @@ export class LdnServicesOverviewComponent implements OnInit, OnDestroy {
}
toggleStatus(ldnService: any, ldnServicesService: LdnServicesService): void {
const newStatus = !ldnService.enabled;
let status = ldnService.enabled;
const originalStatus = ldnService.enabled;
const patchOperation: Operation = {
op: 'replace',
path: '/enabled',
value: newStatus,
};
ldnServicesService.patch(ldnService, [patchOperation]).pipe(getFirstCompletedRemoteData()).subscribe(
() => {
if (status !== newStatus) {
(rd: RemoteData<LdnService>) => {
if (rd.hasSucceeded) {
ldnService.enabled = newStatus;
this.notificationService.success(this.translateService.get('ldn-enable-service.notification.success.title'),
this.translateService.get('ldn-enable-service.notification.success.content'));
} else {
ldnService.enabled = originalStatus;
this.notificationService.error(this.translateService.get('ldn-enable-service.notification.error.title'),
this.translateService.get('ldn-enable-service.notification.error.content'));
}
}
);
}
}

View File

@@ -67,7 +67,3 @@ export const notifyPatterns = [
];
const pattern = notifyPatterns[0];
console.log(`Pattern Name: ${pattern.name}`);
console.log(`Pattern Description: ${pattern.description}`);
console.log(`Pattern Category: ${pattern.category}`);

View File

@@ -917,9 +917,15 @@
"ldn-service.overview.table.clickToEnable": "Click to enable",
"ldn-service.overview.table.clickToDisable": "Click to disable",
"ldn-edit-registered-service.title": "Edit Service",
"ldn-create-service.title": "Create service",
"service.overview.create.modal": "Create Service",
"service.overview.create.body": "Please confirm the creation of this service",
"ldn-service-status": "Status",
"service.confirm.create": "Create",
"service.refuse.create": "Discard",
"ldn-register-new-service.title": "Register a new service",
"ldn-new-service.form.label.submit": "Submit",
"ldn-new-service.form.label.submit": "Save",
"ldn-new-service.form.label.name": "Name",
"ldn-new-service.form.label.description": "Description",
"ldn-new-service.form.label.url": "Service URL",
@@ -939,6 +945,23 @@
"ldn-new-service.form.label.removeItemFilter": "Remove",
"ldn-register-new-service.breadcrumbs": "New Service",
"service.overview.delete.body": "Are you sure you want to delete this service?",
"service.overview.edit.body": "Are you sure you want to confirm those service changes?",
"service.overview.edit.modal": "Edit Service",
"service.detail.update": "Edit Service",
"service.detail.return": "Cancel",
"service.overview.reset-form.body": "Are you sure you want to discard those changes and leave?",
"service.overview.reset-form.modal": "Discard Service Changes",
"service.overview.reset-form.reset-confirm":"Discard",
"admin.registries.services-formats.modify.success.head": "Successful Edit",
"admin.registries.services-formats.modify.success.content": "The service has been edited",
"ldn-service-notification.created.success.title": "Successful Create",
"ldn-service-notification.created.success.body": "The service has been created",
"ldn-enable-service.notification.success.title": "Successful status updated",
"ldn-enable-service.notification.success.content": "The service status has been updated",
"ldn-service-delete.notification.success.title": "Successful Deletion",
"ldn-service-delete.notification.success.content": "The service has been deleted",
"ldn-service-delete.notification.error.title": "Failed Deletion",
"ldn-service-delete.notification.error.content": "The service has not been deleted",
"service.overview.delete": "Delete service",
"ldn-edit-service.title": "Edit service",
"ldn-edit-service.form.label.name": "Name",
@@ -954,7 +977,7 @@
"ldn-edit-service.form.label.outboundPattern": "Outbound Pattern",
"ldn-edit-service.form.label.noOutboundPatternSelected": "No Outbound Pattern",
"ldn-edit-service.form.label.addOutboundPattern": "+ Add more",
"ldn-edit-service.form.label.submit": "Submit",
"ldn-edit-service.form.label.submit": "Save",
"ldn-edit-service.breadcrumbs": "Edit Service",