Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pve-manager
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
pve-manager
Commits
9822bddd
Commit
9822bddd
authored
Nov 04, 2011
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use new button class
parent
5838b3ba
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
83 deletions
+64
-83
BackupView.js
www/manager/grid/BackupView.js
+64
-83
No files found.
www/manager/grid/BackupView.js
View file @
9822bddd
...
...
@@ -61,7 +61,9 @@ Ext.define('PVE.grid.BackupView', {
}
});
var
backup_btn
=
new
Ext
.
Button
({
var
sm
=
Ext
.
create
(
'
Ext.selection.RowModel
'
,
{});
var
backup_btn
=
Ext
.
create
(
'
Ext.button.Button
'
,
{
text
:
'
Backup now
'
,
handler
:
function
()
{
var
win
=
Ext
.
create
(
'
PVE.window.Backup
'
,
{
...
...
@@ -74,111 +76,91 @@ Ext.define('PVE.grid.BackupView', {
}
});
var
restore_btn
=
new
Ext
.
Button
(
{
var
restore_btn
=
Ext
.
create
(
'
PVE.button.Button
'
,
{
text
:
'
Restore
'
,
disabled
:
true
,
handler
:
function
(){
var
sm
=
me
.
getSelectionModel
();
var
rec
=
sm
.
getSelection
()[
0
];
if
(
!
rec
)
{
return
;
}
var
volid
=
rec
.
data
.
volid
;
msg
=
'
Are you sure you want to restore from "
'
+
volid
+
'
"?
'
+
selModel
:
sm
,
confirmMsg
:
function
(
rec
)
{
return
'
Are you sure you want to restore from "
'
+
rec
.
data
.
volid
+
'
"?
'
+
'
This will permanently erase current VM data.
'
;
Ext
.
Msg
.
confirm
(
'
Restore Confirmation
'
,
msg
,
function
(
btn
)
{
if
(
btn
!==
'
yes
'
)
{
return
;
}
},
enableFn
:
function
(
rec
)
{
return
!!
rec
;
},
handler
:
function
(
b
,
e
,
rec
)
{
var
volid
=
rec
.
data
.
volid
;
var
url
;
var
params
=
{
vmid
:
vmid
,
force
:
1
};
if
(
vmtype
===
'
openvz
'
)
{
url
=
'
/nodes/
'
+
nodename
+
'
/openvz
'
;
params
.
ostemplate
=
volid
;
}
else
if
(
vmtype
===
'
qemu
'
)
{
url
=
'
/nodes/
'
+
nodename
+
'
/qemu
'
;
params
.
archive
=
volid
;
}
else
{
throw
'
unknown VM type
'
;
}
var
url
;
var
params
=
{
vmid
:
vmid
,
force
:
1
};
if
(
vmtype
===
'
openvz
'
)
{
url
=
'
/nodes/
'
+
nodename
+
'
/openvz
'
;
params
.
ostemplate
=
volid
;
}
else
if
(
vmtype
===
'
qemu
'
)
{
url
=
'
/nodes/
'
+
nodename
+
'
/qemu
'
;
params
.
archive
=
volid
;
}
else
{
throw
'
unknown VM type
'
;
}
PVE
.
Utils
.
API2Request
({
url
:
url
,
params
:
params
,
method
:
'
POST
'
,
waitMsgTarget
:
me
,
failure
:
function
(
response
,
opts
)
{
Ext
.
Msg
.
alert
(
'
Error
'
,
response
.
htmlStatus
);
},
success
:
function
(
response
,
options
)
{
var
upid
=
response
.
result
.
data
;
PVE
.
Utils
.
API2Request
({
url
:
url
,
params
:
params
,
method
:
'
POST
'
,
waitMsgTarget
:
me
,
failure
:
function
(
response
,
opts
)
{
Ext
.
Msg
.
alert
(
'
Error
'
,
response
.
htmlStatus
);
},
success
:
function
(
response
,
options
)
{
var
upid
=
response
.
result
.
data
;
var
win
=
Ext
.
create
(
'
PVE.window.TaskViewer
'
,
{
upid
:
upid
});
win
.
show
();
}
});
var
win
=
Ext
.
create
(
'
PVE.window.TaskViewer
'
,
{
upid
:
upid
});
win
.
show
();
}
});
}
});
var
delete_btn
=
new
Ext
.
Button
(
{
var
delete_btn
=
Ext
.
create
(
'
PVE.button.Button
'
,
{
text
:
'
Delete
'
,
disabled
:
true
,
handler
:
function
(){
var
sm
=
me
.
getSelectionModel
();
var
rec
=
sm
.
getSelection
()[
0
];
if
(
!
rec
)
{
return
;
}
selModel
:
sm
,
confirmMsg
:
function
(
rec
)
{
return
'
Are you sure you want to delete "
'
+
rec
.
data
.
volid
+
'
"?
'
+
'
This will permanently erase all data.
'
;
},
enableFn
:
function
(
rec
)
{
return
!!
rec
;
},
handler
:
function
(
b
,
e
,
rec
){
var
storage
=
storagesel
.
getValue
();
if
(
!
storage
)
{
return
;
}
var
volid
=
rec
.
data
.
volid
;
msg
=
'
Are you sure you want to delete "
'
+
volid
+
'
"?
'
+
'
This will permanently erase all data.
'
;
Ext
.
Msg
.
confirm
(
'
Delete Confirmation
'
,
msg
,
function
(
btn
)
{
if
(
btn
!==
'
yes
'
)
{
return
;
PVE
.
Utils
.
API2Request
({
url
:
"
/nodes/
"
+
nodename
+
"
/storage/
"
+
storage
+
"
/content/
"
+
volid
,
method
:
'
DELETE
'
,
waitMsgTarget
:
me
,
failure
:
function
(
response
,
opts
)
{
Ext
.
Msg
.
alert
(
'
Error
'
,
response
.
htmlStatus
);
},
success
:
function
(
response
,
options
)
{
reload
();
}
PVE
.
Utils
.
API2Request
({
url
:
"
/nodes/
"
+
nodename
+
"
/storage/
"
+
storage
+
"
/content/
"
+
volid
,
method
:
'
DELETE
'
,
waitMsgTarget
:
me
,
failure
:
function
(
response
,
opts
)
{
Ext
.
Msg
.
alert
(
'
Error
'
,
response
.
htmlStatus
);
},
success
:
function
(
response
,
options
)
{
reload
();
}
});
});
}
});
var
set_button_status
=
function
()
{
var
sm
=
me
.
getSelectionModel
();
var
rec
=
sm
.
getSelection
()[
0
];
restore_btn
.
setDisabled
(
!
(
rec
&&
rec
.
data
.
volid
));
delete_btn
.
setDisabled
(
!
(
rec
&&
rec
.
data
.
volid
));
}
Ext
.
apply
(
me
,
{
stateful
:
false
,
selModel
:
sm
,
tbar
:
[
backup_btn
,
restore_btn
,
delete_btn
,
'
->
'
,
storagesel
],
columns
:
[
{
...
...
@@ -201,8 +183,7 @@ Ext.define('PVE.grid.BackupView', {
}
],
listeners
:
{
show
:
reload
,
selectionchange
:
set_button_status
show
:
reload
}
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment