UNPKG

lynx-admin-ui

Version:

this module adds annotations for entities in order to automatically generate an Administration UI

82 lines (81 loc) 3.43 kB
import { Controller } from './controller'; import Request from 'lynx-framework/request'; import Response from 'lynx-framework/response'; import { EntityMetadata } from './decorators'; /** * Basic controller that generates all the UI that contains the logic to perform the * different operations. */ export declare class BaseUIController extends Controller { /** * Generate the list of entities * @param req The current Lynx request */ generateEntitiesIndex(req: Request): Promise<Response>; /** * Perform ajax request for selection values * @param entityName the name of the entity * @param id the id of the editing entity * @param field the name of the field that is edited * @param req the current Lynx request */ performAjaxRequest(entityName: string, id: any, field: string, req: Request): Promise<{ data: { id: any; text: string; }[]; pagination: boolean; }>; /** * Retrieve entity data to dynamically display results * @param entityName the name of the entity * @param id the id of the editing entity * @param field the name of the field that is edited * @param selection the current selection for the field * @param req the current Lynx request */ performAjaxDetails(entityName: string, id: any, field: string, selection: any, req: Request): Promise<any>; /** * Delete the specified entity. * @param entityName The name of the entity class * @param id The id of the entity * @param req The current Lynx request */ performEntityDelete(entityName: string, id: any, req: Request): Promise<Response>; /** * Delete the specified entities. * @param entityName The name of the entity class * @param req The current Lynx request, containing the query parameter ids, with an array of id */ performEntityDeleteMultiple(entityName: string, req: Request): Promise<Response>; /** * Retrieve and display the list of a specified entity * @param entityName The name of the entity class * @param req The current Lynx request */ retrieveEntityList(entityName: string, req: Request): Promise<Response>; generateCxtForEditingRender(data: any, isPopup: boolean, metadata: EntityMetadata, fields: any): any; /** * Retrieve the details of a specific entity by its id * @param entityName The name of the entity class * @param id The id of the entity to retrieve * @param req The current Lynx request */ retrieveEntityDetails(entityName: string, id: any, req: Request): Promise<Response>; /** * Retrieve the nested view of an entity * @param entityName The name of the entity class * @param id The id of the entity to retrieve * @param nestedKey The name of the property of the entity to display * @param req The current Lynx request * @param enableDelete Determines if the delete action is enabled */ retrieveNestedView(entityName: string, id: any, nestedKey: string, req: Request, enableDelete?: Boolean): Promise<Response>; /** * Perform the edit of a specific entity * @param entityName The name of the entity class * @param id The id of the entity to edit * @param req The current Lynx request */ performEntityEdit(entityName: string, id: any, req: Request): Promise<Response>; }