Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gutyán Gábor
/
circlestack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
42866c2b
authored
Feb 27, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: move console js code from template to js file
parent
c9adb6d2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
72 additions
and
71 deletions
+72
-71
circle/dashboard/static/dashboard/vm-console.js
+68
-0
circle/dashboard/templates/dashboard/vm-detail.html
+2
-1
circle/dashboard/templates/dashboard/vm-detail/console.html
+2
-70
No files found.
circle/dashboard/static/dashboard/vm-console.js
0 → 100644
View file @
42866c2b
$
(
function
()
{
"use strict"
;
Util
.
load_scripts
([
"webutil.js"
,
"base64.js"
,
"websock.js"
,
"des.js"
,
"input.js"
,
"display.js"
,
"jsunzip.js"
,
"rfb.js"
]);
var
rfb
;
function
updateState
(
rfb
,
state
,
oldstate
,
msg
)
{
$
(
'#_console .btn-toolbar button'
).
attr
(
'disabled'
,
!
(
state
===
"normal"
));
rfb
.
sendKey
(
0xffe3
);
// press and release ctrl to kill screensaver
if
(
typeof
(
msg
)
!==
'undefined'
)
{
$
(
'#noVNC_status'
).
html
(
msg
);
}
}
$
(
'a[data-toggle$="pill"][href!="#console"]'
).
click
(
function
()
{
if
(
rfb
)
{
rfb
.
disconnect
();
rfb
=
0
;
}
$
(
"#vm-info-pane"
).
fadeIn
();
$
(
"#vm-detail-pane"
).
removeClass
(
"col-md-12"
);
});
$
(
'#sendCtrlAltDelButton'
).
click
(
function
()
{
rfb
.
sendCtrlAltDel
();
return
false
;});
$
(
'#sendPasswordButton'
).
click
(
function
()
{
var
pw
=
$
(
"#vm-details-pw-input"
).
val
();
for
(
var
i
=
0
;
i
<
pw
.
length
;
i
++
)
{
rfb
.
sendKey
(
pw
.
charCodeAt
(
i
));
}
return
false
;});
$
(
"body"
).
on
(
"click"
,
'a[href$="console"]'
,
function
()
{
var
host
,
port
,
password
,
path
;
$
(
"#vm-info-pane"
).
hide
();
$
(
"#vm-detail-pane"
).
addClass
(
"col-md-12"
);
WebUtil
.
init_logging
(
'warn'
);
host
=
window
.
location
.
hostname
;
if
(
window
.
location
.
port
==
8080
)
{
port
=
9999
;
}
else
{
port
=
window
.
location
.
port
==
""
?
"443"
:
window
.
location
.
port
;
}
password
=
''
;
$
(
'#_console .btn-toolbar button'
).
attr
(
'disabled'
,
true
);
$
(
'#noVNC_status'
).
html
(
'Retreiving authorization token.'
);
$
.
get
(
VNC_URL
,
function
(
data
)
{
if
(
data
.
indexOf
(
'vnc'
)
!=
0
)
{
$
(
'#noVNC_status'
).
html
(
'No authorization token received.'
);
}
else
{
rfb
=
new
RFB
({
'target'
:
$D
(
'noVNC_canvas'
),
'encrypt'
:
(
window
.
location
.
protocol
===
"https:"
),
'true_color'
:
true
,
'local_cursor'
:
true
,
'shared'
:
true
,
'view_only'
:
false
,
'updateState'
:
updateState
});
rfb
.
connect
(
host
,
port
,
password
,
data
);
}
}).
fail
(
function
(){
$
(
'#noVNC_status'
).
html
(
"Can't connect to console."
);
});
});
});
circle/dashboard/templates/dashboard/vm-detail.html
View file @
42866c2b
...
...
@@ -80,7 +80,7 @@
<dt>
Password:
</dt>
<dd>
<div
class=
"input-group"
>
<input
type=
"text"
class=
"form-control input-sm input-tags"
value=
"{{ instance.pw }}"
/>
<input
type=
"text"
id=
"vm-details-pw-input"
class=
"form-control input-sm input-tags"
value=
"{{ instance.pw }}"
/>
<span
class=
"input-group-addon input-tags"
id=
"vm-details-pw-show"
>
<i
class=
"icon-eye-open"
id=
"vm-details-pw-eye"
title=
"Show password"
></i>
</span>
...
...
@@ -152,4 +152,5 @@
{% block extra_js %}
<script
src=
"{{ STATIC_URL }}dashboard/vm-details.js"
></script>
<script
src=
"{{ STATIC_URL }}dashboard/vm-common.js"
></script>
<script
src=
"{{ STATIC_URL }}dashboard/vm-console.js"
></script>
{% endblock %}
circle/dashboard/templates/dashboard/vm-detail/console.html
View file @
42866c2b
...
...
@@ -10,74 +10,6 @@
<script
src=
"{{ STATIC_URL }}dashboard/novnc/util.js"
></script>
<script>
"use strict"
;
var
INCLUDE_URI
=
'{{ STATIC_URL }}dashboard/novnc/'
;
Util
.
load_scripts
([
"webutil.js"
,
"base64.js"
,
"websock.js"
,
"des.js"
,
"input.js"
,
"display.js"
,
"jsunzip.js"
,
"rfb.js"
]);
var
rfb
;
function
updateState
(
rfb
,
state
,
oldstate
,
msg
)
{
$
(
'#_console .btn-toolbar button'
).
attr
(
'disabled'
,
!
(
state
===
"normal"
));
rfb
.
sendKey
(
0xffe3
);
// press and release ctrl to kill screensaver
if
(
typeof
(
msg
)
!==
'undefined'
)
{
$
(
'#noVNC_status'
).
html
(
msg
);
}
}
$
(
'a[data-toggle$="pill"][href!="#console"]'
).
click
(
function
()
{
if
(
rfb
)
{
rfb
.
disconnect
();
rfb
=
0
;
}
$
(
"#vm-info-pane"
).
fadeIn
();
$
(
"#vm-detail-pane"
).
removeClass
(
"col-md-12"
);
});
$
(
'#sendCtrlAltDelButton'
).
click
(
function
()
{
rfb
.
sendCtrlAltDel
();
return
false
;});
$
(
'#sendPasswordButton'
).
click
(
function
()
{
var
pw
=
'{{instance.pw}}'
;
for
(
var
i
=
0
;
i
<
pw
.
length
;
i
++
)
{
rfb
.
sendKey
(
pw
.
charCodeAt
(
i
));
}
return
false
;});
$
(
"body"
).
on
(
"click"
,
'a[href$="console"]'
,
function
()
{
var
host
,
port
,
password
,
path
;
$
(
"#vm-info-pane"
).
hide
();
$
(
"#vm-detail-pane"
).
addClass
(
"col-md-12"
);
WebUtil
.
init_logging
(
'warn'
);
host
=
window
.
location
.
hostname
;
if
(
window
.
location
.
port
==
8080
)
{
port
=
9999
;
}
else
{
port
=
window
.
location
.
port
==
""
?
"443"
:
window
.
location
.
port
;
}
password
=
''
;
$
(
'#_console .btn-toolbar button'
).
attr
(
'disabled'
,
true
);
$
(
'#noVNC_status'
).
html
(
'Retreiving authorization token.'
);
$
.
get
(
'{{ vnc_url }}'
,
function
(
data
)
{
if
(
data
.
indexOf
(
'vnc'
)
!=
0
)
{
$
(
'#noVNC_status'
).
html
(
'No authorization token received.'
);
}
else
{
rfb
=
new
RFB
({
'target'
:
$D
(
'noVNC_canvas'
),
'encrypt'
:
(
window
.
location
.
protocol
===
"https:"
),
'true_color'
:
true
,
'local_cursor'
:
true
,
'shared'
:
true
,
'view_only'
:
false
,
'updateState'
:
updateState
});
rfb
.
connect
(
host
,
port
,
password
,
data
);
}
}).
fail
(
function
(){
$
(
'#noVNC_status'
).
html
(
"Can't connect to console."
);
});
});
</script>
var
VNC_URL
=
"{{ vnc_url }}"
;
</script>
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