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

Allen Andreas
Administrator
Administrator

Hello,

Please use the appropriate forum feature: "Insert/Edit code sample" when pasting code on the forums as it makes it more organized and easier to read. Right now, there's just a huge wall of text.

find_real_file.png

The outage details will show, out of box, when "Details" are added to the outage. You may need to add this field to your outage form, but that's where they'd show.

find_real_file.png

find_real_file.png

Please mark reply as Helpful, if applicable. Thanks!


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

Hi Allen,

 

I have details field on the outage table .Still can't see the details on the service status page.

find_real_file.png

Thanks,

Hi,

Glad my reply above was Helpful and thanks for organizing your code 🙂

Can you share a screenshot of what you're seeing?

Is the outage even showing at all? If it's not showing at all, then there's an adjustment needed in your script to allow other class types.

Your question topic says they are displayed, then in your original post, you say they're missing, so just trying to understand where we are at this point.

Please mark reply as Helpful/Correct, if applicable. Thanks!


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

Hi Allen,

 

Yes, I can see the outage record, start and end date but I can't see details which I have added to the outage record.

 

Thanks,