Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
BT360 Alarm Custom Widget
DATAMONITOR ALARM
<div id="WidgetScroll" style="top:30px; text-align:center;" data-bind="addScrollBar: WidgetScroll, scrollCallback: 'false'">
 <!--ko foreach: sqlJobs-->
  <dl>
   <dt data-bind="text: monitorGroupType"></dt>
</dl> 
<!--ko foreach: $data.monitorGroupData.monitorGroups -->
<!--ko foreach: $data.monitors -->
<!--ko if: monitorStatus===0 || monitorStatus===1 || monitorStatus===2-->
<span data-bind="text: $data.name"></span>
<!--ko if: monitorStatus===0-->
<dd><p style="color:green">Healthy</p></dd>
<!--/ko-->
<!--ko if: monitorStatus===2-->
<dd><p style="color:orange">Warning</p></dd>
<!--/ko-->
<!--ko if: monitorStatus===1-->
<dd><p style="color:red">Error</p></dd>
<!--/ko-->
<!--/ko-->
<!--/ko-->
<!--/ko-->
   <!--/ko-->
</div>
  <script>
     sqlJobs = ko.observable();
var AlarmName = 'DataMonitor';
     test = ko.observable(0);
        activate = function () {
            var _this = this;
            _this.getSQLJob(function (data) {
                _this.sqlJobs(data.monitoringDataList);
    console.log(sqlJobs());
           });
        };
        getSQLJob = function (callback) {
            var url = 'http://biztalk360demo/BizTalk360/Services.REST/AlertService.svc/GetLatestMonitoringData';
            $.ajax({
                dataType: "json",
                url: url,
               type:"GET",
                data: { environmentId: 'D5C99999-AAAA-AAAF-6666-D1AEC44F1949', alarmId: 'C777777A8-66F7-467C-83F1-0A2333ED022F'},
                cache: false,
                success: function (data) {
            callback(data);
        },
                error: function (xhr, ajaxOptions, thrownError) { //Add these parameters to display the required response
             
        },
            });
        };
   activate();
    setInterval(function(){
          activate(); // this will run after every 60 seconds
    }, 60000);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment