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
95855a83
Commit
95855a83
authored
Oct 04, 2011
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement Summary/Status view for OpenVZ
And add start/stop/shutdown/remove/console buttons.
parent
77b046eb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
252 additions
and
3 deletions
+252
-3
Makefile
www/manager/Makefile
+3
-1
Config.js
www/manager/openvz/Config.js
+1
-2
StatusView.js
www/manager/openvz/StatusView.js
+61
-0
Summary.js
www/manager/openvz/Summary.js
+187
-0
No files found.
www/manager/Makefile
View file @
95855a83
...
...
@@ -80,7 +80,9 @@ JSSRC= \
qemu/Options.js
\
qemu/Config.js
\
qemu/CreateWizard.js
\
openvz/Config.js
\
openvz/StatusView.js
\
openvz/Summary.js
\
openvz/Config.js
\
openvz/CreateWizard.js
\
storage/ContentView.js
\
storage/StatusView.js
\
...
...
www/manager/openvz/Config.js
View file @
95855a83
...
...
@@ -24,9 +24,8 @@ Ext.define('PVE.openvz.Config', {
items
:
[
{
title
:
'
Summary
'
,
//xtype: 'pveOpenvz
Summary',
xtype
:
'
pveOpenVZ
Summary
'
,
itemId
:
'
summary
'
,
html
:
'
OpenVZ summary - not inplemented!
'
},
{
title
:
'
Options
'
,
...
...
www/manager/openvz/StatusView.js
0 → 100644
View file @
95855a83
Ext
.
define
(
'
PVE.openvz.StatusView
'
,
{
extend
:
'
PVE.grid.ObjectGrid
'
,
initComponent
:
function
()
{
var
me
=
this
;
var
nodename
=
me
.
pveSelNode
.
data
.
node
;
if
(
!
nodename
)
{
throw
"
no node name specified
"
;
}
var
vmid
=
me
.
pveSelNode
.
data
.
vmid
;
if
(
!
vmid
)
{
throw
"
no VM ID specified
"
;
}
var
render_cpu
=
function
(
value
,
metaData
,
record
,
rowIndex
,
colIndex
,
store
)
{
if
(
!
me
.
getObjectValue
(
'
uptime
'
))
{
return
'
-
'
;
}
var
maxcpu
=
me
.
getObjectValue
(
'
cpus
'
,
1
);
if
(
!
(
Ext
.
isNumeric
(
value
)
&&
Ext
.
isNumeric
(
maxcpu
)
&&
(
maxcpu
>=
1
)))
{
return
'
-
'
;
}
var
per
=
(
value
*
100
)
/
maxcpu
;
return
per
.
toFixed
(
1
)
+
'
% of
'
+
maxcpu
.
toString
()
+
(
maxcpu
>
1
?
'
CPUs
'
:
'
CPU
'
);
};
var
render_mem
=
function
(
value
,
metaData
,
record
,
rowIndex
,
colIndex
,
store
)
{
var
maxmem
=
me
.
getObjectValue
(
'
maxmem
'
,
0
);
var
per
=
(
value
/
maxmem
)
*
100
;
var
text
=
"
<div>Total:
"
+
PVE
.
Utils
.
format_size
(
maxmem
)
+
"
</div>
"
+
"
<div>Used:
"
+
PVE
.
Utils
.
format_size
(
value
)
+
"
</div>
"
;
return
text
;
};
var
rows
=
{
name
:
{
header
:
'
Name
'
,
defaultValue
:
'
no name specified
'
},
status
:
{
header
:
'
Status
'
,
defaultValue
:
'
unknown
'
},
cpu
:
{
header
:
'
CPU usage
'
,
required
:
true
,
renderer
:
render_cpu
},
cpus
:
{
visible
:
false
},
mem
:
{
header
:
'
Memory usage
'
,
required
:
true
,
renderer
:
render_mem
},
maxmem
:
{
visible
:
false
},
uptime
:
{
header
:
'
Uptime
'
,
required
:
true
,
renderer
:
PVE
.
Utils
.
render_uptime
}
};
Ext
.
applyIf
(
me
,
{
url
:
"
/api2/json/nodes/
"
+
nodename
+
"
/openvz/
"
+
vmid
+
"
/status/current
"
,
cwidth1
:
150
,
height
:
145
,
interval
:
1000
,
rows
:
rows
});
me
.
callParent
();
}
});
www/manager/openvz/Summary.js
0 → 100644
View file @
95855a83
Ext
.
define
(
'
PVE.openvz.Summary
'
,
{
extend
:
'
Ext.panel.Panel
'
,
alias
:
'
widget.pveOpenVZSummary
'
,
initComponent
:
function
()
{
var
me
=
this
;
var
nodename
=
me
.
pveSelNode
.
data
.
node
;
if
(
!
nodename
)
{
throw
"
no node name specified
"
;
}
var
vmid
=
me
.
pveSelNode
.
data
.
vmid
;
if
(
!
vmid
)
{
throw
"
no VM ID specified
"
;
}
if
(
!
me
.
workspace
)
{
throw
"
no workspace specified
"
;
}
var
statusview
=
Ext
.
create
(
'
PVE.openvz.StatusView
'
,
{
title
:
'
Status
'
,
pveSelNode
:
me
.
pveSelNode
,
width
:
400
});
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
:
'
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
(
'
#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.qemu.NotesView
'
,
{
pveSelNode
:
me
.
pveSelNode
,
flex
:
1
});
Ext
.
apply
(
me
,
{
tbar
:
tbar
,
autoScroll
:
true
,
bodyStyle
:
'
padding:10px
'
,
defaults
:
{
style
:
'
padding-top:10px
'
,
width
:
800
},
items
:
[
{
style
:
'
padding-top:0px
'
,
layout
:
{
type
:
'
hbox
'
,
align
:
'
stretchmax
'
},
border
:
false
,
items
:
[
statusview
,
notesview
]
},
{
xtype
:
'
pveRRDView
'
,
title
:
"
CPU usage %
"
,
pveSelNode
:
me
.
pveSelNode
,
datasource
:
'
cpu
'
,
rrdurl
:
rrdurl
},
{
xtype
:
'
pveRRDView
'
,
title
:
"
Memory usage
"
,
pveSelNode
:
me
.
pveSelNode
,
datasource
:
'
mem,maxmem
'
,
rrdurl
:
rrdurl
},
]
});
me
.
on
(
'
show
'
,
function
()
{
rstore
.
startUpdate
();
notesview
.
load
();
});
me
.
on
(
'
hide
'
,
rstore
.
stopUpdate
);
me
.
on
(
'
destroy
'
,
rstore
.
stopUpdate
);
me
.
callParent
();
}
});
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