mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
CST-12455 Code refactor and new dropdowns implementation
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { I18nBreadcrumbResolver } from 'src/app/core/breadcrumbs/i18n-breadcrumb.resolver';
|
||||
import { LdnServicesOverviewComponent } from './ldn-services-directory/ldn-services-directory.component';
|
||||
import { LdnServiceNewComponent } from './ldn-service-new/ldn-service-new.component';
|
||||
import { LdnServiceFormEditComponent } from './ldn-service-form-edit/ldn-service-form-edit.component';
|
||||
import {NgModule} from '@angular/core';
|
||||
import {RouterModule} from '@angular/router';
|
||||
import {I18nBreadcrumbResolver} from 'src/app/core/breadcrumbs/i18n-breadcrumb.resolver';
|
||||
import {LdnServicesOverviewComponent} from './ldn-services-directory/ldn-services-directory.component';
|
||||
import {LdnServiceNewComponent} from './ldn-service-new/ldn-service-new.component';
|
||||
import {LdnServiceFormEditComponent} from './ldn-service-form-edit/ldn-service-form-edit.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
@@ -1,13 +1,13 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { AdminLdnServicesRoutingModule } from './admin-ldn-services-routing.module';
|
||||
import { LdnServicesOverviewComponent } from './ldn-services-directory/ldn-services-directory.component';
|
||||
import { SharedModule } from '../../shared/shared.module';
|
||||
import { LdnServiceNewComponent } from './ldn-service-new/ldn-service-new.component';
|
||||
import { LdnServiceFormComponent } from './ldn-service-form/ldn-service-form.component';
|
||||
import { LdnServiceFormEditComponent } from './ldn-service-form-edit/ldn-service-form-edit.component';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { LdnItemfiltersService } from './ldn-services-data/ldn-itemfilters-data.service';
|
||||
import {NgModule} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {AdminLdnServicesRoutingModule} from './admin-ldn-services-routing.module';
|
||||
import {LdnServicesOverviewComponent} from './ldn-services-directory/ldn-services-directory.component';
|
||||
import {SharedModule} from '../../shared/shared.module';
|
||||
import {LdnServiceNewComponent} from './ldn-service-new/ldn-service-new.component';
|
||||
import {LdnServiceFormComponent} from './ldn-service-form/ldn-service-form.component';
|
||||
import {LdnServiceFormEditComponent} from './ldn-service-form-edit/ldn-service-form-edit.component';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {LdnItemfiltersService} from './ldn-services-data/ldn-itemfilters-data.service';
|
||||
|
||||
|
||||
@NgModule({
|
||||
|
@@ -87,7 +87,8 @@
|
||||
|
||||
<div class="row mb-1">
|
||||
<div class="col">
|
||||
<div #inboundPatternDropdown="ngbDropdown" class="w-100" id="additionalInboundPattern{{i}}" ngbDropdown>
|
||||
<div #inboundPatternDropdown="ngbDropdown" class="w-80" display="dynamic" id="additionalInboundPattern{{i}}"
|
||||
ngbDropdown placement="bottom">
|
||||
<div class="position-relative right-addon" role="combobox">
|
||||
<i aria-hidden="true" class="position-absolute scrollable-dropdown-toggle"
|
||||
ngbDropdownToggle></i>
|
||||
@@ -95,17 +96,12 @@
|
||||
(click)="inboundPatternDropdown.open();"
|
||||
[readonly]="true"
|
||||
[value]="selectedInboundPatterns"
|
||||
class="form-control w-100 scrollable-dropdown-input"
|
||||
class="form-control w-80 scrollable-dropdown-input"
|
||||
formControlName="pattern"
|
||||
id="inboundPatternDropdownButton"
|
||||
ngbDropdownAnchor
|
||||
type="text"
|
||||
/>
|
||||
|
||||
<!-- Main label TODO: remove after developing done cause it will pick the selected value to show -->
|
||||
<div>{{ selectedInboundPatterns ? ('ldn-service.form.pattern.' + selectedInboundPatterns + '.label' | translate) : ('ldn-new-service.form.label.placeholder.inboundPattern' | translate) }}</div>
|
||||
<div
|
||||
class="small-text">{{ selectedInboundPatterns ? ('ldn-service.form.pattern.' + selectedInboundPatterns + '.description' | translate) : ('' | translate) }}</div>
|
||||
<!-- TODO: infinite scroll with 3 selects -->
|
||||
<div aria-labelledby="inboundPatternDropdownButton" ngbDropdownMenu>
|
||||
<button (click)="selectInboundPattern(pattern, i); $event.stopPropagation()"
|
||||
@@ -137,10 +133,6 @@
|
||||
ngbDropdownAnchor
|
||||
type="text"
|
||||
/>
|
||||
|
||||
<div>{{ selectedInboundItemfilters ? ('ldn-service.form.pattern.' + selectedInboundItemfilters + '.label' | translate) : ('ldn-new-service.form.label.placeholder.outboundPattern' | 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()"
|
||||
@@ -266,10 +258,6 @@
|
||||
ngbDropdownAnchor
|
||||
type="text"
|
||||
/>
|
||||
|
||||
<div>{{ selectedOutboundItemfilters ? ('ldn-service.form.pattern.' + selectedOutboundItemfilters + '.label' | translate) : ('ldn-new-service.form.label.placeholder.outboundPattern' | translate) }}</div>
|
||||
<div
|
||||
class="small-text">{{ selectedOutboundItemfilters ? ('ldn-service.form.pattern.' + selectedOutboundItemfilters + '.description' | translate) : ('' | translate) }}</div>
|
||||
<!-- TODO: infinite scroll with 3 selects -->
|
||||
<div aria-labelledby="outboundItemfilterDropdownButton" ngbDropdownMenu>
|
||||
<button (click)="selectOutboundItemFilter(constraint.id, i); $event.stopPropagation()"
|
||||
|
@@ -99,6 +99,7 @@ textarea {
|
||||
font-size: 0.7em;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
.toggle-switch {
|
||||
cursor: pointer;
|
||||
margin-top: 3px;
|
||||
|
@@ -1,21 +1,21 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
|
||||
import { LdnServiceFormEditComponent } from './ldn-service-form-edit.component';
|
||||
import { ChangeDetectorRef, EventEmitter } from '@angular/core';
|
||||
import { ReactiveFormsModule, FormBuilder } from '@angular/forms';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { TranslateModule, TranslateService } from '@ngx-translate/core';
|
||||
import { PaginationService } from 'ngx-pagination';
|
||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||
import { LdnItemfiltersService } from '../ldn-services-data/ldn-itemfilters-data.service';
|
||||
import { LdnServicesService } from '../ldn-services-data/ldn-services-data.service';
|
||||
import { RouterStub } from '../../../shared/testing/router.stub';
|
||||
import { MockActivatedRoute } from '../../../shared/mocks/active-router.mock';
|
||||
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub';
|
||||
import { of } from 'rxjs';
|
||||
import { RouteService } from '../../../core/services/route.service';
|
||||
import { provideMockStore } from '@ngrx/store/testing';
|
||||
import {LdnServiceFormEditComponent} from './ldn-service-form-edit.component';
|
||||
import {ChangeDetectorRef, EventEmitter} from '@angular/core';
|
||||
import {FormBuilder, ReactiveFormsModule} from '@angular/forms';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {NgbModal} from '@ng-bootstrap/ng-bootstrap';
|
||||
import {TranslateModule, TranslateService} from '@ngx-translate/core';
|
||||
import {PaginationService} from 'ngx-pagination';
|
||||
import {NotificationsService} from '../../../shared/notifications/notifications.service';
|
||||
import {LdnItemfiltersService} from '../ldn-services-data/ldn-itemfilters-data.service';
|
||||
import {LdnServicesService} from '../ldn-services-data/ldn-services-data.service';
|
||||
import {RouterStub} from '../../../shared/testing/router.stub';
|
||||
import {MockActivatedRoute} from '../../../shared/mocks/active-router.mock';
|
||||
import {NotificationsServiceStub} from '../../../shared/testing/notifications-service.stub';
|
||||
import {of} from 'rxjs';
|
||||
import {RouteService} from '../../../core/services/route.service';
|
||||
import {provideMockStore} from '@ngrx/store/testing';
|
||||
|
||||
describe('LdnServiceFormEditComponent', () => {
|
||||
let component: LdnServiceFormEditComponent;
|
||||
@@ -52,18 +52,18 @@ describe('LdnServiceFormEditComponent', () => {
|
||||
imports: [ReactiveFormsModule, TranslateModule.forRoot()],
|
||||
declarations: [LdnServiceFormEditComponent],
|
||||
providers: [
|
||||
{ provide: LdnServicesService, useValue: ldnServicesService },
|
||||
{ provide: LdnItemfiltersService, useValue: ldnItemfiltersService },
|
||||
{ provide: Router, useValue: new RouterStub() },
|
||||
{ provide: ActivatedRoute, useValue: new MockActivatedRoute() },
|
||||
{ provide: ChangeDetectorRef, useValue: cdRefStub },
|
||||
{ provide: NgbModal, useValue: modalService },
|
||||
{ provide: NotificationsService, useValue: NotificationsServiceStub },
|
||||
{ provide: TranslateService, useValue: translateServiceStub },
|
||||
{ provide: PaginationService, useValue: {} },
|
||||
{provide: LdnServicesService, useValue: ldnServicesService},
|
||||
{provide: LdnItemfiltersService, useValue: ldnItemfiltersService},
|
||||
{provide: Router, useValue: new RouterStub()},
|
||||
{provide: ActivatedRoute, useValue: new MockActivatedRoute()},
|
||||
{provide: ChangeDetectorRef, useValue: cdRefStub},
|
||||
{provide: NgbModal, useValue: modalService},
|
||||
{provide: NotificationsService, useValue: NotificationsServiceStub},
|
||||
{provide: TranslateService, useValue: translateServiceStub},
|
||||
{provide: PaginationService, useValue: {}},
|
||||
FormBuilder,
|
||||
RouteService,
|
||||
provideMockStore({ }),
|
||||
provideMockStore({}),
|
||||
]
|
||||
})
|
||||
.compileComponents();
|
||||
|
@@ -202,13 +202,9 @@ export class LdnServiceFormEditComponent implements OnInit {
|
||||
|
||||
|
||||
selectOutboundPattern(patternValue: string, index: number): void {
|
||||
// this.selectedOutboundPatterns = patternValue;
|
||||
const patternArray = (this.formModel.get('notifyServiceOutboundPatterns') as FormArray)
|
||||
console.log((this.formModel.get('notifyServiceOutboundPatterns') as FormArray))
|
||||
patternArray.controls[index].patchValue({pattern: patternValue})
|
||||
|
||||
//console.log(patternArray);
|
||||
//this.getPatternControlNames(index)
|
||||
}
|
||||
|
||||
selectOutboundItemFilter(filterValue: string, index: number) {
|
||||
@@ -218,42 +214,17 @@ export class LdnServiceFormEditComponent implements OnInit {
|
||||
}
|
||||
|
||||
selectInboundPattern(patternValue: string, index: number): void {
|
||||
// this.selectedOutboundPatterns = patternValue;
|
||||
const patternArray = (this.formModel.get('notifyServiceInboundPatterns') as FormArray)
|
||||
console.log((this.formModel.get('notifyServiceInboundPatterns') as FormArray))
|
||||
patternArray.controls[index].patchValue({pattern: patternValue})
|
||||
|
||||
//console.log(patternArray);
|
||||
//this.getPatternControlNames(index)
|
||||
}
|
||||
|
||||
selectInboundItemFilter(filterValue: string, index: number): void {
|
||||
// this.selectedOutboundPatterns = patternValue;
|
||||
const filterArray = (this.formModel.get('notifyServiceInboundPatterns') as FormArray)
|
||||
console.log((this.formModel.get('notifyServiceInboundPatterns') as FormArray))
|
||||
filterArray.controls[index].patchValue({constraint: filterValue})
|
||||
|
||||
//console.log(patternArray);
|
||||
//this.getPatternControlNames(index)
|
||||
}
|
||||
|
||||
|
||||
getOutboundPatternControlNames(index: number) {
|
||||
const patternArrayValue = (this.formModel.get('notifyServiceOutboundPatterns') as FormArray).controls[index]?.value
|
||||
console.log(patternArrayValue)
|
||||
return patternArrayValue
|
||||
}
|
||||
|
||||
getInboundPatternControlNames(index: number) {
|
||||
const patternArrayValue = (this.formModel.get('notifyServiceInboundPatterns') as FormArray).controls[index]?.value
|
||||
console.log(patternArrayValue)
|
||||
return patternArrayValue
|
||||
|
||||
}
|
||||
|
||||
//TODO: make a method that checks if user selected one value for the
|
||||
|
||||
|
||||
toggleAutomatic(i: number) {
|
||||
const automaticControl = this.formModel.get(`notifyServiceInboundPatterns.${i}.automatic`);
|
||||
if (automaticControl) {
|
||||
@@ -478,12 +449,4 @@ export class LdnServiceFormEditComponent implements OnInit {
|
||||
automatic: '',
|
||||
});
|
||||
}
|
||||
|
||||
//setValueForControlInOutboundArray(formArrayName: string, index: number, value: string) {
|
||||
// const formArray = this.formModel.get(formArrayName) as FormArray;
|
||||
//console.warn('inside setValueForControlInOutboundArray', formArray);
|
||||
//formArray.at(index).setValue(value);
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -77,31 +77,31 @@
|
||||
|
||||
<div class="row mb-1">
|
||||
<div class="col">
|
||||
<div ngbDropdown #inboundPatternDropdown="ngbDropdown" class="w-100" id="additionalInboundPattern{{i}}">
|
||||
<div #inboundPatternDropdown="ngbDropdown" class="w-100" id="additionalInboundPattern{{i}}" ngbDropdown>
|
||||
<div class="position-relative right-addon" role="combobox">
|
||||
<i ngbDropdownToggle class="position-absolute scrollable-dropdown-toggle"
|
||||
aria-hidden="true">
|
||||
<i aria-hidden="true" class="position-absolute scrollable-dropdown-toggle"
|
||||
ngbDropdownToggle>
|
||||
|
||||
</i>
|
||||
<input
|
||||
formControlName="pattern"
|
||||
type="text"
|
||||
[readonly]="true"
|
||||
ngbDropdownAnchor
|
||||
class="form-control w-100 scrollable-dropdown-input"
|
||||
[value]="selectedInboundPatterns"
|
||||
(click)="inboundPatternDropdown.open();"
|
||||
[readonly]="true"
|
||||
[value]="selectedInboundPatterns"
|
||||
class="form-control w-100 scrollable-dropdown-input"
|
||||
formControlName="pattern"
|
||||
id="inboundPatternDropdownButton"
|
||||
ngbDropdownAnchor
|
||||
type="text"
|
||||
/>
|
||||
|
||||
<!-- Main label TODO: remove after developing done cause it will pick the selected value to show -->
|
||||
<div>{{ selectedInboundPatterns ? ('ldn-service.form.pattern.' + selectedInboundPatterns + '.label' | translate) : ('ldn-new-service.form.label.placeholder.inboundPattern' | translate) }}</div>
|
||||
<div class="small-text">{{ selectedInboundPatterns ? ('ldn-service.form.pattern.' + selectedInboundPatterns + '.description' | translate) : ('' | translate) }}</div>
|
||||
<!-- TODO: infinite scroll with 3 selects -->
|
||||
<div ngbDropdownMenu aria-labelledby="inboundPatternDropdownButton">
|
||||
<button type="button" ngbDropdownItem *ngFor="let pattern of outboundPatterns; let internalIndex = index" (click)="selectInboundPattern(pattern, i); $event.stopPropagation()">
|
||||
<div>{{ 'ldn-service.form.pattern.'+pattern+'.label' | translate }}</div>
|
||||
<div class="small-text">{{ 'ldn-service.form.pattern.'+pattern+'.description' | translate }}</div>
|
||||
<div aria-labelledby="inboundPatternDropdownButton" ngbDropdownMenu>
|
||||
<button (click)="selectInboundPattern(pattern, i); $event.stopPropagation()"
|
||||
*ngFor="let pattern of inboundPatterns; let internalIndex = index"
|
||||
ngbDropdownItem
|
||||
type="button">
|
||||
<div>{{ 'ldn-service.form.pattern.' + pattern + '.label' | translate }}</div>
|
||||
<div
|
||||
class="small-text">{{ 'ldn-service.form.pattern.' + pattern + '.description' | translate }}</div>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -143,7 +143,9 @@
|
||||
</ng-container>
|
||||
</div>
|
||||
|
||||
<div [style.visibility]="formModel.get('notifyServiceInboundPatterns')['controls'][i]?.value?.pattern ? '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}}"
|
||||
type="checkbox">
|
||||
<div (click)="toggleAutomatic(i)"
|
||||
@@ -193,29 +195,33 @@
|
||||
<!-- Input elements in a separate row -->
|
||||
<div class="row mb-1">
|
||||
<div class="col">
|
||||
<div ngbDropdown #outboundPatternDropdown="ngbDropdown" class="w-100" id="additionalOutboundPattern{{i}}">
|
||||
<div #outboundPatternDropdown="ngbDropdown" class="w-100" id="additionalOutboundPattern{{i}}" ngbDropdown>
|
||||
<div class="position-relative right-addon" role="combobox">
|
||||
<i ngbDropdownToggle class="position-absolute scrollable-dropdown-toggle"
|
||||
aria-hidden="true"></i>
|
||||
<i aria-hidden="true" class="position-absolute scrollable-dropdown-toggle"
|
||||
ngbDropdownToggle></i>
|
||||
<input
|
||||
formControlName="pattern"
|
||||
type="text"
|
||||
[readonly]="true"
|
||||
ngbDropdownAnchor
|
||||
class="form-control w-100 scrollable-dropdown-input"
|
||||
[value]="selectedOutboundPatterns"
|
||||
(click)="outboundPatternDropdown.open();"
|
||||
[readonly]="true"
|
||||
[value]="selectedOutboundPatterns"
|
||||
class="form-control w-100 scrollable-dropdown-input"
|
||||
formControlName="pattern"
|
||||
id="outboundPatternDropdownButton"
|
||||
ngbDropdownAnchor
|
||||
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>
|
||||
<div
|
||||
class="small-text">{{ selectedOutboundPatterns ? ('ldn-service.form.pattern.' + selectedOutboundPatterns + '.description' | translate) : ('' | translate) }}</div>
|
||||
<!-- TODO: infinite scroll with 3 selects -->
|
||||
<div ngbDropdownMenu aria-labelledby="outboundPatternDropdownButton">
|
||||
<button type="button" ngbDropdownItem *ngFor="let pattern of outboundPatterns" (click)="selectOutboundPattern(pattern, i); $event.stopPropagation()">
|
||||
<div>{{ 'ldn-service.form.pattern.'+pattern+'.label' | translate }}</div>
|
||||
<div class="small-text">{{ 'ldn-service.form.pattern.'+pattern+'.description' | translate }}</div>
|
||||
<div aria-labelledby="outboundPatternDropdownButton" ngbDropdownMenu>
|
||||
<button (click)="selectOutboundPattern(pattern, i); $event.stopPropagation()"
|
||||
*ngFor="let pattern of outboundPatterns" ngbDropdownItem
|
||||
type="button">
|
||||
<div>{{ 'ldn-service.form.pattern.' + pattern + '.label' | translate }}</div>
|
||||
<div
|
||||
class="small-text">{{ 'ldn-service.form.pattern.' + pattern + '.description' | translate }}</div>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -1,20 +1,20 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
|
||||
import { LdnServiceFormComponent } from './ldn-service-form.component';
|
||||
import { FormBuilder, ReactiveFormsModule } from '@angular/forms';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { NgbModal, NgbModalModule } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { TranslateModule, TranslateService } from '@ngx-translate/core';
|
||||
import { LdnItemfiltersService } from '../ldn-services-data/ldn-itemfilters-data.service';
|
||||
import { LdnServicesService } from '../ldn-services-data/ldn-services-data.service';
|
||||
import { NotificationsService } from 'src/app/shared/notifications/notifications.service';
|
||||
import { Router } from '@angular/router';
|
||||
import { RouterStub } from 'src/app/shared/testing/router.stub';
|
||||
import { createPaginatedList } from 'src/app/shared/testing/utils.test';
|
||||
import { Itemfilter } from '../ldn-services-model/ldn-service-itemfilters';
|
||||
import { createSuccessfulRemoteDataObject$ } from 'src/app/shared/remote-data.utils';
|
||||
import { of } from 'rxjs';
|
||||
import { EventEmitter } from '@angular/core';
|
||||
import {LdnServiceFormComponent} from './ldn-service-form.component';
|
||||
import {FormBuilder, ReactiveFormsModule} from '@angular/forms';
|
||||
import {RouterTestingModule} from '@angular/router/testing';
|
||||
import {NgbModal, NgbModalModule} from '@ng-bootstrap/ng-bootstrap';
|
||||
import {TranslateModule, TranslateService} from '@ngx-translate/core';
|
||||
import {LdnItemfiltersService} from '../ldn-services-data/ldn-itemfilters-data.service';
|
||||
import {LdnServicesService} from '../ldn-services-data/ldn-services-data.service';
|
||||
import {NotificationsService} from 'src/app/shared/notifications/notifications.service';
|
||||
import {Router} from '@angular/router';
|
||||
import {RouterStub} from 'src/app/shared/testing/router.stub';
|
||||
import {createPaginatedList} from 'src/app/shared/testing/utils.test';
|
||||
import {Itemfilter} from '../ldn-services-model/ldn-service-itemfilters';
|
||||
import {createSuccessfulRemoteDataObject$} from 'src/app/shared/remote-data.utils';
|
||||
import {of} from 'rxjs';
|
||||
import {EventEmitter} from '@angular/core';
|
||||
|
||||
describe('LdnServiceFormComponent', () => {
|
||||
let component: LdnServiceFormComponent;
|
||||
@@ -54,12 +54,17 @@ describe('LdnServiceFormComponent', () => {
|
||||
TranslateModule.forRoot()
|
||||
],
|
||||
providers: [
|
||||
{ provide: LdnItemfiltersService, useValue: ldnItemfiltersService },
|
||||
{ provide: LdnServicesService, useValue: ldnServicesService },
|
||||
{ provide: NotificationsService, useValue: notificationsService },
|
||||
{ provide: TranslateService, useValue: translateServiceStub },
|
||||
{ provide: Router, useValue: new RouterStub() },
|
||||
{ provide: NgbModal, useValue: { open: () => {/*comment*/ } } },
|
||||
{provide: LdnItemfiltersService, useValue: ldnItemfiltersService},
|
||||
{provide: LdnServicesService, useValue: ldnServicesService},
|
||||
{provide: NotificationsService, useValue: notificationsService},
|
||||
{provide: TranslateService, useValue: translateServiceStub},
|
||||
{provide: Router, useValue: new RouterStub()},
|
||||
{
|
||||
provide: NgbModal, useValue: {
|
||||
open: () => {/*comment*/
|
||||
}
|
||||
}
|
||||
},
|
||||
FormBuilder
|
||||
],
|
||||
declarations: [LdnServiceFormComponent]
|
||||
|
@@ -36,8 +36,6 @@ export class LdnServiceFormComponent implements OnInit {
|
||||
formModel: FormGroup;
|
||||
@ViewChild('confirmModal', {static: true}) confirmModal: TemplateRef<any>;
|
||||
@ViewChild('resetFormModal', {static: true}) resetFormModal: TemplateRef<any>;
|
||||
//public inboundPatterns: object[] = notifyPatterns;
|
||||
//public outboundPatterns: object[] = notifyPatterns;
|
||||
public inboundPatterns: string[] = notifyPatterns;
|
||||
public outboundPatterns: string[] = notifyPatterns;
|
||||
itemfiltersRD$: Observable<RemoteData<PaginatedList<Itemfilter>>>;
|
||||
@@ -207,18 +205,12 @@ export class LdnServiceFormComponent implements OnInit {
|
||||
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)
|
||||
}
|
||||
|
||||
selectInboundItemFilter(filterValue: string, index: number): void {
|
||||
// this.selectedOutboundPatterns = patternValue;
|
||||
const filterArray = (this.formModel.get('notifyServiceInboundPatterns') as FormArray)
|
||||
console.log((this.formModel.get('notifyServiceInboundPatterns') as FormArray))
|
||||
filterArray.controls[index].patchValue({constraint: filterValue})
|
||||
|
||||
//console.log(patternArray);
|
||||
//this.getPatternControlNames(index)
|
||||
}
|
||||
|
||||
selectOutboundItemFilter(filterValue: string, index: number) {
|
||||
@@ -227,19 +219,10 @@ export class LdnServiceFormComponent implements OnInit {
|
||||
filterArray.controls[index].patchValue({constraint: filterValue})
|
||||
}
|
||||
|
||||
getPatternControlNames(index: number) {
|
||||
const patternArrayValue = (this.formModel.get('notifyServiceOutboundPatterns') as FormArray).controls[index].value
|
||||
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({
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
|
||||
import { LdnServiceNewComponent } from './ldn-service-new.component';
|
||||
import {LdnServiceNewComponent} from './ldn-service-new.component';
|
||||
|
||||
describe('LdnServiceNewComponent', () => {
|
||||
let component: LdnServiceNewComponent;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { Component } from '@angular/core';
|
||||
import {Component} from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-ldn-service-new',
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { LdnService } from '../ldn-services-model/ldn-services.model';
|
||||
import { LDN_SERVICE } from '../ldn-services-model/ldn-service.resource-type';
|
||||
import { RemoteData } from '../../../core/data/remote-data';
|
||||
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
||||
import { Observable, of } from 'rxjs';
|
||||
import {LdnService} from '../ldn-services-model/ldn-services.model';
|
||||
import {LDN_SERVICE} from '../ldn-services-model/ldn-service.resource-type';
|
||||
import {RemoteData} from '../../../core/data/remote-data';
|
||||
import {PaginatedList} from '../../../core/data/paginated-list.model';
|
||||
import {Observable, of} from 'rxjs';
|
||||
// Create a mock data object for a single LDN notify service
|
||||
export const mockLdnService: LdnService = {
|
||||
id: 1,
|
||||
|
@@ -1,20 +1,20 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { dataService } from '../../../core/data/base/data-service.decorator';
|
||||
import { LDN_SERVICE_CONSTRAINT_FILTERS } from '../ldn-services-model/ldn-service.resource-type';
|
||||
import { IdentifiableDataService } from '../../../core/data/base/identifiable-data.service';
|
||||
import { FindAllData, FindAllDataImpl } from '../../../core/data/base/find-all-data';
|
||||
import {Injectable} from '@angular/core';
|
||||
import {dataService} from '../../../core/data/base/data-service.decorator';
|
||||
import {LDN_SERVICE_CONSTRAINT_FILTERS} from '../ldn-services-model/ldn-service.resource-type';
|
||||
import {IdentifiableDataService} from '../../../core/data/base/identifiable-data.service';
|
||||
import {FindAllData, FindAllDataImpl} from '../../../core/data/base/find-all-data';
|
||||
|
||||
import { RequestService } from '../../../core/data/request.service';
|
||||
import { RemoteDataBuildService } from '../../../core/cache/builders/remote-data-build.service';
|
||||
import { ObjectCacheService } from '../../../core/cache/object-cache.service';
|
||||
import { HALEndpointService } from '../../../core/shared/hal-endpoint.service';
|
||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||
import { FindListOptions } from '../../../core/data/find-list-options.model';
|
||||
import { FollowLinkConfig } from '../../../shared/utils/follow-link-config.model';
|
||||
import { Observable } from 'rxjs';
|
||||
import { RemoteData } from '../../../core/data/remote-data';
|
||||
import { Itemfilter } from '../ldn-services-model/ldn-service-itemfilters';
|
||||
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
||||
import {RequestService} from '../../../core/data/request.service';
|
||||
import {RemoteDataBuildService} from '../../../core/cache/builders/remote-data-build.service';
|
||||
import {ObjectCacheService} from '../../../core/cache/object-cache.service';
|
||||
import {HALEndpointService} from '../../../core/shared/hal-endpoint.service';
|
||||
import {NotificationsService} from '../../../shared/notifications/notifications.service';
|
||||
import {FindListOptions} from '../../../core/data/find-list-options.model';
|
||||
import {FollowLinkConfig} from '../../../shared/utils/follow-link-config.model';
|
||||
import {Observable} from 'rxjs';
|
||||
import {RemoteData} from '../../../core/data/remote-data';
|
||||
import {Itemfilter} from '../ldn-services-model/ldn-service-itemfilters';
|
||||
import {PaginatedList} from '../../../core/data/paginated-list.model';
|
||||
|
||||
|
||||
/**
|
||||
|
@@ -1,38 +1,38 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { dataService } from '../../../core/data/base/data-service.decorator';
|
||||
import { LDN_SERVICE } from '../ldn-services-model/ldn-service.resource-type';
|
||||
import { IdentifiableDataService } from '../../../core/data/base/identifiable-data.service';
|
||||
import { FindAllData, FindAllDataImpl } from '../../../core/data/base/find-all-data';
|
||||
import { DeleteData, DeleteDataImpl } from '../../../core/data/base/delete-data';
|
||||
import { RequestService } from '../../../core/data/request.service';
|
||||
import { RemoteDataBuildService } from '../../../core/cache/builders/remote-data-build.service';
|
||||
import { ObjectCacheService } from '../../../core/cache/object-cache.service';
|
||||
import { HALEndpointService } from '../../../core/shared/hal-endpoint.service';
|
||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||
import { FindListOptions } from '../../../core/data/find-list-options.model';
|
||||
import { FollowLinkConfig } from '../../../shared/utils/follow-link-config.model';
|
||||
import { Observable } from 'rxjs';
|
||||
import { RemoteData } from '../../../core/data/remote-data';
|
||||
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
||||
import { NoContent } from '../../../core/shared/NoContent.model';
|
||||
import { map, take } from 'rxjs/operators';
|
||||
import { URLCombiner } from '../../../core/url-combiner/url-combiner';
|
||||
import { MultipartPostRequest } from '../../../core/data/request.models';
|
||||
import { RestRequest } from '../../../core/data/rest-request.model';
|
||||
import {Injectable} from '@angular/core';
|
||||
import {dataService} from '../../../core/data/base/data-service.decorator';
|
||||
import {LDN_SERVICE} from '../ldn-services-model/ldn-service.resource-type';
|
||||
import {IdentifiableDataService} from '../../../core/data/base/identifiable-data.service';
|
||||
import {FindAllData, FindAllDataImpl} from '../../../core/data/base/find-all-data';
|
||||
import {DeleteData, DeleteDataImpl} from '../../../core/data/base/delete-data';
|
||||
import {RequestService} from '../../../core/data/request.service';
|
||||
import {RemoteDataBuildService} from '../../../core/cache/builders/remote-data-build.service';
|
||||
import {ObjectCacheService} from '../../../core/cache/object-cache.service';
|
||||
import {HALEndpointService} from '../../../core/shared/hal-endpoint.service';
|
||||
import {NotificationsService} from '../../../shared/notifications/notifications.service';
|
||||
import {FindListOptions} from '../../../core/data/find-list-options.model';
|
||||
import {FollowLinkConfig} from '../../../shared/utils/follow-link-config.model';
|
||||
import {Observable} from 'rxjs';
|
||||
import {RemoteData} from '../../../core/data/remote-data';
|
||||
import {PaginatedList} from '../../../core/data/paginated-list.model';
|
||||
import {NoContent} from '../../../core/shared/NoContent.model';
|
||||
import {map, take} from 'rxjs/operators';
|
||||
import {URLCombiner} from '../../../core/url-combiner/url-combiner';
|
||||
import {MultipartPostRequest} from '../../../core/data/request.models';
|
||||
import {RestRequest} from '../../../core/data/rest-request.model';
|
||||
|
||||
|
||||
import { LdnService } from '../ldn-services-model/ldn-services.model';
|
||||
import {LdnService} from '../ldn-services-model/ldn-services.model';
|
||||
|
||||
import { PatchData, PatchDataImpl } from '../../../core/data/base/patch-data';
|
||||
import { ChangeAnalyzer } from '../../../core/data/change-analyzer';
|
||||
import { Operation } from 'fast-json-patch';
|
||||
import { RestRequestMethod } from '../../../core/data/rest-request-method';
|
||||
import { CreateData, CreateDataImpl } from '../../../core/data/base/create-data';
|
||||
import { LdnServiceConstrain } from '../ldn-services-model/ldn-service.constrain.model';
|
||||
import { getFirstCompletedRemoteData } from '../../../core/shared/operators';
|
||||
import { hasValue } from '../../../shared/empty.util';
|
||||
import { SearchDataImpl } from '../../../core/data/base/search-data';
|
||||
import { RequestParam } from '../../../core/cache/models/request-param.model';
|
||||
import {PatchData, PatchDataImpl} from '../../../core/data/base/patch-data';
|
||||
import {ChangeAnalyzer} from '../../../core/data/change-analyzer';
|
||||
import {Operation} from 'fast-json-patch';
|
||||
import {RestRequestMethod} from '../../../core/data/rest-request-method';
|
||||
import {CreateData, CreateDataImpl} from '../../../core/data/base/create-data';
|
||||
import {LdnServiceConstrain} from '../ldn-services-model/ldn-service.constrain.model';
|
||||
import {getFirstCompletedRemoteData} from '../../../core/shared/operators';
|
||||
import {hasValue} from '../../../shared/empty.util';
|
||||
import {SearchDataImpl} from '../../../core/data/base/search-data';
|
||||
import {RequestParam} from '../../../core/cache/models/request-param.model';
|
||||
|
||||
/**
|
||||
* A service responsible for fetching/sending data from/to the REST API on the ldnservices endpoint
|
||||
@@ -92,7 +92,7 @@ export class LdnServicesService extends IdentifiableDataService<LdnService> impl
|
||||
|
||||
findByInboundPattern(pattern: string, options?: FindListOptions, useCachedVersionIfAvailable?: boolean, reRequestOnStale?: boolean, ...linksToFollow: FollowLinkConfig<LdnService>[]): Observable<RemoteData<PaginatedList<LdnService>>> {
|
||||
const params = [new RequestParam('pattern', pattern)];
|
||||
const findListOptions = Object.assign(new FindListOptions(), options, { searchParams: params });
|
||||
const findListOptions = Object.assign(new FindListOptions(), options, {searchParams: params});
|
||||
return this.searchData.searchBy(this.findByPatternEndpoint, findListOptions, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
|
||||
}
|
||||
|
||||
|
@@ -28,7 +28,8 @@
|
||||
<td>{{ ldnService.description }}</td>
|
||||
<td>
|
||||
<span (click)="toggleStatus(ldnService, ldnServicesService)"
|
||||
[ngClass]="{ 'status-enabled': ldnService.enabled, 'status-disabled': !ldnService.enabled }" [title]="ldnService.enabled ? ('ldn-service.overview.table.clickToDisable' | translate) : ('ldn-service.overview.table.clickToEnable' | translate)"
|
||||
[ngClass]="{ 'status-enabled': ldnService.enabled, 'status-disabled': !ldnService.enabled }"
|
||||
[title]="ldnService.enabled ? ('ldn-service.overview.table.clickToDisable' | translate) : ('ldn-service.overview.table.clickToEnable' | translate)"
|
||||
class="status-indicator">
|
||||
{{ ldnService.enabled ? ('ldn-service.overview.table.enabled' | translate) : ('ldn-service.overview.table.disabled' | translate) }}
|
||||
</span>
|
||||
|
@@ -1,14 +1,14 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { LdnServicesOverviewComponent } from './ldn-services-directory.component';
|
||||
import { ChangeDetectorRef, EventEmitter } from '@angular/core';
|
||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub';
|
||||
import { TranslateModule, TranslateService } from '@ngx-translate/core';
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { LdnServicesService } from '../ldn-services-data/ldn-services-data.service';
|
||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||
import { PaginationServiceStub } from '../../../shared/testing/pagination-service.stub';
|
||||
import { of } from 'rxjs';
|
||||
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
import {LdnServicesOverviewComponent} from './ldn-services-directory.component';
|
||||
import {ChangeDetectorRef, EventEmitter} from '@angular/core';
|
||||
import {NotificationsService} from '../../../shared/notifications/notifications.service';
|
||||
import {NotificationsServiceStub} from '../../../shared/testing/notifications-service.stub';
|
||||
import {TranslateModule, TranslateService} from '@ngx-translate/core';
|
||||
import {NgbModal} from '@ng-bootstrap/ng-bootstrap';
|
||||
import {LdnServicesService} from '../ldn-services-data/ldn-services-data.service';
|
||||
import {PaginationService} from '../../../core/pagination/pagination.service';
|
||||
import {PaginationServiceStub} from '../../../shared/testing/pagination-service.stub';
|
||||
import {of} from 'rxjs';
|
||||
|
||||
describe('LdnServicesOverviewComponent', () => {
|
||||
let component: LdnServicesOverviewComponent;
|
||||
@@ -26,17 +26,17 @@ describe('LdnServicesOverviewComponent', () => {
|
||||
imports: [TranslateModule.forRoot()],
|
||||
declarations: [LdnServicesOverviewComponent],
|
||||
providers: [
|
||||
{ provide: LdnServicesService, useValue: {} },
|
||||
{ provide: PaginationService, useValue: new PaginationServiceStub() },
|
||||
{provide: LdnServicesService, useValue: {}},
|
||||
{provide: PaginationService, useValue: new PaginationServiceStub()},
|
||||
{
|
||||
provide: NgbModal, useValue: {
|
||||
open: () => {/*comment*/
|
||||
}
|
||||
}
|
||||
},
|
||||
{ provide: ChangeDetectorRef, useValue: {} },
|
||||
{ provide: NotificationsService, useValue: NotificationsServiceStub },
|
||||
{ provide: TranslateService, useValue: translateServiceStub },
|
||||
{provide: ChangeDetectorRef, useValue: {}},
|
||||
{provide: NotificationsService, useValue: NotificationsServiceStub},
|
||||
{provide: TranslateService, useValue: translateServiceStub},
|
||||
]
|
||||
})
|
||||
.compileComponents();
|
||||
|
@@ -7,21 +7,21 @@ import {
|
||||
TemplateRef,
|
||||
ViewChild
|
||||
} from '@angular/core';
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
import { RemoteData } from '../../../core/data/remote-data';
|
||||
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
||||
import { FindListOptions } from '../../../core/data/find-list-options.model';
|
||||
import { LdnService } from '../ldn-services-model/ldn-services.model';
|
||||
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
||||
import { map, switchMap } from 'rxjs/operators';
|
||||
import { LdnServicesService } from 'src/app/admin/admin-ldn-services/ldn-services-data/ldn-services-data.service';
|
||||
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 { getFirstCompletedRemoteData } from '../../../core/shared/operators';
|
||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import {Observable, Subscription} from 'rxjs';
|
||||
import {RemoteData} from '../../../core/data/remote-data';
|
||||
import {PaginatedList} from '../../../core/data/paginated-list.model';
|
||||
import {FindListOptions} from '../../../core/data/find-list-options.model';
|
||||
import {LdnService} from '../ldn-services-model/ldn-services.model';
|
||||
import {PaginationComponentOptions} from '../../../shared/pagination/pagination-component-options.model';
|
||||
import {map, switchMap} from 'rxjs/operators';
|
||||
import {LdnServicesService} from 'src/app/admin/admin-ldn-services/ldn-services-data/ldn-services-data.service';
|
||||
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 {getFirstCompletedRemoteData} from '../../../core/shared/operators';
|
||||
import {NotificationsService} from '../../../shared/notifications/notifications.service';
|
||||
import {TranslateService} from '@ngx-translate/core';
|
||||
|
||||
|
||||
@Component({
|
||||
|
@@ -1,9 +1,9 @@
|
||||
import { autoserialize, deserialize, inheritSerialization } from 'cerialize';
|
||||
import { LDN_SERVICE_CONSTRAINT_FILTER } from './ldn-service.resource-type';
|
||||
import { CacheableObject } from '../../../core/cache/cacheable-object.model';
|
||||
import { typedObject } from '../../../core/cache/builders/build-decorators';
|
||||
import { excludeFromEquals } from '../../../core/utilities/equals.decorators';
|
||||
import { ResourceType } from '../../../core/shared/resource-type';
|
||||
import {autoserialize, deserialize, inheritSerialization} from 'cerialize';
|
||||
import {LDN_SERVICE_CONSTRAINT_FILTER} from './ldn-service.resource-type';
|
||||
import {CacheableObject} from '../../../core/cache/cacheable-object.model';
|
||||
import {typedObject} from '../../../core/cache/builders/build-decorators';
|
||||
import {excludeFromEquals} from '../../../core/utilities/equals.decorators';
|
||||
import {ResourceType} from '../../../core/shared/resource-type';
|
||||
|
||||
/** A single filter value and its properties. */
|
||||
@typedObject
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { autoserialize } from 'cerialize';
|
||||
import {autoserialize} from 'cerialize';
|
||||
|
||||
/**
|
||||
* notify service patterns
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* Needs to be in a separate file to prevent circular
|
||||
* dependencies in webpack.
|
||||
*/
|
||||
import { ResourceType } from '../../../core/shared/resource-type';
|
||||
import {ResourceType} from '../../../core/shared/resource-type';
|
||||
|
||||
export const LDN_SERVICE = new ResourceType('ldnservice');
|
||||
export const LDN_SERVICE_CONSTRAINT_FILTERS = new ResourceType('itemfilters');
|
||||
|
@@ -1,10 +1,10 @@
|
||||
import { ResourceType } from '../../../core/shared/resource-type';
|
||||
import { CacheableObject } from '../../../core/cache/cacheable-object.model';
|
||||
import { autoserialize, deserialize, deserializeAs, inheritSerialization } from 'cerialize';
|
||||
import { LDN_SERVICE } from './ldn-service.resource-type';
|
||||
import { excludeFromEquals } from '../../../core/utilities/equals.decorators';
|
||||
import { typedObject } from '../../../core/cache/builders/build-decorators';
|
||||
import { NotifyServicePattern } from './ldn-service-patterns.model';
|
||||
import {ResourceType} from '../../../core/shared/resource-type';
|
||||
import {CacheableObject} from '../../../core/cache/cacheable-object.model';
|
||||
import {autoserialize, deserialize, deserializeAs, inheritSerialization} from 'cerialize';
|
||||
import {LDN_SERVICE} from './ldn-service.resource-type';
|
||||
import {excludeFromEquals} from '../../../core/utilities/equals.decorators';
|
||||
import {typedObject} from '../../../core/cache/builders/build-decorators';
|
||||
import {NotifyServicePattern} from './ldn-service-patterns.model';
|
||||
|
||||
|
||||
/** An LdnService and its properties. */
|
||||
|
Reference in New Issue
Block a user