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
a9a1e2f2
Commit
a9a1e2f2
authored
Nov 11, 2011
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GUI rework
parent
2b8c2281
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
395 additions
and
428 deletions
+395
-428
Workspace.js
www/manager/Workspace.js
+31
-40
Config.js
www/manager/node/Config.js
+65
-0
StatusView.js
www/manager/node/StatusView.js
+0
-2
Summary.js
www/manager/node/Summary.js
+9
-76
Config.js
www/manager/openvz/Config.js
+97
-10
StatusView.js
www/manager/openvz/StatusView.js
+0
-2
Summary.js
www/manager/openvz/Summary.js
+14
-113
ConfigPanel.js
www/manager/panel/ConfigPanel.js
+53
-35
Config.js
www/manager/qemu/Config.js
+116
-10
StatusView.js
www/manager/qemu/StatusView.js
+0
-2
Summary.js
www/manager/qemu/Summary.js
+9
-137
ResourceTree.js
www/manager/tree/ResourceTree.js
+1
-1
No files found.
www/manager/Workspace.js
View file @
a9a1e2f2
...
...
@@ -160,34 +160,24 @@ Ext.define('PVE.ConsoleWorkspace', {
Ext
.
define
(
'
PVE.StdWorkspace
'
,
{
extend
:
'
PVE.Workspace
'
,
requires
:
[
'
Ext.History
'
,
'
Ext.state.*
'
,
'
Ext.selection.*
'
,
'
PVE.form.ViewSelector
'
,
'
PVE.data.ResourceStore
'
,
'
PVE.tree.ResourceTree
'
],
alias
:
[
'
widget.pveStdWorkspace
'
],
// private
defaultContent
:
{
title
:
'
Nothing selected
'
,
region
:
'
center
'
},
setContent
:
function
(
comp
)
{
var
me
=
this
;
if
(
!
comp
)
{
comp
=
me
.
defaultContent
;
}
var
cont
=
me
.
child
(
'
#content
'
);
cont
.
removeAll
(
true
);
cont
.
add
(
comp
);
cont
.
doLayout
();
if
(
comp
)
{
cont
.
setLoading
(
false
);
comp
.
border
=
false
;
cont
.
add
(
comp
);
cont
.
doLayout
();
}
else
{
cont
.
setLoading
(
'
nothing selected
'
);
}
},
selectById
:
function
(
nodeid
)
{
...
...
@@ -231,26 +221,11 @@ Ext.define('PVE.StdWorkspace', {
Ext
.
History
.
init
();
Ext
.
state
.
Manager
.
setProvider
(
Ext
.
create
(
'
PVE.StateProvider
'
));
//document.title = ;
var
selview
=
new
PVE
.
form
.
ViewSelector
({
listeners
:
{
select
:
function
(
combo
,
records
)
{
if
(
records
&&
records
.
length
)
{
var
view
=
combo
.
getViewFilter
();
combo
.
up
(
'
pveResourceTree
'
).
setViewFilter
(
view
);
}
}
}
});
var
selview
=
new
PVE
.
form
.
ViewSelector
({});
var
rtree
=
Ext
.
createWidget
(
'
pveResourceTree
'
,
{
width
:
200
,
region
:
'
west
'
,
margins
:
'
0 0 0 5
'
,
split
:
true
,
viewFilter
:
selview
.
getViewFilter
(),
tbar
:
[
'
'
,
selview
]
,
flex
:
1
,
selModel
:
new
Ext
.
selection
.
TreeModel
({
listeners
:
{
selectionchange
:
function
(
sm
,
selected
)
{
...
...
@@ -283,6 +258,13 @@ Ext.define('PVE.StdWorkspace', {
})
});
selview
.
on
(
'
select
'
,
function
(
combo
,
records
)
{
if
(
records
&&
records
.
length
)
{
var
view
=
combo
.
getViewFilter
();
rtree
.
setViewFilter
(
view
);
}
});
Ext
.
apply
(
me
,
{
layout
:
{
type
:
'
border
'
},
border
:
false
,
...
...
@@ -358,14 +340,23 @@ Ext.define('PVE.StdWorkspace', {
{
region
:
'
center
'
,
id
:
'
content
'
,
xtype
:
'
panel
'
,
xtype
:
'
container
'
,
layout
:
{
type
:
'
fit
'
},
border
:
false
,
stateful
:
false
,
margins
:
'
0 5 0 0
'
,
items
:
[
me
.
defaultContent
]
margins
:
'
0 5 0 0
'
,
items
:
[]
},
{
region
:
'
west
'
,
xtype
:
'
container
'
,
border
:
false
,
layout
:
{
type
:
'
vbox
'
,
align
:
'
stretch
'
},
margins
:
'
0 0 0 5
'
,
split
:
true
,
width
:
200
,
items
:
[
selview
,
rtree
]
},
rtree
,
{
xtype
:
'
pveStatusPanel
'
,
region
:
'
south
'
,
...
...
www/manager/node/Config.js
View file @
a9a1e2f2
...
...
@@ -10,9 +10,57 @@ Ext.define('PVE.node.Config', {
throw
"
no node name specified
"
;
}
me
.
statusStore
=
Ext
.
create
(
'
PVE.data.ObjectStore
'
,
{
url
:
"
/api2/json/nodes/
"
+
nodename
+
"
/status
"
,
interval
:
1000
});
var
node_command
=
function
(
cmd
)
{
PVE
.
Utils
.
API2Request
({
params
:
{
command
:
cmd
},
url
:
'
/nodes/
'
+
nodename
+
'
/status
'
,
method
:
'
POST
'
,
waitMsgTarget
:
me
,
failure
:
function
(
response
,
opts
)
{
Ext
.
Msg
.
alert
(
'
Error
'
,
response
.
htmlStatus
);
}
});
};
var
rebootBtn
=
Ext
.
create
(
'
PVE.button.Button
'
,
{
text
:
'
Reboot
'
,
confirmMsg
:
"
Do you really want to reboot node '
"
+
nodename
+
"
'?
"
,
handler
:
function
()
{
node_command
(
'
reboot
'
);
}
});
var
shutdownBtn
=
Ext
.
create
(
'
PVE.button.Button
'
,
{
text
:
'
Shutdown
'
,
confirmMsg
:
"
Do you really want to shutdown node '
"
+
nodename
+
"
'?
"
,
handler
:
function
()
{
node_command
(
'
shutdown
'
);
}
});
var
shellBtn
=
Ext
.
create
(
'
Ext.Button
'
,
{
text
:
'
Shell
'
,
handler
:
function
()
{
var
url
=
Ext
.
urlEncode
({
console
:
'
shell
'
,
node
:
nodename
});
var
nw
=
window
.
open
(
"
?
"
+
url
,
'
_blank
'
,
"
innerWidth=745,innerheight=427
"
);
nw
.
focus
();
}
});
Ext
.
apply
(
me
,
{
title
:
"
Node '
"
+
nodename
+
"
'
"
,
hstateid
:
'
nodetab
'
,
defaults
:
{
statusStore
:
me
.
statusStore
},
tbar
:
[
rebootBtn
,
shutdownBtn
,
shellBtn
],
items
:
[
{
title
:
'
Summary
'
,
...
...
@@ -59,5 +107,22 @@ Ext.define('PVE.node.Config', {
});
me
.
callParent
();
me
.
statusStore
.
on
(
'
load
'
,
function
(
s
,
records
,
success
)
{
var
uptimerec
=
s
.
data
.
get
(
'
uptime
'
);
var
uptime
=
uptimerec
?
uptimerec
.
data
.
value
:
false
;
rebootBtn
.
setDisabled
(
!
uptime
);
shutdownBtn
.
setDisabled
(
!
uptime
);
shellBtn
.
setDisabled
(
!
uptime
);
});
me
.
on
(
'
afterrender
'
,
function
()
{
me
.
statusStore
.
startUpdate
();
});
me
.
on
(
'
destroy
'
,
function
()
{
me
.
statusStore
.
stopUpdate
();
});
}
});
www/manager/node/StatusView.js
View file @
a9a1e2f2
...
...
@@ -44,9 +44,7 @@ Ext.define('PVE.node.StatusView', {
};
Ext
.
applyIf
(
me
,
{
url
:
"
/api2/json/nodes/
"
+
nodename
+
"
/status
"
,
cwidth1
:
150
,
interval
:
1000
,
//height: 276,
rows
:
rows
});
...
...
www/manager/node/Summary.js
View file @
a9a1e2f2
...
...
@@ -10,84 +10,21 @@ Ext.define('PVE.node.Summary', {
throw
"
no node name specified
"
;
}
if
(
!
me
.
statusStore
)
{
throw
"
no status storage specified
"
;
}
var
rstore
=
me
.
statusStore
;
var
statusview
=
Ext
.
create
(
'
PVE.node.StatusView
'
,
{
title
:
'
Status
'
,
pveSelNode
:
me
.
pveSelNode
,
style
:
'
padding-top:0px
'
style
:
'
padding-top:0px
'
,
rstore
:
rstore
});
var
rstore
=
statusview
.
rstore
;
var
node_command
=
function
(
cmd
)
{
PVE
.
Utils
.
API2Request
({
params
:
{
command
:
cmd
},
url
:
'
/nodes/
'
+
nodename
+
'
/status
'
,
method
:
'
POST
'
,
waitMsgTarget
:
me
,
failure
:
function
(
response
,
opts
)
{
Ext
.
Msg
.
alert
(
'
Error
'
,
response
.
htmlStatus
);
}
});
};
var
rrdurl
=
"
/api2/png/nodes/
"
+
nodename
+
"
/rrd
"
;
var
tbar
=
Ext
.
create
(
'
Ext.toolbar.Toolbar
'
,
{
items
:
[
{
itemId
:
'
reboot
'
,
text
:
'
Reboot
'
,
handler
:
function
()
{
var
msg
=
"
Do you really want to reboot node '
"
+
nodename
+
"
'?
"
;
Ext
.
Msg
.
confirm
(
'
Confirm
'
,
msg
,
function
(
btn
)
{
if
(
btn
!==
'
yes
'
)
{
return
;
}
node_command
(
'
reboot
'
);
});
}
},
{
itemId
:
'
shutdown
'
,
text
:
'
Shutdown
'
,
handler
:
function
()
{
var
msg
=
"
Do you really want to shutdown node '
"
+
nodename
+
"
'?
"
;
Ext
.
Msg
.
confirm
(
'
Confirm
'
,
msg
,
function
(
btn
)
{
if
(
btn
!==
'
yes
'
)
{
return
;
}
node_command
(
'
shutdown
'
);
});
}
},
{
itemId
:
'
shell
'
,
text
:
'
Shell
'
,
handler
:
function
()
{
var
url
=
Ext
.
urlEncode
({
console
:
'
shell
'
,
node
:
nodename
});
var
nw
=
window
.
open
(
"
?
"
+
url
,
'
_blank
'
,
"
innerWidth=745,innerheight=427
"
);
nw
.
focus
();
}
},
'
->
'
,
{
xtype
:
'
pveRRDTypeSelector
'
}
]
});
me
.
mon
(
rstore
,
'
load
'
,
function
(
s
,
records
,
success
)
{
var
uptimerec
=
s
.
data
.
get
(
'
uptime
'
);
var
uptime
=
uptimerec
?
uptimerec
.
data
.
value
:
false
;
tbar
.
down
(
'
#reboot
'
).
setDisabled
(
!
uptime
);
tbar
.
down
(
'
#shutdown
'
).
setDisabled
(
!
uptime
);
tbar
.
down
(
'
#shell
'
).
setDisabled
(
!
uptime
);
});
Ext
.
apply
(
me
,
{
autoScroll
:
true
,
bodyStyle
:
'
padding:10px
'
,
...
...
@@ -95,7 +32,7 @@ Ext.define('PVE.node.Summary', {
width
:
800
,
style
:
'
padding-top:10px
'
},
tbar
:
tbar
,
tbar
:
[
'
->
'
,
{
xtype
:
'
pveRRDTypeSelector
'
}
]
,
items
:
[
statusview
,
{
...
...
@@ -125,10 +62,6 @@ Ext.define('PVE.node.Summary', {
]
});
me
.
on
(
'
show
'
,
rstore
.
startUpdate
);
me
.
on
(
'
hide
'
,
rstore
.
stopUpdate
);
me
.
on
(
'
destroy
'
,
rstore
.
stopUpdate
);
me
.
callParent
();
}
});
www/manager/openvz/Config.js
View file @
a9a1e2f2
...
...
@@ -15,12 +15,84 @@ Ext.define('PVE.openvz.Config', {
throw
"
no VM ID specified
"
;
}
me
.
statusStore
=
Ext
.
create
(
'
PVE.data.ObjectStore
'
,
{
url
:
"
/api2/json/nodes/
"
+
nodename
+
"
/openvz/
"
+
vmid
+
"
/status/current
"
,
interval
:
1000
});
var
vm_command
=
function
(
cmd
,
params
)
{
PVE
.
Utils
.
API2Request
({
params
:
params
,
url
:
'
/nodes/
'
+
nodename
+
'
/openvz/
'
+
vmid
+
"
/status/
"
+
cmd
,
waitMsgTarget
:
me
,
method
:
'
POST
'
,
failure
:
function
(
response
,
opts
)
{
Ext
.
Msg
.
alert
(
'
Error
'
,
response
.
htmlStatus
);
}
});
};
var
startBtn
=
Ext
.
create
(
'
Ext.Button
'
,
{
text
:
'
Start
'
,
handler
:
function
()
{
vm_command
(
'
start
'
);
}
});
var
stopBtn
=
Ext
.
create
(
'
PVE.button.Button
'
,
{
text
:
'
Stop
'
,
confirmMsg
:
"
Do you really want to stop the VM?
"
,
handler
:
function
()
{
vm_command
(
"
stop
"
,
{
fast
:
1
});
}
});
var
shutdownBtn
=
Ext
.
create
(
'
PVE.button.Button
'
,
{
text
:
'
Shutdown
'
,
confirmMsg
:
"
Do you really want to shutdown the VM?
"
,
handler
:
function
()
{
vm_command
(
'
stop
'
);
}
});
var
removeBtn
=
Ext
.
create
(
'
PVE.button.Button
'
,
{
text
:
'
Remove
'
,
confirmMsg
:
'
Are you sure you want to remove VM
'
+
vmid
+
'
? This will permanently erase all VM data.
'
,
handler
:
function
()
{
PVE
.
Utils
.
API2Request
({
url
:
'
/nodes/
'
+
nodename
+
'
/openvz/
'
+
vmid
,
method
:
'
DELETE
'
,
waitMsgTarget
:
me
,
failure
:
function
(
response
,
opts
)
{
Ext
.
Msg
.
alert
(
'
Error
'
,
response
.
htmlStatus
);
}
});
}
});
var
consoleBtn
=
Ext
.
create
(
'
Ext.Button
'
,
{
text
:
'
Console
'
,
handler
:
function
()
{
var
url
=
Ext
.
urlEncode
({
console
:
'
openvz
'
,
vmid
:
vmid
,
node
:
nodename
});
var
nw
=
window
.
open
(
"
?
"
+
url
,
'
_blank
'
,
"
innerWidth=745,innerheight=427
"
);
nw
.
focus
();
}
});
var
vmname
=
me
.
pveSelNode
.
data
.
name
;
var
descr
=
vmname
?
"
'
"
+
vmname
+
"
'
"
:
''
;
Ext
.
apply
(
me
,
{
title
:
"
OpenVZ container
"
+
vmid
+
descr
+
"
on node '
"
+
nodename
+
"
'
"
,
hstateid
:
'
ovztab
'
,
tbar
:
[
startBtn
,
stopBtn
,
shutdownBtn
,
removeBtn
,
consoleBtn
],
defaults
:
{
statusStore
:
me
.
statusStore
},
items
:
[
{
title
:
'
Summary
'
,
...
...
@@ -59,15 +131,6 @@ Ext.define('PVE.openvz.Config', {
xtype
:
'
pveLogView
'
,
url
:
'
/api2/json/nodes/
'
+
nodename
+
'
/openvz/
'
+
vmid
+
'
/initlog
'
},
/*
{
xtype: 'pveOpenVZConsole',
title: 'Console',
itemId: 'console',
nodename: nodename,
vmid: vmid
},
*/
{
xtype
:
'
pveBackupView
'
,
title
:
'
Backup
'
,
...
...
@@ -83,5 +146,29 @@ Ext.define('PVE.openvz.Config', {
});
me
.
callParent
();
}
me
.
statusStore
.
on
(
'
load
'
,
function
(
s
,
records
,
success
)
{
var
status
;
if
(
!
success
)
{
me
.
workspace
.
checkVmMigration
(
me
.
pveSelNode
);
status
=
'
unknown
'
;
}
else
{
var
rec
=
s
.
data
.
get
(
'
status
'
);
status
=
rec
?
rec
.
data
.
value
:
'
unknown
'
;
}
startBtn
.
setDisabled
(
status
===
'
running
'
);
shutdownBtn
.
setDisabled
(
status
!==
'
running
'
);
stopBtn
.
setDisabled
(
status
===
'
stopped
'
);
consoleBtn
.
setDisabled
(
status
!==
'
running
'
);
removeBtn
.
setDisabled
(
status
!==
'
stopped
'
);
});
me
.
on
(
'
afterrender
'
,
function
()
{
me
.
statusStore
.
startUpdate
();
});
me
.
on
(
'
destroy
'
,
function
()
{
me
.
statusStore
.
stopUpdate
();
});
}
});
www/manager/openvz/StatusView.js
View file @
a9a1e2f2
...
...
@@ -74,10 +74,8 @@ Ext.define('PVE.openvz.StatusView', {
};
Ext
.
applyIf
(
me
,
{
url
:
"
/api2/json/nodes/
"
+
nodename
+
"
/openvz/
"
+
vmid
+
"
/status/current
"
,
cwidth1
:
150
,
height
:
179
,
interval
:
1000
,
rows
:
rows
});
...
...
www/manager/openvz/Summary.js
View file @
a9a1e2f2
...
...
@@ -19,128 +19,33 @@ Ext.define('PVE.openvz.Summary', {
throw
"
no workspace specified
"
;
}
if
(
!
me
.
statusStore
)
{
throw
"
no status storage specified
"
;
}
var
rstore
=
me
.
statusStore
;
var
statusview
=
Ext
.
create
(
'
PVE.openvz.StatusView
'
,
{
title
:
'
Status
'
,
pveSelNode
:
me
.
pveSelNode
,
width
:
400
width
:
400
,
rstore
:
rstore
});
var
rstore
=
statusview
.
rstore
;
var
rrdurl
=
"
/api2/png/nodes/
"
+
nodename
+
"
/openvz/
"
+
vmid
+
"
/rrd
"
;
var
vm_command
=
function
(
cmd
,
params
)
{
PVE
.
Utils
.
API2Request
({
params
:
params
,
url
:
'
/nodes/
'
+
nodename
+
'
/openvz/
'
+
vmid
+
"
/status/
"
+
cmd
,
waitMsgTarget
:
me
,
method
:
'
POST
'
,
failure
:
function
(
response
,
opts
)
{
Ext
.
Msg
.
alert
(
'
Error
'
,
response
.
htmlStatus
);
}
});
};
var
tbar
=
Ext
.
create
(
'
Ext.toolbar.Toolbar
'
,
{
items
:
[
{
itemId
:
'
start
'
,
text
:
'
Start
'
,
handler
:
function
()
{
vm_command
(
'
start
'
);
}
},
{
itemId
:
'
stop
'
,
text
:
'
Stop
'
,
handler
:
function
()
{
var
msg
=
"
Do you really want to stop the VM?
"
;
Ext
.
Msg
.
confirm
(
'
Confirm
'
,
msg
,
function
(
btn
)
{
if
(
btn
!==
'
yes
'
)
{
return
;
}
vm_command
(
"
stop
"
,
{
fast
:
1
});
});
}
},
{
itemId
:
'
shutdown
'
,
text
:
'
Shutdown
'
,
handler
:
function
()
{
var
msg
=
"
Do you really want to shutdown the VM?
"
;
Ext
.
Msg
.
confirm
(
'
Confirm
'
,
msg
,
function
(
btn
)
{
if
(
btn
!==
'
yes
'
)
{
return
;
}
vm_command
(
'
stop
'
);
});
}
},
{
itemId
:
'
remove
'
,
text
:
'
Remove
'
,
handler
:
function
()
{
var
msg
=
'
Are you sure you want to remove VM
'
+
vmid
+
'
? This will permanently erase all VM data.
'
;
Ext
.
Msg
.
confirm
(
'
Confirm
'
,
msg
,
function
(
btn
)
{
if
(
btn
!==
'
yes
'
)
{
return
;
}
PVE
.
Utils
.
API2Request
({
url
:
'
/nodes/
'
+
nodename
+
'
/openvz/
'
+
vmid
,
method
:
'
DELETE
'
,
waitMsgTarget
:
me
,
failure
:
function
(
response
,
opts
)
{
Ext
.
Msg
.
alert
(
'
Error
'
,
response
.
htmlStatus
);
}
});
});
}
},
{
itemId
:
'
console
'
,
text
:
'
Console
'
,
handler
:
function
()
{
var
url
=
Ext
.
urlEncode
({
console
:
'
openvz
'
,
vmid
:
vmid
,
node
:
nodename
});
var
nw
=
window
.
open
(
"
?
"
+
url
,
'
_blank
'
,
"
innerWidth=745,innerheight=427
"
);
nw
.
focus
();
}
},
'
->
'
,
{
xtype
:
'
pveRRDTypeSelector
'
}
]
});
me
.
mon
(
rstore
,
'
load
'
,
function
(
s
,
records
,
success
)
{
var
status
;
if
(
!
success
)
{
me
.
workspace
.
checkVmMigration
(
me
.
pveSelNode
);
status
=
'
unknown
'
;
}
else
{
var
rec
=
s
.
data
.
get
(
'
status
'
);
status
=
rec
?
rec
.
data
.
value
:
'
unknown
'
;
}
tbar
.
down
(
'
#start
'
).
setDisabled
(
status
===
'
running
'
);
tbar
.
down
(
'
#shutdown
'
).
setDisabled
(
status
!==
'
running
'
);
tbar
.
down
(
'
#stop
'
).
setDisabled
(
status
===
'
stopped
'
);
tbar
.
down
(
'
#console
'
).
setDisabled
(
status
!==
'
running
'
);
tbar
.
down
(
'
#remove
'
).
setDisabled
(
status
!==
'
stopped
'
);
});
var
notesview
=
Ext
.
create
(
'
PVE.panel.NotesView
'
,
{
pveSelNode
:
me
.
pveSelNode
,
flex
:
1
});
Ext
.
apply
(
me
,
{
tbar
:
tbar
,
tbar
:
[
'
->
'
,
{
xtype
:
'
pveRRDTypeSelector
'
}
],
autoScroll
:
true
,
bodyStyle
:
'
padding:10px
'
,
defaults
:
{
...
...
@@ -189,13 +94,9 @@ Ext.define('PVE.openvz.Summary', {
});
me
.
on
(
'
show
'
,
function
()
{
rstore
.
startUpdate
();
notesview
.
load
();
});
me
.
on
(
'
hide
'
,
rstore
.
stopUpdate
);
me
.
on
(
'
destroy
'
,
rstore
.
stopUpdate
);
me
.
callParent
();
}
});
www/manager/panel/ConfigPanel.js
View file @
a9a1e2f2
Ext
.
define
(
'
PVE.panel.Config
'
,
{
extend
:
'
Ext.tab.Panel
'
,
requires
:
[
'
Ext.state.Manager
'
,
'
PVE.grid.ResourceGrid
'
],
alias
:
'
widget.PVE.panel.Config
'
,
extend
:
'
Ext.panel.Panel
'
,
initComponent
:
function
()
{
var
me
=
this
;
...
...
@@ -13,23 +8,34 @@ Ext.define('PVE.panel.Config', {
var
sp
=
Ext
.
state
.
Manager
.
getProvider
();
var
activeTab
;
if
(
stateid
)
{
var
state
=
sp
.
get
(
stateid
);
if
(
state
&&
state
.
value
)
{
activeTab
=
state
.
value
;
}
}
var
items
=
me
.
items
||
[];
me
.
items
=
null
;
me
.
items
=
undefined
;
Ext
.
applyIf
(
me
,
{
title
:
me
.
pveSelNode
.
data
.
text
,
showSearch
:
true
,
defaults
:
{}
})
;
var
tbar
=
me
.
tbar
||
[];
me
.
tbar
=
undefined
;
var
title
=
me
.
title
||
me
.
pveSelNode
.
data
.
text
;
me
.
title
=
undefined
;
// pass workspace, pveSelNode and viewFilter to all children
Ext
.
apply
(
me
.
defaults
,
{
pveSelNode
:
me
.
pveSelNode
,
viewFilter
:
me
.
viewFilter
,
workspace
:
me
.
workspace
,
border
:
false
tbar
.
unshift
(
'
->
'
);
tbar
.
unshift
(
{
xtype
:
'
tbtext
'
,
text
:
title
,
baseCls
:
'
x-panel-header-text
'
,
padding
:
'
0 0 5 0
'
});
Ext
.
applyIf
(
me
,
{
showSearch
:
true
});
if
(
me
.
showSearch
)
{
items
.
unshift
({
itemId
:
'
search
'
,
...
...
@@ -37,8 +43,27 @@ Ext.define('PVE.panel.Config', {
});
}
Ext
.
apply
(
me
,
{
var
toolbar
=
Ext
.
create
(
'
Ext.toolbar.Toolbar
'
,
{
items
:
tbar
,
style
:
'
border:0px;
'
,
height
:
28
});
var
tab
=
Ext
.
create
(
'
Ext.tab.Panel
'
,
{
flex
:
1
,
border
:
true
,
activeTab
:
activeTab
,
defaults
:
Ext
.
apply
(
me
.
defaults
||
{},
{
pveSelNode
:
me
.
pveSelNode
,
viewFilter
:
me
.
viewFilter
,
workspace
:
me
.
workspace
,
border
:
false
}),
items
:
items
,
listeners
:
{
afterrender
:
function
(
tp
)
{
tp
.
items
.
get
(
0
).
fireEvent
(
'
show
'
,
tp
.
items
.
get
(
0
));
},
tabchange
:
function
(
tp
,
newcard
,
oldcard
)
{
var
ntab
=
newcard
.
itemId
;
// Note: '' is alias for first tab.
...
...
@@ -51,36 +76,29 @@ Ext.define('PVE.panel.Config', {
sp
.
set
(
stateid
,
state
);
}
}
},
items
:
items
}
});
if
(
stateid
)
{
var
state
=
sp
.
get
(
stateid
);
if
(
state
&&
state
.
value
)
{
me
.
activeTab
=
state
.
value
;
}
}
Ext
.
apply
(
me
,
{
layout
:
{
type
:
'
vbox
'
,
align
:
'
stretch
'
},
items
:
[
toolbar
,
tab
]
});
me
.
callParent
();
me
.
items
.
get
(
0
).
fireEvent
(
'
show
'
,
me
.
items
.
get
(
0
));
var
statechange
=
function
(
sp
,
key
,
state
)
{
if
(
stateid
&&
key
===
stateid
)
{
var
atab
=
me
.
getActiveTab
().
itemId
;
console
.
log
(
"
scanhge
"
);
var
atab
=
tab
.
getActiveTab
().
itemId
;
var
ntab
=
state
.
value
||
items
[
0
].
itemId
;
if
(
state
&&
ntab
&&
(
atab
!=
ntab
))
{
me
.
setActiveTab
(
ntab
);
tab
.
setActiveTab
(
ntab
);
}
}
};
if
(
stateid
)
{
sp
.
on
(
'
statechange
'
,
statechange
);
me
.
on
(
'
destroy
'
,
function
()
{
sp
.
un
(
'
statechange
'
,
statechange
);
});
me
.
mon
(
sp
,
'
statechange
'
,
statechange
);
}
}
});
www/manager/qemu/Config.js
View file @
a9a1e2f2
...
...
@@ -15,12 +15,102 @@ Ext.define('PVE.qemu.Config', {
throw
"
no VM ID specified
"
;
}
me
.
statusStore
=
Ext
.
create
(
'
PVE.data.ObjectStore
'
,
{
url
:
"
/api2/json/nodes/
"
+
nodename
+
"
/qemu/
"
+
vmid
+
"
/status/current
"
,
interval
:
1000
});
var
vm_command
=
function
(
cmd
,
params
)
{
PVE
.
Utils
.
API2Request
({
params
:
params
,
url
:
'
/nodes/
'
+
nodename
+
'
/qemu/
'
+
vmid
+
"
/status/
"
+
cmd
,
waitMsgTarget
:
me
,
method
:
'
POST
'
,
failure
:
function
(
response
,
opts
)
{
Ext
.
Msg
.
alert
(
'
Error
'
,
response
.
htmlStatus
);
}
});
};
var
startBtn
=
Ext
.
create
(
'
Ext.Button
'
,
{
text
:
'
Start
'
,
handler
:
function
()
{
vm_command
(
'
start
'
);
}
});
var
stopBtn
=
Ext
.
create
(
'
PVE.button.Button
'
,
{
text
:
'
Stop
'
,
confirmMsg
:
"
Do you really want to stop the VM?
"
,
handler
:
function
()
{
vm_command
(
"
stop
"
,
{
timeout
:
30
});
}
});
var
migrateBtn
=
Ext
.
create
(
'
Ext.Button
'
,
{
text
:
'
Migrate
'
,
handler
:
function
()
{
var
win
=
Ext
.
create
(
'
PVE.qemu.Migrate
'
,
{
pveSelNode
:
me
.
pveSelNode
});
win
.
show
();
}
});
var
resetBtn
=
Ext
.
create
(
'
PVE.button.Button
'
,
{
text
:
'
Reset
'
,
confirmMsg
:
"
Do you really want to reset the VM?
"
,
handler
:
function
()
{
vm_command
(
"
reset
"
);
}
});
var
shutdownBtn
=
Ext
.
create
(
'
PVE.button.Button
'
,
{
text
:
'
Shutdown
'
,
confirmMsg
:
"
Do you really want to shutdown the VM?
"
,
handler
:
function
()
{
vm_command
(
'
shutdown
'
,
{
timeout
:
30
});
}
});
var
removeBtn
=
Ext
.
create
(
'
PVE.button.Button
'
,
{
text
:
'
Remove
'
,
confirmMsg
:
'
Are you sure you want to remove VM
'
+
vmid
+
'
? This will permanently erase all VM data.
'
,
handler
:
function
()
{
PVE
.
Utils
.
API2Request
({
url
:
'
/nodes/
'
+
nodename
+
'
/qemu/
'
+
vmid
,
method
:
'
DELETE
'
,
waitMsgTarget
:
me
,
failure
:
function
(
response
,
opts
)
{
Ext
.
Msg
.
alert
(
'
Error
'
,
response
.
htmlStatus
);
}
});
}
});
var
consoleBtn
=
Ext
.
create
(
'
Ext.Button
'
,
{
text
:
'
Console
'
,
handler
:
function
()
{
var
url
=
Ext
.
urlEncode
({
console
:
'
kvm
'
,
vmid
:
vmid
,
node
:
nodename
});
var
nw
=
window
.
open
(
"
?
"
+
url
,
'
_blank
'
,
"
innerWidth=745,innerheight=427
"
);
nw
.
focus
();
}
});
var
vmname
=
me
.
pveSelNode
.
data
.
name
;
var
descr
=
vmname
?
"
'
"
+
vmname
+
"
'
"
:
''
;
Ext
.
apply
(
me
,
{
title
:
"
Virtual machine
"
+
descr
+
"
'KVM
"
+
vmid
+
"
' on node '
"
+
nodename
+
"
'
"
,
hstateid
:
'
kvmtab
'
,
tbar
:
[
startBtn
,
stopBtn
,
migrateBtn
,
resetBtn
,
shutdownBtn
,
removeBtn
,
consoleBtn
],
defaults
:
{
statusStore
:
me
.
statusStore
},
items
:
[
{
title
:
'
Summary
'
,
...
...
@@ -42,16 +132,6 @@ Ext.define('PVE.qemu.Config', {
itemId
:
'
monitor
'
,
xtype
:
'
pveQemuMonitor
'
},
/*
{
xtype: 'pveKVMConsole',
title: 'Console',
itemId: 'console',
//disabled: true,
nodename: nodename,
vmid: vmid
},
*/
{
xtype
:
'
pveBackupView
'
,
title
:
'
Backup
'
,
...
...
@@ -67,5 +147,31 @@ Ext.define('PVE.qemu.Config', {
});
me
.
callParent
();
me
.
statusStore
.
on
(
'
load
'
,
function
(
s
,
records
,
success
)
{
var
status
;
if
(
!
success
)
{
me
.
workspace
.
checkVmMigration
(
me
.
pveSelNode
);
status
=
'
unknown
'
;
}
else
{
var
rec
=
s
.
data
.
get
(
'
status
'
);
status
=
rec
?
rec
.
data
.
value
:
'
unknown
'
;
}
startBtn
.
setDisabled
(
status
===
'
running
'
);
resetBtn
.
setDisabled
(
status
!==
'
running
'
);
shutdownBtn
.
setDisabled
(
status
!==
'
running
'
);
stopBtn
.
setDisabled
(
status
===
'
stopped
'
);
consoleBtn
.
setDisabled
(
status
!==
'
running
'
);
removeBtn
.
setDisabled
(
status
!==
'
stopped
'
);
});
me
.
on
(
'
afterrender
'
,
function
()
{
me
.
statusStore
.
startUpdate
();
});
me
.
on
(
'
destroy
'
,
function
()
{
me
.
statusStore
.
stopUpdate
();
});
}
});
www/manager/qemu/StatusView.js
View file @
a9a1e2f2
...
...
@@ -50,10 +50,8 @@ Ext.define('PVE.qemu.StatusView', {
};
Ext
.
applyIf
(
me
,
{
url
:
"
/api2/json/nodes/
"
+
nodename
+
"
/qemu/
"
+
vmid
+
"
/status/current
"
,
cwidth1
:
150
,
height
:
145
,
interval
:
1000
,
rows
:
rows
});
...
...
www/manager/qemu/Summary.js
View file @
a9a1e2f2
...
...
@@ -19,152 +19,28 @@ Ext.define('PVE.qemu.Summary', {
throw
"
no workspace specified
"
;
}
if
(
!
me
.
statusStore
)
{
throw
"
no status storage specified
"
;
}
var
rstore
=
me
.
statusStore
;
var
statusview
=
Ext
.
create
(
'
PVE.qemu.StatusView
'
,
{
title
:
'
Status
'
,
pveSelNode
:
me
.
pveSelNode
,
width
:
400
width
:
400
,
rstore
:
rstore
});
var
rstore
=
statusview
.
rstore
;
var
rrdurl
=
"
/api2/png/nodes/
"
+
nodename
+
"
/qemu/
"
+
vmid
+
"
/rrd
"
;
var
vm_command
=
function
(
cmd
,
params
)
{
PVE
.
Utils
.
API2Request
({
params
:
params
,
url
:
'
/nodes/
'
+
nodename
+
'
/qemu/
'
+
vmid
+
"
/status/
"
+
cmd
,
waitMsgTarget
:
me
,
method
:
'
POST
'
,
failure
:
function
(
response
,
opts
)
{
Ext
.
Msg
.
alert
(
'
Error
'
,
response
.
htmlStatus
);
}
});
};
var
tbar
=
Ext
.
create
(
'
Ext.toolbar.Toolbar
'
,
{
items
:
[
{
itemId
:
'
start
'
,
text
:
'
Start
'
,
handler
:
function
()
{
vm_command
(
'
start
'
);
}
},
{
itemId
:
'
stop
'
,
text
:
'
Stop
'
,
handler
:
function
()
{
var
msg
=
"
Do you really want to stop the VM?
"
;
Ext
.
Msg
.
confirm
(
'
Confirm
'
,
msg
,
function
(
btn
)
{
if
(
btn
!==
'
yes
'
)
{
return
;
}
vm_command
(
"
stop
"
,
{
timeout
:
30
});
});
}
},
{
itemId
:
'
migrate
'
,
text
:
'
Migrate
'
,
handler
:
function
()
{
var
win
=
Ext
.
create
(
'
PVE.qemu.Migrate
'
,
{
pveSelNode
:
me
.
pveSelNode
});
win
.
show
();
}
},
{
text
:
'
Reset
'
,
itemId
:
'
reset
'
,
handler
:
function
()
{
var
msg
=
"
Do you really want to reset the VM?
"
;
Ext
.
Msg
.
confirm
(
'
Confirm
'
,
msg
,
function
(
btn
)
{
if
(
btn
!==
'
yes
'
)
{
return
;
}
vm_command
(
"
reset
"
);
});
}
},
{
itemId
:
'
shutdown
'
,
text
:
'
Shutdown
'
,
handler
:
function
()
{
var
msg
=
"
Do you really want to shutdown the VM?
"
;
Ext
.
Msg
.
confirm
(
'
Confirm
'
,
msg
,
function
(
btn
)
{
if
(
btn
!==
'
yes
'
)
{
return
;
}
vm_command
(
'
shutdown
'
,
{
timeout
:
30
});
});
}
},
{
itemId
:
'
remove
'
,
text
:
'
Remove
'
,
handler
:
function
()
{
var
msg
=
'
Are you sure you want to remove VM
'
+
vmid
+
'
? This will permanently erase all VM data.
'
;
Ext
.
Msg
.
confirm
(
'
Confirm
'
,
msg
,
function
(
btn
)
{
if
(
btn
!==
'
yes
'
)
{
return
;
}
PVE
.
Utils
.
API2Request
({
url
:
'
/nodes/
'
+
nodename
+
'
/qemu/
'
+
vmid
,
method
:
'
DELETE
'
,
waitMsgTarget
:
me
,
failure
:
function
(
response
,
opts
)
{
Ext
.
Msg
.
alert
(
'
Error
'
,
response
.
htmlStatus
);
}
});
});
}
},
{
itemId
:
'
console
'
,
text
:
'
Console
'
,
handler
:
function
()
{
var
url
=
Ext
.
urlEncode
({
console
:
'
kvm
'
,
vmid
:
vmid
,
node
:
nodename
});
var
nw
=
window
.
open
(
"
?
"
+
url
,
'
_blank
'
,
"
innerWidth=745,innerheight=427
"
);
nw
.
focus
();
}
},
'
->
'
,
{
xtype
:
'
pveRRDTypeSelector
'
}
]
});
me
.
mon
(
rstore
,
'
load
'
,
function
(
s
,
records
,
success
)
{
var
status
;
if
(
!
success
)
{
me
.
workspace
.
checkVmMigration
(
me
.
pveSelNode
);
status
=
'
unknown
'
;
}
else
{
var
rec
=
s
.
data
.
get
(
'
status
'
);
status
=
rec
?
rec
.
data
.
value
:
'
unknown
'
;
}
tbar
.
down
(
'
#start
'
).
setDisabled
(
status
===
'
running
'
);
tbar
.
down
(
'
#reset
'
).
setDisabled
(
status
!==
'
running
'
);
tbar
.
down
(
'
#shutdown
'
).
setDisabled
(
status
!==
'
running
'
);
tbar
.
down
(
'
#stop
'
).
setDisabled
(
status
===
'
stopped
'
);
tbar
.
down
(
'
#console
'
).
setDisabled
(
status
!==
'
running
'
);
tbar
.
down
(
'
#remove
'
).
setDisabled
(
status
!==
'
stopped
'
);
});
var
notesview
=
Ext
.
create
(
'
PVE.panel.NotesView
'
,
{
pveSelNode
:
me
.
pveSelNode
,
flex
:
1
});
Ext
.
apply
(
me
,
{
tbar
:
tbar
,
tbar
:
[
'
->
'
,
{
xtype
:
'
pveRRDTypeSelector
'
}
]
,
autoScroll
:
true
,
bodyStyle
:
'
padding:10px
'
,
defaults
:
{
...
...
@@ -213,13 +89,9 @@ Ext.define('PVE.qemu.Summary', {
});
me
.
on
(
'
show
'
,
function
()
{
rstore
.
startUpdate
();
notesview
.
load
();
});
me
.
on
(
'
hide
'
,
rstore
.
stopUpdate
);
me
.
on
(
'
destroy
'
,
rstore
.
stopUpdate
);
me
.
callParent
();
}
});
www/manager/tree/ResourceTree.js
View file @
a9a1e2f2
...
...
@@ -320,7 +320,7 @@ Ext.define('PVE.tree.ResourceTree', {
},
//useArrows: true,
//rootVisible: false,
title
:
'
Resource Tree
'
,
//
title: 'Resource Tree',
listeners
:
{
destroy
:
function
()
{
rstore
.
un
(
"
load
"
,
updateTree
);
...
...
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