!function(e){ko.validation.init({insertMessages:!1,decorateElement:!0,errorElementClass:"error"},!0),ko.applyBindings(new function(){var t=this;t.width=ko.observable(e("#main").outerWidth()),t.isPhone=ko.computed((function(){return t.width()<768})),t.id=ko.observable(),t.hostid=ko.observable(),t.host=ko.observable(""),t.date=ko.observable(""),t.servicename=ko.observable(""),t.servicetype=ko.observable(""),t.event=ko.observable(""),t.eventstate=ko.observable(),t.action=ko.observable(""),t.message=ko.observable(""),t.notes=ko.observableArray(),t.notice=ko.observable("").extend({required:!0}),t.hosturl=ko.computed((function(){return"../../status/hosts/detail?id="+t.hostid()})),t.eventstateColor=ko.computed((function(){switch(t.eventstate()){case 5:case 4:return"gray";case 3:case 2:return"orange";case 1:return"red";default:return"green"}})),t.save=function(){t.notice.isValid()?e.post("notice",e.param({id:t.id(),notice:t.notice()},!0),(function(){window.location.reload()})).fail(MMONIT.error.json):(t.notice.valueHasMutated(),e("#notice").focus())},e.getJSON("../../reports/events/get?id="+e(document).getUrlParam("id"),(function(o){t.id(o.id),t.hostid(o.hostid),t.host(o.host),t.date(strftime("%b %d %Y %H:%M:%S",new Date(1e3*o.date))),t.servicename(o.servicename),t.servicetype(o.servicetype),t.event(o.event),t.eventstate(o.eventstate),t.action(o.action),t.message(o.message),e.map(o.note,(function(e,o){t.notes.push({date:strftime("%b %d %Y %H:%M:%S",new Date(1e3*e.date)),message:e.message,uname:e.uname})}))})).fail(MMONIT.error.json),function o(){t.width(e("#main").outerWidth()),e(window).off("resize orientationchange").on("resize orientationchange",o)}()})}(jQuery);