Refactor edit_in_editor
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
This commit is contained in:
parent
0b32153489
commit
e30d95ff09
@ -132,7 +132,27 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
|
||||
this.selectedFeatures$.next(null);
|
||||
this.query$.pipe(withLatestFrom(this.mapState$),withLatestFrom(this.setStateCount$)).subscribe(([[queryState,mapState],setStateCount]) =>{
|
||||
if(setStateCount>0) {
|
||||
this.replaceUrl(mapState,queryState,false);
|
||||
let newQueryState = tassign(mapReducers.initialQueryState);
|
||||
let urlparts=[];
|
||||
if (queryState.itemCode && queryState.itemCode != "") {
|
||||
if(queryState.itemType && queryState.itemType!= "") {
|
||||
let itemType = this.itemTypeService.itemTypes[queryState.itemType];
|
||||
if (itemType.viewer && itemType.viewer == "edit_in_editor" && itemType.editor) {
|
||||
urlparts.push('/editor');
|
||||
urlparts.push(itemType.editor);
|
||||
urlparts.push('item');
|
||||
urlparts.push(queryState.itemCode);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
newQueryState= queryState;
|
||||
}
|
||||
if(urlparts.length==0 ) {
|
||||
newQueryState.itemCode = queryState.itemCode;
|
||||
this.replaceUrl(mapState,newQueryState,false);
|
||||
} else {
|
||||
this.router.navigate(urlparts);
|
||||
}
|
||||
}
|
||||
});
|
||||
this.mapState$.pipe(withLatestFrom(this.queryState$),withLatestFrom(this.setStateCount$)).subscribe(([[mapState,queryState],setStateCount]) =>{
|
||||
|
@ -257,22 +257,7 @@ export class MapEffects {
|
||||
switchMap((action: mapActions.SetQueryState) => {
|
||||
var newAction:Action;
|
||||
if (action.queryState.itemCode && action.queryState.itemCode != "") {
|
||||
let urlparts=[];
|
||||
if(action.queryState.itemType && action.queryState.itemType!= "") {
|
||||
let itemType = this.itemTypeService$.itemTypes[action.queryState.itemType];
|
||||
if (itemType.viewer == "edit_in_editor" && itemType.editor) {
|
||||
urlparts.push('/editor');
|
||||
urlparts.push(itemType.editor);
|
||||
urlparts.push('item');
|
||||
urlparts.push(action.queryState.itemCode);
|
||||
}
|
||||
}
|
||||
if(urlparts.length==0 ) {
|
||||
newAction= new mapActions.SelectItem(action.queryState.itemCode);
|
||||
} else {
|
||||
this.router$.navigate(urlparts);
|
||||
return [];
|
||||
}
|
||||
newAction= new mapActions.SelectItem(action.queryState.itemCode);
|
||||
} else {
|
||||
newAction= new mapActions.StartSearch(action.queryState);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user