Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
eefc2151
authored
Sep 30, 2013
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: vm list shift selection
parent
d3cb7b1a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
3 deletions
+61
-3
circle/dashboard/templates/dashboard/vm-list.html
+61
-3
No files found.
circle/dashboard/templates/dashboard/vm-list.html
View file @
eefc2151
...
...
@@ -4,7 +4,11 @@
{% block content %}
<div
class=
"alert alert-info"
>
Tip of the day: you can select multiple vm instances while holding down the
<strong>
CTRL
</strong>
button!
Tip #1: you can select multiple vm instances while holding down the
<strong>
CTRL
</strong>
key!
</div>
<div
class=
"alert alert-info"
>
Tip #2: if you want to select multiple instances by one click select an instance then hold down
<strong>
SHIFT
</strong>
key and select another one!
</div>
<div
class=
"row"
>
...
...
@@ -13,6 +17,19 @@
<div
class=
"panel-heading"
>
<h3
class=
"no-margin"
><i
class=
"icon-desktop"
></i>
Your virtual machines
</h3>
</div>
<div
class=
"panel-body vm-list-group-control"
>
<p>
<strong>
Group actions
</strong>
<button
class=
"btn btn-info btn-xs"
>
Select all
</button>
<a
class=
"btn btn-default btn-xs"
><i
class=
"icon-truck"
></i>
Migrate
</a>
<button
type=
"button"
class=
"btn btn-xs btn-warning dropdown-toggle"
data-toggle=
"dropdown"
>
Action
<i
class=
"icon-caret-down"
></i></button>
<ul
class=
"dropdown-menu"
role=
"menu"
>
<li><a
href=
"#"
><i
class=
"icon-refresh"
></i>
Reboot
</a></li>
<li><a
href=
"#"
><i
class=
"icon-off"
></i>
Shutdown
</a></li>
<li><a
href=
"#"
><i
class=
"icon-remove"
></i>
Discard
</a></li>
</ul>
</p>
</div>
<div
class=
"panel-body"
>
<table
class=
"table table-bordered table-striped table-hover vm-list-table"
>
<thead>
...
...
@@ -84,22 +101,63 @@
{% block extra_js %}
$(function() {
var ctrlDown = false;
$('.vm-list-group-control .btn').attr('disabled', true);
var ctrlDown, shiftDown = false;
var ctrlKey = 17;
var shiftKey = 16;
var selected = [];
$(document).keydown(function(e) {
if (e.keyCode == ctrlKey) ctrlDown = true;
if (e.keyCode == shiftKey) shiftDown = true;
}).keyup(function(e) {
if (e.keyCode == ctrlKey) ctrlDown = false;
if (e.keyCode == shiftKey) shiftDown = false;
});
$('.vm-list-table
').find('tr').click
(function() {
$('.vm-list-table
tbody').find('tr').mousedown
(function() {
if (ctrlDown) {
setRowColor($(this));
if(!$(this).hasClass('vm-list-selected')) {
selected.splice(selected.indexOf($(this).index()), 1);
} else {
selected.push($(this).index());
}
} else if(shiftDown) {
if(selected.length > 0) {
start = selected[selected.length - 1] + 1;
end = $(this).index();
if(start > end) {
var tmp = start - 1; start = end; end = tmp - 1;
}
for(var i = start; i
<
=
end
;
i
++)
{
if
(
selected
.
indexOf
(
i
)
<
0
)
{
selected
.
push
(
i
);
setRowColor
($('.
vm-list-table
tbody
tr
').
eq
(
i
));
}
}
}
}
else
{
$('.
vm-list-selected
').
removeClass
('
vm-list-selected
');
$(
this
).
addClass
('
vm-list-selected
');
selected =
[$(this).index()];
}
//
reset
btn
disables
$('.
vm-list-table
tbody
tr
.
btn
').
attr
('
disabled
',
false
);
//
show
/
hide
group
controls
if
(
selected
.
length
>
1) {
$('.vm-list-group-control .btn').attr('disabled', false);
for(var i = 0; i
<
selected
.
length
;
i
++)
{
$('.
vm-list-table
tbody
tr
').
eq
(
selected
[
i
]).
find
('.
btn
').
attr
('
disabled
',
true
);
}
}
else
{
$('.
vm-list-group-control
.
btn
').
attr
('
disabled
',
true
);
}
return
false
;
});
$('.
vm-list-details
').
popover
({
...
...
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