Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
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
ebb4929a
authored
Apr 20, 2018
by
Szabolcs Gelencser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add favorite mark, display on detail page
parent
583f2684
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
101 additions
and
10 deletions
+101
-10
.idea/workspace.xml
+0
-0
circle/circle/db.sqlite3
+0
-0
circle/dashboard/migrations/0008_auto_20180420_1054.py
+25
-0
circle/dashboard/models.py
+2
-2
circle/dashboard/templates/dashboard/vm-detail.html
+1
-1
circle/dashboard/views/vm.py
+5
-7
circle/request/migrations/0006_auto_20180420_1054.py
+19
-0
circle/vm/migrations/0011_auto_20180420_1054.py
+49
-0
No files found.
.idea/workspace.xml
View file @
ebb4929a
This diff is collapsed.
Click to expand it.
circle/circle/db.sqlite3
View file @
ebb4929a
No preview for this file type
circle/dashboard/migrations/0008_auto_20180420_1054.py
0 → 100644
View file @
ebb4929a
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2018-04-20 08:54
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'dashboard'
,
'0007_profile_network_limit'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'favourite'
,
name
=
'instance'
,
field
=
models
.
CharField
(
max_length
=
50
),
),
migrations
.
AlterField
(
model_name
=
'favourite'
,
name
=
'user'
,
field
=
models
.
CharField
(
max_length
=
50
),
),
]
circle/dashboard/models.py
View file @
ebb4929a
...
@@ -82,8 +82,8 @@ class Message(TimeStampedModel, TimeFramedModel):
...
@@ -82,8 +82,8 @@ class Message(TimeStampedModel, TimeFramedModel):
class
Favourite
(
Model
):
class
Favourite
(
Model
):
instance
=
ForeignKey
(
"vm.Instance"
)
instance
=
CharField
(
max_length
=
50
,
blank
=
False
)
user
=
ForeignKey
(
User
)
user
=
CharField
(
max_length
=
50
,
blank
=
False
)
class
Notification
(
TimeStampedModel
):
class
Notification
(
TimeStampedModel
):
...
...
circle/dashboard/templates/dashboard/vm-detail.html
View file @
ebb4929a
...
@@ -73,7 +73,7 @@
...
@@ -73,7 +73,7 @@
{{ instance.name }}
{{ instance.name }}
</div>
</div>
<small>
{{ instance.primary_host.get_fqdn }}
</small>
<small>
{{ instance.primary_host.get_fqdn }}
</small>
<small
class=
"dashboard-vm-favourite"
style=
"line-height: 39.6px;"
data-vm=
"{{ instance.
pk
}}"
>
<small
class=
"dashboard-vm-favourite"
style=
"line-height: 39.6px;"
data-vm=
"{{ instance.
id
}}"
>
{% if fav %}
{% if fav %}
<i
class=
"fa fa-star text-primary title-favourite"
title=
"{% trans "
Unfavourite
"
%}"
></i>
<i
class=
"fa fa-star text-primary title-favourite"
title=
"{% trans "
Unfavourite
"
%}"
></i>
{% else %}
{% else %}
...
...
circle/dashboard/views/vm.py
View file @
ebb4929a
...
@@ -137,7 +137,7 @@ class VmDetailView(LoginRequiredMixin, GraphMixin, DetailView):
...
@@ -137,7 +137,7 @@ class VmDetailView(LoginRequiredMixin, GraphMixin, DetailView):
'op'
:
{
i
.
op
:
i
for
i
in
ops
},
'op'
:
{
i
.
op
:
i
for
i
in
ops
},
# 'connect_commands': user.profile.get_connect_commands(instance),
# 'connect_commands': user.profile.get_connect_commands(instance),
'hide_tutorial'
:
hide_tutorial
,
'hide_tutorial'
:
hide_tutorial
,
'fav'
:
[],
#instance.favourite_set.filter(user=user
).exists(),
'fav'
:
Favourite
.
objects
.
filter
(
user
=
user
.
id
,
instance
=
instance
.
id
)
.
exists
(),
'instance'
:
self
.
object
'instance'
:
self
.
object
})
})
...
@@ -1392,15 +1392,13 @@ def vm_activity(request, pk):
...
@@ -1392,15 +1392,13 @@ def vm_activity(request, pk):
class
FavouriteView
(
TemplateView
):
class
FavouriteView
(
TemplateView
):
def
post
(
self
,
*
args
,
**
kwargs
):
def
post
(
self
,
*
args
,
**
kwargs
):
user
=
self
.
request
.
user
user_id
=
self
.
request
.
user
.
id
vm
=
Instance
.
objects
.
get
(
pk
=
self
.
request
.
POST
.
get
(
"vm"
))
vm_id
=
self
.
request
.
POST
.
get
(
"vm"
)
if
not
vm
.
has_level
(
user
,
'user'
):
raise
PermissionDenied
()
try
:
try
:
Favourite
.
objects
.
get
(
instance
=
vm
,
user
=
user
)
.
delete
()
Favourite
.
objects
.
get
(
instance
=
vm
_id
,
user
=
user_id
)
.
delete
()
return
HttpResponse
(
"Deleted."
)
return
HttpResponse
(
"Deleted."
)
except
Favourite
.
DoesNotExist
:
except
Favourite
.
DoesNotExist
:
Favourite
(
instance
=
vm
,
user
=
user
)
.
save
()
Favourite
(
instance
=
vm
_id
,
user
=
user_id
)
.
save
()
return
HttpResponse
(
"Added."
)
return
HttpResponse
(
"Added."
)
#
#
#
#
...
...
circle/request/migrations/0006_auto_20180420_1054.py
0 → 100644
View file @
ebb4929a
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2018-04-20 08:54
from
__future__
import
unicode_literals
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'request'
,
'0005_auto_20180403_1342'
),
]
operations
=
[
migrations
.
AlterModelOptions
(
name
=
'request'
,
options
=
{},
),
]
circle/vm/migrations/0011_auto_20180420_1054.py
0 → 100644
View file @
ebb4929a
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2018-04-20 08:54
from
__future__
import
unicode_literals
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'vm'
,
'0010_auto_20180313_1628'
),
]
operations
=
[
migrations
.
RemoveField
(
model_name
=
'node'
,
name
=
'host'
,
),
migrations
.
RemoveField
(
model_name
=
'node'
,
name
=
'tags'
,
),
migrations
.
RemoveField
(
model_name
=
'node'
,
name
=
'traits'
,
),
migrations
.
RemoveField
(
model_name
=
'nodeactivity'
,
name
=
'node'
,
),
migrations
.
RemoveField
(
model_name
=
'nodeactivity'
,
name
=
'parent'
,
),
migrations
.
RemoveField
(
model_name
=
'nodeactivity'
,
name
=
'user'
,
),
migrations
.
RemoveField
(
model_name
=
'instance'
,
name
=
'node'
,
),
migrations
.
DeleteModel
(
name
=
'Node'
,
),
migrations
.
DeleteModel
(
name
=
'NodeActivity'
,
),
]
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