Commit 4097a8a3 by Bach Dániel

Merge branch 'issue-vm-list' into 'master'

Issue Vm List
parents c1f12679 4d522c12
......@@ -1161,9 +1161,9 @@ class VmResourcesForm(forms.ModelForm):
vm_search_choices = (
(0, _("owned")),
(1, _("shared")),
(2, _("all")),
("owned", _("owned")),
("shared", _("shared")),
("all", _("all")),
)
......@@ -1182,5 +1182,5 @@ class VmListSearchForm(forms.Form):
# set initial value, otherwise it would be overwritten by request.GET
if not self.data.get("stype"):
data = self.data.copy()
data['stype'] = 2
data['stype'] = "all"
self.data = data
......@@ -262,7 +262,7 @@ $(function () {
$("#dashboard-vm-search-form").submit(function() {
var vm_list_items = $("#dashboard-vm-list .list-group-item");
if(vm_list_items.length == 1) {
if(vm_list_items.length == 1 && vm_list_items.first().prop("href")) {
window.location.href = vm_list_items.first().prop("href");
return false;
}
......
......@@ -1628,10 +1628,10 @@ class VmList(LoginRequiredMixin, FilterMixin, ListView):
def create_default_queryset(self):
cleaned_data = self.search_form.cleaned_data
stype = cleaned_data.get('stype', 2)
superuser = stype == 2
shared = stype == 1
level = "owner" if stype == 0 else "user"
stype = cleaned_data.get('stype', "all")
superuser = stype == "all"
shared = stype == "shared"
level = "owner" if stype == "owned" else "user"
queryset = Instance.get_objects_with_level(
level, self.request.user,
group_also=shared, disregard_superuser=not superuser,
......
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