AW-1330
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
This commit is contained in:
parent
925af1e645
commit
28d4adc571
@ -7,9 +7,10 @@ import { commonReducers, ItemTypeService, IItem, Item, ItemService, FolderServic
|
|||||||
import { Router, ActivatedRoute, ParamMap, Event } from '@angular/router';
|
import { Router, ActivatedRoute, ParamMap, Event } from '@angular/router';
|
||||||
import { ForItemType } from '../for-item/for-itemtype.decorator';
|
import { ForItemType } from '../for-item/for-itemtype.decorator';
|
||||||
import { AbstractSelectedItemComponent } from '../selected-item/selected-item.component';
|
import { AbstractSelectedItemComponent } from '../selected-item/selected-item.component';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable,of } from 'rxjs';
|
||||||
import {GeoJSON} from 'ol/format';
|
import {GeoJSON} from 'ol/format';
|
||||||
import {getArea} from 'ol/sphere';
|
import {getArea} from 'ol/sphere';
|
||||||
|
import { withLatestFrom,switchMap,combineLatest } from 'rxjs/operators';
|
||||||
|
|
||||||
|
|
||||||
@ForItemType("vnd.farmmaps.itemtype.cropfield")
|
@ForItemType("vnd.farmmaps.itemtype.cropfield")
|
||||||
@ -38,6 +39,25 @@ export class SelectedItemCropfieldComponent extends AbstractSelectedItemComponen
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this. items = this.folderService$.getItems(this.item.code, 0, 1000);
|
var childItems = this.folderService$.getItems(this.item.code, 0, 1000);
|
||||||
|
var atLocationItems = this.itemService$.getItemList(null,null,null,this.item.code,true);
|
||||||
|
this.items = childItems.pipe(
|
||||||
|
combineLatest(atLocationItems),
|
||||||
|
switchMap(([ci,ali]) => {
|
||||||
|
let retVal:IListItem[] = [];
|
||||||
|
let codes = {};
|
||||||
|
ci.forEach((listItem) => {
|
||||||
|
retVal.push(listItem);
|
||||||
|
codes[listItem.code]=listItem;
|
||||||
|
});
|
||||||
|
ali.forEach((atlocationitem) => {
|
||||||
|
let listItem = atlocationitem as IListItem;
|
||||||
|
let allowedItemTypes = "vnd.farmmaps.itemtype.device.senml"; // this is a hack
|
||||||
|
if(!codes[listItem.code] && allowedItemTypes.indexOf(listItem.itemType) >= 0) {
|
||||||
|
retVal.push(listItem);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return of(retVal);
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user