mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-08 02:24:11 +00:00
CST-12455 Create page logic is working now finishing up the styling for the page
This commit is contained in:
@@ -110,16 +110,40 @@
|
|||||||
|
|
||||||
|
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<ng-container *ngIf="selectedInboundPatterns">
|
<ng-container *ngIf="!!(formModel.get('notifyServiceInboundPatterns')['controls'][i].value.pattern)">
|
||||||
<select formControlName="constraint" id="constraint{{i}}" name="constraint{{i}}">
|
<div #inboundItemfilterDropdown="ngbDropdown" class="w-100" id="constraint{{i}}" ngbDropdown>
|
||||||
<option value="">{{ 'ldn-new-service.form.label.placeholder.selectedItemFilter' | translate }}</option>
|
<div class="position-relative right-addon" role="combobox">
|
||||||
<option *ngFor="let itemFilter of (itemfiltersRD$ | async)?.payload?.page"
|
<i aria-hidden="true" class="position-absolute scrollable-dropdown-toggle"
|
||||||
[value]="itemFilter.id">{{ itemFilter.id }}</option>
|
ngbDropdownToggle></i>
|
||||||
</select>
|
<input
|
||||||
|
(click)="inboundItemfilterDropdown.open();"
|
||||||
|
[readonly]="true"
|
||||||
|
[value]="selectedInboundItemfilters"
|
||||||
|
class="form-control w-100 scrollable-dropdown-input"
|
||||||
|
formControlName="constraint"
|
||||||
|
id="inboundItemfilterDropdown"
|
||||||
|
ngbDropdownAnchor
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div>{{ selectedInboundItemfilters ? ('ldn-service.form.pattern.' + selectedInboundItemfilters + '.label' | translate) : ('ldn-new-service.form.label.placeholder.inboundPattern' | translate) }}</div>
|
||||||
|
<div
|
||||||
|
class="small-text">{{ selectedInboundItemfilters ? ('ldn-service.form.pattern.' + selectedInboundItemfilters + '.description' | translate) : ('' | translate) }}</div>
|
||||||
|
<!-- TODO: infinite scroll with 3 selects -->
|
||||||
|
<div aria-labelledby="inboundItemfilterDropdownButton" ngbDropdownMenu>
|
||||||
|
<button (click)="selectInboundItemFilter(constraint.id, i); $event.stopPropagation()"
|
||||||
|
*ngFor="let constraint of (itemfiltersRD$ | async)?.payload?.page; let internalIndex = index"
|
||||||
|
ngbDropdownItem
|
||||||
|
type="button">
|
||||||
|
<div>{{ constraint.id }}</div>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div [style.visibility]="selectedInboundPatterns ? 'visible' : 'hidden'" class="col-sm-1">
|
<div [style.visibility]="formModel.get('notifyServiceInboundPatterns')['controls'][i]?.value?.pattern ? 'visible' : 'hidden'" class="col-sm-1">
|
||||||
<input formControlName="automatic" hidden id="automatic{{i}}" name="automatic{{i}}"
|
<input formControlName="automatic" hidden id="automatic{{i}}" name="automatic{{i}}"
|
||||||
type="checkbox">
|
type="checkbox">
|
||||||
<div (click)="toggleAutomatic(i)"
|
<div (click)="toggleAutomatic(i)"
|
||||||
@@ -199,17 +223,37 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<ng-container *ngIf="selectedOutboundPatterns">
|
<ng-container *ngIf="!!(formModel.get('notifyServiceOutboundPatterns')['controls'][i].value.pattern)">
|
||||||
<select formControlName="constraint" id="constraint{{i}}" name="constraint{{i}}">
|
<div #outboundItemfilterDropdown="ngbDropdown" class="w-100" id="constraint{{i}}" ngbDropdown>
|
||||||
<option value="">{{ 'ldn-new-service.form.label.placeholder.selectedItemFilter' | translate }}</option>
|
<div class="position-relative right-addon" role="combobox">
|
||||||
<option *ngFor="let itemFilter of (itemfiltersRD$ | async)?.payload?.page"
|
<i aria-hidden="true" class="position-absolute scrollable-dropdown-toggle"
|
||||||
[value]="itemFilter.id">{{ itemFilter.id }}</option>
|
ngbDropdownToggle></i>
|
||||||
</select>
|
<input
|
||||||
|
(click)="outboundItemfilterDropdown.open();"
|
||||||
|
[readonly]="true"
|
||||||
|
[value]="selectedOutboundItemfilters"
|
||||||
|
class="form-control w-100 scrollable-dropdown-input"
|
||||||
|
formControlName="constraint"
|
||||||
|
id="outboundItemfilterDropdown"
|
||||||
|
ngbDropdownAnchor
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
<!-- TODO: infinite scroll with 3 selects -->
|
||||||
|
<div aria-labelledby="outboundItemfilterDropdownButton" ngbDropdownMenu>
|
||||||
|
<button (click)="selectOutboundItemFilter(constraint.id, i); $event.stopPropagation()"
|
||||||
|
*ngFor="let constraint of (itemfiltersRD$ | async)?.payload?.page; let internalIndex = index"
|
||||||
|
ngbDropdownItem
|
||||||
|
type="button">
|
||||||
|
<div>{{ constraint.id }}</div>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div [style.visibility]="'hidden'" class="col-sm-1">
|
<div [style.visibility]="'hidden'" class="col-sm-1">
|
||||||
<input formControlName="automatic" hidden id="automatic{{i}}" name="automatic{{i}}"
|
<input hidden id="automatic{{i}}" name="automatic{{i}}"
|
||||||
type="checkbox">
|
type="checkbox">
|
||||||
<div
|
<div
|
||||||
class="toggle-switch">
|
class="toggle-switch">
|
||||||
|
@@ -1,244 +1,260 @@
|
|||||||
import {
|
import {ChangeDetectorRef, Component, EventEmitter, Input, OnInit, Output, TemplateRef, ViewChild} from '@angular/core';
|
||||||
ChangeDetectorRef,
|
import {FormArray, FormBuilder, FormGroup, Validators} from '@angular/forms';
|
||||||
Component,
|
import {Router} from '@angular/router';
|
||||||
EventEmitter,
|
|
||||||
Input,
|
|
||||||
OnInit,
|
|
||||||
Output,
|
|
||||||
TemplateRef,
|
|
||||||
ViewChild
|
|
||||||
} from '@angular/core';
|
|
||||||
import { FormArray, FormBuilder, FormGroup, Validators } from '@angular/forms';
|
|
||||||
import { Router } from '@angular/router';
|
|
||||||
|
|
||||||
import { LdnServicesService } from '../ldn-services-data/ldn-services-data.service';
|
import {LdnServicesService} from '../ldn-services-data/ldn-services-data.service';
|
||||||
import { notifyPatterns } from '../ldn-services-patterns/ldn-service-coar-patterns';
|
import {notifyPatterns} from '../ldn-services-patterns/ldn-service-coar-patterns';
|
||||||
import { LDN_SERVICE } from '../ldn-services-model/ldn-service.resource-type';
|
import {LDN_SERVICE} from '../ldn-services-model/ldn-service.resource-type';
|
||||||
import { animate, state, style, transition, trigger } from '@angular/animations';
|
import {animate, state, style, transition, trigger} from '@angular/animations';
|
||||||
import { getFirstCompletedRemoteData } from '../../../core/shared/operators';
|
import {getFirstCompletedRemoteData} from '../../../core/shared/operators';
|
||||||
import { RemoteData } from '../../../core/data/remote-data';
|
import {RemoteData} from '../../../core/data/remote-data';
|
||||||
import { LdnService } from '../ldn-services-model/ldn-services.model';
|
import {LdnService} from '../ldn-services-model/ldn-services.model';
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import {NotificationsService} from '../../../shared/notifications/notifications.service';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import {TranslateService} from '@ngx-translate/core';
|
||||||
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
import {PaginatedList} from '../../../core/data/paginated-list.model';
|
||||||
import { Itemfilter } from '../ldn-services-model/ldn-service-itemfilters';
|
import {Itemfilter} from '../ldn-services-model/ldn-service-itemfilters';
|
||||||
import { Observable } from 'rxjs';
|
import {Observable} from 'rxjs';
|
||||||
import { FindListOptions } from '../../../core/data/find-list-options.model';
|
import {FindListOptions} from '../../../core/data/find-list-options.model';
|
||||||
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
import {PaginationComponentOptions} from '../../../shared/pagination/pagination-component-options.model';
|
||||||
import { LdnItemfiltersService } from '../ldn-services-data/ldn-itemfilters-data.service';
|
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({
|
@Component({
|
||||||
selector: 'ds-ldn-service-form',
|
selector: 'ds-ldn-service-form',
|
||||||
templateUrl: './ldn-service-form.component.html',
|
templateUrl: './ldn-service-form.component.html',
|
||||||
styleUrls: ['./ldn-service-form.component.scss'],
|
styleUrls: ['./ldn-service-form.component.scss'],
|
||||||
animations: [
|
animations: [
|
||||||
trigger('toggleAnimation', [
|
trigger('toggleAnimation', [
|
||||||
state('true', style({})),
|
state('true', style({})),
|
||||||
state('false', style({})),
|
state('false', style({})),
|
||||||
transition('true <=> false', animate('300ms ease-in')),
|
transition('true <=> false', animate('300ms ease-in')),
|
||||||
]),
|
]),
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class LdnServiceFormComponent implements OnInit {
|
export class LdnServiceFormComponent implements OnInit {
|
||||||
formModel: FormGroup;
|
formModel: FormGroup;
|
||||||
@ViewChild('confirmModal', {static: true}) confirmModal: TemplateRef<any>;
|
@ViewChild('confirmModal', {static: true}) confirmModal: TemplateRef<any>;
|
||||||
@ViewChild('resetFormModal', {static: true}) resetFormModal: TemplateRef<any>;
|
@ViewChild('resetFormModal', {static: true}) resetFormModal: TemplateRef<any>;
|
||||||
//public inboundPatterns: object[] = notifyPatterns;
|
//public inboundPatterns: object[] = notifyPatterns;
|
||||||
//public outboundPatterns: object[] = notifyPatterns;
|
//public outboundPatterns: object[] = notifyPatterns;
|
||||||
public inboundPatterns: string[] = notifyPatterns;
|
public inboundPatterns: string[] = notifyPatterns;
|
||||||
public outboundPatterns: string[] = notifyPatterns;
|
public outboundPatterns: string[] = notifyPatterns;
|
||||||
itemfiltersRD$: Observable<RemoteData<PaginatedList<Itemfilter>>>;
|
itemfiltersRD$: Observable<RemoteData<PaginatedList<Itemfilter>>>;
|
||||||
config: FindListOptions = Object.assign(new FindListOptions(), {
|
config: FindListOptions = Object.assign(new FindListOptions(), {
|
||||||
elementsPerPage: 20
|
elementsPerPage: 20
|
||||||
|
});
|
||||||
|
pageConfig: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), {
|
||||||
|
id: 'po',
|
||||||
|
pageSize: 20
|
||||||
|
});
|
||||||
|
@Input() public name: string;
|
||||||
|
@Input() public description: string;
|
||||||
|
@Input() public url: string;
|
||||||
|
@Input() public ldnUrl: string;
|
||||||
|
@Input() public inboundPattern: string;
|
||||||
|
@Input() public outboundPattern: string;
|
||||||
|
@Input() public constraint: string;
|
||||||
|
@Input() public automatic: boolean;
|
||||||
|
@Input() public headerKey: string;
|
||||||
|
@Output() submitForm: EventEmitter<any> = new EventEmitter();
|
||||||
|
@Output() cancelForm: EventEmitter<any> = new EventEmitter();
|
||||||
|
selectedOutboundPatterns: string[];
|
||||||
|
selectedInboundPatterns: string[];
|
||||||
|
selectedInboundItemfilters: string[];
|
||||||
|
selectedOutboundItemfilters: string[];
|
||||||
|
private modalRef: any;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private ldnServicesService: LdnServicesService,
|
||||||
|
private ldnItemfiltersService: LdnItemfiltersService,
|
||||||
|
private formBuilder: FormBuilder,
|
||||||
|
private router: Router,
|
||||||
|
private notificationsService: NotificationsService,
|
||||||
|
private translateService: TranslateService,
|
||||||
|
private cdRef: ChangeDetectorRef,
|
||||||
|
protected modalService: NgbModal,
|
||||||
|
) {
|
||||||
|
|
||||||
|
this.formModel = this.formBuilder.group({
|
||||||
|
enabled: true,
|
||||||
|
id: [''],
|
||||||
|
name: ['', Validators.required],
|
||||||
|
description: [''],
|
||||||
|
url: ['', Validators.required],
|
||||||
|
ldnUrl: ['', Validators.required],
|
||||||
|
inboundPattern: [''],
|
||||||
|
outboundPattern: [''],
|
||||||
|
constraintPattern: [''],
|
||||||
|
notifyServiceInboundPatterns: this.formBuilder.array([this.createInboundPatternFormGroup()]),
|
||||||
|
notifyServiceOutboundPatterns: this.formBuilder.array([this.createOutboundPatternFormGroup()]),
|
||||||
|
type: LDN_SERVICE.value,
|
||||||
});
|
});
|
||||||
pageConfig: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), {
|
}
|
||||||
id: 'po',
|
|
||||||
pageSize: 20
|
|
||||||
});
|
|
||||||
@Input() public name: string;
|
|
||||||
@Input() public description: string;
|
|
||||||
@Input() public url: string;
|
|
||||||
@Input() public ldnUrl: string;
|
|
||||||
@Input() public inboundPattern: string;
|
|
||||||
@Input() public outboundPattern: string;
|
|
||||||
@Input() public constraint: string;
|
|
||||||
@Input() public automatic: boolean;
|
|
||||||
@Input() public headerKey: string;
|
|
||||||
@Output() submitForm: EventEmitter<any> = new EventEmitter();
|
|
||||||
@Output() cancelForm: EventEmitter<any> = new EventEmitter();
|
|
||||||
private modalRef: any;
|
|
||||||
selectedOutboundPatterns: string[];
|
|
||||||
selectedInboundPatterns: string[];
|
|
||||||
|
|
||||||
constructor(
|
ngOnInit(): void {
|
||||||
private ldnServicesService: LdnServicesService,
|
console.log(notifyPatterns)
|
||||||
private ldnItemfiltersService: LdnItemfiltersService,
|
this.setItemfilters();
|
||||||
private formBuilder: FormBuilder,
|
|
||||||
private router: Router,
|
|
||||||
private notificationsService: NotificationsService,
|
|
||||||
private translateService: TranslateService,
|
|
||||||
private cdRef: ChangeDetectorRef,
|
|
||||||
protected modalService: NgbModal,
|
|
||||||
) {
|
|
||||||
|
|
||||||
this.formModel = this.formBuilder.group({
|
}
|
||||||
enabled: true,
|
|
||||||
id: [''],
|
setItemfilters() {
|
||||||
name: ['', Validators.required],
|
this.itemfiltersRD$ = this.ldnItemfiltersService.findAll().pipe(
|
||||||
description: [''],
|
getFirstCompletedRemoteData());
|
||||||
url: ['', Validators.required],
|
}
|
||||||
ldnUrl: ['', Validators.required],
|
|
||||||
inboundPattern: [''],
|
onSubmit() {
|
||||||
outboundPattern: [''],
|
this.openConfirmModal(this.confirmModal);
|
||||||
constraintPattern: [''],
|
}
|
||||||
notifyServiceInboundPatterns: this.formBuilder.array([this.createInboundPatternFormGroup()]),
|
|
||||||
notifyServiceOutboundPatterns: this.formBuilder.array([this.createOutboundPatternFormGroup()]),
|
openConfirmModal(content) {
|
||||||
type: LDN_SERVICE.value,
|
this.modalRef = this.modalService.open(content);
|
||||||
});
|
}
|
||||||
|
|
||||||
|
openResetFormModal(content) {
|
||||||
|
this.modalRef = this.modalService.open(content);
|
||||||
|
}
|
||||||
|
|
||||||
|
createService() {
|
||||||
|
this.formModel.get('name').markAsTouched();
|
||||||
|
this.formModel.get('url').markAsTouched();
|
||||||
|
this.formModel.get('ldnUrl').markAsTouched();
|
||||||
|
|
||||||
|
const name = this.formModel.get('name').value;
|
||||||
|
const url = this.formModel.get('url').value;
|
||||||
|
const ldnUrl = this.formModel.get('ldnUrl').value;
|
||||||
|
|
||||||
|
if (!name || !url || !ldnUrl) {
|
||||||
|
this.closeModal();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
this.formModel.value.notifyServiceInboundPatterns = this.formModel.value.notifyServiceInboundPatterns.filter((pattern: {
|
||||||
console.log(notifyPatterns)
|
pattern: string;
|
||||||
this.setItemfilters();
|
}) => pattern.pattern !== '');
|
||||||
|
this.formModel.value.notifyServiceOutboundPatterns = this.formModel.value.notifyServiceOutboundPatterns.filter((pattern: {
|
||||||
|
pattern: string;
|
||||||
|
}) => pattern.pattern !== '');
|
||||||
|
|
||||||
}
|
const values = this.formModel.value;
|
||||||
|
|
||||||
setItemfilters() {
|
const ldnServiceData = this.ldnServicesService.create(values);
|
||||||
this.itemfiltersRD$ = this.ldnItemfiltersService.findAll().pipe(
|
|
||||||
getFirstCompletedRemoteData());
|
|
||||||
}
|
|
||||||
|
|
||||||
onSubmit() {
|
ldnServiceData.pipe(
|
||||||
this.openConfirmModal(this.confirmModal);
|
getFirstCompletedRemoteData()
|
||||||
}
|
).subscribe((rd: RemoteData<LdnService>) => {
|
||||||
|
if (rd.hasSucceeded) {
|
||||||
|
this.notificationsService.success(this.translateService.get('ldn-service-notification.created.success.title'),
|
||||||
|
this.translateService.get('ldn-service-notification.created.success.body'));
|
||||||
|
|
||||||
openConfirmModal(content) {
|
|
||||||
this.modalRef = this.modalService.open(content);
|
|
||||||
}
|
|
||||||
|
|
||||||
openResetFormModal(content) {
|
|
||||||
this.modalRef = this.modalService.open(content);
|
|
||||||
}
|
|
||||||
|
|
||||||
createService() {
|
|
||||||
this.formModel.get('name').markAsTouched();
|
|
||||||
this.formModel.get('url').markAsTouched();
|
|
||||||
this.formModel.get('ldnUrl').markAsTouched();
|
|
||||||
|
|
||||||
const name = this.formModel.get('name').value;
|
|
||||||
const url = this.formModel.get('url').value;
|
|
||||||
const ldnUrl = this.formModel.get('ldnUrl').value;
|
|
||||||
|
|
||||||
if (!name || !url || !ldnUrl) {
|
|
||||||
this.closeModal();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.formModel.value.notifyServiceInboundPatterns = this.formModel.value.notifyServiceInboundPatterns.filter((pattern: { pattern: string; }) => pattern.pattern !== '');
|
|
||||||
this.formModel.value.notifyServiceOutboundPatterns = this.formModel.value.notifyServiceOutboundPatterns.filter((pattern: { pattern: string; }) => pattern.pattern !== '');
|
|
||||||
|
|
||||||
const values = this.formModel.value;
|
|
||||||
|
|
||||||
const ldnServiceData = this.ldnServicesService.create(values);
|
|
||||||
|
|
||||||
ldnServiceData.pipe(
|
|
||||||
getFirstCompletedRemoteData()
|
|
||||||
).subscribe((rd: RemoteData<LdnService>) => {
|
|
||||||
if (rd.hasSucceeded) {
|
|
||||||
this.notificationsService.success(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.sendBack();
|
||||||
this.closeModal();
|
this.closeModal();
|
||||||
|
} else {
|
||||||
|
this.notificationsService.error(this.translateService.get('notification.created.failure'));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
resetFormAndLeave() {
|
||||||
|
this.sendBack();
|
||||||
|
this.closeModal();
|
||||||
|
}
|
||||||
|
|
||||||
|
closeModal() {
|
||||||
|
this.modalRef.close();
|
||||||
|
this.cdRef.detectChanges();
|
||||||
|
}
|
||||||
|
|
||||||
|
addInboundPattern() {
|
||||||
|
const notifyServiceInboundPatternsArray = this.formModel.get('notifyServiceInboundPatterns') as FormArray;
|
||||||
|
notifyServiceInboundPatternsArray.push(this.createInboundPatternFormGroup());
|
||||||
|
}
|
||||||
|
|
||||||
|
removeInboundPattern(index: number) {
|
||||||
|
const notifyServiceInboundPatternsArray = this.formModel.get('notifyServiceInboundPatterns') as FormArray;
|
||||||
|
notifyServiceInboundPatternsArray.removeAt(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
addOutboundPattern() {
|
||||||
|
const notifyServiceOutboundPatternsArray = this.formModel.get('notifyServiceOutboundPatterns') as FormArray;
|
||||||
|
notifyServiceOutboundPatternsArray.push(this.createOutboundPatternFormGroup());
|
||||||
|
}
|
||||||
|
|
||||||
|
removeOutboundPattern(index: number) {
|
||||||
|
const notifyServiceOutboundPatternsArray = this.formModel.get('notifyServiceOutboundPatterns') as FormArray;
|
||||||
|
notifyServiceOutboundPatternsArray.removeAt(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
toggleAutomatic(i: number) {
|
||||||
|
const automaticControl = this.formModel.get(`notifyServiceInboundPatterns.${i}.automatic`);
|
||||||
|
if (automaticControl) {
|
||||||
|
automaticControl.setValue(!automaticControl.value);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
closeModal() {
|
selectOutboundPattern(patternValue: string, index: number): void {
|
||||||
this.modalRef.close();
|
// this.selectedOutboundPatterns = patternValue;
|
||||||
this.cdRef.detectChanges();
|
const patternArray = (this.formModel.get('notifyServiceOutboundPatterns') as FormArray).controls[index]
|
||||||
}
|
console.log((this.formModel.get('notifyServiceOutboundPatterns') as FormArray))
|
||||||
|
patternArray.patchValue({pattern: patternValue})
|
||||||
|
//console.log(patternArray);
|
||||||
|
//this.getPatternControlNames(index)
|
||||||
|
}
|
||||||
|
|
||||||
addInboundPattern() {
|
selectInboundPattern(patternValue: string, index: number): void {
|
||||||
const notifyServiceInboundPatternsArray = this.formModel.get('notifyServiceInboundPatterns') as FormArray;
|
// this.selectedOutboundPatterns = patternValue;
|
||||||
notifyServiceInboundPatternsArray.push(this.createInboundPatternFormGroup());
|
const patternArray = (this.formModel.get('notifyServiceInboundPatterns') as FormArray).controls[index]
|
||||||
}
|
console.log((this.formModel.get('notifyServiceInboundPatterns') as FormArray))
|
||||||
|
patternArray.patchValue({pattern: patternValue})
|
||||||
|
//console.log(patternArray);
|
||||||
|
//this.getPatternControlNames(index)
|
||||||
|
}
|
||||||
|
|
||||||
removeInboundPattern(index: number) {
|
selectInboundItemFilter(filterValue: string, index: number): void {
|
||||||
const notifyServiceInboundPatternsArray = this.formModel.get('notifyServiceInboundPatterns') as FormArray;
|
// this.selectedOutboundPatterns = patternValue;
|
||||||
notifyServiceInboundPatternsArray.removeAt(index);
|
const filterArray = (this.formModel.get('notifyServiceInboundPatterns') as FormArray)
|
||||||
}
|
console.log((this.formModel.get('notifyServiceInboundPatterns') as FormArray))
|
||||||
|
filterArray.controls[index].patchValue({constraint: filterValue})
|
||||||
|
|
||||||
addOutboundPattern() {
|
//console.log(patternArray);
|
||||||
const notifyServiceOutboundPatternsArray = this.formModel.get('notifyServiceOutboundPatterns') as FormArray;
|
//this.getPatternControlNames(index)
|
||||||
notifyServiceOutboundPatternsArray.push(this.createOutboundPatternFormGroup());
|
}
|
||||||
}
|
|
||||||
|
|
||||||
removeOutboundPattern(index: number) {
|
selectOutboundItemFilter(filterValue: string, index: number) {
|
||||||
const notifyServiceOutboundPatternsArray = this.formModel.get('notifyServiceOutboundPatterns') as FormArray;
|
const filterArray = (this.formModel.get('notifyServiceOutboundPatterns') as FormArray)
|
||||||
notifyServiceOutboundPatternsArray.removeAt(index);
|
console.log((this.formModel.get('notifyServiceOutboundPatterns') as FormArray))
|
||||||
}
|
filterArray.controls[index].patchValue({constraint: filterValue})
|
||||||
|
}
|
||||||
|
|
||||||
toggleAutomatic(i: number) {
|
getPatternControlNames(index: number) {
|
||||||
const automaticControl = this.formModel.get(`notifyServiceInboundPatterns.${i}.automatic`);
|
|
||||||
if (automaticControl) {
|
|
||||||
automaticControl.setValue(!automaticControl.value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private sendBack() {
|
|
||||||
this.router.navigateByUrl('admin/ldn/services');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private createOutboundPatternFormGroup(): FormGroup {
|
|
||||||
return this.formBuilder.group({
|
|
||||||
pattern: [''],
|
|
||||||
constraint: [''],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private createInboundPatternFormGroup(): FormGroup {
|
|
||||||
return this.formBuilder.group({
|
|
||||||
pattern: [''],
|
|
||||||
constraint: [''],
|
|
||||||
automatic: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
selectOutboundPattern(patternValue: string, index: number): void {
|
|
||||||
// this.selectedOutboundPatterns = patternValue;
|
|
||||||
const patternArray = (this.formModel.get('notifyServiceOutboundPatterns') as FormArray).controls[index]
|
|
||||||
console.log((this.formModel.get('notifyServiceOutboundPatterns') as FormArray))
|
|
||||||
patternArray.patchValue({pattern: patternValue} )
|
|
||||||
//console.log(patternArray);
|
|
||||||
//this.getPatternControlNames(index)
|
|
||||||
}
|
|
||||||
//selectInboundPattern(pattern: string, index: number): void {
|
|
||||||
//this.selectedInboundPatterns = pattern;
|
|
||||||
//}
|
|
||||||
|
|
||||||
selectInboundPattern(patternValue: string, index: number): void {
|
|
||||||
// this.selectedOutboundPatterns = patternValue;
|
|
||||||
const patternArray = (this.formModel.get('notifyServiceInboundPatterns') as FormArray).controls[index]
|
|
||||||
console.log((this.formModel.get('notifyServiceInboundPatterns') as FormArray))
|
|
||||||
patternArray.patchValue({pattern: patternValue} )
|
|
||||||
//console.log(patternArray);
|
|
||||||
//this.getPatternControlNames(index)
|
|
||||||
}
|
|
||||||
|
|
||||||
getPatternControlNames(index: number) {
|
|
||||||
const patternArrayValue = (this.formModel.get('notifyServiceOutboundPatterns') as FormArray).controls[index].value
|
const patternArrayValue = (this.formModel.get('notifyServiceOutboundPatterns') as FormArray).controls[index].value
|
||||||
return patternArrayValue
|
return patternArrayValue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private sendBack() {
|
||||||
|
this.router.navigateByUrl('admin/ldn/services');
|
||||||
|
}
|
||||||
|
|
||||||
|
//selectInboundPattern(pattern: string, index: number): void {
|
||||||
|
//this.selectedInboundPatterns = pattern;
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
private createOutboundPatternFormGroup(): FormGroup {
|
||||||
|
return this.formBuilder.group({
|
||||||
|
pattern: [''],
|
||||||
|
constraint: [''],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private createInboundPatternFormGroup(): FormGroup {
|
||||||
|
return this.formBuilder.group({
|
||||||
|
pattern: [''],
|
||||||
|
constraint: [''],
|
||||||
|
automatic: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user