From aa3707aa560605d1807939599263ec59e14f379c Mon Sep 17 00:00:00 2001 From: Mark van der Wal Date: Mon, 22 Jun 2020 12:20:02 +0200 Subject: [PATCH] Added getSchema method to itemtypes service. --- projects/common/src/fm/models/item.type.ts | 1 + .../common/src/fm/services/itemtype.service.ts | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/projects/common/src/fm/models/item.type.ts b/projects/common/src/fm/models/item.type.ts index 4c19e57..cf11313 100644 --- a/projects/common/src/fm/models/item.type.ts +++ b/projects/common/src/fm/models/item.type.ts @@ -4,5 +4,6 @@ export interface IItemType { editor?: string; isFolder?: boolean; iconColor?: string; + schema?: string; extraAttributes?: string; } diff --git a/projects/common/src/fm/services/itemtype.service.ts b/projects/common/src/fm/services/itemtype.service.ts index f81f1ad..96f04c5 100644 --- a/projects/common/src/fm/services/itemtype.service.ts +++ b/projects/common/src/fm/services/itemtype.service.ts @@ -9,9 +9,9 @@ export class ItemTypeService { public itemTypes: IItemTypes; private httpClient: HttpClient; - constructor(xhrBackend: HttpXhrBackend) { + constructor(xhrBackend: HttpXhrBackend) { this.httpClient = new HttpClient(xhrBackend); - } + } getIcon(itemType: string) { var icon = "fa fa-file-o"; @@ -31,6 +31,12 @@ export class ItemTypeService { return extraAttributes; } + getSchema(itemType: string): string { + let schema = null; + if (this.itemTypes[itemType]) schema = this.itemTypes[itemType].schema; + return schema; + } + hasViewer(item: IItem) { let itemType: string = item.itemType; if (this.itemTypes[itemType]) return this.itemTypes[itemType].viewer !== undefined; @@ -49,7 +55,7 @@ export class ItemTypeService { } public load(config:AppConfig): Promise { - + var url = `${ config.getConfig("apiEndPoint")}/api/v1/itemtypes/` return this.httpClient.get(url) .toPromise() @@ -59,4 +65,4 @@ export class ItemTypeService { }) .catch(error => this.itemTypes = null); }; -} \ No newline at end of file +}