diff --git a/src/bin/proxmox-backup-proxy.rs b/src/bin/proxmox-backup-proxy.rs index 68fbbaad..541d34b5 100644 --- a/src/bin/proxmox-backup-proxy.rs +++ b/src/bin/proxmox-backup-proxy.rs @@ -86,6 +86,11 @@ async fn run() -> Result<(), Error> { let mut config = ApiConfig::new( buildcfg::JS_DIR, &proxmox_backup::api2::ROUTER, RpcEnvironmentType::PUBLIC)?; + // Enable experimental tape UI if tape.cfg exists + if Path::new("/etc/proxmox-backup/tape.cfg").exists() { + config.enable_tape_ui = true; + } + config.add_alias("novnc", "/usr/share/novnc-pve"); config.add_alias("extjs", "/usr/share/javascript/extjs"); config.add_alias("qrcodejs", "/usr/share/javascript/qrcodejs"); diff --git a/src/server/config.rs b/src/server/config.rs index 8306f1c2..9094fa80 100644 --- a/src/server/config.rs +++ b/src/server/config.rs @@ -22,6 +22,7 @@ pub struct ApiConfig { templates: RwLock>, template_files: RwLock>, request_log: Option>>, + pub enable_tape_ui: bool, } impl ApiConfig { @@ -35,7 +36,8 @@ impl ApiConfig { templates: RwLock::new(Handlebars::new()), template_files: RwLock::new(HashMap::new()), request_log: None, - }) + enable_tape_ui: false, + }) } pub fn find_method( diff --git a/src/server/rest.rs b/src/server/rest.rs index 9bf494fd..44e157fb 100644 --- a/src/server/rest.rs +++ b/src/server/rest.rs @@ -457,6 +457,7 @@ fn get_index( "CSRFPreventionToken": csrf_token, "language": lang, "debug": debug, + "enableTapeUI": api.enable_tape_ui, }); let (ct, index) = match api.render_template(template_file, &data) { diff --git a/www/Makefile b/www/Makefile index 53981aa4..d45e1789 100644 --- a/www/Makefile +++ b/www/Makefile @@ -5,9 +5,6 @@ IMAGES := \ images/logo-128.png \ images/proxmox_logo.png -TAPE_UI_FILES= - -ifdef TEST_TAPE_GUI TAPE_UI_FILES= \ tape/form/AllocationSelector.js \ tape/form/ChangerSelector.js \ @@ -18,7 +15,7 @@ TAPE_UI_FILES= \ tape/form/KeySelector.js \ tape/window/ChangerEdit.js \ tape/window/DriveEdit.js \ - tape/window/Erase.js \ + tape/window/Erase.js \ tape/window/EncryptionEdit.js \ tape/window/LabelMedia.js \ tape/window/PoolEdit.js \ @@ -34,9 +31,7 @@ TAPE_UI_FILES= \ tape/PoolConfig.js \ tape/TapeInventory.js \ tape/BackupJobs.js \ - tape/TapeManagement.js \ - -endif + tape/TapeManagement.js JSSRC= \ Utils.js \ diff --git a/www/NavigationTree.js b/www/NavigationTree.js index 9aef4a9e..1c33d52d 100644 --- a/www/NavigationTree.js +++ b/www/NavigationTree.js @@ -118,7 +118,7 @@ Ext.define('PBS.view.main.NavigationTree', { view.rstore.on('load', this.onLoad, this); view.on('destroy', view.rstore.stopUpdate); - if (PBS.TapeManagement !== undefined) { + if (PBS.enableTapeUI) { view.tapestore = Ext.create('Proxmox.data.UpdateStore', { autoStart: true, interval: 2 * 1000, @@ -266,7 +266,7 @@ Ext.define('PBS.view.main.NavigationTree', { select: function(path, silent) { var me = this; - if (me.rstore.isLoaded() && (!PBS.TapeManagement || me.tapestore.isLoaded())) { + if (me.rstore.isLoaded() && (!PBS.enableTapeUI || me.tapestore.isLoaded())) { if (silent) { me.suspendEvents(false); } diff --git a/www/index.hbs b/www/index.hbs index 665bef23..ff3ccb99 100644 --- a/www/index.hbs +++ b/www/index.hbs @@ -31,6 +31,9 @@ UserName: "{{ UserName }}", CSRFPreventionToken: "{{ CSRFPreventionToken }}", }; + PBS = { + enableTapeUI: {{ enableTapeUI }}, + };