src/api2/admin/datastore.rs: avoid slash in UPID strings

This commit is contained in:
Dietmar Maurer 2020-06-30 13:11:22 +02:00
parent 0d5ab04a90
commit 2162e2c15d
2 changed files with 12 additions and 17 deletions

View File

@ -441,13 +441,13 @@ pub fn verify(
match (backup_type, backup_id, backup_time) {
(Some(backup_type), Some(backup_id), Some(backup_time)) => {
worker_id = format!("{}_{}_{}_{:08X}", store, backup_type, backup_id, backup_time);
let dir = BackupDir::new(backup_type, backup_id, backup_time);
worker_id = format!("{}_{}", store, dir);
backup_dir = Some(dir);
}
(Some(backup_type), Some(backup_id), None) => {
worker_id = format!("{}_{}_{}", store, backup_type, backup_id);
let group = BackupGroup::new(backup_type, backup_id);
worker_id = format!("{}_{}", store, group);
backup_group = Some(group);
}
(None, None, None) => {

View File

@ -33,23 +33,18 @@ Ext.define('PBS.Utils', {
},
render_datastore_worker_id: function(id, what) {
const result = id.match(/^(\S+)_([^_\s]+)_([^_\s]+)$/);
if (result) {
let datastore = result[1], type = result[2], id = result[3];
return `Datastore ${datastore} - ${what} ${type}/${id}`;
}
return `Datastore ${id} - ${what}`;
},
render_datastore_time_worker_id: function(id, what) {
const res = id.match(/^(\S+)_([^_\s]+)_([^_\s]+)_([^_\s]+)$/);
const res = id.match(/^(\S+?)_(\S+?)_(\S+?)(_(.+))?$/);
if (res) {
let datastore = res[1], type = res[2], id = res[3];
let datetime = Ext.Date.parse(parseInt(res[4], 16), 'U');
if (res[4] !== undefined) {
let datetime = Ext.Date.parse(parseInt(res[5], 16), 'U');
let utctime = PBS.Utils.render_datetime_utc(datetime);
return `Datastore ${datastore} - ${what} ${type}/${id}/${utctime}`;
return `Datastore ${datastore} ${what} ${type}/${id}/${utctime}`;
} else {
return `Datastore ${datastore} ${what} ${type}/${id}`;
}
return what;
}
return `Datastore ${what} ${id}`;
},
constructor: function() {
@ -70,7 +65,7 @@ Ext.define('PBS.Utils', {
return PBS.Utils.render_datastore_worker_id(id, gettext('Backup'));
},
reader: (type, id) => {
return PBS.Utils.render_datastore_time_worker_id(id, gettext('Read objects'));
return PBS.Utils.render_datastore_worker_id(id, gettext('Read objects'));
},
});
}