Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
b77be59b
authored
Jul 04, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: disable unavailable operation buttons
instead hiding them
parent
251e4039
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
circle/dashboard/views.py
+6
-2
No files found.
circle/dashboard/views.py
View file @
b77be59b
...
@@ -593,9 +593,11 @@ class OperationView(DetailView):
...
@@ -593,9 +593,11 @@ class OperationView(DetailView):
(
cls
,
),
{
'op'
:
op
,
'icon'
:
icon
,
'effect'
:
effect
})
(
cls
,
),
{
'op'
:
op
,
'icon'
:
icon
,
'effect'
:
effect
})
@classmethod
@classmethod
def
bind_to_object
(
cls
,
instance
):
def
bind_to_object
(
cls
,
instance
,
**
kwargs
):
v
=
cls
()
v
=
cls
()
v
.
get_object
=
lambda
:
instance
v
.
get_object
=
lambda
:
instance
for
key
,
value
in
kwargs
.
iteritems
():
setattr
(
v
,
key
,
value
)
return
v
return
v
...
@@ -728,9 +730,11 @@ def get_operations(instance, user):
...
@@ -728,9 +730,11 @@ def get_operations(instance, user):
op
=
v
.
get_op_by_object
(
instance
)
op
=
v
.
get_op_by_object
(
instance
)
op
.
check_auth
(
user
)
op
.
check_auth
(
user
)
op
.
check_precond
()
op
.
check_precond
()
except
Exception
as
e
:
except
PermissionDenied
as
e
:
logger
.
debug
(
'Not showing operation
%
s for
%
s:
%
s'
,
logger
.
debug
(
'Not showing operation
%
s for
%
s:
%
s'
,
k
,
instance
,
unicode
(
e
))
k
,
instance
,
unicode
(
e
))
except
Exception
:
ops
.
append
(
v
.
bind_to_object
(
instance
,
disabled
=
True
))
else
:
else
:
ops
.
append
(
v
.
bind_to_object
(
instance
))
ops
.
append
(
v
.
bind_to_object
(
instance
))
return
ops
return
ops
...
...
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