mirror of
https://github.com/Joxit/docker-registry-ui.git
synced 2025-04-29 00:19:54 +03:00
Optimize date format
This commit is contained in:
parent
6d798ca75f
commit
5bb7dfce7d
1 changed files with 34 additions and 5 deletions
|
@ -51,20 +51,49 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
oReq.addEventListener('load', function () {
|
oReq.addEventListener('load', function () {
|
||||||
console.log("taghistory addEventListener::load");
|
console.log("taghistory addEventListener::load");
|
||||||
registryUI.taghistory.elements = [];
|
registryUI.taghistory.elements = [];
|
||||||
|
|
||||||
|
function modifySpecificAttributeTypes(value) {
|
||||||
|
if (attribute == "created") {
|
||||||
|
let date = new Date(value);
|
||||||
|
let year = date.getFullYear();
|
||||||
|
let month = date.getMonth();
|
||||||
|
let day = date.getDay();
|
||||||
|
let minutes = date.getMinutes();
|
||||||
|
let hours = date.getUTCHours();
|
||||||
|
let seconds = date.getSeconds();
|
||||||
|
let milliSeconds = date.getMilliseconds();
|
||||||
|
|
||||||
|
if (month < 10) {
|
||||||
|
month = '0' + month;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (minutes < 10) {
|
||||||
|
minutes = '0' + minutes;
|
||||||
|
}
|
||||||
|
if (hours < 10) {
|
||||||
|
hours = '0' + hours;
|
||||||
|
}
|
||||||
|
|
||||||
|
value = day + "." + month + "." + year+ " | " + hours + ":" + minutes + ":" + seconds + "." + milliSeconds;
|
||||||
|
} else if (attribute == "container_config" || attribute == "config") {
|
||||||
|
value = "";
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.status == 200) {
|
if (this.status == 200) {
|
||||||
var elements = JSON.parse(this.responseText).history || [];
|
var elements = JSON.parse(this.responseText).history || [];
|
||||||
for(var index in elements){
|
for(var index in elements){
|
||||||
var parsedNestedElements = JSON.parse(elements[index].v1Compatibility || {});
|
var parsedNestedElements = JSON.parse(elements[index].v1Compatibility || {});
|
||||||
|
|
||||||
var guiElements = [];
|
var guiElements = [];
|
||||||
var guiElement = {};
|
var guiElement = {};
|
||||||
|
|
||||||
for(var attribute in parsedNestedElements){
|
for(var attribute in parsedNestedElements){
|
||||||
if(parsedNestedElements.hasOwnProperty(attribute)){
|
if(parsedNestedElements.hasOwnProperty(attribute)){
|
||||||
var value = parsedNestedElements[attribute];
|
var value = parsedNestedElements[attribute];
|
||||||
if(attribute == "created"){
|
|
||||||
// Todo this must be parsed correctly
|
value = modifySpecificAttributeTypes(value);
|
||||||
}else if(attribute == "container_config" || attribute == "config"){
|
|
||||||
value = "";
|
|
||||||
}
|
|
||||||
guiElement = {
|
guiElement = {
|
||||||
"key": attribute,
|
"key": attribute,
|
||||||
"value": value
|
"value": value
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue