Fix thumbnail source
FarmMaps.Develop/FarmMapsLib/develop This commit looks good Details

pull/1/head
Willem Dantuma 2019-12-11 18:03:37 +01:00
parent 8e5383b0f2
commit f44b079cde
2 changed files with 72 additions and 72 deletions

View File

@ -1,16 +1,16 @@
<div *ngIf="item;let item"> <div *ngIf="item;let item">
<div class="card border-0"> <div class="card border-0">
<img *ngIf="item.thumbnail" class="card-img-top" [src]="'/api/v1/items/'+item.code+'/thumbnail?v='+item.updated.getTime()" /> <img *ngIf="item.thumbnail" class="card-img-top" [src]="config.getConfig('apiEndPoint') +'/api/v1/items/'+item.code+'/thumbnail?v='+item.updated.getTime()" />
<div *ngIf="!item.thumbnail" class="big-icon" [style.background-color]="itemTypeService.getColor(item.itemType)"> <div *ngIf="!item.thumbnail" class="big-icon" [style.background-color]="itemTypeService.getColor(item.itemType)">
<i [ngClass]="itemTypeService.getIcon(item.itemType)"></i> <i [ngClass]="itemTypeService.getIcon(item.itemType)"></i>
</div> </div>
<div class="card-body"> <div class="card-body">
<div class="mb-2"><a href="#" (click)="handleBackToList($event)" i18n>Back</a></div> <div class="mb-2"><a href="#" (click)="handleBackToList($event)" i18n>Back</a></div>
<h1 class="card-title">{{item.name}}</h1> <h1 class="card-title">{{item.name}}</h1>
<a *ngIf="itemTypeService.hasViewer(item)" href="#" (click)="handleOnView(item)" class="btn btn-outline-secondary" i18n><i class="fa fa-eye" aria-hidden="true" title="View"></i> View</a> <a *ngIf="itemTypeService.hasViewer(item)" href="#" (click)="handleOnView(item)" class="btn btn-outline-secondary" i18n><i class="fa fa-eye" aria-hidden="true" title="View"></i> View</a>
<a href="/api/v1/items/{{item.code}}/data" class="btn btn-outline-secondary" i18n><i class="fa fa-download" aria-hidden="true" title="Download"></i> Download</a> <a href="/api/v1/items/{{item.code}}/data" class="btn btn-outline-secondary" i18n><i class="fa fa-download" aria-hidden="true" title="Download"></i> Download</a>
<a href="#" class="btn btn-outline-secondary" (click)="handleOnEdit(item)" i18n><i class="fa fa-pencil" aria-hidden="true" title="Edit"></i> Edit</a> <a href="#" class="btn btn-outline-secondary" (click)="handleOnEdit(item)" i18n><i class="fa fa-pencil" aria-hidden="true" title="Edit"></i> Edit</a>
<a *ngIf="itemTypeService.isLayer(item)" href="#" (click)="handleAddAsLayer(item)" class="btn btn-outline-secondary" i18n><i class="fa fa-eye" aria-hidden="true" title="Add as layer"></i> Add as overlay</a> <a *ngIf="itemTypeService.isLayer(item)" href="#" (click)="handleAddAsLayer(item)" class="btn btn-outline-secondary" i18n><i class="fa fa-eye" aria-hidden="true" title="Add as layer"></i> Add as overlay</a>
</div> </div>
</div> </div>
</div> </div>

View File

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