Application Packaging Standard

Last updated 18-Mar-2019

Services in Users List

To represent its service in the users list, an application must plug a view-plugin into the User Manager placeholder http://www.parallels.com/ccp-users#usersview.

In this document:

API

The User Manager calls the following methods that must be defined in the view-plugin:

  • init(mediator) - contains definition of the other methods of the mediator object as mentioned below.

  • mediator.getServicesList() - must return the title of the column that shows service data of the application in the grid mode. In a case, there are more than one services, it can return an array of titles.

  • mediator.getState(users) - must return an object in the following format:

    {
        <user-1 APS ID>: [<state-11>, <state-12>,...],
        <user-2 APS ID>: [<state-21>, <state-22>,...],
        ...
    }
    

    Where <state-11>, <state-12> and so forth are state objects each containing structured data about a service assigned to the respective user:

    • state.status - a string that indicates if the application service is assigned to the user and reflects the service status. It can be one of “Assigned”, “Not Assigned”, “Updating”, or “Deleting”.

      Warning

      It is not allowed to apply the translation function, for example, _(“Assigned”), to those values.

    • state.title - the title of the application service displayed in a tile.

    • state.widget - a UI container that displays in a tile the service and its resources assigned to the user.

    • state.gridWidget - a UI container or an output widget that displays in the grid the service and its resources assigned to the user.

Input

The User Manager passes the following objects when calling methods defined in the view-plugin:

  • The init(mediator) method gets the mediator object used for exchanging data between the User Manager and view-plugins.

  • The mediator.getState(users) method gets the users array:

    [{user-1},{user-2},...]
    

Each item in the users array represents a user in accordance with the PAUser schema. It also contains all assigned services as the services array. Generally, a user structure looks as follows:

{
   <user properties>,
   "services": [
      {resource-1},
      {resource-2},
      ...
   ]
}

The structure of a resource is defined by the APS type the resource is based on.

Data Processing

As mentioned earlier, the init(mediator) method must define the methods that the dashboard application can call through the mediator.

The mediator.getServicesList method returns one of the following.

  • If the application can assign resources of only one type to users, it returns the title of the respective column in the grid presenting the application service. For example:

    mediator.getServicesList = function() {
        return { "title": "VPSes" };
    };
    
  • If the application can assign resources of several types to users, it returns a list of titles, one per each column, for example:

    mediator.getServicesList = function() {
        return [ {"title": "VPSes"}, {"title": "Backup"} ];
    };
    

The mediator.getState(users) method must figure out a list of services assigned to each user from the input list and create widgets that the User Manager displays in the list of users. The returned object is a list of user APS IDs mapped to the list of state objects as explained earlier. The method skeleton may look as follows:

mediator.getState = function(users) {
/* For each user from the list, define a list of <state> objects as follows: */

   /* For each APS type used to assign resources to users, define a state object: */

      /* Figure out resources assigned to the user and their status - "Assigned" or not */

      /* Define the state.widget for a tile */

      /* Define the state.gridWidget for the grid */

/* Return the list of APS IDs of users, each mapped to an array of <state> objects assigned to the respective user */

};

Output

  • The mediator.getServicesList() method returns the title of the column for the grid presentation of the user list.
  • The mediator.getState(users) method returns a list of user APS IDs mapped to arrays of states. Each state contains some data about a service assigned to a user including data presentation in the following widgets:
    • state.widget shows the service data in a tile.
    • state.gridWidget shows the service data in the grid.

Example

Refer to the demo process of developing such a view.