Skip to content

Commit

Permalink
use custom create proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
Son Roy Almerol committed Nov 8, 2024
1 parent a44859f commit 09436e4
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmd/pbs_d2d_backup/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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{
Expand Down
92 changes: 92 additions & 0 deletions internal/proxy/views/d2d_backup/windows/backup.js
Original file line number Diff line number Diff line change
@@ -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}',
},
},
],
},
],
},
],
});

0 comments on commit 09436e4

Please sign in to comment.