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
0d278bac
Commit
0d278bac
authored
Jun 25, 2014
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
further console cleanups
parent
700f0740
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
66 additions
and
80 deletions
+66
-80
Utils.js
www/manager/Utils.js
+50
-11
VNCConsole.js
www/manager/VNCConsole.js
+2
-2
ConsoleButton.js
www/manager/button/ConsoleButton.js
+11
-58
CmdMenu.js
www/manager/openvz/CmdMenu.js
+1
-1
CmdMenu.js
www/manager/qemu/CmdMenu.js
+2
-8
No files found.
www/manager/Utils.js
View file @
0d278bac
...
...
@@ -1090,17 +1090,44 @@ Ext.define('PVE.Utils', { statics: {
}
},
openConsoleWindow
:
function
(
vmtype
,
vmid
,
nodename
,
vmname
,
novnc
)
{
var
url
=
Ext
.
urlEncode
({
console
:
vmtype
,
// kvm, openvz or shell
novnc
:
novnc
?
1
:
0
,
vmid
:
vmid
,
vmname
:
vmname
,
node
:
nodename
});
var
nw
=
window
.
open
(
"
?
"
+
url
,
'
_blank
'
,
"
innerWidth=745,innerheight=427
"
);
nw
.
focus
();
openDefaultConsoleWindow
:
function
(
allowSpice
,
vmtype
,
vmid
,
nodename
,
vmname
)
{
var
dv
=
PVE
.
Utils
.
defaultViewer
(
allowSpice
);
PVE
.
Utils
.
openConsoleWindow
(
dv
,
vmtype
,
vmid
,
nodename
,
vmname
);
},
openConsoleWindow
:
function
(
viewer
,
vmtype
,
vmid
,
nodename
,
vmname
)
{
// kvm, openvz, shell, upgrade
if
(
vmid
==
undefined
&&
(
vmtype
===
'
kvm
'
||
vmtype
===
'
openvz
'
))
{
throw
"
missing vmid
"
;
}
if
(
!
nodename
)
{
throw
"
no nodename specified
"
;
}
if
(
viewer
===
'
applet
'
||
viewer
===
'
html5
'
)
{
PVE
.
Utils
.
openVNCViewer
(
vmtype
,
vmid
,
nodename
,
vmname
,
viewer
===
'
html5
'
);
}
else
if
(
viewer
===
'
vv
'
)
{
var
url
;
var
params
=
{
proxy
:
window
.
location
.
hostname
};
if
(
vmtype
===
'
kvm
'
)
{
url
=
'
/nodes/
'
+
nodename
+
'
/qemu/
'
+
vmid
.
toString
()
+
'
/spiceproxy
'
;
PVE
.
Utils
.
openSpiceViewer
(
url
,
params
);
}
else
if
(
vmtype
===
'
openvz
'
)
{
url
=
'
/nodes/
'
+
nodename
+
'
/openvz/
'
+
vmid
.
toString
()
+
'
/spiceproxy
'
;
PVE
.
Utils
.
openSpiceViewer
(
url
,
params
);
}
else
if
(
vmtype
===
'
shell
'
)
{
url
=
'
/nodes/
'
+
nodename
+
'
/spiceshell
'
;
PVE
.
Utils
.
openSpiceViewer
(
url
,
params
);
}
else
if
(
vmtype
===
'
upgrade
'
)
{
url
=
'
/nodes/
'
+
nodename
+
'
/spiceshell
'
;
params
.
upgrade
=
1
;
PVE
.
Utils
.
openSpiceViewer
(
url
,
params
);
}
}
else
{
throw
"
unknown viewer type
"
;
}
},
defaultViewer
:
function
(
allowSpice
)
{
...
...
@@ -1113,6 +1140,18 @@ Ext.define('PVE.Utils', { statics: {
return
dv
;
},
openVNCViewer
:
function
(
vmtype
,
vmid
,
nodename
,
vmname
,
novnc
)
{
var
url
=
Ext
.
urlEncode
({
console
:
vmtype
,
// kvm, openvz, upgrade or shell
novnc
:
novnc
?
1
:
0
,
vmid
:
vmid
,
vmname
:
vmname
,
node
:
nodename
});
var
nw
=
window
.
open
(
"
?
"
+
url
,
'
_blank
'
,
"
innerWidth=745,innerheight=427
"
);
nw
.
focus
();
},
openSpiceViewer
:
function
(
url
,
params
){
var
downloadWithName
=
function
(
uri
,
name
)
{
...
...
www/manager/VNCConsole.js
View file @
0d278bac
...
...
@@ -347,7 +347,7 @@ Ext.define('PVE.KVMConsole', {
{
text
:
gettext
(
'
Console
'
),
handler
:
function
()
{
PVE
.
Utils
.
open
ConsoleWindow
(
'
kvm
'
,
me
.
vmid
,
me
.
nodename
,
me
.
vmname
,
me
.
novnc
);
PVE
.
Utils
.
open
VNCViewer
(
'
kvm
'
,
me
.
vmid
,
me
.
nodename
,
me
.
vmname
,
me
.
novnc
);
}
},
'
->
'
,
...
...
@@ -506,7 +506,7 @@ Ext.define('PVE.Shell', {
{
text
:
gettext
(
'
Shell
'
),
handler
:
function
()
{
PVE
.
Utils
.
open
ConsoleWindow
(
'
shell
'
,
undefined
,
me
.
nodename
,
undefined
,
me
.
novnc
);
PVE
.
Utils
.
open
VNCViewer
(
'
shell
'
,
undefined
,
me
.
nodename
,
undefined
,
me
.
novnc
);
}
}
]);
...
...
www/manager/button/ConsoleButton.js
View file @
0d278bac
...
...
@@ -26,83 +26,36 @@ Ext.define('PVE.button.ConsoleButton', {
throw
"
no node name specified
"
;
}
if
(
!
me
.
consoleName
)
{
if
(
me
.
consoleType
===
'
kvm
'
)
{
me
.
consoleName
=
"
VM
"
+
me
.
vmid
.
toString
();
}
else
if
(
me
.
consoleType
===
'
openvz
'
)
{
me
.
consoleName
=
"
CT
"
+
me
.
vmid
.
toString
();
}
else
{
me
.
consoleName
=
"
Shell
"
;
}
}
var
create_spice_console
=
function
()
{
var
url
;
var
params
=
{
proxy
:
window
.
location
.
hostname
};
if
(
me
.
consoleType
===
'
kvm
'
)
{
url
=
'
/nodes/
'
+
me
.
nodename
+
'
/qemu/
'
+
me
.
vmid
.
toString
()
+
'
/spiceproxy
'
;
PVE
.
Utils
.
openSpiceViewer
(
url
,
params
);
}
else
if
(
me
.
consoleType
===
'
openvz
'
)
{
url
=
'
/nodes/
'
+
me
.
nodename
+
'
/openvz/
'
+
me
.
vmid
.
toString
()
+
'
/spiceproxy
'
;
PVE
.
Utils
.
openSpiceViewer
(
url
,
params
);
}
else
if
(
me
.
consoleType
===
'
shell
'
)
{
url
=
'
/nodes/
'
+
me
.
nodename
+
'
/spiceshell
'
;
PVE
.
Utils
.
openSpiceViewer
(
url
,
params
);
}
else
if
(
me
.
consoleType
===
'
upgrade
'
)
{
url
=
'
/nodes/
'
+
me
.
nodename
+
'
/spiceshell
'
;
params
.
upgrade
=
1
;
PVE
.
Utils
.
openSpiceViewer
(
url
,
params
);
}
};
var
create_vnc_console
=
function
(
novnc
)
{
if
(
me
.
consoleType
===
'
kvm
'
)
{
PVE
.
Utils
.
openConsoleWindow
(
'
kvm
'
,
me
.
vmid
,
me
.
nodename
,
me
.
consoleName
,
novnc
);
}
else
if
(
me
.
consoleType
===
'
openvz
'
)
{
PVE
.
Utils
.
openConsoleWindow
(
'
openvz
'
,
me
.
vmid
,
me
.
nodename
,
me
.
consoleName
,
novnc
);
}
else
if
(
me
.
consoleType
===
'
shell
'
)
{
PVE
.
Utils
.
openConsoleWindow
(
'
shell
'
,
undefined
,
me
.
nodename
,
undefined
,
novnc
);
}
else
if
(
me
.
consoleType
===
'
upgrade
'
)
{
var
url
=
Ext
.
urlEncode
({
console
:
'
upgrade
'
,
node
:
me
.
nodename
,
novnc
:
novnc
});
var
nw
=
window
.
open
(
"
?
"
+
url
,
'
_blank
'
,
"
innerWidth=745,innerheight=427
"
);
nw
.
focus
();
}
};
me
.
spiceMenu
=
Ext
.
create
(
'
Ext.menu.Item
'
,
{
text
:
'
SPICE
'
,
iconCls
:
'
pve-itype-icon-virt-viewer
'
,
handler
:
create_spice_console
handler
:
function
()
{
PVE
.
Utils
.
openConsoleWindow
(
'
vv
'
,
me
.
consoleType
,
me
.
vmid
,
me
.
nodename
,
me
.
consoleName
);
}
});
var
vncMenu
=
Ext
.
create
(
'
Ext.menu.Item
'
,
{
text
:
'
VNC
'
,
iconCls
:
'
pve-itype-icon-tigervnc
'
,
handler
:
function
()
{
create_vnc_console
(
0
);
}
handler
:
function
()
{
PVE
.
Utils
.
openConsoleWindow
(
'
applet
'
,
me
.
consoleType
,
me
.
vmid
,
me
.
nodename
,
me
.
consoleName
);
}
});
var
noVncMenu
=
Ext
.
create
(
'
Ext.menu.Item
'
,
{
text
:
'
noVNC
'
,
iconCls
:
'
pve-itype-icon-novnc
'
,
handler
:
function
()
{
create_vnc_console
(
1
);
}
handler
:
function
()
{
PVE
.
Utils
.
openConsoleWindow
(
'
html5
'
,
me
.
consoleType
,
me
.
vmid
,
me
.
nodename
,
me
.
consoleName
);
}
});
Ext
.
applyIf
(
me
,
{
text
:
gettext
(
'
Console
'
)
});
Ext
.
apply
(
me
,
{
handler
:
function
()
{
var
dv
=
PVE
.
Utils
.
defaultViewer
(
me
.
enableSpice
);
if
(
dv
===
'
vv
'
)
{
create_spice_console
();
}
else
if
(
dv
===
'
applet
'
)
{
create_vnc_console
(
0
);
}
else
if
(
dv
===
'
html5
'
)
{
create_vnc_console
(
1
);
}
else
{
throw
"
unknown defaultViewer
"
;
}
PVE
.
Utils
.
openDefaultConsoleWindow
(
me
.
enableSpice
,
me
.
consoleType
,
me
.
vmid
,
me
.
nodename
,
me
.
consoleName
);
},
menu
:
new
Ext
.
menu
.
Menu
({
items
:
[
noVncMenu
,
vncMenu
,
me
.
spiceMenu
]
...
...
www/manager/openvz/CmdMenu.js
View file @
0d278bac
...
...
@@ -81,7 +81,7 @@ Ext.define('PVE.openvz.CmdMenu', {
text
:
gettext
(
'
Console
'
),
icon
:
'
/pve2/images/display.png
'
,
handler
:
function
()
{
PVE
.
Utils
.
open
ConsoleWindow
(
'
openvz
'
,
vmid
,
nodename
,
vmname
);
PVE
.
Utils
.
open
DefaultConsoleWindow
(
true
,
'
openvz
'
,
vmid
,
nodename
,
vmname
);
}
}
];
...
...
www/manager/qemu/CmdMenu.js
View file @
0d278bac
...
...
@@ -118,14 +118,8 @@ Ext.define('PVE.qemu.CmdMenu', {
Ext
.
Msg
.
alert
(
'
Error
'
,
response
.
htmlStatus
);
},
success
:
function
(
response
,
opts
)
{
var
spice
=
response
.
result
.
data
.
spice
;
if
(
PVE
.
VersionInfo
.
console
===
'
applet
'
||
!
spice
)
{
PVE
.
Utils
.
openConsoleWindow
(
'
kvm
'
,
vmid
,
nodename
,
vmname
);
}
else
{
var
url
=
'
/nodes/
'
+
nodename
+
'
/qemu/
'
+
vmid
+
'
/spiceproxy
'
;
var
params
=
{
proxy
:
window
.
location
.
hostname
};
PVE
.
Utils
.
openSpiceViewer
(
url
,
params
);
}
var
allowSpice
=
response
.
result
.
data
.
spice
;
PVE
.
Utils
.
openDefaultConsoleWindow
(
allowSpice
,
'
kvm
'
,
vmid
,
nodename
,
vmname
);
}
});
}
...
...
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