src/api2/admin/datastore.rs: avoid slash in UPID strings
This commit is contained in:
parent
0d5ab04a90
commit
2162e2c15d
@ -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) => {
|
||||
|
25
www/Utils.js
25
www/Utils.js
@ -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');
|
||||
let utctime = PBS.Utils.render_datetime_utc(datetime);
|
||||
return `Datastore ${datastore} - ${what} ${type}/${id}/${utctime}`;
|
||||
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}`;
|
||||
} 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'));
|
||||
},
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user