diff --git a/cmd/pbs_d2d_backup/main.go b/cmd/pbs_d2d_backup/main.go index 8da7660..6e63bdc 100644 --- a/cmd/pbs_d2d_backup/main.go +++ b/cmd/pbs_d2d_backup/main.go @@ -7,12 +7,12 @@ import ( "fmt" "log" "net/http" - "net/http/httputil" "net/url" "regexp" "github.com/sonroyaalmerol/pbs-d2d-backup/internal/backend/backup" "github.com/sonroyaalmerol/pbs-d2d-backup/internal/logger" + "github.com/sonroyaalmerol/pbs-d2d-backup/internal/proxy" "github.com/sonroyaalmerol/pbs-d2d-backup/internal/proxy/controllers/agents" "github.com/sonroyaalmerol/pbs-d2d-backup/internal/proxy/controllers/jobs" "github.com/sonroyaalmerol/pbs-d2d-backup/internal/proxy/controllers/targets" @@ -111,7 +111,7 @@ func main() { log.Fatalf("Failed to parse target URL: %v", err) } - proxy := httputil.NewSingleHostReverseProxy(targetURL) + proxy := proxy.CreateProxy(targetURL, storeInstance) // Set up router with routes and a reverse proxy as the default handler router := &CustomRouter{ diff --git a/internal/proxy/views/d2d_backup/windows/backup.js b/internal/proxy/views/d2d_backup/windows/backup.js new file mode 100644 index 0000000..c0a29d7 --- /dev/null +++ b/internal/proxy/views/d2d_backup/windows/backup.js @@ -0,0 +1,92 @@ +Ext.define('PBS.D2DManagement.BackupWindow', { + extend: 'Proxmox.window.Edit', + mixins: ['Proxmox.Mixin.CBind'], + + job: undefined, + target: undefined, + + cbindData: function(config) { + let me = this; + return { + warning: Ext.String.format(gettext("Are you sure you want to manually start backup '{0}' ?"), me.job), + }; + }, + + title: gettext('Backup'), + url: `/api2/extjs/tape/drive`, + showProgress: true, + submitUrl: function(url, values) { + let drive = values.drive; + delete values.drive; + return `${url}/${drive}/format-media`; + }, + + layout: 'hbox', + width: 400, + method: 'POST', + isCreate: true, + submitText: gettext('Ok'), + items: [ + { + xtype: 'container', + padding: 0, + layout: { + type: 'hbox', + align: 'stretch', + }, + items: [ + { + xtype: 'component', + cls: [Ext.baseCSSPrefix + 'message-box-icon', + Ext.baseCSSPrefix + 'message-box-warning', + Ext.baseCSSPrefix + 'dlg-icon'], + }, + { + xtype: 'container', + flex: 1, + items: [ + { + xtype: 'displayfield', + cbind: { + value: '{warning}', + }, + }, + { + xtype: 'displayfield', + cls: 'pmx-hint', + value: gettext('Make sure to insert the tape into the selected drive.'), + cbind: { + hidden: '{changer}', + }, + }, + { + xtype: 'hidden', + name: 'label-text', + cbind: { + value: '{label}', + }, + }, + { + xtype: 'hidden', + name: 'drive', + cbind: { + disabled: '{!hasSingleDrive}', + value: '{singleDrive}', + }, + }, + { + xtype: 'pbsDriveSelector', + fieldLabel: gettext('Drive'), + name: 'drive', + cbind: { + changer: '{changer}', + disabled: '{hasSingleDrive}', + hidden: '{hasSingleDrive}', + }, + }, + ], + }, + ], + }, + ], +});