[pbs-devel] [PATCH proxmox-backup 2/6] ui: refactor get_type_icon_cls
Dominik Csapak
d.csapak at proxmox.com
Tue Feb 2 14:00:35 CET 2021
we need this later again
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
www/Utils.js | 12 ++++++++++++
www/datastore/Content.js | 10 ++--------
2 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/www/Utils.js b/www/Utils.js
index e6ea64ea..acfc4556 100644
--- a/www/Utils.js
+++ b/www/Utils.js
@@ -260,6 +260,18 @@ Ext.define('PBS.Utils', {
return dedup;
},
+ get_type_icon_cls: function(btype) {
+ var cls = '';
+ if (btype.startsWith('vm')) {
+ cls = 'fa-desktop';
+ } else if (btype.startsWith('ct')) {
+ cls = 'fa-cube';
+ } else if (btype.startsWith('host')) {
+ cls = 'fa-building';
+ }
+ return cls;
+ },
+
constructor: function() {
var me = this;
diff --git a/www/datastore/Content.js b/www/datastore/Content.js
index 12dacb89..d0cf3e0b 100644
--- a/www/datastore/Content.js
+++ b/www/datastore/Content.js
@@ -105,14 +105,8 @@ Ext.define('PBS.DataStoreContent', {
continue;
}
- var cls = '';
- if (btype === 'vm') {
- cls = 'fa-desktop';
- } else if (btype === 'ct') {
- cls = 'fa-cube';
- } else if (btype === 'host') {
- cls = 'fa-building';
- } else {
+ var cls = PBS.Utils.get_type_icon_cls(btype);
+ if (cls === "") {
console.warn(`got unknown backup-type '${btype}'`);
continue; // FIXME: auto render? what do?
}
--
2.20.1
More information about the pbs-devel
mailing list