Merge branch 'bugfix/print-iso-date-time-when-lost-connection-10625'
fixes #10625
This commit is contained in:
commit
eae7a58ad5
|
@ -681,11 +681,17 @@
|
||||||
req.addToHistory = false;
|
req.addToHistory = false;
|
||||||
} else {
|
} else {
|
||||||
if (this.failureNotice === null) {
|
if (this.failureNotice === null) {
|
||||||
|
var now = new Date();
|
||||||
|
var padString = this.icinga.utils.padString;
|
||||||
this.failureNotice = this.createNotice(
|
this.failureNotice = this.createNotice(
|
||||||
'error',
|
'error',
|
||||||
'The connection to the Icinga web server was lost at ' +
|
'The connection to the Icinga web server was lost at '
|
||||||
this.icinga.utils.timeShort() +
|
+ now.getFullYear()
|
||||||
'.',
|
+ '-' + padString(now.getMonth() + 1, 0, 2)
|
||||||
|
+ '-' + padString(now.getDate(), 0, 2)
|
||||||
|
+ ' ' + padString(now.getHours(), 0, 2)
|
||||||
|
+ ':' + padString(now.getMinutes(), 0, 2)
|
||||||
|
+ '.',
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -386,6 +386,24 @@
|
||||||
}[c];
|
}[c];
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pad a string with another one
|
||||||
|
*
|
||||||
|
* @param {String} str the string to pad
|
||||||
|
* @param {String} padding the string to use for padding
|
||||||
|
* @param {Number} minLength the minimum length of the result
|
||||||
|
*
|
||||||
|
* @returns {String} the padded string
|
||||||
|
*/
|
||||||
|
padString: function(str, padding, minLength) {
|
||||||
|
str = String(str);
|
||||||
|
padding = String(padding);
|
||||||
|
while (str.length < minLength) {
|
||||||
|
str = padding + str;
|
||||||
|
}
|
||||||
|
return str;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue