TSK-974: Fix some small Errors
This commit is contained in:
parent
010632537f
commit
8b7c8027e0
|
|
@ -173,7 +173,8 @@ export class AccessItemsComponent implements OnChanges, OnDestroy {
|
||||||
|
|
||||||
private onSave() {
|
private onSave() {
|
||||||
this.requestInProgressService.setRequestInProgress(true);
|
this.requestInProgressService.setRequestInProgress(true);
|
||||||
this.workbasketService.updateWorkBasketAccessItem(this.accessItemsResource._links.self.href, this.AccessItemsForm.value.accessItemsGroups)
|
this.workbasketService.updateWorkBasketAccessItem(
|
||||||
|
this.accessItemsResource._links.self.href, this.AccessItemsForm.value.accessItemsGroups)
|
||||||
.subscribe(response => {
|
.subscribe(response => {
|
||||||
this.accessItemsClone = this.cloneAccessItems(this.AccessItemsForm.value.accessItemsGroups);
|
this.accessItemsClone = this.cloneAccessItems(this.AccessItemsForm.value.accessItemsGroups);
|
||||||
this.accessItemsResetClone = this.cloneAccessItems(this.AccessItemsForm.value.accessItemsGroups);
|
this.accessItemsResetClone = this.cloneAccessItems(this.AccessItemsForm.value.accessItemsGroups);
|
||||||
|
|
|
||||||
|
|
@ -92,14 +92,14 @@ export class DistributionTargetsComponent implements OnChanges, OnDestroy {
|
||||||
if (side === Side.LEFT) {
|
if (side === Side.LEFT) {
|
||||||
const itemsLeft = this.distributionTargetsLeft.length;
|
const itemsLeft = this.distributionTargetsLeft.length;
|
||||||
const itemsRight = this.distributionTargetsRight.length;
|
const itemsRight = this.distributionTargetsRight.length;
|
||||||
const itemsSelected = this.getSelectedItems(this.distributionTargetsLeft, this.distributionTargetsRight);
|
const itemsSelected = this.getSelectedItems(this.distributionTargetsLeft);
|
||||||
this.distributionTargetsSelected = this.distributionTargetsSelected.concat(itemsSelected);
|
this.distributionTargetsSelected = this.distributionTargetsSelected.concat(itemsSelected);
|
||||||
this.distributionTargetsRight = this.distributionTargetsRight.concat(itemsSelected);
|
this.distributionTargetsRight = this.distributionTargetsRight.concat(itemsSelected);
|
||||||
if (((itemsLeft - itemsSelected.length) <= TaskanaQueryParameters.pageSize) && ((itemsLeft + itemsRight) < this.page.totalElements)) {
|
if (((itemsLeft - itemsSelected.length) <= TaskanaQueryParameters.pageSize) && ((itemsLeft + itemsRight) < this.page.totalElements)) {
|
||||||
this.getNextPage(side);
|
this.getNextPage(side);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const itemsSelected = this.getSelectedItems(this.distributionTargetsRight, this.distributionTargetsLeft);
|
const itemsSelected = this.getSelectedItems(this.distributionTargetsRight);
|
||||||
this.distributionTargetsSelected = this.removeSeletedItems(this.distributionTargetsSelected, itemsSelected);
|
this.distributionTargetsSelected = this.removeSeletedItems(this.distributionTargetsSelected, itemsSelected);
|
||||||
this.distributionTargetsRight = this.removeSeletedItems(this.distributionTargetsRight, itemsSelected);
|
this.distributionTargetsRight = this.removeSeletedItems(this.distributionTargetsRight, itemsSelected);
|
||||||
this.distributionTargetsLeft = this.distributionTargetsLeft.concat(itemsSelected);
|
this.distributionTargetsLeft = this.distributionTargetsLeft.concat(itemsSelected);
|
||||||
|
|
@ -121,7 +121,9 @@ export class DistributionTargetsComponent implements OnChanges, OnDestroy {
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
this.generalModalService.triggerMessage(new MessageModal(`There was error while saving your workbasket's distribution targets`, error));
|
this.generalModalService.triggerMessage(
|
||||||
|
new MessageModal(`There was error while saving your workbasket's distribution targets`, error)
|
||||||
|
);
|
||||||
this.requestInProgressService.setRequestInProgress(false);
|
this.requestInProgressService.setRequestInProgress(false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -240,13 +242,13 @@ export class DistributionTargetsComponent implements OnChanges, OnDestroy {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private getSelectedItems(originList: any, destinationList: any): Array<any> {
|
private getSelectedItems(originList: any): Array<any> {
|
||||||
return originList.filter((item: any) => { return (item.selected === true) });
|
return originList.filter((item: any) => (item.selected === true));
|
||||||
}
|
}
|
||||||
|
|
||||||
private removeSeletedItems(originList: any, selectedItemList) {
|
private removeSeletedItems(originList: any, selectedItemList) {
|
||||||
for (let index = originList.length - 1; index >= 0; index--) {
|
for (let index = originList.length - 1; index >= 0; index--) {
|
||||||
if (selectedItemList.some(itemToRemove => { return originList[index].workbasketId === itemToRemove.workbasketId })) {
|
if (selectedItemList.some(itemToRemove => (originList[index].workbasketId === itemToRemove.workbasketId))) {
|
||||||
originList.splice(index, 1);
|
originList.splice(index, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,8 +74,8 @@ describe('WorkbasketDetailsComponent', () => {
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
masterAndDetailService = TestBed.get(MasterAndDetailService);
|
masterAndDetailService = TestBed.get(MasterAndDetailService);
|
||||||
workbasketService = TestBed.get(WorkbasketService);
|
workbasketService = TestBed.get(WorkbasketService);
|
||||||
spyOn(masterAndDetailService, 'getShowDetail').and.callFake(() => { return of(true) })
|
spyOn(masterAndDetailService, 'getShowDetail').and.callFake(() => of(true))
|
||||||
spyOn(workbasketService, 'getSelectedWorkBasket').and.callFake(() => { return of('id1') })
|
spyOn(workbasketService, 'getSelectedWorkBasket').and.callFake(() => of('id1'))
|
||||||
spyOn(workbasketService, 'getWorkBasketsSummary').and.callFake(() => {
|
spyOn(workbasketService, 'getWorkBasketsSummary').and.callFake(() => {
|
||||||
return of(new WorkbasketSummaryResource(
|
return of(new WorkbasketSummaryResource(
|
||||||
new Array<WorkbasketSummary>(
|
new Array<WorkbasketSummary>(
|
||||||
|
|
@ -84,7 +84,7 @@ describe('WorkbasketDetailsComponent', () => {
|
||||||
, new LinksWorkbasketSummary({ 'href': 'someurl' })))
|
, new LinksWorkbasketSummary({ 'href': 'someurl' })))
|
||||||
})
|
})
|
||||||
|
|
||||||
spyOn(workbasketService, 'getWorkBasket').and.callFake(() => { return of(workbasket) })
|
spyOn(workbasketService, 'getWorkBasket').and.callFake(() => of(workbasket))
|
||||||
spyOn(workbasketService, 'getWorkBasketAccessItems').and.callFake(() => {
|
spyOn(workbasketService, 'getWorkBasketAccessItems').and.callFake(() => {
|
||||||
return of(new WorkbasketAccessItemsResource(
|
return of(new WorkbasketAccessItemsResource(
|
||||||
new Array<WorkbasketAccessItems>(), new Links({ 'href': 'url' })))
|
new Array<WorkbasketAccessItems>(), new Links({ 'href': 'url' })))
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ export class TypeAheadComponent implements OnInit, ControlValueAccessor {
|
||||||
}
|
}
|
||||||
|
|
||||||
initializeDataSource() {
|
initializeDataSource() {
|
||||||
this.dataSource = Observable.create((observer: any) => {
|
this.dataSource = new Observable((observer: any) => {
|
||||||
observer.next(this.value);
|
observer.next(this.value);
|
||||||
}).pipe(mergeMap((token: string) => this.getUsersAsObservable(token)));
|
}).pipe(mergeMap((token: string) => this.getUsersAsObservable(token)));
|
||||||
this.accessIdsService.getAccessItemsInformation(this.value).subscribe(items => {
|
this.accessIdsService.getAccessItemsInformation(this.value).subscribe(items => {
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ export class DummyDetailComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
// tslint:disable-next-line: component-selector
|
||||||
selector: 'svg-icon',
|
selector: 'svg-icon',
|
||||||
template: '<p>Mock Icon Component</p>'
|
template: '<p>Mock Icon Component</p>'
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue