diff --git a/projects/common-map/src/fm-map/components/selected-item-geotiff/selected-item-geotiff.component.html b/projects/common-map/src/fm-map/components/selected-item-geotiff/selected-item-geotiff.component.html
index bcf2d66..88d2730 100644
--- a/projects/common-map/src/fm-map/components/selected-item-geotiff/selected-item-geotiff.component.html
+++ b/projects/common-map/src/fm-map/components/selected-item-geotiff/selected-item-geotiff.component.html
@@ -25,6 +25,7 @@
Add as overlay
Remove overlay
+
diff --git a/projects/common/src/fm/common.module.ts b/projects/common/src/fm/common.module.ts
index d70175a..a352b6d 100644
--- a/projects/common/src/fm/common.module.ts
+++ b/projects/common/src/fm/common.module.ts
@@ -42,6 +42,8 @@ import { IEventMessage } from './models/event.message';
import { IItem, Item } from './models/item';
import { WeatherCurrentObservation } from './models/weatherCurrentObservation';
import { IItemType } from './models/item.type';
+import { IItemLinkType} from './models/itemlink.type';
+import {IUrlType} from './models/url.type';
import { IItemTypes } from './models/item.types';
import { IItemTask, ItemTask } from './models/itemTask';
import { IListItem } from './models/list.item';
@@ -65,6 +67,7 @@ import { HelpMenuComponent} from './components/help-menu/help-menu.component';
import { BackButtonComponent } from './components/back-button/back-button.component';
import { EditImageModalComponent } from './components/edit-image-modal/edit-image-modal.component';
import { AvatarComponent } from './components/avatar/avatar.component';
+import { ItemLinkComponent } from './components/item-link/item-link.component';
import { AvatarModule } from 'ngx-avatar';
import { ImageCropperModule } from 'ngx-image-cropper';
@@ -92,6 +95,8 @@ export {
IItem,
Item,
IItemType,
+ IItemLinkType,
+ IUrlType,
IItemTypes,
IItemTask,
ItemTask,
@@ -115,6 +120,7 @@ export {
IGradientstop,
BackButtonComponent,
AvatarComponent,
+ ItemLinkComponent,
EditImageModalComponent,
GradientComponent,
GradientSelectComponent
@@ -160,7 +166,8 @@ export {
BackButtonComponent,
ThumbnailComponent,
EditImageModalComponent,
- AvatarComponent
+ AvatarComponent,
+ ItemLinkComponent
],
exports: [
NgbModule,
@@ -189,6 +196,7 @@ export {
BackButtonComponent,
ThumbnailComponent,
AvatarComponent,
+ ItemLinkComponent,
EditImageModalComponent
]
})
diff --git a/projects/common/src/fm/components/item-link/item-link.component.html b/projects/common/src/fm/components/item-link/item-link.component.html
new file mode 100644
index 0000000..58437f4
--- /dev/null
+++ b/projects/common/src/fm/components/item-link/item-link.component.html
@@ -0,0 +1 @@
+ Copy link
\ No newline at end of file
diff --git a/projects/common/src/fm/components/item-link/item-link.component.ts b/projects/common/src/fm/components/item-link/item-link.component.ts
new file mode 100644
index 0000000..45694b2
--- /dev/null
+++ b/projects/common/src/fm/components/item-link/item-link.component.ts
@@ -0,0 +1,44 @@
+import { Component, Input, OnDestroy} from '@angular/core';
+import { IItemLinkType} from '../../models/itemlink.type'
+import { IUrlType } from '../../models/url.type';
+import { ItemService } from '../../common-service.module';
+import { Subscription } from 'rxjs';
+import { ClipboardService } from 'ngx-clipboard'
+
+
+@Component({
+ selector: 'fm-item-link',
+ templateUrl: './item-link.component.html'
+})
+export class ItemLinkComponent implements OnDestroy {
+
+ @Input() itemCode:string;
+ @Input() pathSuffix:string;
+ @Input() query:string;
+ @Input() validMinutes:number;
+ @Input() showText:boolean;
+
+ private sub : Subscription = null;
+
+ constructor(private itemService:ItemService,private clipboardService$: ClipboardService) { }
+
+ copylink(tooltip) {
+ if(this.sub) {
+ this.sub.unsubscribe();
+ }
+ let link: IItemLinkType = {itemcode:this.itemCode,pathsuffix:this.pathSuffix,query:this.query,validminutes:this.validMinutes}
+ this.sub = this.itemService.getItemLink(link).subscribe((url:IUrlType) => {
+ this.clipboardService$.copy(url.url);
+ tooltip.open();
+ setTimeout(() => {
+ tooltip.close();
+ }, 2000);
+ })
+ }
+
+ ngOnDestroy(): void {
+ if(this.sub) {
+ this.sub.unsubscribe();
+ }
+ }
+}
diff --git a/projects/common/src/fm/models/itemlink.type.ts b/projects/common/src/fm/models/itemlink.type.ts
new file mode 100644
index 0000000..9d3f001
--- /dev/null
+++ b/projects/common/src/fm/models/itemlink.type.ts
@@ -0,0 +1,6 @@
+export interface IItemLinkType {
+ itemcode: string;
+ pathsuffix?: string;
+ query?: string;
+ validminutes?: number;
+}
diff --git a/projects/common/src/fm/models/url.type.ts b/projects/common/src/fm/models/url.type.ts
new file mode 100644
index 0000000..f9c58e2
--- /dev/null
+++ b/projects/common/src/fm/models/url.type.ts
@@ -0,0 +1,3 @@
+export interface IUrlType {
+ url: string;
+}
diff --git a/projects/common/src/fm/services/item.service.ts b/projects/common/src/fm/services/item.service.ts
index 1554d6e..b13b558 100644
--- a/projects/common/src/fm/services/item.service.ts
+++ b/projects/common/src/fm/services/item.service.ts
@@ -2,6 +2,8 @@ import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { IItemType } from '../models/item.type';
+import { IItemLinkType } from '../models/itemlink.type';
+import { IUrlType } from '../models/url.type';
import { IItem } from '../models/item';
import { IJsonline } from '../models/json-line';
import { IItemTask } from '../models/itemTask';
@@ -63,6 +65,10 @@ export class ItemService {
return this.httpClient.get(`${this.ApiEndpoint()}/api/v1/items/${code}`);
}
+ getItemLink(itemLink: IItemLinkType): Observable {
+ return this.httpClient.post(`${this.ApiEndpoint()}/api/v1/itemlink`,itemLink);
+ }
+
getItemData(code: string,start?:number,size?:number): Observable {
let headers = new HttpHeaders();
if(start !== undefined && size !== undefined) headers=headers.set("Range",`bytes=${start}-${size-1}`);