mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
CST-12455 Task Completed, cleanup needed
This commit is contained in:
@@ -68,12 +68,14 @@
|
|||||||
<div class="col">
|
<div class="col">
|
||||||
<label>{{ 'ldn-new-service.form.label.inboundPattern' | translate }} </label>
|
<label>{{ 'ldn-new-service.form.label.inboundPattern' | translate }} </label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<ng-container *ngIf="!!(formModel.get('notifyServiceInboundPatterns')['controls'][0]?.value?.pattern)">
|
||||||
<label class="">{{ 'ldn-new-service.form.label.ItemFilter' | translate }}</label>
|
<div class="col">
|
||||||
</div>
|
<label>{{ 'ldn-new-service.form.label.ItemFilter' | translate }}</label>
|
||||||
<div class="col-sm-1 ">
|
</div>
|
||||||
<label class="">{{ 'ldn-new-service.form.label.automatic' | translate }}</label>
|
<div class="col-sm-1">
|
||||||
</div>
|
<label class="">{{ 'ldn-new-service.form.label.automatic' | translate }}</label>
|
||||||
|
</div>
|
||||||
|
</ng-container>
|
||||||
<div class="col-sm-2">
|
<div class="col-sm-2">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -95,9 +97,8 @@
|
|||||||
<input
|
<input
|
||||||
(click)="inboundPatternDropdown.open();"
|
(click)="inboundPatternDropdown.open();"
|
||||||
[readonly]="true"
|
[readonly]="true"
|
||||||
[value]="selectedInboundPatterns"
|
|
||||||
class="form-control w-80 scrollable-dropdown-input"
|
class="form-control w-80 scrollable-dropdown-input"
|
||||||
formControlName="pattern"
|
formControlName="patternLabel"
|
||||||
id="inboundPatternDropdownButton"
|
id="inboundPatternDropdownButton"
|
||||||
ngbDropdownAnchor
|
ngbDropdownAnchor
|
||||||
type="text"
|
type="text"
|
||||||
@@ -190,9 +191,11 @@
|
|||||||
<div class="col">
|
<div class="col">
|
||||||
<label>{{ 'ldn-new-service.form.label.outboundPattern' | translate }}</label>
|
<label>{{ 'ldn-new-service.form.label.outboundPattern' | translate }}</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<ng-container *ngIf="!!(formModel.get('notifyServiceOutboundPatterns')['controls'][0]?.value?.pattern)">
|
||||||
<label class="label-box-3">{{ 'ldn-new-service.form.label.ItemFilter' | translate }}</label>
|
<div class="col">
|
||||||
</div>
|
<label class="">{{ 'ldn-new-service.form.label.ItemFilter' | translate }}</label>
|
||||||
|
</div>
|
||||||
|
</ng-container>
|
||||||
<div class="col-sm-1 ">
|
<div class="col-sm-1 ">
|
||||||
<label class="label-box-2"></label>
|
<label class="label-box-2"></label>
|
||||||
</div>
|
</div>
|
||||||
@@ -209,7 +212,8 @@
|
|||||||
<!-- Input elements in a separate row -->
|
<!-- Input elements in a separate row -->
|
||||||
<div class="row mb-1">
|
<div class="row mb-1">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<div #outboundPatternDropdown="ngbDropdown" class="w-100" id="additionalOutboundPattern{{i}}" ngbDropdown>
|
<div #outboundPatternDropdown="ngbDropdown" class="w-100" id="additionalOutboundPattern{{i}}" ngbDropdown
|
||||||
|
placement="bottom">
|
||||||
<div class="position-relative right-addon" role="combobox">
|
<div class="position-relative right-addon" role="combobox">
|
||||||
<i aria-hidden="true" class="position-absolute scrollable-dropdown-toggle"
|
<i aria-hidden="true" class="position-absolute scrollable-dropdown-toggle"
|
||||||
ngbDropdownToggle></i>
|
ngbDropdownToggle></i>
|
||||||
@@ -218,16 +222,11 @@
|
|||||||
[readonly]="true"
|
[readonly]="true"
|
||||||
[value]="selectedOutboundPatterns"
|
[value]="selectedOutboundPatterns"
|
||||||
class="form-control w-100 scrollable-dropdown-input"
|
class="form-control w-100 scrollable-dropdown-input"
|
||||||
formControlName="pattern"
|
formControlName="patternLabel"
|
||||||
id="outboundPatternDropdownButton"
|
id="outboundPatternDropdownButton"
|
||||||
ngbDropdownAnchor
|
ngbDropdownAnchor
|
||||||
type="text"
|
type="text"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- Main label TODO: remove after developing done cause it will pick the selected value to show -->
|
|
||||||
<div>{{ selectedOutboundPatterns ? ('ldn-service.form.pattern.' + selectedOutboundPatterns + '.label' | translate) : ('ldn-new-service.form.label.placeholder.outboundPattern' | translate) }}</div>
|
|
||||||
<div
|
|
||||||
class="small-text">{{ selectedOutboundPatterns ? ('ldn-service.form.pattern.' + selectedOutboundPatterns + '.description' | translate) : ('' | translate) }}</div>
|
|
||||||
<!-- TODO: infinite scroll with 3-5 selects -->
|
<!-- TODO: infinite scroll with 3-5 selects -->
|
||||||
<div aria-labelledby="outboundPatternDropdownButton" ngbDropdownMenu>
|
<div aria-labelledby="outboundPatternDropdownButton" ngbDropdownMenu>
|
||||||
<button (click)="selectOutboundPattern(pattern, i); $event.stopPropagation()"
|
<button (click)="selectOutboundPattern(pattern, i); $event.stopPropagation()"
|
||||||
|
@@ -19,6 +19,7 @@ import {Observable} from 'rxjs';
|
|||||||
import {PaginationService} from '../../../core/pagination/pagination.service';
|
import {PaginationService} from '../../../core/pagination/pagination.service';
|
||||||
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 {NotifyServicePattern} from "../ldn-services-model/ldn-service-patterns.model";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-ldn-service-form-edit',
|
selector: 'ds-ldn-service-form-edit',
|
||||||
@@ -98,8 +99,6 @@ export class LdnServiceFormEditComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
console.log((this.formModel.get('notifyServiceOutboundPatterns') as FormArray))
|
|
||||||
console.log((this.formModel.get('notifyServiceInboundPatterns') as FormArray))
|
|
||||||
this.route.params.subscribe((params) => {
|
this.route.params.subscribe((params) => {
|
||||||
this.serviceId = params.serviceId;
|
this.serviceId = params.serviceId;
|
||||||
if (this.serviceId) {
|
if (this.serviceId) {
|
||||||
@@ -132,29 +131,66 @@ export class LdnServiceFormEditComponent implements OnInit {
|
|||||||
type: this.service.type,
|
type: this.service.type,
|
||||||
enabled: this.service.enabled
|
enabled: this.service.enabled
|
||||||
});
|
});
|
||||||
|
this.filterPatternObjectsAndPickLabel('notifyServiceInboundPatterns', false)
|
||||||
const inboundPatternsArray = this.formModel.get('notifyServiceInboundPatterns') as FormArray;
|
this.filterPatternObjectsAndPickLabel('notifyServiceOutboundPatterns', true)
|
||||||
|
/*const inboundPatternsArray = this.formModel.get('notifyServiceInboundPatterns') as FormArray;
|
||||||
inboundPatternsArray.clear();
|
inboundPatternsArray.clear();
|
||||||
this.service.notifyServiceInboundPatterns.forEach((pattern: any) => {
|
console.log(" outside (pattern: any)")
|
||||||
|
this.service.notifyServiceInboundPatterns.forEach((patternObj: NotifyServicePattern) => {
|
||||||
const patternFormGroup = this.initializeInboundPatternFormGroup();
|
const patternFormGroup = this.initializeInboundPatternFormGroup();
|
||||||
patternFormGroup.patchValue(pattern);
|
const newPatternObjWithLabel = Object.assign(new NotifyServicePattern(), {...patternObj,patternLabel: this.translateService.instant('ldn-service.form.pattern.' + patternObj.pattern + '.label')})
|
||||||
|
patternFormGroup.patchValue(newPatternObjWithLabel);
|
||||||
|
console.log("(pattern: any)")
|
||||||
|
|
||||||
|
|
||||||
inboundPatternsArray.push(patternFormGroup);
|
inboundPatternsArray.push(patternFormGroup);
|
||||||
this.cdRef.detectChanges();
|
this.cdRef.detectChanges();
|
||||||
});
|
})*/;
|
||||||
|
|
||||||
const outboundPatternsArray = this.formModel.get('notifyServiceOutboundPatterns') as FormArray;
|
/*const outboundPatternsArray = this.formModel.get('notifyServiceOutboundPatterns') as FormArray;
|
||||||
outboundPatternsArray.clear();
|
outboundPatternsArray.clear();
|
||||||
this.service.notifyServiceOutboundPatterns.forEach((pattern: any) => {
|
this.service.notifyServiceOutboundPatterns.forEach((pattern: any) => {
|
||||||
const patternFormGroup = this.initializeOutboundPatternFormGroup();
|
const patternFormGroup = this.initializeOutboundPatternFormGroup();
|
||||||
patternFormGroup.patchValue(pattern);
|
patternFormGroup.patchValue(pattern);
|
||||||
outboundPatternsArray.push(patternFormGroup);
|
outboundPatternsArray.push(patternFormGroup);
|
||||||
this.cdRef.detectChanges();
|
this.cdRef.detectChanges();
|
||||||
});
|
});*/
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
filterPatternObjectsAndPickLabel(formArrayName: string, isOutbound: boolean) {
|
||||||
|
const PatternsArray = this.formModel.get(formArrayName) as FormArray;
|
||||||
|
PatternsArray.clear();
|
||||||
|
let servicesToUse;
|
||||||
|
if (isOutbound) {
|
||||||
|
servicesToUse = this.service.notifyServiceOutboundPatterns
|
||||||
|
} else {
|
||||||
|
servicesToUse = this.service.notifyServiceInboundPatterns
|
||||||
|
}
|
||||||
|
|
||||||
|
servicesToUse.forEach((patternObj: NotifyServicePattern) => {
|
||||||
|
let patternFormGroup;
|
||||||
|
if (isOutbound) {
|
||||||
|
patternFormGroup = this.initializeOutboundPatternFormGroup();
|
||||||
|
} else {
|
||||||
|
patternFormGroup = this.initializeInboundPatternFormGroup();
|
||||||
|
}
|
||||||
|
const newPatternObjWithLabel = Object.assign(new NotifyServicePattern(), {
|
||||||
|
...patternObj,
|
||||||
|
patternLabel: this.translateService.instant('ldn-service.form.pattern.' + patternObj?.pattern + '.label')
|
||||||
|
})
|
||||||
|
patternFormGroup.patchValue(newPatternObjWithLabel);
|
||||||
|
console.log("(pattern: any)")
|
||||||
|
|
||||||
|
PatternsArray.push(patternFormGroup);
|
||||||
|
this.cdRef.detectChanges();
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
generatePatchOperations(): any[] {
|
generatePatchOperations(): any[] {
|
||||||
const patchOperations: any[] = [];
|
const patchOperations: any[] = [];
|
||||||
|
|
||||||
@@ -205,6 +241,8 @@ export class LdnServiceFormEditComponent implements OnInit {
|
|||||||
const patternArray = (this.formModel.get('notifyServiceOutboundPatterns') as FormArray)
|
const patternArray = (this.formModel.get('notifyServiceOutboundPatterns') as FormArray)
|
||||||
console.log((this.formModel.get('notifyServiceOutboundPatterns') as FormArray))
|
console.log((this.formModel.get('notifyServiceOutboundPatterns') as FormArray))
|
||||||
patternArray.controls[index].patchValue({pattern: patternValue})
|
patternArray.controls[index].patchValue({pattern: patternValue})
|
||||||
|
patternArray.controls[index].patchValue({patternLabel: this.translateService.instant('ldn-service.form.pattern.' + patternValue + '.label')})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
selectOutboundItemFilter(filterValue: string, index: number) {
|
selectOutboundItemFilter(filterValue: string, index: number) {
|
||||||
@@ -217,6 +255,7 @@ export class LdnServiceFormEditComponent implements OnInit {
|
|||||||
const patternArray = (this.formModel.get('notifyServiceInboundPatterns') as FormArray)
|
const patternArray = (this.formModel.get('notifyServiceInboundPatterns') as FormArray)
|
||||||
console.log((this.formModel.get('notifyServiceInboundPatterns') as FormArray))
|
console.log((this.formModel.get('notifyServiceInboundPatterns') as FormArray))
|
||||||
patternArray.controls[index].patchValue({pattern: patternValue})
|
patternArray.controls[index].patchValue({pattern: patternValue})
|
||||||
|
patternArray.controls[index].patchValue({patternLabel: this.translateService.instant('ldn-service.form.pattern.' + patternValue + '.label')})
|
||||||
}
|
}
|
||||||
|
|
||||||
selectInboundItemFilter(filterValue: string, index: number): void {
|
selectInboundItemFilter(filterValue: string, index: number): void {
|
||||||
@@ -391,9 +430,8 @@ export class LdnServiceFormEditComponent implements OnInit {
|
|||||||
const patternGroup = patternsArray.at(i) as FormGroup;
|
const patternGroup = patternsArray.at(i) as FormGroup;
|
||||||
|
|
||||||
const patternValue = patternGroup.value;
|
const patternValue = patternGroup.value;
|
||||||
|
|
||||||
debugger
|
|
||||||
if (patternGroup.touched) {
|
if (patternGroup.touched) {
|
||||||
|
delete patternValue?.patternLabel;
|
||||||
if (patternValue.isNew) {
|
if (patternValue.isNew) {
|
||||||
delete patternValue.isNew;
|
delete patternValue.isNew;
|
||||||
const addOperation = {
|
const addOperation = {
|
||||||
@@ -421,6 +459,7 @@ export class LdnServiceFormEditComponent implements OnInit {
|
|||||||
private createOutboundPatternFormGroup(): FormGroup {
|
private createOutboundPatternFormGroup(): FormGroup {
|
||||||
return this.formBuilder.group({
|
return this.formBuilder.group({
|
||||||
pattern: '',
|
pattern: '',
|
||||||
|
patternLabel: 'Select a pattern',
|
||||||
constraint: '',
|
constraint: '',
|
||||||
isNew: true,
|
isNew: true,
|
||||||
});
|
});
|
||||||
@@ -429,6 +468,7 @@ export class LdnServiceFormEditComponent implements OnInit {
|
|||||||
private createInboundPatternFormGroup(): FormGroup {
|
private createInboundPatternFormGroup(): FormGroup {
|
||||||
return this.formBuilder.group({
|
return this.formBuilder.group({
|
||||||
pattern: '',
|
pattern: '',
|
||||||
|
patternLabel: 'Select a pattern',
|
||||||
constraint: '',
|
constraint: '',
|
||||||
automatic: false,
|
automatic: false,
|
||||||
isNew: true
|
isNew: true
|
||||||
@@ -438,6 +478,7 @@ export class LdnServiceFormEditComponent implements OnInit {
|
|||||||
private initializeOutboundPatternFormGroup(): FormGroup {
|
private initializeOutboundPatternFormGroup(): FormGroup {
|
||||||
return this.formBuilder.group({
|
return this.formBuilder.group({
|
||||||
pattern: '',
|
pattern: '',
|
||||||
|
patternLabel: '',
|
||||||
constraint: '',
|
constraint: '',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -445,6 +486,7 @@ export class LdnServiceFormEditComponent implements OnInit {
|
|||||||
private initializeInboundPatternFormGroup(): FormGroup {
|
private initializeInboundPatternFormGroup(): FormGroup {
|
||||||
return this.formBuilder.group({
|
return this.formBuilder.group({
|
||||||
pattern: '',
|
pattern: '',
|
||||||
|
patternLabel: '',
|
||||||
constraint: '',
|
constraint: '',
|
||||||
automatic: '',
|
automatic: '',
|
||||||
});
|
});
|
||||||
|
@@ -59,12 +59,14 @@
|
|||||||
<div class="col">
|
<div class="col">
|
||||||
<label>{{ 'ldn-new-service.form.label.inboundPattern' | translate }} </label>
|
<label>{{ 'ldn-new-service.form.label.inboundPattern' | translate }} </label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<ng-container *ngIf="!!(formModel.get('notifyServiceInboundPatterns')['controls'][0]?.value?.pattern)">
|
||||||
<label>{{ 'ldn-new-service.form.label.ItemFilter' | translate }}</label>
|
<div class="col">
|
||||||
</div>
|
<label>{{ 'ldn-new-service.form.label.ItemFilter' | translate }}</label>
|
||||||
<div class="col-sm-1 ">
|
</div>
|
||||||
<label class="">{{ 'ldn-new-service.form.label.automatic' | translate }}</label>
|
<div class="col-sm-1">
|
||||||
</div>
|
<label class="">{{ 'ldn-new-service.form.label.automatic' | translate }}</label>
|
||||||
|
</div>
|
||||||
|
</ng-container>
|
||||||
<div class="col-sm-1">
|
<div class="col-sm-1">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -77,7 +79,8 @@
|
|||||||
|
|
||||||
<div class="row mb-1">
|
<div class="row mb-1">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<div #inboundPatternDropdown="ngbDropdown" class="w-100" id="additionalInboundPattern{{i}}" ngbDropdown>
|
<div #inboundPatternDropdown="ngbDropdown" class="w-100" id="additionalInboundPattern{{i}}" ngbDropdown
|
||||||
|
placement="bottom">
|
||||||
<div class="position-relative right-addon" role="combobox">
|
<div class="position-relative right-addon" role="combobox">
|
||||||
<i aria-hidden="true" class="position-absolute scrollable-dropdown-toggle"
|
<i aria-hidden="true" class="position-absolute scrollable-dropdown-toggle"
|
||||||
ngbDropdownToggle>
|
ngbDropdownToggle>
|
||||||
@@ -88,7 +91,7 @@
|
|||||||
[readonly]="true"
|
[readonly]="true"
|
||||||
[value]="selectedInboundPatterns"
|
[value]="selectedInboundPatterns"
|
||||||
class="form-control w-100 scrollable-dropdown-input"
|
class="form-control w-100 scrollable-dropdown-input"
|
||||||
formControlName="pattern"
|
formControlName="patternLabel"
|
||||||
id="inboundPatternDropdownButton"
|
id="inboundPatternDropdownButton"
|
||||||
ngbDropdownAnchor
|
ngbDropdownAnchor
|
||||||
type="text"
|
type="text"
|
||||||
@@ -111,7 +114,8 @@
|
|||||||
|
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<ng-container *ngIf="!!(formModel.get('notifyServiceInboundPatterns')['controls'][i].value.pattern)">
|
<ng-container *ngIf="!!(formModel.get('notifyServiceInboundPatterns')['controls'][i].value.pattern)">
|
||||||
<div #inboundItemfilterDropdown="ngbDropdown" class="w-100" id="constraint{{i}}" ngbDropdown>
|
<div #inboundItemfilterDropdown="ngbDropdown" class="w-100" id="constraint{{i}}" ngbDropdown
|
||||||
|
placement="bottom">
|
||||||
<div class="position-relative right-addon" role="combobox">
|
<div class="position-relative right-addon" role="combobox">
|
||||||
<i aria-hidden="true" class="position-absolute scrollable-dropdown-toggle"
|
<i aria-hidden="true" class="position-absolute scrollable-dropdown-toggle"
|
||||||
ngbDropdownToggle></i>
|
ngbDropdownToggle></i>
|
||||||
@@ -125,10 +129,6 @@
|
|||||||
ngbDropdownAnchor
|
ngbDropdownAnchor
|
||||||
type="text"
|
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 -->
|
<!-- TODO: infinite scroll with 3 selects -->
|
||||||
<div aria-labelledby="inboundItemfilterDropdownButton" ngbDropdownMenu>
|
<div aria-labelledby="inboundItemfilterDropdownButton" ngbDropdownMenu>
|
||||||
<button (click)="selectInboundItemFilter(constraint.id, i); $event.stopPropagation()"
|
<button (click)="selectInboundItemFilter(constraint.id, i); $event.stopPropagation()"
|
||||||
@@ -178,9 +178,11 @@
|
|||||||
<div class="col">
|
<div class="col">
|
||||||
<label>{{ 'ldn-new-service.form.label.outboundPattern' | translate }}</label>
|
<label>{{ 'ldn-new-service.form.label.outboundPattern' | translate }}</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<ng-container *ngIf="!!(formModel.get('notifyServiceOutboundPatterns')['controls'][0]?.value?.pattern)">
|
||||||
<label class="">{{ 'ldn-new-service.form.label.ItemFilter' | translate }}</label>
|
<div class="col">
|
||||||
</div>
|
<label class="">{{ 'ldn-new-service.form.label.ItemFilter' | translate }}</label>
|
||||||
|
</div>
|
||||||
|
</ng-container>
|
||||||
<div class="col-sm-1 ">
|
<div class="col-sm-1 ">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-1 ">
|
<div class="col-sm-1 ">
|
||||||
@@ -195,7 +197,8 @@
|
|||||||
<!-- Input elements in a separate row -->
|
<!-- Input elements in a separate row -->
|
||||||
<div class="row mb-1">
|
<div class="row mb-1">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<div #outboundPatternDropdown="ngbDropdown" class="w-100" id="additionalOutboundPattern{{i}}" ngbDropdown>
|
<div #outboundPatternDropdown="ngbDropdown" class="w-100" id="additionalOutboundPattern{{i}}" ngbDropdown
|
||||||
|
placement="bottom">
|
||||||
<div class="position-relative right-addon" role="combobox">
|
<div class="position-relative right-addon" role="combobox">
|
||||||
<i aria-hidden="true" class="position-absolute scrollable-dropdown-toggle"
|
<i aria-hidden="true" class="position-absolute scrollable-dropdown-toggle"
|
||||||
ngbDropdownToggle></i>
|
ngbDropdownToggle></i>
|
||||||
@@ -204,16 +207,11 @@
|
|||||||
[readonly]="true"
|
[readonly]="true"
|
||||||
[value]="selectedOutboundPatterns"
|
[value]="selectedOutboundPatterns"
|
||||||
class="form-control w-100 scrollable-dropdown-input"
|
class="form-control w-100 scrollable-dropdown-input"
|
||||||
formControlName="pattern"
|
formControlName="patternLabel"
|
||||||
id="outboundPatternDropdownButton"
|
id="outboundPatternDropdownButton"
|
||||||
ngbDropdownAnchor
|
ngbDropdownAnchor
|
||||||
type="text"
|
type="text"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- Main label TODO: remove after developing done cause it will pick the selected value to show -->
|
|
||||||
<div>{{ selectedOutboundPatterns ? ('ldn-service.form.pattern.' + selectedOutboundPatterns + '.label' | translate) : ('ldn-new-service.form.label.placeholder.outboundPattern' | translate) }}</div>
|
|
||||||
<div
|
|
||||||
class="small-text">{{ selectedOutboundPatterns ? ('ldn-service.form.pattern.' + selectedOutboundPatterns + '.description' | translate) : ('' | translate) }}</div>
|
|
||||||
<!-- TODO: infinite scroll with 3 selects -->
|
<!-- TODO: infinite scroll with 3 selects -->
|
||||||
<div aria-labelledby="outboundPatternDropdownButton" ngbDropdownMenu>
|
<div aria-labelledby="outboundPatternDropdownButton" ngbDropdownMenu>
|
||||||
<button (click)="selectOutboundPattern(pattern, i); $event.stopPropagation()"
|
<button (click)="selectOutboundPattern(pattern, i); $event.stopPropagation()"
|
||||||
@@ -230,7 +228,8 @@
|
|||||||
|
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<ng-container *ngIf="!!(formModel.get('notifyServiceOutboundPatterns')['controls'][i].value.pattern)">
|
<ng-container *ngIf="!!(formModel.get('notifyServiceOutboundPatterns')['controls'][i].value.pattern)">
|
||||||
<div #outboundItemfilterDropdown="ngbDropdown" class="w-100" id="constraint{{i}}" ngbDropdown>
|
<div #outboundItemfilterDropdown="ngbDropdown" class="w-100" id="constraint{{i}}" ngbDropdown
|
||||||
|
placement="bottom">
|
||||||
<div class="position-relative right-addon" role="combobox">
|
<div class="position-relative right-addon" role="combobox">
|
||||||
<i aria-hidden="true" class="position-absolute scrollable-dropdown-toggle"
|
<i aria-hidden="true" class="position-absolute scrollable-dropdown-toggle"
|
||||||
ngbDropdownToggle></i>
|
ngbDropdownToggle></i>
|
||||||
|
@@ -4,7 +4,10 @@
|
|||||||
form {
|
form {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type="text"],
|
input[type="text"],
|
||||||
@@ -105,18 +108,6 @@ textarea {
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.label-box {
|
|
||||||
margin-left: 11px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.label-box-2 {
|
|
||||||
margin-left: 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.label-box-3 {
|
|
||||||
margin-left: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
form button.btn.btn-primary[type="submit"] {
|
form button.btn.btn-primary[type="submit"] {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
|
@@ -127,12 +127,21 @@ export class LdnServiceFormComponent implements OnInit {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.formModel.value.notifyServiceInboundPatterns = this.formModel.value.notifyServiceInboundPatterns.filter((pattern: {
|
this.formModel.value.notifyServiceInboundPatterns = this.formModel.value.notifyServiceInboundPatterns.map((pattern: {
|
||||||
pattern: string;
|
pattern: string;
|
||||||
}) => pattern.pattern !== '');
|
patternLabel: string
|
||||||
this.formModel.value.notifyServiceOutboundPatterns = this.formModel.value.notifyServiceOutboundPatterns.filter((pattern: {
|
}) => {
|
||||||
|
const {patternLabel, ...rest} = pattern;
|
||||||
|
return rest;
|
||||||
|
});
|
||||||
|
|
||||||
|
this.formModel.value.notifyServiceOutboundPatterns = this.formModel.value.notifyServiceOutboundPatterns.map((pattern: {
|
||||||
pattern: string;
|
pattern: string;
|
||||||
}) => pattern.pattern !== '');
|
patternLabel: string
|
||||||
|
}) => {
|
||||||
|
const {patternLabel, ...rest} = pattern;
|
||||||
|
return rest;
|
||||||
|
});
|
||||||
|
|
||||||
const values = this.formModel.value;
|
const values = this.formModel.value;
|
||||||
|
|
||||||
@@ -191,20 +200,21 @@ export class LdnServiceFormComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
selectOutboundPattern(patternValue: string, index: number): void {
|
selectOutboundPattern(patternValue: string, index: number): void {
|
||||||
// this.selectedOutboundPatterns = patternValue;
|
const patternArray = (this.formModel.get('notifyServiceOutboundPatterns') as FormArray)
|
||||||
const patternArray = (this.formModel.get('notifyServiceOutboundPatterns') as FormArray).controls[index]
|
|
||||||
console.log((this.formModel.get('notifyServiceOutboundPatterns') as FormArray))
|
console.log((this.formModel.get('notifyServiceOutboundPatterns') as FormArray))
|
||||||
patternArray.patchValue({pattern: patternValue})
|
patternArray.controls[index].patchValue({pattern: patternValue})
|
||||||
//console.log(patternArray);
|
patternArray.controls[index].patchValue({patternLabel: this.translateService.instant('ldn-service.form.pattern.' + patternValue + '.label')})
|
||||||
//this.getPatternControlNames(index)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
selectInboundPattern(patternValue: string, index: number): void {
|
selectInboundPattern(patternValue: string, index: number): void {
|
||||||
// this.selectedOutboundPatterns = patternValue;
|
const patternArray = (this.formModel.get('notifyServiceInboundPatterns') as FormArray)
|
||||||
const patternArray = (this.formModel.get('notifyServiceInboundPatterns') as FormArray).controls[index]
|
|
||||||
console.log((this.formModel.get('notifyServiceInboundPatterns') as FormArray))
|
console.log((this.formModel.get('notifyServiceInboundPatterns') as FormArray))
|
||||||
patternArray.patchValue({pattern: patternValue})
|
patternArray.controls[index].patchValue({pattern: patternValue})
|
||||||
|
patternArray.controls[index].patchValue({patternLabel: this.translateService.instant('ldn-service.form.pattern.' + patternValue + '.label')})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
selectInboundItemFilter(filterValue: string, index: number): void {
|
selectInboundItemFilter(filterValue: string, index: number): void {
|
||||||
@@ -228,6 +238,7 @@ export class LdnServiceFormComponent implements OnInit {
|
|||||||
return this.formBuilder.group({
|
return this.formBuilder.group({
|
||||||
pattern: [''],
|
pattern: [''],
|
||||||
constraint: [''],
|
constraint: [''],
|
||||||
|
patternLabel: 'Select a Pattern',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -235,7 +246,8 @@ export class LdnServiceFormComponent implements OnInit {
|
|||||||
return this.formBuilder.group({
|
return this.formBuilder.group({
|
||||||
pattern: [''],
|
pattern: [''],
|
||||||
constraint: [''],
|
constraint: [''],
|
||||||
automatic: false
|
automatic: false,
|
||||||
|
patternLabel: 'Select a Pattern',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user