AppMenu
Expression Extends:
class AppMenu extends aggregate(AppMenuModel, Helper)
Helper class representing app menu. A app menu redirects the user to different screens and sections of the application.
Constructor Summary
Public Constructor | ||
public |
constructor(response: Object) Helper class representing an single app menu. |
Member Summary
Public Members | ||
public set |
actionDetail: Any |
|
public get |
actionDetail: Any |
|
public get |
|
|
public get |
|
|
public set |
|
|
public get |
|
|
public |
image: C6Image |
|
public get |
|
|
public set |
|
|
public get |
|
|
public set |
|
|
public get |
|
|
public set |
|
Private Members | ||
private |
_badge: * |
|
private |
_children: *[] |
|
private |
|
Method Summary
Public Methods | ||
public |
async connectChildren(appMenus: *) |
|
public |
Saves a appMenu (insert if id doesn't exist, update if it does) |
|
public |
Process the defaults for the app menu to have correct information. |
|
public |
Saves a appMenu (insert if id doesn't exist, update if it does) |
Public Constructors
public constructor(response: Object) source
Helper class representing an single app menu.
Params:
Name | Type | Attribute | Description |
response | Object |
|
JSON formatted response of a single menu |
response.id | Number | The id of the app menu |
|
response.title | String | The title of the app menu |
|
response.action | String | The action that the devices need to execute when the app menu is tapped. Options are:
|
|
response.image | Object | The icon of the app menu |
Public Members
public set actionDetail: Any source
public get actionDetail: Any source
public set flowContainer: FlowContainer source
public get flowContainer: FlowContainer source
public image: C6Image source
public get predefinedScreen: PredefinedScreen source
public set predefinedScreen: PredefinedScreen source
Private Members
private _badge: * source
private _children: *[] source
Public Methods
public async connectChildren(appMenus: *) source
Params:
Name | Type | Attribute | Description |
appMenus | * |
|
public async delete(cascade: boolean): Promise source
Saves a appMenu (insert if id doesn't exist, update if it does)
Params:
Name | Type | Attribute | Description |
cascade | boolean |
|
Example:
import { AppMenu, Client } from 'clinical6';
// Removes appMenu from server and local storage
const appMenu = new AppMenu({
"id": 1,
"type": "appMenus",
"attributes": {
"udid": "this-is-a-udid-string",
"technology": "ios",
"access_token": "cd68fa04e458d6d1a9d29faec6a329d3",
"push_id": null,
"created_at": "2017-05-19T17:21:26.311Z",
"updated_at": "2017-05-19T17:21:26.311Z",
"app_version": null
}
});
appMenu.delete();
// No longer in storage
Client.instance.storageUtility.has('appMenus', { id: 1 });
// if cascade parameter pass is true, check that all submenus are also deleted recursively
public processDefaults() source
Process the defaults for the app menu to have correct information. This will call and store the appropriate values for various modules, such as 'alerts'.
public async save(): Promise<AppMenu> source
Saves a appMenu (insert if id doesn't exist, update if it does)
Example:
import { AppMenu, appMenuService } from 'clinical6';
// Inserts when id does not exist
const appMenu = new AppMenu({
"title": "You are a winner"
});
appMenu.save();
// Updates existing appMenu when id exists
appMenuService.get().then(appMenus => appMenus[0].save());
Test:
- [unit] AppMenu.save should successfully insert a appMenu with a appMenu object when id does not exist
- [unit] AppMenu.save should successfully update a appMenu with a appMenu object when id exists
- [unit] AppMenu.save should successfully update a appMenu with a appMenu object with a null relationship when id exists