commit
c530337c50
|
@ -1,12 +1,28 @@
|
||||||
class Server {
|
'use strict';
|
||||||
constructor(json) {
|
|
||||||
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||||
|
|
||||||
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||||
|
|
||||||
|
var Server = function () {
|
||||||
|
function Server(json) {
|
||||||
|
_classCallCheck(this, Server);
|
||||||
|
|
||||||
for (var k in json) {
|
for (var k in json) {
|
||||||
this[k] = json[k];
|
this[k] = json[k];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
url(port=0){
|
|
||||||
return location.protocol+'//'+this.Hostname+
|
_createClass(Server, [{
|
||||||
(port ? ':'+port : '') +
|
key: 'url',
|
||||||
( ( this.PathPrefix && this.PathPrefix != 'null') ? this.PathPrefix : '');
|
value: function url() {
|
||||||
|
var port = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
||||||
|
|
||||||
|
return location.protocol + '//' + this.Hostname + (port ? ':' + port : '') + (this.PathPrefix && this.PathPrefix != 'null' ? this.PathPrefix : '');
|
||||||
}
|
}
|
||||||
};
|
}]);
|
||||||
|
|
||||||
|
return Server;
|
||||||
|
}();
|
||||||
|
|
||||||
|
;
|
||||||
|
|
|
@ -319,11 +319,11 @@ function convertLabelFormat(LabelFormat, monitorName){
|
||||||
|
|
||||||
function addVideoTimingTrack(video, LabelFormat, monitorName, duration, startTime){
|
function addVideoTimingTrack(video, LabelFormat, monitorName, duration, startTime){
|
||||||
//This is a hacky way to handle changing the texttrack. If we ever upgrade vjs in a revamp replace this. Old method preserved because it's the right way.
|
//This is a hacky way to handle changing the texttrack. If we ever upgrade vjs in a revamp replace this. Old method preserved because it's the right way.
|
||||||
let cues = vid.textTracks()[0].cues();
|
var cues = vid.textTracks()[0].cues();
|
||||||
let labelFormat = convertLabelFormat(LabelFormat, monitorName);
|
var labelFormat = convertLabelFormat(LabelFormat, monitorName);
|
||||||
startTime = moment(startTime);
|
startTime = moment(startTime);
|
||||||
|
|
||||||
for (let i = 0; i <= duration; i++) {
|
for (var i = 0; i <= duration; i++) {
|
||||||
cues[i] = {id: i, index: i, startTime: i, Ca: i+1, text: startTime.format(labelFormat)};
|
cues[i] = {id: i, index: i, startTime: i, Ca: i+1, text: startTime.format(labelFormat)};
|
||||||
startTime.add(1, 's');
|
startTime.add(1, 's');
|
||||||
}
|
}
|
||||||
|
@ -361,21 +361,21 @@ function endOfResize(e) {
|
||||||
|
|
||||||
function scaleToFit (baseWidth, baseHeight, scaleEl, bottomEl) {
|
function scaleToFit (baseWidth, baseHeight, scaleEl, bottomEl) {
|
||||||
$j(window).on('resize', endOfResize) //set delayed scaling when Scale to Fit is selected
|
$j(window).on('resize', endOfResize) //set delayed scaling when Scale to Fit is selected
|
||||||
let ratio = baseWidth / baseHeight;
|
var ratio = baseWidth / baseHeight;
|
||||||
let container = $j('#content');
|
var container = $j('#content');
|
||||||
let viewPort = $j(window);
|
var viewPort = $j(window);
|
||||||
// jquery does not provide a bottom offet, and offset dows not include margins. outerHeight true minus false gives total vertical margins.
|
// jquery does not provide a bottom offet, and offset dows not include margins. outerHeight true minus false gives total vertical margins.
|
||||||
let bottomLoc = bottomEl.offset().top + (bottomEl.outerHeight(true) - bottomEl.outerHeight()) + bottomEl.outerHeight(true);
|
var bottomLoc = bottomEl.offset().top + (bottomEl.outerHeight(true) - bottomEl.outerHeight()) + bottomEl.outerHeight(true);
|
||||||
let newHeight = viewPort.height() - (bottomLoc - scaleEl.outerHeight(true))
|
var newHeight = viewPort.height() - (bottomLoc - scaleEl.outerHeight(true))
|
||||||
let newWidth = ratio * newHeight;
|
var newWidth = ratio * newHeight;
|
||||||
if (newWidth > container.innerWidth()) {
|
if (newWidth > container.innerWidth()) {
|
||||||
newWidth = container.innerWidth();
|
newWidth = container.innerWidth();
|
||||||
newHeight = newWidth / ratio;
|
newHeight = newWidth / ratio;
|
||||||
}
|
}
|
||||||
let autoScale = Math.round(newWidth / baseWidth * SCALE_BASE);
|
var autoScale = Math.round(newWidth / baseWidth * SCALE_BASE);
|
||||||
let scales = $j('#scale option').map(function() {return parseInt($j(this).val());}).get();
|
var scales = $j('#scale option').map(function() {return parseInt($j(this).val());}).get();
|
||||||
scales.shift();
|
scales.shift();
|
||||||
let closest;
|
var closest;
|
||||||
$j(scales).each(function () { //Set zms scale to nearest regular scale. Zoom does not like arbitrary scale values.
|
$j(scales).each(function () { //Set zms scale to nearest regular scale. Zoom does not like arbitrary scale values.
|
||||||
if (closest == null || Math.abs(this - autoScale) < Math.abs(closest - autoScale)) {
|
if (closest == null || Math.abs(this - autoScale) < Math.abs(closest - autoScale)) {
|
||||||
closest = this.valueOf();
|
closest = this.valueOf();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
var vid = null;
|
var vid = null;
|
||||||
|
|
||||||
function vjsReplay() {
|
function vjsReplay() {
|
||||||
let endTime = (Date.parse(eventData.EndTime)).getTime();
|
var endTime = (Date.parse(eventData.EndTime)).getTime();
|
||||||
switch(replayMode.value) {
|
switch(replayMode.value) {
|
||||||
case 'none':
|
case 'none':
|
||||||
break;
|
break;
|
||||||
|
@ -10,22 +10,22 @@ function vjsReplay() {
|
||||||
break;
|
break;
|
||||||
case 'all':
|
case 'all':
|
||||||
if (nextEventId == 0) {
|
if (nextEventId == 0) {
|
||||||
let overLaid = $j("#videoobj");
|
var overLaid = $j("#videoobj");
|
||||||
overLaid.append('<p class="vjsMessage" style="height: '+overLaid.height()+'px; line-height: '+overLaid.height()+'px;">No more events</p>');
|
overLaid.append('<p class="vjsMessage" style="height: '+overLaid.height()+'px; line-height: '+overLaid.height()+'px;">No more events</p>');
|
||||||
} else {
|
} else {
|
||||||
let nextStartTime = nextEventStartTime.getTime(); //nextEventStartTime.getTime() is a mootools workaround, highjacks Date.parse
|
var nextStartTime = nextEventStartTime.getTime(); //nextEventStartTime.getTime() is a mootools workaround, highjacks Date.parse
|
||||||
if (nextStartTime <= endTime) {
|
if (nextStartTime <= endTime) {
|
||||||
streamNext( true );
|
streamNext( true );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let overLaid = $j("#videoobj");
|
var overLaid = $j("#videoobj");
|
||||||
vid.pause();
|
vid.pause();
|
||||||
overLaid.append('<p class="vjsMessage" style="height: '+overLaid.height()+'px; line-height: '+overLaid.height()+'px;"></p>');
|
overLaid.append('<p class="vjsMessage" style="height: '+overLaid.height()+'px; line-height: '+overLaid.height()+'px;"></p>');
|
||||||
let gapDuration = (new Date().getTime()) + (nextStartTime - endTime);
|
var gapDuration = (new Date().getTime()) + (nextStartTime - endTime);
|
||||||
let messageP = $j(".vjsMessage");
|
var messageP = $j(".vjsMessage");
|
||||||
let x = setInterval(function() {
|
var x = setInterval(function() {
|
||||||
let now = new Date().getTime();
|
var now = new Date().getTime();
|
||||||
let remainder = new Date(Math.round(gapDuration - now)).toISOString().substr(11,8);
|
var remainder = new Date(Math.round(gapDuration - now)).toISOString().substr(11,8);
|
||||||
messageP.html(remainder + ' to next event.');
|
messageP.html(remainder + ' to next event.');
|
||||||
if (remainder < 0) {
|
if (remainder < 0) {
|
||||||
clearInterval(x);
|
clearInterval(x);
|
||||||
|
@ -70,7 +70,7 @@ function renderAlarmCues (containerEl) {
|
||||||
var pixSkew = 0;
|
var pixSkew = 0;
|
||||||
var skip = 0;
|
var skip = 0;
|
||||||
var num_cueFrames = cueFrames.length;
|
var num_cueFrames = cueFrames.length;
|
||||||
for ( let i = 0; i < num_cueFrames; i++ ) {
|
for ( var i = 0; i < num_cueFrames; i++ ) {
|
||||||
skip = 0;
|
skip = 0;
|
||||||
frame = cueFrames[i];
|
frame = cueFrames[i];
|
||||||
if (frame.Type == "Alarm" && alarmed == 0) { //From nothing to alarm. End nothing and start alarm.
|
if (frame.Type == "Alarm" && alarmed == 0) { //From nothing to alarm. End nothing and start alarm.
|
||||||
|
@ -78,7 +78,7 @@ var num_cueFrames = cueFrames.length;
|
||||||
if (frame.Delta == 0) continue; //If event starts with an alarm or too few for a nonespan
|
if (frame.Delta == 0) continue; //If event starts with an alarm or too few for a nonespan
|
||||||
spanTimeEnd = frame.Delta * 100;
|
spanTimeEnd = frame.Delta * 100;
|
||||||
spanTime = spanTimeEnd - spanTimeStart;
|
spanTime = spanTimeEnd - spanTimeStart;
|
||||||
let pix = cueRatio * spanTime;
|
var pix = cueRatio * spanTime;
|
||||||
pixSkew += pix - Math.round(pix);//average out the rounding errors.
|
pixSkew += pix - Math.round(pix);//average out the rounding errors.
|
||||||
pix = Math.round(pix);
|
pix = Math.round(pix);
|
||||||
if ((pixSkew > 1 || pixSkew < -1) && pix + Math.round(pixSkew) > 0) { //add skew if it's a pixel and won't zero out span.
|
if ((pixSkew > 1 || pixSkew < -1) && pix + Math.round(pixSkew) > 0) { //add skew if it's a pixel and won't zero out span.
|
||||||
|
@ -143,20 +143,20 @@ function setButtonState( element, butClass ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeScale() {
|
function changeScale() {
|
||||||
let scale = $j('#scale').val();
|
var scale = $j('#scale').val();
|
||||||
let newWidth;
|
var newWidth;
|
||||||
let newHeight;
|
var newHeight;
|
||||||
let autoScale;
|
var autoScale;
|
||||||
let eventViewer;
|
var eventViewer;
|
||||||
let alarmCue = $j('div.alarmCue');
|
var alarmCue = $j('div.alarmCue');
|
||||||
let bottomEl = streamMode == 'stills' ? $j('#eventImageNav') : $j('#replayStatus');
|
var bottomEl = streamMode == 'stills' ? $j('#eventImageNav') : $j('#replayStatus');
|
||||||
if (streamMode == 'stills') {
|
if (streamMode == 'stills') {
|
||||||
eventViewer = $j('#eventThumbs');
|
eventViewer = $j('#eventThumbs');
|
||||||
} else {
|
} else {
|
||||||
eventViewer = $j(vid ? '#videoobj' : '#evtStream');
|
eventViewer = $j(vid ? '#videoobj' : '#evtStream');
|
||||||
}
|
}
|
||||||
if ( scale == "auto" ) {
|
if ( scale == "auto" ) {
|
||||||
let newSize = scaleToFit(eventData.Width, eventData.Height, eventViewer, bottomEl);
|
var newSize = scaleToFit(eventData.Width, eventData.Height, eventViewer, bottomEl);
|
||||||
newWidth = newSize.width;
|
newWidth = newSize.width;
|
||||||
newHeight = newSize.height;
|
newHeight = newSize.height;
|
||||||
autoScale = newSize.autoScale;
|
autoScale = newSize.autoScale;
|
||||||
|
@ -420,8 +420,8 @@ function streamNext(action) {
|
||||||
$j(".vjsMessage").remove();//This shouldn't happen
|
$j(".vjsMessage").remove();//This shouldn't happen
|
||||||
if ( nextEventId == 0 ) { //handles deleting last event.
|
if ( nextEventId == 0 ) { //handles deleting last event.
|
||||||
pauseClicked();
|
pauseClicked();
|
||||||
let hideContainer = $j('#eventVideo');
|
var hideContainer = $j('#eventVideo');
|
||||||
let hideStream = $j(vid ? "#videoobj" : "#evtStream").height() + (vid ? 0 :$j("#progressBar").height());
|
var hideStream = $j(vid ? "#videoobj" : "#evtStream").height() + (vid ? 0 :$j("#progressBar").height());
|
||||||
hideContainer.prepend('<p class="vjsMessage" style="height: ' + hideStream + 'px; line-height: ' + hideStream + 'px;">No more events</p>');
|
hideContainer.prepend('<p class="vjsMessage" style="height: ' + hideStream + 'px; line-height: ' + hideStream + 'px;">No more events</p>');
|
||||||
if ( vid == null ) zmsBroke = true;
|
if ( vid == null ) zmsBroke = true;
|
||||||
return;
|
return;
|
||||||
|
@ -444,15 +444,15 @@ function streamNext(action) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function vjsPanZoom (action, x, y) { //Pan and zoom with centering where the click occurs
|
function vjsPanZoom (action, x, y) { //Pan and zoom with centering where the click occurs
|
||||||
let outer = $j('#videoobj');
|
var outer = $j('#videoobj');
|
||||||
let video = outer.children().first();
|
var video = outer.children().first();
|
||||||
let zoom = parseFloat($j('#zoomValue').html());
|
var zoom = parseFloat($j('#zoomValue').html());
|
||||||
let zoomRate = .5;
|
var zoomRate = .5;
|
||||||
let matrix = video.css('transform').split(',');
|
var matrix = video.css('transform').split(',');
|
||||||
let currentPanX = parseFloat(matrix[4]);
|
var currentPanX = parseFloat(matrix[4]);
|
||||||
let currentPanY = parseFloat(matrix[5]);
|
var currentPanY = parseFloat(matrix[5]);
|
||||||
let xDist = outer.width()/2 - x //Click distance from center of view
|
var xDist = outer.width()/2 - x //Click distance from center of view
|
||||||
let yDist = outer.height()/2 - y
|
var yDist = outer.height()/2 - y
|
||||||
if (action == 'zoomOut') {
|
if (action == 'zoomOut') {
|
||||||
zoom -= zoomRate;
|
zoom -= zoomRate;
|
||||||
if (x && y) {
|
if (x && y) {
|
||||||
|
@ -477,8 +477,8 @@ function vjsPanZoom (action, x, y) { //Pan and zoom with centering where the cli
|
||||||
x = xDist + currentPanX;
|
x = xDist + currentPanX;
|
||||||
y = yDist + currentPanY;
|
y = yDist + currentPanY;
|
||||||
}
|
}
|
||||||
let limitX = ((zoom*outer.width()) - outer.width())/2; //Calculate outer bounds of video
|
var limitX = ((zoom*outer.width()) - outer.width())/2; //Calculate outer bounds of video
|
||||||
let limitY = ((zoom*outer.height()) - outer.height())/2;
|
var limitY = ((zoom*outer.height()) - outer.height())/2;
|
||||||
x = Math.min(Math.max((x),-limitX),limitX); //Limit pan to outer bounds of video
|
x = Math.min(Math.max((x),-limitX),limitX); //Limit pan to outer bounds of video
|
||||||
y = Math.min(Math.max((y),-limitY),limitY);
|
y = Math.min(Math.max((y),-limitY),limitY);
|
||||||
video.css('transform', 'matrix('+zoom+', 0, 0, '+zoom+', '+x+', '+y+')');
|
video.css('transform', 'matrix('+zoom+', 0, 0, '+zoom+', '+x+', '+y+')');
|
||||||
|
@ -951,7 +951,7 @@ function videoEvent() {
|
||||||
|
|
||||||
// Called on each event load because each event can be a different width
|
// Called on each event load because each event can be a different width
|
||||||
function drawProgressBar() {
|
function drawProgressBar() {
|
||||||
let barWidth = $j('#evtStream').width();
|
var barWidth = $j('#evtStream').width();
|
||||||
$j('#progressBar').css( 'width', barWidth );
|
$j('#progressBar').css( 'width', barWidth );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
function validateForm ( form ) {
|
function validateForm ( form ) {
|
||||||
let rows = $j(form).find('tbody').eq(0).find('tr');
|
var rows = $j(form).find('tbody').eq(0).find('tr');
|
||||||
let obrCount = 0;
|
var obrCount = 0;
|
||||||
let cbrCount = 0;
|
var cbrCount = 0;
|
||||||
for ( let i = 0; i < rows.length; i++ ) {
|
for ( var i = 0; i < rows.length; i++ ) {
|
||||||
if (rows.length > 2) {
|
if (rows.length > 2) {
|
||||||
obrCount += parseInt(form.elements['filter[Query][terms][' + i + '][obr]'].value);
|
obrCount += parseInt(form.elements['filter[Query][terms][' + i + '][obr]'].value);
|
||||||
cbrCount += parseInt(form.elements['filter[Query][terms][' + i + '][cbr]'].value);
|
cbrCount += parseInt(form.elements['filter[Query][terms][' + i + '][cbr]'].value);
|
||||||
|
@ -59,7 +59,7 @@ function updateButtons( element ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkValue ( element ) {
|
function checkValue ( element ) {
|
||||||
let rows = $j(element).closest('tbody').children();
|
var rows = $j(element).closest('tbody').children();
|
||||||
parseRows(rows);
|
parseRows(rows);
|
||||||
//clearValue(element);
|
//clearValue(element);
|
||||||
}
|
}
|
||||||
|
@ -103,32 +103,32 @@ function deleteFilter( element, name ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseRows (rows) {
|
function parseRows (rows) {
|
||||||
for (let rowNum = 0; rowNum < rows.length; rowNum++) { //Each row is a term
|
for (var rowNum = 0; rowNum < rows.length; rowNum++) { //Each row is a term
|
||||||
let queryPrefix = 'filter[Query][terms][';
|
var queryPrefix = 'filter[Query][terms][';
|
||||||
let inputTds = rows.eq(rowNum).children();
|
var inputTds = rows.eq(rowNum).children();
|
||||||
|
|
||||||
if (rowNum == 0) inputTds.eq(0).html(' '); //Remove and from first term
|
if (rowNum == 0) inputTds.eq(0).html(' '); //Remove and from first term
|
||||||
if (rowNum > 0) { //add and/or to 1+
|
if (rowNum > 0) { //add and/or to 1+
|
||||||
let cnjVal = inputTds.eq(0).children().val();
|
var cnjVal = inputTds.eq(0).children().val();
|
||||||
let conjSelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][cnj]').attr('id', queryPrefix + rowNum + '][cnj]');
|
var conjSelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][cnj]').attr('id', queryPrefix + rowNum + '][cnj]');
|
||||||
$j.each(conjTypes, function (i) {
|
$j.each(conjTypes, function (i) {
|
||||||
conjSelect.append('<option value="' + i + '" >' + i + '</option>');
|
conjSelect.append('<option value="' + i + '" >' + i + '</option>');
|
||||||
});
|
});
|
||||||
inputTds.eq(0).html(conjSelect).children().val(cnjVal === undefined ? 'and' : cnjVal);
|
inputTds.eq(0).html(conjSelect).children().val(cnjVal === undefined ? 'and' : cnjVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
let brackets = rows.length - 2;
|
var brackets = rows.length - 2;
|
||||||
if (brackets > 0) { //add bracket select to all rows
|
if (brackets > 0) { //add bracket select to all rows
|
||||||
let obrSelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][obr]').attr('id', queryPrefix + rowNum + '][obr]');
|
var obrSelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][obr]').attr('id', queryPrefix + rowNum + '][obr]');
|
||||||
let cbrSelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][cbr]').attr('id', queryPrefix + rowNum + '][cbr]');
|
var cbrSelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][cbr]').attr('id', queryPrefix + rowNum + '][cbr]');
|
||||||
obrSelect.append('<option value="0"</option>');
|
obrSelect.append('<option value="0"</option>');
|
||||||
cbrSelect.append('<option value="0"</option>');
|
cbrSelect.append('<option value="0"</option>');
|
||||||
for (let i = 1; i <= brackets; i++) {//build bracket options
|
for (var i = 1; i <= brackets; i++) {//build bracket options
|
||||||
obrSelect.append('<option value="' + i + '">' + '('.repeat(i) + '</option>');
|
obrSelect.append('<option value="' + i + '">' + '('.repeat(i) + '</option>');
|
||||||
cbrSelect.append('<option value="' + i + '">' + ')'.repeat(i) + '</option>');
|
cbrSelect.append('<option value="' + i + '">' + ')'.repeat(i) + '</option>');
|
||||||
}
|
}
|
||||||
let obrVal = inputTds.eq(1).children().val() != undefined ? inputTds.eq(1).children().val() : 0; //Save currently selected bracket option
|
var obrVal = inputTds.eq(1).children().val() != undefined ? inputTds.eq(1).children().val() : 0; //Save currently selected bracket option
|
||||||
let cbrVal = inputTds.eq(5).children().val() != undefined ? inputTds.eq(5).children().val() : 0;
|
var cbrVal = inputTds.eq(5).children().val() != undefined ? inputTds.eq(5).children().val() : 0;
|
||||||
inputTds.eq(1).html(obrSelect).children().val(obrVal); //Set bracket contents and assign saved value
|
inputTds.eq(1).html(obrSelect).children().val(obrVal); //Set bracket contents and assign saved value
|
||||||
inputTds.eq(5).html(cbrSelect).children().val(cbrVal);
|
inputTds.eq(5).html(cbrSelect).children().val(cbrVal);
|
||||||
} else {
|
} else {
|
||||||
|
@ -146,61 +146,61 @@ function parseRows (rows) {
|
||||||
|
|
||||||
if ( attr == "Archived") { //Archived types
|
if ( attr == "Archived") { //Archived types
|
||||||
inputTds.eq(3).html('equal to<input type="hidden" name="filter[Query][terms][' + rowNum + '][op]" value="=">');
|
inputTds.eq(3).html('equal to<input type="hidden" name="filter[Query][terms][' + rowNum + '][op]" value="=">');
|
||||||
let archiveSelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]');
|
var archiveSelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]');
|
||||||
for (let i = 0; i < archiveTypes.length; i++) {
|
for (var i = 0; i < archiveTypes.length; i++) {
|
||||||
archiveSelect.append('<option value="' + i + '">' + archiveTypes[i] + '</option>');
|
archiveSelect.append('<option value="' + i + '">' + archiveTypes[i] + '</option>');
|
||||||
}
|
}
|
||||||
let archiveVal = inputTds.eq(4).children().val();
|
var archiveVal = inputTds.eq(4).children().val();
|
||||||
inputTds.eq(4).html(archiveSelect).children().val(archiveVal).chosen({width: "101%"});
|
inputTds.eq(4).html(archiveSelect).children().val(archiveVal).chosen({width: "101%"});
|
||||||
|
|
||||||
} else if ( attr.indexOf('Weekday') >= 0 ) { //Weekday selection
|
} else if ( attr.indexOf('Weekday') >= 0 ) { //Weekday selection
|
||||||
let weekdaySelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]');
|
var weekdaySelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]');
|
||||||
for (let i = 0; i < weekdays.length; i++) {
|
for (var i = 0; i < weekdays.length; i++) {
|
||||||
weekdaySelect.append('<option value="' + i + '">' + weekdays[i] + '</option>');
|
weekdaySelect.append('<option value="' + i + '">' + weekdays[i] + '</option>');
|
||||||
}
|
}
|
||||||
let weekdayVal = inputTds.eq(4).children().val();
|
var weekdayVal = inputTds.eq(4).children().val();
|
||||||
inputTds.eq(4).html(weekdaySelect).children().val(weekdayVal).chosen({width: "101%"});
|
inputTds.eq(4).html(weekdaySelect).children().val(weekdayVal).chosen({width: "101%"});
|
||||||
|
|
||||||
} else if ( attr == 'StateId' ) { //Run state
|
} else if ( attr == 'StateId' ) { //Run state
|
||||||
let stateSelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]');
|
var stateSelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]');
|
||||||
for (let key in states) {
|
for (var key in states) {
|
||||||
stateSelect.append('<option value="' + key + '">' + states[key] + '</option>');
|
stateSelect.append('<option value="' + key + '">' + states[key] + '</option>');
|
||||||
}
|
}
|
||||||
let stateVal = inputTds.eq(4).children().val();
|
var stateVal = inputTds.eq(4).children().val();
|
||||||
inputTds.eq(4).html(stateSelect).children().val(stateVal).chosen({width: "101%"});
|
inputTds.eq(4).html(stateSelect).children().val(stateVal).chosen({width: "101%"});
|
||||||
|
|
||||||
} else if ( attr == 'ServerId' || attr == 'MonitorServerId' || attr == 'StorageServerId' || attr == 'FilterServerId' ) { //Select Server
|
} else if ( attr == 'ServerId' || attr == 'MonitorServerId' || attr == 'StorageServerId' || attr == 'FilterServerId' ) { //Select Server
|
||||||
let serverSelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]');
|
var serverSelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]');
|
||||||
for (let key in servers) {
|
for (var key in servers) {
|
||||||
serverSelect.append('<option value="' + key + '">' + servers[key] + '</option>');
|
serverSelect.append('<option value="' + key + '">' + servers[key] + '</option>');
|
||||||
}
|
}
|
||||||
let serverVal = inputTds.eq(4).children().val();
|
var serverVal = inputTds.eq(4).children().val();
|
||||||
inputTds.eq(4).html(serverSelect).children().val(serverVal).chosen({width: "101%"});
|
inputTds.eq(4).html(serverSelect).children().val(serverVal).chosen({width: "101%"});
|
||||||
|
|
||||||
} else if ( attr == 'StorageId' ) { //Choose by storagearea
|
} else if ( attr == 'StorageId' ) { //Choose by storagearea
|
||||||
let storageSelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]');
|
var storageSelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]');
|
||||||
for ( key in storageareas ) {
|
for ( key in storageareas ) {
|
||||||
storageSelect.append('<option value="' + key + '">' + storageareas[key] + '</option>');
|
storageSelect.append('<option value="' + key + '">' + storageareas[key] + '</option>');
|
||||||
}
|
}
|
||||||
let storageVal = inputTds.eq(4).children().val();
|
var storageVal = inputTds.eq(4).children().val();
|
||||||
inputTds.eq(4).html(storageSelect).children().val(storageVal).chosen({width: "101%"});
|
inputTds.eq(4).html(storageSelect).children().val(storageVal).chosen({width: "101%"});
|
||||||
|
|
||||||
} else if ( attr == 'MonitorName' ) { //Monitor names
|
} else if ( attr == 'MonitorName' ) { //Monitor names
|
||||||
let monitorSelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]');
|
var monitorSelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]');
|
||||||
for (let key in monitors) {
|
for (var key in monitors) {
|
||||||
monitorSelect.append('<option value="' + key + '">' + monitors[key] + '</option>');
|
monitorSelect.append('<option value="' + key + '">' + monitors[key] + '</option>');
|
||||||
}
|
}
|
||||||
let monitorVal = inputTds.eq(4).children().val();
|
var monitorVal = inputTds.eq(4).children().val();
|
||||||
inputTds.eq(4).html(monitorSelect).children().val(monitorVal);
|
inputTds.eq(4).html(monitorSelect).children().val(monitorVal);
|
||||||
} else { //Reset to regular text field and operator for everything that isn't special
|
} else { //Reset to regular text field and operator for everything that isn't special
|
||||||
let opSelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][op]').attr('id', queryPrefix + rowNum + '][op]');
|
var opSelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][op]').attr('id', queryPrefix + rowNum + '][op]');
|
||||||
for (let key in opTypes) {
|
for (var key in opTypes) {
|
||||||
opSelect.append('<option value="' + key + '">' + opTypes[key] + '</option>');
|
opSelect.append('<option value="' + key + '">' + opTypes[key] + '</option>');
|
||||||
}
|
}
|
||||||
let opVal = inputTds.eq(3).children().val();
|
var opVal = inputTds.eq(3).children().val();
|
||||||
inputTds.eq(3).html(opSelect).children().val(opVal).chosen({width: "101%"});
|
inputTds.eq(3).html(opSelect).children().val(opVal).chosen({width: "101%"});
|
||||||
let textInput = $j('<input></input>').attr('type', 'text').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]');
|
var textInput = $j('<input></input>').attr('type', 'text').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]');
|
||||||
let textVal = inputTds.eq(4).children().val();
|
var textVal = inputTds.eq(4).children().val();
|
||||||
inputTds.eq(4).html(textInput).children().val(textVal);
|
inputTds.eq(4).html(textInput).children().val(textVal);
|
||||||
}
|
}
|
||||||
if ( attr.endsWith('DateTime') ) { //Start/End DateTime
|
if ( attr.endsWith('DateTime') ) { //Start/End DateTime
|
||||||
|
@ -212,7 +212,7 @@ function parseRows (rows) {
|
||||||
}
|
}
|
||||||
|
|
||||||
attr = inputTds.find("[name$='attr\\]']") // Set attr list id and name
|
attr = inputTds.find("[name$='attr\\]']") // Set attr list id and name
|
||||||
let term = attr.attr('name').split(/[[\]]{1,2}/);
|
var term = attr.attr('name').split(/[[\]]{1,2}/);
|
||||||
term.length--;
|
term.length--;
|
||||||
term.shift();
|
term.shift();
|
||||||
term[2] = rowNum;
|
term[2] = rowNum;
|
||||||
|
@ -223,7 +223,7 @@ function parseRows (rows) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function stringFilter (term) {
|
function stringFilter (term) {
|
||||||
let termString = '';
|
var termString = '';
|
||||||
term.forEach(function(item) {
|
term.forEach(function(item) {
|
||||||
termString += '[' + item + ']';
|
termString += '[' + item + ']';
|
||||||
});
|
});
|
||||||
|
@ -231,23 +231,23 @@ function stringFilter (term) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function addTerm( element ) {
|
function addTerm( element ) {
|
||||||
let row = $j(element).closest('tr');
|
var row = $j(element).closest('tr');
|
||||||
row.find('select').chosen("destroy");
|
row.find('select').chosen("destroy");
|
||||||
let newRow = row.clone().insertAfter(row);
|
var newRow = row.clone().insertAfter(row);
|
||||||
row.find('select').chosen({width: "101%"});
|
row.find('select').chosen({width: "101%"});
|
||||||
newRow.find('select').each( function () { //reset new row to default
|
newRow.find('select').each( function () { //reset new row to default
|
||||||
this[0].selected = 'selected';
|
this[0].selected = 'selected';
|
||||||
}).chosen({width: "101%"});
|
}).chosen({width: "101%"});
|
||||||
newRow.find('input[type="text"]').val('');
|
newRow.find('input[type="text"]').val('');
|
||||||
let rows = $j(row).parent().children();
|
var rows = $j(row).parent().children();
|
||||||
parseRows(rows);
|
parseRows(rows);
|
||||||
}
|
}
|
||||||
|
|
||||||
function delTerm( element ) {
|
function delTerm( element ) {
|
||||||
let row = $j(element).closest('tr');
|
var row = $j(element).closest('tr');
|
||||||
let rowParent = $j(row).parent();
|
var rowParent = $j(row).parent();
|
||||||
row.remove();
|
row.remove();
|
||||||
let rows = rowParent.children();
|
var rows = rowParent.children();
|
||||||
parseRows(rows);
|
parseRows(rows);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue