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
c086ab65
authored
Mar 18, 2014
by
Oláh István Gergely
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: remove flush from NodeDetailsView, modify template, add trans
parent
b722b632
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
54 deletions
+13
-54
circle/dashboard/static/dashboard/dashboard.js
+2
-1
circle/dashboard/templates/dashboard/confirm/ajax-node-flush.html
+1
-1
circle/dashboard/templates/dashboard/node-detail.html
+4
-9
circle/dashboard/templates/dashboard/node-list/column-actions.html
+4
-10
circle/dashboard/views.py
+2
-33
No files found.
circle/dashboard/static/dashboard/dashboard.js
View file @
c086ab65
...
@@ -140,9 +140,10 @@ $(function () {
...
@@ -140,9 +140,10 @@ $(function () {
/* for Node flush buttons */
/* for Node flush buttons */
$
(
'.node-flush'
).
click
(
function
()
{
$
(
'.node-flush'
).
click
(
function
()
{
var
node_pk
=
$
(
this
).
data
(
'node-pk'
);
var
node_pk
=
$
(
this
).
data
(
'node-pk'
);
var
postto
=
$
(
this
).
attr
(
'href'
);
var
dir
=
window
.
location
.
pathname
.
indexOf
(
'list'
)
==
-
1
;
var
dir
=
window
.
location
.
pathname
.
indexOf
(
'list'
)
==
-
1
;
addModalConfirmation
(
function
(){},
addModalConfirmation
(
function
(){},
{
'url'
:
'/dashboard/node/flush/'
+
node_pk
+
'/'
,
{
'url'
:
postto
,
'data'
:
[],
'data'
:
[],
'pk'
:
node_pk
,
'pk'
:
node_pk
,
'type'
:
"node"
,
'type'
:
"node"
,
...
...
circle/dashboard/templates/dashboard/confirm/ajax-node-flush.html
View file @
c086ab65
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
{%endblocktrans%}
{%endblocktrans%}
{% endif %}
{% endif %}
<div
class=
"pull-right"
>
<div
class=
"pull-right"
>
<form
action=
"
"
method=
"POST"
>
<form
action=
"{% url "
dashboard
.
views
.
flush-node
"
pk=
node.pk
%}?
next=
{{next}}
"
method=
"POST"
>
{% csrf_token %}
{% csrf_token %}
<button
type=
"button"
class=
"btn btn-default"
data-dismiss=
"modal"
>
{% trans "Cancel" %}
</button>
<button
type=
"button"
class=
"btn btn-default"
data-dismiss=
"modal"
>
{% trans "Cancel" %}
</button>
<input
type=
"hidden"
name=
"flush"
value=
""
/>
<input
type=
"hidden"
name=
"flush"
value=
""
/>
...
...
circle/dashboard/templates/dashboard/node-detail.html
View file @
c086ab65
...
@@ -29,15 +29,10 @@
...
@@ -29,15 +29,10 @@
<button
type=
"button"
class=
"btn {{ btn_size }} btn-warning nojs-dropdown-toogle dropdown-toggle"
data-toggle=
"dropdown"
>
Action
<i
class=
"icon-caret-down"
></i></button>
<button
type=
"button"
class=
"btn {{ btn_size }} btn-warning nojs-dropdown-toogle dropdown-toggle"
data-toggle=
"dropdown"
>
Action
<i
class=
"icon-caret-down"
></i></button>
<ul
class=
"dropdown-menu nojs-dropdown-toogle"
role=
"menu"
>
<ul
class=
"dropdown-menu nojs-dropdown-toogle"
role=
"menu"
>
<li><a
href=
"#"
class=
"node-details-rename-button"
><i
class=
"icon-pencil"
></i>
{% trans "Rename" %}
</a></li>
<li><a
href=
"#"
class=
"node-details-rename-button"
><i
class=
"icon-pencil"
></i>
{% trans "Rename" %}
</a></li>
<li><a
data-node-pk=
"{{ node.pk }}"
class=
"real-link node-flush"
href=
"{% url "
dashboard
.
views
.
flush-node
"
pk=
node.pk
%}?
next=
{{
request
.
path
}}"
><i
class=
"icon-cloud-upload"
></i>
Flush
</a>
<li><a
data-node-pk=
"{{ node.pk }}"
class=
"real-link node-flush"
href=
"{% url "
dashboard
.
views
.
flush-node
"
pk=
node.pk
%}"
><i
class=
"icon-cloud-upload"
></i>
{% trans "Flush" %}
</a>
{% if node.enabled %}
<li>
<li><a
style=
"display:none"
data-node-pk=
"{{ node.pk }}"
class=
"real-link node-enable"
href=
"{% url "
dashboard
.
views
.
status-node
"
pk=
node.pk
%}?
next=
{{
request
.
path
}}"
><i
class=
"icon-check"
></i>
Enable
</a>
<a
style=
"display:{% if node.enabled %}none{% else %}block{% endif %}"
data-node-pk=
"{{ node.pk }}"
class=
"real-link node-enable"
href=
"{% url "
dashboard
.
views
.
status-node
"
pk=
node.pk
%}?
next=
{{
request
.
path
}}"
><i
class=
"icon-check"
></i>
{% trans "Enable" %}
</a>
<a
style=
"display:block"
data-node-pk=
"{{ node.pk }}"
class=
"real-link node-enable"
href=
"{% url "
dashboard
.
views
.
status-node
"
pk=
node.pk
%}?
next=
{{
request
.
path
}}"
><i
class=
"icon-remove"
></i>
Disable
</a></li>
<a
style=
"display:{% if not node.enabled %}none{% else %}block{% endif %}"
data-node-pk=
"{{ node.pk }}"
class=
"real-link node-enable"
href=
"{% url "
dashboard
.
views
.
status-node
"
pk=
node.pk
%}?
next=
{{
request
.
path
}}"
><i
class=
"icon-remove"
></i>
{% trans "Disable" %}
</a></li>
{% else %}
<li><a
style=
"display:block"
data-node-pk=
"{{ node.pk }}"
class=
"real-link node-enable"
href=
"{% url "
dashboard
.
views
.
status-node
"
pk=
node.pk
%}?
next=
{{
request
.
path
}}"
>
<i
class=
"icon-check"
></i>
Enable
</a>
<a
style=
"display:none"
data-node-pk=
"{{ node.pk }}"
class=
"real-link node-enable"
href=
"{% url "
dashboard
.
views
.
status-node
"
pk=
node.pk
%}?
next=
{{
request
.
path
}}"
><i
class=
"icon-remove"
></i>
Disable
</a></li>
{% endif %}
<li><a
data-node-pk=
"{{ node.pk }}"
class=
"real-link node-delete"
href=
"{% url "
dashboard
.
views
.
delete-node
"
pk=
node.pk
%}?
next=
{{
request
.
path
}}"
><i
class=
"icon-trash"
></i>
Delete
</a></li>
<li><a
data-node-pk=
"{{ node.pk }}"
class=
"real-link node-delete"
href=
"{% url "
dashboard
.
views
.
delete-node
"
pk=
node.pk
%}?
next=
{{
request
.
path
}}"
><i
class=
"icon-trash"
></i>
Delete
</a></li>
</ul>
</ul>
</div>
</div>
...
...
circle/dashboard/templates/dashboard/node-list/column-actions.html
View file @
c086ab65
...
@@ -3,15 +3,9 @@
...
@@ -3,15 +3,9 @@
<button
type=
"button"
class=
"btn {{ btn_size }} btn-warning nojs-dropdown-toogle dropdown-toggle"
data-toggle=
"dropdown"
>
Action
<i
class=
"icon-caret-down"
></i></button>
<button
type=
"button"
class=
"btn {{ btn_size }} btn-warning nojs-dropdown-toogle dropdown-toggle"
data-toggle=
"dropdown"
>
Action
<i
class=
"icon-caret-down"
></i></button>
<ul
class=
"dropdown-menu nojs-dropdown-toogle"
role=
"menu"
>
<ul
class=
"dropdown-menu nojs-dropdown-toogle"
role=
"menu"
>
<li><a
href=
"#"
class=
"node-details-rename-button"
><i
class=
"icon-pencil"
></i>
{% trans "Rename" %}
</a></li>
<li><a
href=
"#"
class=
"node-details-rename-button"
><i
class=
"icon-pencil"
></i>
{% trans "Rename" %}
</a></li>
<li><a
data-node-pk=
"{{ record.pk }}"
class=
"real-link node-flush"
href=
"{% url "
dashboard
.
views
.
flush-node
"
pk=
record.pk
%}?
next=
{{
request
.
path
}}"
><i
class=
"icon-cloud-upload"
></i>
Flush
</a>
<li><a
data-node-pk=
"{{ record.pk }}"
class=
"real-link node-flush"
href=
"{% url "
dashboard
.
views
.
flush-node
"
pk=
record.pk
%}"
><i
class=
"icon-cloud-upload"
></i>
{% trans "Flush" %}
</a>
{% if record.enabled %}
<li><a
style=
{%
if
record
.
enabled
%}"
display:none
"{%
else
%}"
display:block
"{%
endif
%}
data-status=
"enable"
data-node-pk=
"{{ record.pk }}"
class=
"real-link node-enable"
href=
"{% url "
dashboard
.
views
.
status-node
"
pk=
record.pk
%}?
next=
{{
request
.
path
}}&
status=
enable"
><i
class=
"icon-check"
></i>
{% trans "Enable" %}
</a>
<li><a
style=
"display:none"
data-status=
"enable"
data-node-pk=
"{{ record.pk }}"
class=
"real-link node-enable"
href=
"{% url "
dashboard
.
views
.
status-node
"
pk=
record.pk
%}?
next=
{{
request
.
path
}}&
status=
enable"
><i
class=
"icon-check"
></i>
Enable
</a>
<a
style=
{%
if
record
.
enabled
%}"
display:block
"{%
else
%}"
display:none
"{%
endif
%}
data-status=
"disable"
data-node-pk=
"{{ record.pk }}"
class=
"real-link node-enable"
href=
"{% url "
dashboard
.
views
.
status-node
"
pk=
record.pk
%}?
next=
{{
request
.
path
}}&
status=
disable"
><i
class=
"icon-remove"
></i>
{% trans "Disable" %}
</a></li>
<a
style=
"display:block"
data-status=
"disable"
data-node-pk=
"{{ record.pk }}"
class=
"real-link node-enable"
href=
"{% url "
dashboard
.
views
.
status-node
"
pk=
record.pk
%}?
next=
{{
request
.
path
}}&
status=
disable"
><i
class=
"icon-remove"
></i>
Disable
</a></li>
<li><a
data-node-pk=
"{{ record.pk }}"
class=
"real-link node-delete"
href=
"{% url "
dashboard
.
views
.
delete-node
"
pk=
record.pk
%}?
next=
{{
request
.
path
}}"
><i
class=
"icon-trash"
></i>
{% trans "Delete" %}
</a></li>
{% else %}
<li><a
style=
"display:block"
data-status=
"enable"
data-node-pk=
"{{ record.pk }}"
class=
"real-link node-enable"
href=
"{% url "
dashboard
.
views
.
status-node
"
pk=
record.pk
%}?
next=
{{
request
.
path
}}&
status=
enable"
>
<i
class=
"icon-check"
></i>
Enable
</a>
<a
style=
"display:none"
data-status=
"disable"
data-node-pk=
"{{ record.pk }}"
class=
"real-link node-enable"
href=
"{% url "
dashboard
.
views
.
status-node
"
pk=
record.pk
%}?
next=
{{
request
.
path
}}&
status=
disable"
><i
class=
"icon-remove"
></i>
Disable
</a></li>
{% endif %}
<li><a
data-node-pk=
"{{ record.pk }}"
class=
"real-link node-delete"
href=
"{% url "
dashboard
.
views
.
delete-node
"
pk=
record.pk
%}?
next=
{{
request
.
path
}}"
><i
class=
"icon-trash"
></i>
Delete
</a></li>
</ul>
</ul>
</div>
</div>
circle/dashboard/views.py
View file @
c086ab65
...
@@ -503,8 +503,6 @@ class NodeDetailView(LoginRequiredMixin, SuperuserRequiredMixin, DetailView):
...
@@ -503,8 +503,6 @@ class NodeDetailView(LoginRequiredMixin, SuperuserRequiredMixin, DetailView):
return
self
.
__set_status
(
request
)
return
self
.
__set_status
(
request
)
if
request
.
POST
.
get
(
'to_remove'
):
if
request
.
POST
.
get
(
'to_remove'
):
return
self
.
__remove_trait
(
request
)
return
self
.
__remove_trait
(
request
)
if
request
.
POST
.
get
(
'flush'
)
is
not
None
:
return
self
.
__flush
(
request
)
return
redirect
(
reverse_lazy
(
"dashboard.views.node-detail"
,
return
redirect
(
reverse_lazy
(
"dashboard.views.node-detail"
,
kwargs
=
{
'pk'
:
self
.
get_object
()
.
pk
}))
kwargs
=
{
'pk'
:
self
.
get_object
()
.
pk
}))
...
@@ -530,24 +528,6 @@ class NodeDetailView(LoginRequiredMixin, SuperuserRequiredMixin, DetailView):
...
@@ -530,24 +528,6 @@ class NodeDetailView(LoginRequiredMixin, SuperuserRequiredMixin, DetailView):
return
redirect
(
reverse_lazy
(
"dashboard.views.node-detail"
,
return
redirect
(
reverse_lazy
(
"dashboard.views.node-detail"
,
kwargs
=
{
'pk'
:
self
.
object
.
pk
}))
kwargs
=
{
'pk'
:
self
.
object
.
pk
}))
def
__flush
(
self
,
request
):
self
.
object
=
self
.
get_object
()
self
.
object
.
flush_async
(
user
=
request
.
user
)
success_message
=
_
(
"Node successfully flushed!"
)
if
request
.
is_ajax
():
response
=
{
'message'
:
success_message
,
'node_pk'
:
self
.
object
.
pk
}
return
HttpResponse
(
json
.
dumps
(
response
),
content_type
=
"application/json"
)
else
:
messages
.
success
(
request
,
success_message
)
return
redirect
(
reverse_lazy
(
"dashboard.views.node-detail"
,
kwargs
=
{
'pk'
:
self
.
object
.
pk
}))
def
__set_status
(
self
,
request
):
def
__set_status
(
self
,
request
):
self
.
object
=
self
.
get_object
()
self
.
object
=
self
.
get_object
()
if
not
self
.
object
.
enabled
:
if
not
self
.
object
.
enabled
:
...
@@ -1444,19 +1424,8 @@ class NodeFlushView(LoginRequiredMixin, SuperuserRequiredMixin, DetailView):
...
@@ -1444,19 +1424,8 @@ class NodeFlushView(LoginRequiredMixin, SuperuserRequiredMixin, DetailView):
self
.
object
=
self
.
get_object
()
self
.
object
=
self
.
get_object
()
self
.
object
.
flush_async
(
user
=
request
.
user
)
self
.
object
.
flush_async
(
user
=
request
.
user
)
success_message
=
_
(
"Node successfully flushed!"
)
success_message
=
_
(
"Node successfully flushed!"
)
messages
.
success
(
request
,
success_message
)
if
request
.
is_ajax
():
return
redirect
(
self
.
get_success_url
())
response
=
{
'message'
:
success_message
,
'node_pk'
:
self
.
object
.
pk
}
return
HttpResponse
(
json
.
dumps
(
response
),
content_type
=
"application/json"
)
else
:
messages
.
success
(
request
,
success_message
)
return
redirect
(
self
.
get_success_url
())
class
PortDelete
(
LoginRequiredMixin
,
DeleteView
):
class
PortDelete
(
LoginRequiredMixin
,
DeleteView
):
...
...
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