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
f1a56913
authored
Aug 06, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: fix issues
parent
7d0ad459
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
19 deletions
+35
-19
circle/dashboard/forms.py
+10
-3
circle/dashboard/static/dashboard/dashboard.js
+7
-6
circle/dashboard/templates/dashboard/index-vm.html
+8
-5
circle/dashboard/templates/dashboard/vm-list.html
+2
-0
circle/dashboard/views.py
+8
-5
No files found.
circle/dashboard/forms.py
View file @
f1a56913
...
@@ -39,8 +39,7 @@ from django.contrib.auth.forms import UserCreationForm as OrgUserCreationForm
...
@@ -39,8 +39,7 @@ from django.contrib.auth.forms import UserCreationForm as OrgUserCreationForm
from
django.forms.widgets
import
TextInput
,
HiddenInput
from
django.forms.widgets
import
TextInput
,
HiddenInput
from
django.template
import
Context
from
django.template
import
Context
from
django.template.loader
import
render_to_string
from
django.template.loader
import
render_to_string
from
django.utils.translation
import
ugettext
as
_
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.utils.translation
import
ugettext_lazy
from
sizefield.widgets
import
FileSizeWidget
from
sizefield.widgets
import
FileSizeWidget
from
django.core.urlresolvers
import
reverse_lazy
from
django.core.urlresolvers
import
reverse_lazy
...
@@ -1142,9 +1141,17 @@ vm_search_choices = (
...
@@ -1142,9 +1141,17 @@ vm_search_choices = (
class
VmListSearchForm
(
forms
.
Form
):
class
VmListSearchForm
(
forms
.
Form
):
s
=
forms
.
CharField
(
widget
=
forms
.
TextInput
(
attrs
=
{
s
=
forms
.
CharField
(
widget
=
forms
.
TextInput
(
attrs
=
{
'class'
:
"form-control input-tags"
,
'class'
:
"form-control input-tags"
,
'placeholder'
:
ugettext_lazy
(
"Search..."
)
'placeholder'
:
_
(
"Search..."
)
}))
}))
stype
=
forms
.
ChoiceField
(
vm_search_choices
,
widget
=
forms
.
Select
(
attrs
=
{
stype
=
forms
.
ChoiceField
(
vm_search_choices
,
widget
=
forms
.
Select
(
attrs
=
{
'class'
:
"btn btn-default input-tags"
,
'class'
:
"btn btn-default input-tags"
,
}))
}))
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
VmListSearchForm
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
# set initial value, otherwise it would be overwritten by request.GET
if
not
self
.
data
.
get
(
"stype"
):
data
=
self
.
data
.
copy
()
data
[
'stype'
]
=
2
self
.
data
=
data
circle/dashboard/static/dashboard/dashboard.js
View file @
f1a56913
...
@@ -258,14 +258,15 @@ $(function () {
...
@@ -258,14 +258,15 @@ $(function () {
html
+=
'<div class="list-group-item list-group-item-last">'
+
gettext
(
"No result"
)
+
'</div>'
;
html
+=
'<div class="list-group-item list-group-item-last">'
+
gettext
(
"No result"
)
+
'</div>'
;
$
(
"#dashboard-vm-list"
).
html
(
html
);
$
(
"#dashboard-vm-list"
).
html
(
html
);
$
(
'.title-favourite'
).
tooltip
({
'placement'
:
'right'
});
$
(
'.title-favourite'
).
tooltip
({
'placement'
:
'right'
});
});
// if there is only one result and ENTER is pressed redirect
$
(
"#dashboard-vm-search-form"
).
submit
(
function
()
{
if
(
e
.
keyCode
==
13
&&
search_result
.
length
==
1
)
{
var
vm_list_items
=
$
(
"#dashboard-vm-list .list-group-item"
);
window
.
location
.
href
=
"/dashboard/vm/"
+
search_result
[
0
].
pk
+
"/"
;
if
(
vm_list_items
.
length
==
1
)
{
}
window
.
location
.
href
=
vm_list_items
.
first
().
prop
(
"href"
);
if
(
e
.
keyCode
==
13
&&
search_result
.
length
>
1
&&
input
.
length
>
0
)
{
return
false
;
window
.
location
.
href
=
"/dashboard/vm/list/?s="
+
input
+
"&stype=2"
;
}
}
return
true
;
});
});
/* search for nodes */
/* search for nodes */
...
...
circle/dashboard/templates/dashboard/index-vm.html
View file @
f1a56913
...
@@ -46,12 +46,15 @@
...
@@ -46,12 +46,15 @@
</style>
</style>
<div
href=
"#"
class=
"list-group-item list-group-footer"
>
<div
href=
"#"
class=
"list-group-item list-group-footer"
>
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"col-sm-6 col-xs-6 input-group input-group-sm"
>
<form
action=
"{% url "
dashboard
.
views
.
vm-list
"
%}"
method=
"GET"
id=
"dashboard-vm-search-form"
>
<input
id=
"dashboard-vm-search-input"
type=
"text"
class=
"form-control"
placeholder=
"{% trans "
Search
..."
%}"
/>
<div
class=
"col-sm-6 col-xs-6 input-group input-group-sm"
>
<div
class=
"input-group-btn"
>
<input
id=
"dashboard-vm-search-input"
type=
"text"
class=
"form-control"
name=
"s"
<button
type=
"submit"
class=
"form-control btn btn-primary"
><i
class=
"fa fa-search"
></i></button>
placeholder=
"{% trans "
Search
..."
%}"
/>
<div
class=
"input-group-btn"
>
<button
type=
"submit"
class=
"form-control btn btn-primary"
><i
class=
"fa fa-search"
></i></button>
</div>
</div>
</div>
</
div
>
</
form
>
<div
class=
"col-sm-6 text-right"
>
<div
class=
"col-sm-6 text-right"
>
<a
class=
"btn btn-primary btn-xs"
href=
"{% url "
dashboard
.
views
.
vm-list
"
%}"
>
<a
class=
"btn btn-primary btn-xs"
href=
"{% url "
dashboard
.
views
.
vm-list
"
%}"
>
<i
class=
"fa fa-chevron-circle-right"
></i>
<i
class=
"fa fa-chevron-circle-right"
></i>
...
...
circle/dashboard/templates/dashboard/vm-list.html
View file @
f1a56913
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
<div
class=
"panel-body vm-list-group-control"
>
<div
class=
"panel-body vm-list-group-control"
>
<p>
<p>
<strong>
{% trans "Group actions" %}
</strong>
<strong>
{% trans "Group actions" %}
</strong>
<!--
<button id="vm-list-group-select-all" class="btn btn-info btn-xs">{% trans "Select all" %}</button>
<button id="vm-list-group-select-all" class="btn btn-info btn-xs">{% trans "Select all" %}</button>
<a href="#" class="btn btn-default btn-xs" title="{% trans "Migrate" %}" disabled>
<a href="#" class="btn btn-default btn-xs" title="{% trans "Migrate" %}" disabled>
<i class="fa fa-truck"></i>
<i class="fa fa-truck"></i>
...
@@ -41,6 +42,7 @@
...
@@ -41,6 +42,7 @@
<a href="#" class="btn btn-default btn-xs" title="{% trans "Shutdown" %}" disabled>
<a href="#" class="btn btn-default btn-xs" title="{% trans "Shutdown" %}" disabled>
<i class="fa fa-power-off"></i>
<i class="fa fa-power-off"></i>
</a>
</a>
-->
<a
title=
"{% trans "
Destroy
"
%}"
id=
"vm-list-group-delete"
disabled
href=
"#"
class=
"btn btn-danger btn-xs"
disabled
>
<a
title=
"{% trans "
Destroy
"
%}"
id=
"vm-list-group-delete"
disabled
href=
"#"
class=
"btn btn-danger btn-xs"
disabled
>
<i
class=
"fa fa-times"
></i>
<i
class=
"fa fa-times"
></i>
</a>
</a>
...
...
circle/dashboard/views.py
View file @
f1a56913
...
@@ -1554,7 +1554,7 @@ class VmList(LoginRequiredMixin, FilterMixin, ListView):
...
@@ -1554,7 +1554,7 @@ class VmList(LoginRequiredMixin, FilterMixin, ListView):
def
get_context_data
(
self
,
*
args
,
**
kwargs
):
def
get_context_data
(
self
,
*
args
,
**
kwargs
):
context
=
super
(
VmList
,
self
)
.
get_context_data
(
*
args
,
**
kwargs
)
context
=
super
(
VmList
,
self
)
.
get_context_data
(
*
args
,
**
kwargs
)
context
[
'search_form'
]
=
VmListSearchForm
(
self
.
request
.
GET
)
context
[
'search_form'
]
=
self
.
search_form
return
context
return
context
def
get
(
self
,
*
args
,
**
kwargs
):
def
get
(
self
,
*
args
,
**
kwargs
):
...
@@ -1576,6 +1576,8 @@ class VmList(LoginRequiredMixin, FilterMixin, ListView):
...
@@ -1576,6 +1576,8 @@ class VmList(LoginRequiredMixin, FilterMixin, ListView):
content_type
=
"application/json"
,
content_type
=
"application/json"
,
)
)
else
:
else
:
self
.
search_form
=
VmListSearchForm
(
self
.
request
.
GET
)
self
.
search_form
.
full_clean
()
return
super
(
VmList
,
self
)
.
get
(
*
args
,
**
kwargs
)
return
super
(
VmList
,
self
)
.
get
(
*
args
,
**
kwargs
)
def
get_queryset
(
self
):
def
get_queryset
(
self
):
...
@@ -1597,10 +1599,11 @@ class VmList(LoginRequiredMixin, FilterMixin, ListView):
...
@@ -1597,10 +1599,11 @@ class VmList(LoginRequiredMixin, FilterMixin, ListView):
)
.
distinct
()
)
.
distinct
()
def
create_default_queryset
(
self
):
def
create_default_queryset
(
self
):
stype
=
self
.
request
.
GET
.
get
(
"stype"
,
"0"
)
cleaned_data
=
self
.
search_form
.
cleaned_data
superuser
=
stype
==
"2"
stype
=
cleaned_data
.
get
(
'stype'
,
2
)
shared
=
stype
==
"1"
superuser
=
stype
==
2
level
=
"owner"
if
stype
==
"0"
else
"user"
shared
=
stype
==
1
level
=
"owner"
if
stype
==
0
else
"user"
queryset
=
Instance
.
get_objects_with_level
(
queryset
=
Instance
.
get_objects_with_level
(
level
,
self
.
request
.
user
,
level
,
self
.
request
.
user
,
group_also
=
shared
,
disregard_superuser
=
not
superuser
,
group_also
=
shared
,
disregard_superuser
=
not
superuser
,
...
...
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