Made changes to "current status" widget to display service offerings but outage details are displayed

Harika1
Tera Contributor

Hi ,

I was trying to make "current status" widget to display service offerings but in the service status page outage details are missing.

 

Body HTML template:

<div ng-if="!data.service || data.outages.length > 0" class="panel panel-{{options.color}} b">
<div class="panel-heading">
<h3 class="panel-title">${Current Status}<span ng-if="data.serviceDisplay"> - {{data.serviceDisplay}}</span></h3>

</div>

<div class="panel-body">
<div ng-if="!standalone && !data.service" class="hidden-xs">${We constantly monitor our services and their related components.} ${If there is ever a service interruption, a notification will be posted to this page.} ${If you are experiencing problems not listed on this page, you can submit a request for service.}</div>

<div ng-if="data.outages.length == 0" class="col-xs-12 bs-callout bs-callout-success">
<div ng-if="!data.service">${No system is reporting an issue}</div>
</div>
<div ng-if="data.outages.length > 0" ng-repeat="outage in data.outages" class="col-xs-12 bs-callout bs-callout-{{outage.type}}">
<a ng-if="!data.service" style="color:inherit" ng-href="?id=service_status_sp&service={{outage.serviceID}}">{{outage.typeDisplay}} - {{outage.ci}} (${started {{outage.begin}}})
<div ng-if="options.show_outage_details == 'true' && outage.details" ng-bind-html="::trustAsHtml(outage.details)" class="sp-outage-details"></div>
</a>
<span ng-if="data.service" style="color:inherit">{{outage.typeDisplay}} - {{outage.ci}} (${started {{outage.begin}}})

<div ng-if="options.show_outage_details == 'true' && outage.details" ng-bind-html="::trustAsHtml(outage.details)" class="sp-outage-details"></div>
</span>
</div>
<div ng-if="::standalone"><a href="?id=services_status" aria-label="${More information, open current status page}">${More information...}</a></div>
</div>
</div>

 

Server script:

var outage = new GlideRecord("cmdb_ci_outage");
outage.addQuery("cmdb_ci.sys_class_name","service_offering");
//outage.addQuery("cmdb_ci.sys_class_name", "IN", options.sys_class_list || "service_offering");
outage.addQuery("begin", "<=", gs.nowNoTZ());
outage.addQuery("end", ">=", gs.nowNoTZ()).addOrCondition("end", "=", "NULL");
/*data.service = $sp.getParameter("serivce_offering");

if (!GlideStringUtil.nil(data.service)) {
outage.addQuery("cmdb_ci", data.service);
var serviceGR = new GlideRecord("service_offering");
if (serviceGR.get(data.service))
data.serviceDisplay = serviceGR.getDisplayValue();

*/
outage.query();
data.outages = [];
data.outageIDs = "";
while (outage.next()) {
//gs.log("Harika details"+outage.getValue("details"));
var out = {};
out.typeDisplay = outage.type.getDisplayValue();
out.type = outage.getValue("type");
out.details = outage.getValue("details");
out.issue = outage.getValue("u_issue");
out.ci = outage.cmdb_ci.getDisplayValue();
out.serviceID = outage.getValue("cmdb_ci");
out.begin = outage.begin.getDisplayValue();
data.outages.push(out);
data.outageIDs += "," + outage.getUniqueValue();
}

 

 

Client controller:

function ($scope, spUtil, snRecordWatcher, $rootScope, $sce) {
var c = this;
$scope.standalone = $scope.options.standalone == 'true' || $scope.options.standalone == true;
var q = "cmdb_ci.sys_class_name=cmdb_ci_service";
if ($scope.data.outageIDs != "")
q += "^NQsys_idIN" + $scope.data.outageIDs;

spUtil.recordWatch($scope, "cmdb_ci_outage", q, function() {
$scope.server.update();
$rootScope.$broadcast("sp.outage.updated");
//console.log('Harika',data.serviceDisplay);
});

$scope.trustAsHtml = function(html) {
return $sce.trustAsHtml(html);
};

}

 

Please help me

Thanks in Advance!

1 ACCEPTED SOLUTION

Hi,

Please ensure on the widget itself, you have that option turned on:

You can press ctrl+right-click on the status widget and then instance options and select it:

find_real_file.png

find_real_file.png

Please mark reply as Helpful/Correct. Thanks! 🙂


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

View solution in original post

7 REPLIES 7

Hi,

Please ensure on the widget itself, you have that option turned on:

You can press ctrl+right-click on the status widget and then instance options and select it:

find_real_file.png

find_real_file.png

Please mark reply as Helpful/Correct. Thanks! 🙂


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Thanks..that worked

Hi,

Great!

If any other reply of mine was Helpful, please also mark it as Helpful.

Thanks and have a great weekend! 🙂


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!