lynx-admin-ui
Version:
this module adds annotations for entities in order to automatically generate an Administration UI
98 lines (97 loc) • 3.65 kB
TypeScript
import { Request, Response } from 'express';
import SimpleModule from 'lynx-framework/simple.module';
import { AdminType } from './decorators';
export default class AdminUIModule extends SimpleModule {
static configuration: any;
static indexParentTemplatePath: string;
static indexTemplatePath: string;
static editorParentTemplatePath: string;
static editorTemplatePath: string;
static listParentTemplatePath: string;
static listTemplatePath: string;
static nestedParentTemplatePath: string;
static nestedTemplatePath: string;
static popupEditorParentTemplatePath: string;
static popupEditorTemplatePath: string;
static canReadFunction: (req: Request, entityName: String) => boolean;
static canWriteFunction: (req: Request, entityName: String) => boolean;
static permissionDeniedHandler: (req: Request, res: Response, entityName: String) => void;
constructor();
/**
* Set a new template path for the specified type.
* @param type The type of widget
* @param templatePath The view path of the editor
*/
static setEditor(type: AdminType, templatePath: string): void;
/**
* Customize the index template
* @param path the index template path
*/
static setIndexTemplatePath(path: string): void;
/**
* Customize the editor template
* @param path the editor template path
*/
static setEditorTemplatePath(path: string): void;
/**
* Customize the list template
* @param path the list template path
*/
static setListTemplatePath(path: string): void;
/**
* Customize the nested template
* @param path the nested template path
*/
static setNestedTemplatePath(path: string): void;
/**
* Customize the popup editor template
* @param path the popup editor template path
*/
static setEditorPopupTemplatePath(path: string): void;
/**
* Customize the index template
* @param path the index father template path
*/
static setIndexParentTemplatePath(path: string): void;
/**
* Customize the editor template
* @param path the editor father template path
*/
static setEditorParentTemplatePath(path: string): void;
/**
* Customize the list template
* @param path the list father template path
*/
static setListParentTemplatePath(path: string): void;
/**
* Customize the nested template
* @param path the nested father template path
*/
static setNestedParentTemplatePath(path: string): void;
/**
* Customize the popup editor father template
* @param path the popup editor father template path
*/
static setEditorPopupParentTemplatePath(path: string): void;
/**
* Customize to protect routes and frontend
* @param func the function that contains the access logic
*/
static setCanReadFunction(func: (req: Request, entity: String) => boolean): void;
/**
* Customize to protect routes and frontend
* @param func the function that contains the access logic
*/
static setCanWriteFunction(func: (req: Request, entityName: String) => boolean): void;
/**
* Customize the response when access permission is denied (based on canRead/Write methods)
* @param func the function that contains the permission denied logc
*/
static setPermissionDeniedHandler(func: (req: Request, res: Response, entityName: string) => void): void;
get translation(): string;
get controllers(): string;
get views(): string;
get public(): string;
get templating(): string;
get middlewares(): string;
}