Added getSchema method to itemtypes service.
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
This commit is contained in:
parent
ff06b419f2
commit
aa3707aa56
@ -4,5 +4,6 @@ export interface IItemType {
|
|||||||
editor?: string;
|
editor?: string;
|
||||||
isFolder?: boolean;
|
isFolder?: boolean;
|
||||||
iconColor?: string;
|
iconColor?: string;
|
||||||
|
schema?: string;
|
||||||
extraAttributes?: string;
|
extraAttributes?: string;
|
||||||
}
|
}
|
||||||
|
@ -9,9 +9,9 @@ export class ItemTypeService {
|
|||||||
public itemTypes: IItemTypes;
|
public itemTypes: IItemTypes;
|
||||||
private httpClient: HttpClient;
|
private httpClient: HttpClient;
|
||||||
|
|
||||||
constructor(xhrBackend: HttpXhrBackend) {
|
constructor(xhrBackend: HttpXhrBackend) {
|
||||||
this.httpClient = new HttpClient(xhrBackend);
|
this.httpClient = new HttpClient(xhrBackend);
|
||||||
}
|
}
|
||||||
|
|
||||||
getIcon(itemType: string) {
|
getIcon(itemType: string) {
|
||||||
var icon = "fa fa-file-o";
|
var icon = "fa fa-file-o";
|
||||||
@ -31,6 +31,12 @@ export class ItemTypeService {
|
|||||||
return extraAttributes;
|
return extraAttributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getSchema(itemType: string): string {
|
||||||
|
let schema = null;
|
||||||
|
if (this.itemTypes[itemType]) schema = this.itemTypes[itemType].schema;
|
||||||
|
return schema;
|
||||||
|
}
|
||||||
|
|
||||||
hasViewer(item: IItem) {
|
hasViewer(item: IItem) {
|
||||||
let itemType: string = item.itemType;
|
let itemType: string = item.itemType;
|
||||||
if (this.itemTypes[itemType]) return this.itemTypes[itemType].viewer !== undefined;
|
if (this.itemTypes[itemType]) return this.itemTypes[itemType].viewer !== undefined;
|
||||||
@ -49,7 +55,7 @@ export class ItemTypeService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public load(config:AppConfig): Promise<any> {
|
public load(config:AppConfig): Promise<any> {
|
||||||
|
|
||||||
var url = `${ config.getConfig("apiEndPoint")}/api/v1/itemtypes/`
|
var url = `${ config.getConfig("apiEndPoint")}/api/v1/itemtypes/`
|
||||||
return this.httpClient.get(url)
|
return this.httpClient.get(url)
|
||||||
.toPromise()
|
.toPromise()
|
||||||
@ -59,4 +65,4 @@ export class ItemTypeService {
|
|||||||
})
|
})
|
||||||
.catch(error => this.itemTypes = null);
|
.catch(error => this.itemTypes = null);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user