Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gyuricska Milán
/
cloud
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
4263acfd
authored
Aug 19, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'issue-250' into 'master'
Remove mass operations support from group list Closes #250
parents
c06380e5
7cda0196
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
172 deletions
+11
-172
circle/dashboard/static/dashboard/group-list.js
+0
-126
circle/dashboard/templates/dashboard/group-list.html
+6
-45
circle/dashboard/templates/dashboard/group-list/column-actions.html
+5
-1
No files found.
circle/dashboard/static/dashboard/group-list.js
View file @
4263acfd
var
ctrlDown
,
shiftDown
=
false
;
var
ctrlKey
=
17
;
var
shiftKey
=
16
;
var
selected
=
[];
$
(
function
()
{
$
(
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
;
});
$
(
'.group-list-table tbody'
).
find
(
'tr'
).
mousedown
(
function
()
{
var
retval
=
true
;
if
(
ctrlDown
)
{
setRowColor
(
$
(
this
));
if
(
!
$
(
this
).
hasClass
(
'group-list-selected'
))
{
selected
.
splice
(
selected
.
indexOf
(
$
(
this
).
index
()),
1
);
}
else
{
selected
.
push
(
$
(
this
).
index
());
}
retval
=
false
;
}
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
(
$
(
'.group-list-table tbody tr'
).
eq
(
i
));
}
}
}
retval
=
false
;
}
else
{
$
(
'.group-list-selected'
).
removeClass
(
'group-list-selected'
);
$
(
this
).
addClass
(
'group-list-selected'
);
selected
=
[
$
(
this
).
index
()];
}
// reset btn disables
$
(
'.group-list-table tbody tr .btn'
).
attr
(
'disabled'
,
false
);
// show/hide group controls
if
(
selected
.
length
>
1
)
{
$
(
'.group-list-group-control a'
).
attr
(
'disabled'
,
false
);
for
(
var
i
=
0
;
i
<
selected
.
length
;
i
++
)
{
$
(
'.group-list-table tbody tr'
).
eq
(
selected
[
i
]).
find
(
'.btn'
).
attr
(
'disabled'
,
true
);
}
}
else
{
$
(
'.group-list-group-control a'
).
attr
(
'disabled'
,
true
);
}
return
retval
;
});
$
(
'#group-list-group-migrate'
).
click
(
function
()
{
console
.
log
(
collectIds
(
selected
));
});
$
(
'tbody a'
).
mousedown
(
function
(
e
)
{
// parent tr doesn't get selected when clicked
e
.
stopPropagation
();
});
$
(
'tbody a'
).
click
(
function
(
e
)
{
// browser doesn't jump to top when clicked the buttons
if
(
!
$
(
this
).
hasClass
(
'real-link'
))
{
return
false
;
}
});
/* rename */
$
(
"#group-list-rename-button, .group-details-rename-button"
).
click
(
function
()
{
$
(
"#group-list-column-name"
,
$
(
this
).
closest
(
"tr"
)).
hide
();
...
...
@@ -113,51 +34,4 @@ $(function() {
return
false
;
});
/* group actions */
/* select all */
$
(
'#group-list-group-select-all'
).
click
(
function
()
{
$
(
'.group-list-table tbody tr'
).
each
(
function
()
{
var
index
=
$
(
this
).
index
();
if
(
selected
.
indexOf
(
index
)
<
0
)
{
selected
.
push
(
index
);
$
(
this
).
addClass
(
'group-list-selected'
);
}
});
if
(
selected
.
length
>
0
)
$
(
'.group-list-group-control a'
).
attr
(
'disabled'
,
false
);
return
false
;
});
/* mass vm delete */
$
(
'#group-list-group-delete'
).
click
(
function
()
{
addModalConfirmation
(
massDeleteVm
,
{
'url'
:
'/dashboard/group/mass-delete/'
,
'data'
:
{
'selected'
:
selected
,
'v'
:
collectIds
(
selected
)
}
}
);
return
false
;
});
});
function
collectIds
(
rows
)
{
var
ids
=
[];
for
(
var
i
=
0
;
i
<
rows
.
length
;
i
++
)
{
var
div
=
$
(
'td:first-child div'
,
$
(
'.group-list-table tbody tr'
).
eq
(
rows
[
i
]));
ids
.
push
(
div
.
prop
(
'id'
).
replace
(
'node-'
,
''
));
}
return
ids
;
}
function
setRowColor
(
row
)
{
if
(
!
row
.
hasClass
(
'group-list-selected'
))
{
row
.
addClass
(
'group-list-selected'
);
}
else
{
row
.
removeClass
(
'group-list-selected'
);
}
}
circle/dashboard/templates/dashboard/group-list.html
View file @
4263acfd
...
...
@@ -6,63 +6,24 @@
{% block content %}
<div
class=
"alert alert-info"
>
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"
>
<div
class=
"col-md-12"
>
<div
class=
"panel panel-default"
>
<div
class=
"panel-heading"
>
<h3
class=
"no-margin"
><i
class=
"fa fa-group"
></i>
Your groups
</h3>
</div>
<div
class=
"panel-body group-list-group-control"
>
<p>
<strong>
Group actions
</strong>
<button
id=
"group-list-group-select-all"
class=
"btn btn-info btn-xs"
>
Select all
</button>
<a
id=
"group-list-group-delete"
disabled
href=
"#"
class=
"btn btn-danger btn-xs"
><i
class=
"fa fa-times"
></i>
Discard
</a>
</p>
</div>
<div
class=
"panel-body"
>
<div
id=
"table_container"
>
<div
id=
"rendered_table"
class=
"panel-body"
>
{% render_table table %}
<div
id=
"rendered_table"
class=
"panel-body"
>
{% render_table table %}
</div>
</div>
</div>
</div>
<!-- .panel-body -->
</div>
</div>
</div>
<style>
.popover
{
max-width
:
600px
;
}
.group-list-selected
,
.group-list-selected
td
{
background-color
:
#e8e8e8
!important
;
}
.group-list-selected
:hover
,
.group-list-selected
:hover
td
{
background-color
:
#d0d0d0
!important
;
}
.group-list-selected
td
:first-child
{
font-weight
:
bold
;
}
.group-list-table-thin
{
width
:
10px
;
}
.group-list-table-admin
{
width
:
130px
;
}
</style>
{% endblock %}
{% block extra_js %}
<script
src=
"{{ STATIC_URL}}dashboard/group-list.js"
></script>
<script
src=
"{{ STATIC_URL}}dashboard/group-list.js"
></script>
{% endblock %}
circle/dashboard/templates/dashboard/group-list/column-actions.html
View file @
4263acfd
<a
data-group-pk=
"{{ record.pk }}"
class=
"btn btn-danger btn-xs real-link group-delete"
href=
"{% url "
dashboard
.
views
.
delete-group
"
pk=
record.pk
%}?
next=
{{
request
.
path
}}"
><i
class=
"fa fa-trash"
></i></a>
<a
data-group-pk=
"{{ record.pk }}"
class=
"btn btn-danger btn-xs real-link group-delete"
href=
"{% url "
dashboard
.
views
.
delete-group
"
pk=
record.pk
%}?
next=
{{
request
.
path
}}"
>
<i
class=
"fa fa-trash-o"
></i>
</a>
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