SmartIT_Extensions/BMC/smart-it-full/scripts/app/common/vo/sla-vo.js

61 lines
1.7 KiB
JavaScript

"use strict";
/**
* Value object for sla.
*
* @constructor
*/
function SLAVO() {
// simple fields
this.parentId = '';
this.title = '';
this.goal = '';
this.startTime = '';
this.endTime = '';
this.measurementStatus = '';
this.overallStopTime = '';
this.downStartTime = '';
this.upStartTime = '';
this.downElapsedTime = '';
this.upElapsedTime = '';
this.slaType = '';
// derived fields
this.iconClass = '';
this.position = '';
// methods
this.processIconClass = function () {
switch (this.measurementStatus) {
case SLAVO.MEASUREMENT_STATUS_MET:
this.iconClass = 'check_circle_o';
break;
case SLAVO.MEASUREMENT_STATUS_MISSED:
case SLAVO.MEASUREMENT_STATUS_MISSED_GOAL:
this.iconClass = 'cross_circle_o';
break;
default:
this.iconClass = 'circle_o';
break;
}
};
}
// inherit BaseVO
SLAVO.prototype = new BaseVO();
// correct the constructor pointer
SLAVO.prototype.constructor = SLAVO;
SLAVO.MEASUREMENT_STATUS_PENDING = '2';
SLAVO.MEASUREMENT_STATUS_MET = '4';
SLAVO.MEASUREMENT_STATUS_MISSED = '5';
SLAVO.MEASUREMENT_STATUS_MISSED_GOAL = '7';
/**
* @override
* @return {Array}
*/
SLAVO.prototype.getProps = function () {
return BaseVO.prototype.getProps().concat('parentId', 'title', 'goal', 'startTime', 'endTime', 'measurementStatus', 'overallStopTime', 'downStartTime', 'upStartTime', 'downElapsedTime', 'upElapsedTime', 'slaType', 'warningDate', 'warningPercentage');
};
/**
* @override
*/
SLAVO.prototype.postBuild = function () {
this.processIconClass();
};