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
from
django.forms.widgets
import
TextInput
,
HiddenInput
from
django.template
import
Context
from
django.template.loader
import
render_to_string
from
django.utils.translation
import
ugettext
as
_
from
django.utils.translation
import
ugettext_lazy
from
django.utils.translation
import
ugettext_lazy
as
_
from
sizefield.widgets
import
FileSizeWidget
from
django.core.urlresolvers
import
reverse_lazy
...
...
@@ -1142,9 +1141,17 @@ vm_search_choices = (
class
VmListSearchForm
(
forms
.
Form
):
s
=
forms
.
CharField
(
widget
=
forms
.
TextInput
(
attrs
=
{
'class'
:
"form-control input-tags"
,
'placeholder'
:
ugettext_lazy
(
"Search..."
)
'placeholder'
:
_
(
"Search..."
)
}))
stype
=
forms
.
ChoiceField
(
vm_search_choices
,
widget
=
forms
.
Select
(
attrs
=
{
'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 () {
html
+=
'<div class="list-group-item list-group-item-last">'
+
gettext
(
"No result"
)
+
'</div>'
;
$
(
"#dashboard-vm-list"
).
html
(
html
);
$
(
'.title-favourite'
).
tooltip
({
'placement'
:
'right'
});
});
// if there is only one result and ENTER is pressed redirect
if
(
e
.
keyCode
==
13
&&
search_result
.
length
==
1
)
{
window
.
location
.
href
=
"/dashboard/vm/"
+
search_result
[
0
].
pk
+
"/"
;
}
if
(
e
.
keyCode
==
13
&&
search_result
.
length
>
1
&&
input
.
length
>
0
)
{
window
.
location
.
href
=
"/dashboard/vm/list/?s="
+
input
+
"&stype=2"
;
$
(
"#dashboard-vm-search-form"
).
submit
(
function
()
{
var
vm_list_items
=
$
(
"#dashboard-vm-list .list-group-item"
);
if
(
vm_list_items
.
length
==
1
)
{
window
.
location
.
href
=
vm_list_items
.
first
().
prop
(
"href"
);
return
false
;
}
return
true
;
});
/* search for nodes */
...
...
circle/dashboard/templates/dashboard/index-vm.html
View file @
f1a56913
...
...
@@ -46,12 +46,15 @@
</style>
<div
href=
"#"
class=
"list-group-item list-group-footer"
>
<div
class=
"row"
>
<div
class=
"col-sm-6 col-xs-6 input-group input-group-sm"
>
<input
id=
"dashboard-vm-search-input"
type=
"text"
class=
"form-control"
placeholder=
"{% trans "
Search
..."
%}"
/>
<div
class=
"input-group-btn"
>
<button
type=
"submit"
class=
"form-control btn btn-primary"
><i
class=
"fa fa-search"
></i></button>
<form
action=
"{% url "
dashboard
.
views
.
vm-list
"
%}"
method=
"GET"
id=
"dashboard-vm-search-form"
>
<div
class=
"col-sm-6 col-xs-6 input-group input-group-sm"
>
<input
id=
"dashboard-vm-search-input"
type=
"text"
class=
"form-control"
name=
"s"
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
>
</
form
>
<div
class=
"col-sm-6 text-right"
>
<a
class=
"btn btn-primary btn-xs"
href=
"{% url "
dashboard
.
views
.
vm-list
"
%}"
>
<i
class=
"fa fa-chevron-circle-right"
></i>
...
...
circle/dashboard/templates/dashboard/vm-list.html
View file @
f1a56913
...
...
@@ -31,6 +31,7 @@
<div
class=
"panel-body vm-list-group-control"
>
<p>
<strong>
{% trans "Group actions" %}
</strong>
<!--
<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>
<i class="fa fa-truck"></i>
...
...
@@ -41,6 +42,7 @@
<a href="#" class="btn btn-default btn-xs" title="{% trans "Shutdown" %}" disabled>
<i class="fa fa-power-off"></i>
</a>
-->
<a
title=
"{% trans "
Destroy
"
%}"
id=
"vm-list-group-delete"
disabled
href=
"#"
class=
"btn btn-danger btn-xs"
disabled
>
<i
class=
"fa fa-times"
></i>
</a>
...
...
circle/dashboard/views.py
View file @
f1a56913
...
...
@@ -1554,7 +1554,7 @@ class VmList(LoginRequiredMixin, FilterMixin, ListView):
def
get_context_data
(
self
,
*
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
def
get
(
self
,
*
args
,
**
kwargs
):
...
...
@@ -1576,6 +1576,8 @@ class VmList(LoginRequiredMixin, FilterMixin, ListView):
content_type
=
"application/json"
,
)
else
:
self
.
search_form
=
VmListSearchForm
(
self
.
request
.
GET
)
self
.
search_form
.
full_clean
()
return
super
(
VmList
,
self
)
.
get
(
*
args
,
**
kwargs
)
def
get_queryset
(
self
):
...
...
@@ -1597,10 +1599,11 @@ class VmList(LoginRequiredMixin, FilterMixin, ListView):
)
.
distinct
()
def
create_default_queryset
(
self
):
stype
=
self
.
request
.
GET
.
get
(
"stype"
,
"0"
)
superuser
=
stype
==
"2"
shared
=
stype
==
"1"
level
=
"owner"
if
stype
==
"0"
else
"user"
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"
queryset
=
Instance
.
get_objects_with_level
(
level
,
self
.
request
.
user
,
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