Commit 83fdaf87 by Kálmán Viktor

dashboard: get ids from row selections in vm list

parent 1942bfb9
......@@ -6,7 +6,8 @@ from django.utils.translation import ugettext_lazy as _
class VmListTable(Table):
pk = Column(
pk = TemplateColumn(
template_name='dashboard/vm-list/column-id.html',
verbose_name="ID",
attrs={'th': {'class': 'vm-list-table-thin'}},
)
......
......@@ -21,7 +21,7 @@
<p>
<strong>Group actions</strong>
<button class="btn btn-info btn-xs" disabled>Select all</button>
<a class="btn btn-default btn-xs" disabled><i class="icon-truck"></i> Migrate</a>
<a class="btn btn-default btn-xs" id="vm-list-group-migrate" disabled><i class="icon-truck"></i> Migrate</a>
<button type="button" class="btn btn-xs btn-warning dropdown-toggle" data-toggle="dropdown" disabled>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>
......@@ -158,6 +158,11 @@ $(function() {
return false;
});
$('#vm-list-group-migrate').click(function() {
console.log(collectIds(selected));
});
$('.vm-list-details').popover({
'placement': 'auto',
'html': true,
......@@ -180,6 +185,14 @@ $(function() {
});
});
function collectIds(rows) {
var ids = [];
for(var i = 0; i < rows.length; i++) {
var div = $('td:first-child div', $('.vm-list-table tbody tr').eq(i));
ids.push(div.prop('id').replace('vm-', ''));
}
return ids;
}
function setRowColor(row) {
if(!row.hasClass('vm-list-selected')) {
......
<div id="vm-{{ record.pk }}">{{ record.pk }}</div>
<tr>
<!--<td><input type="checkbox"/ class="vm-checkbox" id="vm-1825{{ c }}"></td>-->
<td>182{{ c }}</td>
<td>
<div id="vm-1{{ c }}">1{{ c }}</div>
</td>
<td><a href="" class="real-link">network-devenv</a></td>
<td>running</td>
<td>10 days</td>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment