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
93218515
authored
Jul 08, 2014
by
Dudás Ádám
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
common: add (human-)readable name field and property to activites
parent
08ed0023
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
17 additions
and
12 deletions
+17
-12
circle/common/models.py
+12
-0
circle/dashboard/templates/dashboard/instanceactivity_detail.html
+1
-1
circle/dashboard/templates/dashboard/node-detail/_activity-timeline.html
+2
-2
circle/dashboard/templates/dashboard/vm-detail/_activity-timeline.html
+2
-2
circle/vm/migrations/0025_auto__add_field_instanceactivity_readable_name_data__add_field_nodeact.py
+0
-0
circle/vm/models/activity.py
+0
-7
No files found.
circle/common/models.py
View file @
93218515
...
...
@@ -110,6 +110,10 @@ def split_activity_code(activity_code):
class
ActivityModel
(
TimeStampedModel
):
activity_code
=
CharField
(
max_length
=
100
,
verbose_name
=
_
(
'activity code'
))
readable_name_data
=
JSONField
(
blank
=
True
,
null
=
True
,
verbose_name
=
_
(
'human readable name'
),
help_text
=
_
(
'Human readable name of '
'activity.'
))
parent
=
ForeignKey
(
'self'
,
blank
=
True
,
null
=
True
,
related_name
=
'children'
)
task_uuid
=
CharField
(
blank
=
True
,
max_length
=
50
,
null
=
True
,
unique
=
True
,
help_text
=
_
(
'Celery task unique identifier.'
),
...
...
@@ -156,6 +160,14 @@ class ActivityModel(TimeStampedModel):
return
self
.
finished
and
not
self
.
succeeded
@property
def
readable_name
(
self
):
return
HumanReadableObject
.
from_dict
(
self
.
readable_name_data
)
@readable_name.setter
def
set_readable_name
(
self
,
value
):
self
.
readable_name_data
=
None
if
value
is
None
else
value
.
to_dict
()
@property
def
result
(
self
):
return
HumanReadableObject
.
from_dict
(
self
.
result_data
)
...
...
circle/dashboard/templates/dashboard/instanceactivity_detail.html
View file @
93218515
...
...
@@ -5,7 +5,7 @@
<div
class=
"body-content"
>
<div
class=
"page-header"
>
<h1>
{{ object.instance.name }}: {{ object.
get_readable_name
}}
{{ object.instance.name }}: {{ object.
readable_name.get_user_text
}}
</h1>
</div>
<div
class=
"row"
>
...
...
circle/dashboard/templates/dashboard/node-detail/_activity-timeline.html
View file @
93218515
...
...
@@ -5,13 +5,13 @@
<span
class=
"timeline-icon{% if a.has_failed %} timeline-icon-failed{% endif %}"
>
<i
class=
"{% if not a.finished %} icon-refresh icon-spin {% else %}icon-plus{% endif %}"
></i>
</span>
<strong>
{{ a.
get_readable_name
}}
</strong>
<strong>
{{ a.
readable_name.get_user_text
}}
</strong>
{{ a.started|date:"Y-m-d H:i" }}, {{ a.user }}
{% if a.children.count > 0 %}
<div
class=
"sub-timeline"
>
{% for s in a.children.all %}
<div
data-activity-id=
"{{ s.pk }}"
class=
"sub-activity{% if s.has_failed %} sub-activity-failed{% endif %}"
>
{{ s.
get_readable_name
}} -
{{ s.
readable_name.get_user_text
}} -
{% if s.finished %}
{{ s.finished|time:"H:i:s" }}
{% else %}
...
...
circle/dashboard/templates/dashboard/vm-detail/_activity-timeline.html
View file @
93218515
...
...
@@ -7,7 +7,7 @@
<strong
{%
if
user
.
is_superuser
and
a
.
result
%}
title=
"{{ a.result.get_admin_text }}"
{%
endif
%}
>
{% if user.is_superuser %}
<a
href=
"{{ a.get_absolute_url }}"
>
{% endif %}
{% if a.times > 1 %}({{ a.times }}x){% endif %}
{{ a.
get_readable_name
}}{% if user.is_superuser %}
</a>
{% endif %}
{{ a.
readable_name.get_user_text
}}{% if user.is_superuser %}
</a>
{% endif %}
{% if a.has_percent %}
- {{ a.percentage }}%
...
...
@@ -32,7 +32,7 @@
<div
data-activity-id=
"{{ s.pk }}"
class=
"sub-activity{% if s.has_failed %} sub-activity-failed{% endif %}{% if s.pk == active.pk %} sub-activity-active{% endif %}"
>
<span
{%
if
user
.
is_superuser
and
s
.
result
%}
title=
"{{ s.result.get_admin_text }}"
{%
endif
%}
>
{% if user.is_superuser %}
<a
href=
"{{ s.get_absolute_url }}"
>
{% endif %}
{{ s.
get_readable_name
}}{% if user.is_superuser %}
</a>
{% endif %}
</span>
–
{{ s.
readable_name.get_user_text
}}{% if user.is_superuser %}
</a>
{% endif %}
</span>
–
{% if s.finished %}
{{ s.finished|time:"H:i:s" }}
{% else %}
...
...
circle/vm/migrations/0025_auto__add_field_instanceactivity_readable_name_data__add_field_nodeact.py
0 → 100644
View file @
93218515
This diff is collapsed.
Click to expand it.
circle/vm/models/activity.py
View file @
93218515
...
...
@@ -105,10 +105,6 @@ class InstanceActivity(ActivityModel):
def
get_absolute_url
(
self
):
return
reverse
(
'dashboard.views.vm-activity'
,
args
=
[
self
.
pk
])
def
get_readable_name
(
self
):
activity_code_last_suffix
=
split_activity_code
(
self
.
activity_code
)[
-
1
]
return
activity_code_last_suffix
.
replace
(
'_'
,
' '
)
.
capitalize
()
def
get_status_id
(
self
):
if
self
.
succeeded
is
None
:
return
'wait'
...
...
@@ -199,9 +195,6 @@ class NodeActivity(ActivityModel):
return
'{}({})'
.
format
(
self
.
activity_code
,
self
.
node
)
def
get_readable_name
(
self
):
return
self
.
activity_code
.
split
(
'.'
)[
-
1
]
.
replace
(
'_'
,
' '
)
.
capitalize
()
@classmethod
def
create
(
cls
,
code_suffix
,
node
,
task_uuid
=
None
,
user
=
None
):
activity_code
=
join_activity_code
(
cls
.
ACTIVITY_CODE_BASE
,
code_suffix
)
...
...
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