Fix thumbnail source
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
This commit is contained in:
@@ -1,56 +1,56 @@
|
||||
import { Component, Input, Injectable } from '@angular/core';
|
||||
import { Location } from '@angular/common';
|
||||
import { Feature } from 'ol';
|
||||
import { Store } from '@ngrx/store';
|
||||
import * as mapReducers from '../../reducers/map.reducer';
|
||||
import { commonReducers,ItemTypeService, IItem, Item } from '@farmmaps/common';
|
||||
import * as mapActions from '../../actions/map.actions';
|
||||
import { Router, ActivatedRoute, ParamMap, Event } from '@angular/router';
|
||||
|
||||
|
||||
@Injectable()
|
||||
export abstract class AbstractSelectedItemComponent {
|
||||
@Input() item: IItem
|
||||
constructor(public store: Store<mapReducers.State | commonReducers.State>, public itemTypeService: ItemTypeService, private location: Location, private router: Router) {
|
||||
}
|
||||
|
||||
handleOnView(item: IItem) {
|
||||
var itemType = this.itemTypeService.itemTypes[item.itemType];
|
||||
if (itemType) {
|
||||
if (itemType.viewer) {
|
||||
let url = `/viewer/${itemType.viewer}/item/${item.code}`;
|
||||
this.router.navigate([url]);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
handleOnEdit(item: IItem) {
|
||||
let url = `/editor/property/item/${item.code}`;
|
||||
this.router.navigate([url]);
|
||||
return false;
|
||||
}
|
||||
|
||||
handleAddAsLayer(item: IItem,layerIndex:number = -1) {
|
||||
this.store.dispatch(new mapActions.AddLayer(item,layerIndex));
|
||||
return false;
|
||||
}
|
||||
|
||||
handleBackToList(event: MouseEvent) {
|
||||
event.preventDefault();
|
||||
this.location.back();
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
@Component({
|
||||
selector: 'fm-map-selected-item',
|
||||
templateUrl: './selected-item.component.html',
|
||||
styleUrls: ['./selected-item.component.scss']
|
||||
})
|
||||
export class SelectedItemComponent extends AbstractSelectedItemComponent {
|
||||
|
||||
constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService, location: Location, router: Router) {
|
||||
super(store, itemTypeService,location,router);
|
||||
}
|
||||
}
|
||||
import { Component, Input, Injectable } from '@angular/core';
|
||||
import { Location } from '@angular/common';
|
||||
import { Feature } from 'ol';
|
||||
import { Store } from '@ngrx/store';
|
||||
import * as mapReducers from '../../reducers/map.reducer';
|
||||
import { commonReducers,ItemTypeService, IItem, Item,AppConfig } from '@farmmaps/common';
|
||||
import * as mapActions from '../../actions/map.actions';
|
||||
import { Router, ActivatedRoute, ParamMap, Event } from '@angular/router';
|
||||
|
||||
|
||||
@Injectable()
|
||||
export abstract class AbstractSelectedItemComponent {
|
||||
@Input() item: IItem
|
||||
constructor(public store: Store<mapReducers.State | commonReducers.State>, public itemTypeService: ItemTypeService, private location: Location, private router: Router) {
|
||||
}
|
||||
|
||||
handleOnView(item: IItem) {
|
||||
var itemType = this.itemTypeService.itemTypes[item.itemType];
|
||||
if (itemType) {
|
||||
if (itemType.viewer) {
|
||||
let url = `/viewer/${itemType.viewer}/item/${item.code}`;
|
||||
this.router.navigate([url]);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
handleOnEdit(item: IItem) {
|
||||
let url = `/editor/property/item/${item.code}`;
|
||||
this.router.navigate([url]);
|
||||
return false;
|
||||
}
|
||||
|
||||
handleAddAsLayer(item: IItem,layerIndex:number = -1) {
|
||||
this.store.dispatch(new mapActions.AddLayer(item,layerIndex));
|
||||
return false;
|
||||
}
|
||||
|
||||
handleBackToList(event: MouseEvent) {
|
||||
event.preventDefault();
|
||||
this.location.back();
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
@Component({
|
||||
selector: 'fm-map-selected-item',
|
||||
templateUrl: './selected-item.component.html',
|
||||
styleUrls: ['./selected-item.component.scss']
|
||||
})
|
||||
export class SelectedItemComponent extends AbstractSelectedItemComponent {
|
||||
|
||||
constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService, location: Location, router: Router, public config:AppConfig) {
|
||||
super(store, itemTypeService,location,router);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user