<  Widgets

RocketFuel Service Alerts Rotator

### Description

This widget rotates through any service outages or planned maintenance windows.

### Configuration

The instance options allow you to specify a page, custom classes for the column, and custom classes for the parent element, as well as change the color of the panel heading, customize the title and select which image field should be used to display category images.

First install the widget, then access the instance options menu by CTRL + Right-Clicking on the widget from within the portal and selecting Instance Options. You must specify an API in the API Name field. An example of the API that is needed for this widget is listed below in the dependency section of this documentation.

### Widget Option Schema Parameters

|  Option       | Property | Comments |
| ----- |:-----:| ---- |
| Template | `u_template` | This property allows a custom template to be selected. |
| Carousel Interval | `carousel_interval` | This field specifies the length of time in milliseconds, which should elapse between the display of each outage. |
| Page | `sp_page` | This property can be used to select a page which is used for create the URL for each category. |
| API Name | `api` | This property specifies the name of the API that you would like to use with this widget. |

### Sample Data

```json
{
 "data": {
   "query": "cmdb_ci.sys_class_name=cmdb_ci_service",
   "always_show": "true",
   "api": "FOO",
   "templateID": "alert.html"
 }
}
```

### Dependencies
_Dependencies are included and configured as part of the provided Update Set._

This widget uses a script include. (Make sure to include the name of the script include in the API Name field of the instance options)

To install this API, access the sys_script_include table and create a new record that uses this script, then place the name of the API that you created in the API Name field of the widget instance options.

```javascript
var AlertQuery = Class.create();
AlertQuery.prototype = {
initialize: function() {
},
getAlerts: function() {
var alerts = [];
var grOutage = new GlideRecord("cmdb_ci_outage");
grOutage.addQuery("cmdb_ci.sys_class_name", "cmdb_ci_service");
grOutage.addQuery("begin", "<=", gs.beginningOfCurrentMinute());
grOutage.addEncodedQuery("end>=" + gs.beginningOfCurrentMinute() + '^ORendISEMPTY');
grOutage.query();
while (grOutage.next()) {
var item = {};
item.displayType = grOutage.type.getDisplayValue();
item.type = grOutage.getValue("type");
item.message = grOutage.cmdb_ci.getDisplayValue();
item.serviceID = grOutage.getValue("cmdb_ci");
item.begin = grOutage.begin.getDisplayValue();
item.link = '?id=service_status&service=' + item.serviceID;
if(item.type == 'planned') {
item.icon = 'fa-clock-o';
item.labelClass = 'info';
} else if(item.type == 'outage') {
item.icon = 'fa-warning';
item.labelClass = 'danger';
} else {
item.icon = 'fa-arrow-circle-down';
item.labelClass = 'warning';
}
alerts.push(item);
}
return alerts;
},
getQuery: function() {
var query = "cmdb_ci.sys_class_name=cmdb_ci_service";
return query;
},
getTable: function() {
var table = 'cmdb_ci_outage';
return table;
},
type: 'AlertQuery'
};
```

### CSS/SASS Variables

_CSS/SASS variables are given default values that can be overridden with theming or portal-level CSS._

> None

Get Awesome Updates

Enter your email address for news and updates from NewRocket.

Thanks for your email!
There was an error, please try submitting again.