AW-2925 Data temporal item
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good

This commit is contained in:
Peter (extern) 2025-03-10 11:28:34 +01:00
parent a4438d8a90
commit e9880d6eb2
2 changed files with 14 additions and 4 deletions

View File

@ -41,7 +41,7 @@
<li *ngIf="!getItemLayer(item,itemLayer.layerIndex)"><a href="#" (click)="handleAddAsLayer(item,itemLayer.layerIndex)"><i class="fas fa-layer-plus" aria-hidden="true" i18n-title title="Add as layer"></i>&nbsp;<span i18n>Add as overlay</span></a></li>
<li *ngIf="getItemLayer(item,itemLayer.layerIndex)"><a href="#" (click)="handleRemoveLayer(item,itemLayer.layerIndex)"><i class="fas fa-layer-minus" aria-hidden="true" i18n-title title="Remove overlay"></i>&nbsp;<span i18n>Remove overlay</span></a></li>
</ng-container>
<li><a href="#" (click)="handleGoToChart(item)"><i class="fal fa-line-chart" aria-hidden="true" i18m-title title="Show chart"></i>&nbsp;<span i18n>Show chart</span></a></li>
<li><a href="#" (click)="download(item,$event)"><i class="fal fa-download" aria-hidden="true" i18n-title title="Download"></i>&nbsp;<span i18n>Download</span></a></li>
</ul>
</div>
</div>

View File

@ -2,7 +2,7 @@ import { Component, Injectable } from '@angular/core';
import { Location } from '@angular/common';
import { Store } from '@ngrx/store';
import * as mapReducers from '../../reducers/map.reducer';
import { commonReducers, ItemTypeService, IItem } from '@farmmaps/common';
import { commonReducers, ItemTypeService, IItem, ItemService, IItemLinkType, IUrlType } from '@farmmaps/common';
import { Router } from '@angular/router';
import { ForItemType } from '../for-item/for-itemtype.decorator';
import { AbstractSelectedItemComponent } from '../selected-item/selected-item.component';
@ -11,7 +11,6 @@ import * as mapActions from '../../actions/map.actions';
import { IItemLayer } from '../../models/item.layer';
import {TemporalService} from '../../services/temporal.service';
@ForItemType("vnd.farmmaps.itemtype.temporal")
@Injectable()
@Component({
@ -21,7 +20,7 @@ import {TemporalService} from '../../services/temporal.service';
})
export class SelectedItemTemporalComponent extends AbstractSelectedItemComponent {
constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService, location: Location, router: Router,public temporalService:TemporalService) {
constructor(store: Store<mapReducers.State | commonReducers.State>, public itemService: ItemService, itemTypeService: ItemTypeService, location: Location, router: Router,public temporalService:TemporalService) {
super(store, itemTypeService,location,router);
}
@ -61,4 +60,15 @@ export class SelectedItemTemporalComponent extends AbstractSelectedItemComponent
this.router.navigate(['/viewer', 'temporal', 'item', item.parentCode, new Date(Date.parse(item.dataDate)).getUTCFullYear()]);
return false;
}
download(item:IItem,event:MouseEvent) {
event.stopPropagation();
event.preventDefault();
const itemLink : IItemLinkType = {itemcode:item.code,pathsuffix:"download", validminutes:10}
console.log('download1', itemLink)
const foo = this.itemService.getItemLink(itemLink).subscribe((itemLinkUrl:IUrlType) => {
console.log('download2', itemLinkUrl)
window.location.href =itemLinkUrl.url
})
}
}