ui: factor out render_datetime_utc
will be reused in the next patch Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
06c3dc8a8e
commit
f68ae22cc0
@ -103,25 +103,13 @@ Ext.define('PBS.DataStoreContent', {
|
|||||||
|
|
||||||
let groups = this.getRecordGroups(records);
|
let groups = this.getRecordGroups(records);
|
||||||
|
|
||||||
let backup_time_to_string = function(backup_time) {
|
|
||||||
let pad = (number) => number < 10 ? '0' + number : number;
|
|
||||||
return backup_time.getUTCFullYear() +
|
|
||||||
'-' + pad(backup_time.getUTCMonth() + 1) +
|
|
||||||
'-' + pad(backup_time.getUTCDate()) +
|
|
||||||
'T' + pad(backup_time.getUTCHours()) +
|
|
||||||
':' + pad(backup_time.getUTCMinutes()) +
|
|
||||||
':' + pad(backup_time.getUTCSeconds()) +
|
|
||||||
'Z';
|
|
||||||
};
|
|
||||||
|
|
||||||
for (const item of records) {
|
for (const item of records) {
|
||||||
let group = item.data["backup-type"] + "/" + item.data["backup-id"];
|
let group = item.data["backup-type"] + "/" + item.data["backup-id"];
|
||||||
let children = groups[group].children;
|
let children = groups[group].children;
|
||||||
|
|
||||||
let data = item.data;
|
let data = item.data;
|
||||||
|
|
||||||
data.text = Ext.Date.format(data["backup-time"], 'Y-m-d H:i:s');
|
data.text = group + '/' + PBS.Utils.render_datetime_utc(data["backup-time"]);
|
||||||
data.text = group + '/' + backup_time_to_string(data["backup-time"]);
|
|
||||||
data.leaf = true;
|
data.leaf = true;
|
||||||
data.cls = 'no-leaf-icons';
|
data.cls = 'no-leaf-icons';
|
||||||
|
|
||||||
|
11
www/Utils.js
11
www/Utils.js
@ -25,6 +25,17 @@ Ext.define('PBS.Utils', {
|
|||||||
return path.indexOf(PBS.Utils.dataStorePrefix) === 0;
|
return path.indexOf(PBS.Utils.dataStorePrefix) === 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
render_datetime_utc: function(datetime) {
|
||||||
|
let pad = (number) => number < 10 ? '0' + number : number;
|
||||||
|
return datetime.getUTCFullYear() +
|
||||||
|
'-' + pad(datetime.getUTCMonth() + 1) +
|
||||||
|
'-' + pad(datetime.getUTCDate()) +
|
||||||
|
'T' + pad(datetime.getUTCHours()) +
|
||||||
|
':' + pad(datetime.getUTCMinutes()) +
|
||||||
|
':' + pad(datetime.getUTCSeconds()) +
|
||||||
|
'Z';
|
||||||
|
},
|
||||||
|
|
||||||
render_datastore_worker_id: function(id, what) {
|
render_datastore_worker_id: function(id, what) {
|
||||||
const result = id.match(/^(\S+)_([^_\s]+)_([^_\s]+)$/);
|
const result = id.match(/^(\S+)_([^_\s]+)_([^_\s]+)$/);
|
||||||
if (result) {
|
if (result) {
|
||||||
|
Loading…
Reference in New Issue
Block a user