On-Screen Notifications in Provider Panel

The provider control panel (PCP) allows applications to attract the attention of the provider staff to some events. For this purpose, an application can send various notifications through the APS resource presenting the PCP notification manager service and based on the platform built-in PCPNotificationManager APS type.

Visualization

The platform displays the notifications sent by APS applications in pop-up boxes differentiated by types: info, warning, and error notifications as illustrated here.

../../../../_images/pcp-notification-types.png

The notifications appear only on the main dashboard that opens when a user logs in the PCP or clicks later on the top most item in the navigation panel.

../../../../_images/pcp-notification-screenshot.png

The dashboard displays not more than 3 notifications of a certain type per application instance. So, totally, a user can see up to 9 notifications sent by an application instance. For example, if there are 3 notifications of the warning type sent by an application instance, the next notification of this type from the same application instance will replace the oldest one.

Notification Structure

An application sends a notification to the PCP notification manager as a JSON object containing the following components as specified by the RestPCPNotification structure in the PCPNotificationManager APS type.

  • type indicates the level of the notification severity to highlight the notification message in a box using a special background color. One of the following strings can be assigned to this property:

    • info - the message informs about an event.

    • warning - the message warns the staff about some existing or upcoming issues.

    • error - the message contains a description of an error in the application.

    For example:

    "type": "info"
    
  • message contains the description of an event. The description may have a text with some keys in the text. A key is identified by a pair of double underscores (__) surrounding it, for example:

    "message": "The Cloud VPS data center in __datacenter__ now allows you to sell
                the new __servicename__ service"
    
  • keys is a named set that assigns the values to the keys used in the message, for example:

    "keys": { "datacenter": "Orlando", "servicename": "Site Builder" }
    
  • packageId is the APS ID of the package the APS application instance is installed from, for example:

    "packageId": "730e932c-299e-4e79-9b1b-d836601c09da"
    

Notification Manager

The PCP on-screen notification manager is represented by an APS resource based on the PCPNotificationManager APS type. Before operating notifications, an application must find the APS ID of that resource by sending the following request:

GET /aps/2/resources?implementing(http://www.parallels.com/pa/pa-core-services/pcp-notification-manager/1.0)

Having received the APS ID, the application can call the following operations exposed by the notification manager.

sendNotification

An application calls the sendNotification method of the notification manager to send a new notification in the JSON format explained in the Notification Structure section. For example:

POST /aps/2/resources/<notification manager APS ID>/notifications

{
   "type": "info",
   "packageId": "730e932c-299e-4e79-9b1b-d836601c09da",
   "message": "The Cloud VPS data center in __datacenter__ now allows you to sell the new __servicename__ service",
   "keys": {
      "datacenter": "Orlando",
      "servicename": "Site Builder"
   }
}

The method returns the ID of the notification that the application can use to process the notification using the other operations.

getNotification

An application can get the full JSON representation of a given notification. For this effect, the application must send a GET request containing the notification ID in the URL:

GET /aps/2/resources/<notification manager APS ID>/notifications/<notification ID>

deleteNotification

To delete a certain notification, an application sends the DELETE request with the notification ID in the URL:

DELETE /aps/2/resources/<notification manager APS ID>/notifications/<notification ID>

Internationalization

The Internationalization in Notifications document explains in details how notifications can support multiple languages.