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
4444e2b1
authored
Apr 20, 2018
by
Szabolcs Gelencser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement favorite vms on index page
parent
ebb4929a
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
59 deletions
+43
-59
.idea/workspace.xml
+31
-44
circle/circle/db.sqlite3
+0
-0
circle/dashboard/templates/dashboard/index-vm.html
+1
-1
circle/dashboard/views/index.py
+11
-14
No files found.
.idea/workspace.xml
View file @
4444e2b1
...
...
@@ -3,10 +3,8 @@
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"1fbec8af-5a7c-40f9-b994-83ac07d1ae1d"
name=
"Default"
comment=
""
>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
/>
<change
beforePath=
"$PROJECT_DIR$/circle/circle/db.sqlite3"
afterPath=
"$PROJECT_DIR$/circle/circle/db.sqlite3"
/>
<change
beforePath=
"$PROJECT_DIR$/circle/dashboard/models.py"
afterPath=
"$PROJECT_DIR$/circle/dashboard/models.py"
/>
<change
beforePath=
"$PROJECT_DIR$/circle/dashboard/templates/dashboard/vm-detail.html"
afterPath=
"$PROJECT_DIR$/circle/dashboard/templates/dashboard/vm-detail.html"
/>
<change
beforePath=
"$PROJECT_DIR$/circle/dashboard/views/vm.py"
afterPath=
"$PROJECT_DIR$/circle/dashboard/views/vm.py"
/>
<change
beforePath=
"$PROJECT_DIR$/circle/dashboard/templates/dashboard/index-vm.html"
afterPath=
"$PROJECT_DIR$/circle/dashboard/templates/dashboard/index-vm.html"
/>
<change
beforePath=
"$PROJECT_DIR$/circle/dashboard/views/index.py"
afterPath=
"$PROJECT_DIR$/circle/dashboard/views/index.py"
/>
</list>
<option
name=
"EXCLUDED_CONVERTED_TO_IGNORED"
value=
"true"
/>
<option
name=
"TRACKING_ENABLED"
value=
"true"
/>
...
...
@@ -36,31 +34,21 @@
</component>
<component
name=
"FileEditorManager"
>
<leaf
SIDE_TABS_SIZE_LIMIT_KEY=
"300"
>
<file
leaf-file-name=
"vm.py"
pinned=
"false"
current-in-tab=
"true"
>
<entry
file=
"file://$PROJECT_DIR$/circle/dashboard/views/vm.py"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"54"
>
<caret
line=
"1396"
column=
"0"
lean-forward=
"false"
selection-start-line=
"1396"
selection-start-column=
"0"
selection-end-line=
"1396"
selection-end-column=
"0"
/>
<folding
/>
</state>
</provider>
</entry>
</file>
<file
leaf-file-name=
"index-vm.html"
pinned=
"false"
current-in-tab=
"false"
>
<entry
file=
"file://$PROJECT_DIR$/circle/dashboard/templates/dashboard/index-vm.html"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"18
5
"
>
<caret
line=
"
41"
column=
"55"
lean-forward=
"false"
selection-start-line=
"41"
selection-start-column=
"54"
selection-end-line=
"41"
selection-end-column=
"55
"
/>
<state
relative-caret-position=
"18
0
"
>
<caret
line=
"
39"
column=
"28"
lean-forward=
"false"
selection-start-line=
"39"
selection-start-column=
"28"
selection-end-line=
"39"
selection-end-column=
"28
"
/>
<folding
/>
</state>
</provider>
</entry>
</file>
<file
leaf-file-name=
"
vm-detail.html"
pinned=
"false"
current-in-tab=
"fals
e"
>
<entry
file=
"file://$PROJECT_DIR$/circle/dashboard/
templates/dashboard/vm-detail.html
"
>
<file
leaf-file-name=
"
index.py"
pinned=
"false"
current-in-tab=
"tru
e"
>
<entry
file=
"file://$PROJECT_DIR$/circle/dashboard/
views/index.py
"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
214
"
>
<caret
line=
"
75"
column=
"96"
lean-forward=
"false"
selection-start-line=
"75"
selection-start-column=
"96"
selection-end-line=
"75"
selection-end-column=
"9
6"
/>
<state
relative-caret-position=
"
129
"
>
<caret
line=
"
53"
column=
"46"
lean-forward=
"false"
selection-start-line=
"53"
selection-start-column=
"46"
selection-end-line=
"53"
selection-end-column=
"4
6"
/>
<folding
/>
</state>
</provider>
...
...
@@ -105,9 +93,9 @@
<find>
instance_id
</find>
<find>
favor
</find>
<find>
interface
</find>
<find>
favourite
</find>
<find>
favouritev
</find>
<find>
v
</find>
<find>
favourite
</find>
</findStrings>
<replaceStrings>
<replace>
'ACTIVE'
</replace>
...
...
@@ -155,7 +143,6 @@
<option
value=
"$PROJECT_DIR$/circle/request/models.py"
/>
<option
value=
"$PROJECT_DIR$/circle/request/views.py"
/>
<option
value=
"$PROJECT_DIR$/circle/circle/middleware.py"
/>
<option
value=
"$PROJECT_DIR$/circle/dashboard/templates/dashboard/index-vm.html"
/>
<option
value=
"$PROJECT_DIR$/circle/manage.py"
/>
<option
value=
"$PROJECT_DIR$/circle/openstack_auth/urls.py"
/>
<option
value=
"$PROJECT_DIR$/circle/dashboard/templates/auth/login.html"
/>
...
...
@@ -165,7 +152,6 @@
<option
value=
"$PROJECT_DIR$/circle/dashboard/validators.py"
/>
<option
value=
"$PROJECT_DIR$/requirements/circlestack.txt"
/>
<option
value=
"$PROJECT_DIR$/circle/vm/models/instance.py"
/>
<option
value=
"$PROJECT_DIR$/circle/dashboard/views/index.py"
/>
<option
value=
"$PROJECT_DIR$/circle/dashboard/tables.py"
/>
<option
value=
"$PROJECT_DIR$/circle/vm/models/activity.py"
/>
<option
value=
"$PROJECT_DIR$/circle/vm/models/__init__.py"
/>
...
...
@@ -180,6 +166,8 @@
<option
value=
"$PROJECT_DIR$/circle/dashboard/models.py"
/>
<option
value=
"$PROJECT_DIR$/circle/dashboard/views/vm.py"
/>
<option
value=
"$PROJECT_DIR$/circle/dashboard/templates/dashboard/vm-detail.html"
/>
<option
value=
"$PROJECT_DIR$/circle/dashboard/templates/dashboard/index-vm.html"
/>
<option
value=
"$PROJECT_DIR$/circle/dashboard/views/index.py"
/>
</list>
</option>
</component>
...
...
@@ -269,7 +257,7 @@
<property
name=
"settings.editor.selected.configurable"
value=
"watcher.settings"
/>
<property
name=
"NewWatcherDialog.advanced.open"
value=
"true"
/>
<property
name=
"DefaultHtmlFileTemplate"
value=
"HTML File"
/>
<property
name=
"SearchEverywhereHistoryKey"
value=
"
vm-de	FILE	file:///home/h3yduck/cloud/circle/dashboard/templates/dashboard/vm-detail.html index-v	FILE	file:///home/h3yduck/cloud/circle/dashboard/templates/dashboard/index-vm.html detailvi	null	null network	FILE	file:///home/h3yduck/cloud/circle/dashboard/templates/dashboard/vm-detail/network.html nova.	FILE	file:///home/h3yduck/cloud/circle/circle/os_policies/nova_policy.json operation	FILE	file:///home/h3yduck/cloud/circle/vm/operations.py base	FILE	file:///home/h3yduck/cloud/circle/circle/settings/base.py indev	null	null vmdeta	null	null indexview	null	null operatio	FILE	file:///home/h3yduck/cloud/circle/vm/operations.py vxlanc	null	null plain	null	null base.	FILE	file:///home/h3yduck/cloud/circle/circle/settings/base.py local	FILE	file:///home/h3yduck/cloud/circle/circle/settings/local.py views.	FILE	file:///home/h3yduck/cloud/circle/openstack_auth/views.py login.html	FILE	file:///home/h3yduck/cloud/circle/dashboard/templates/auth/login.html LoginVi	null	null indexv	null	null index-vm	FILE	file:///home/h3yduck/cloud/circle/dashboard/templates/dashboard/index-vm.html index.	FILE	file:///home/h3yduck/cloud/circle/dashboard/views/index.py index	FILE	file:///home/h3yduck/cloud/circle/dashboard/templates/dashboard/index.html bas	FILE	file:///home/h3yduck/cloud/circle/openstack_api/base.py save	null	null plainc	null	null templatedet	null	null instancetemp	null	null instancetem	null	null url	FILE	file:///home/h3yduck/cloud/circle/dashboard/urls.py vmcreate	null	null opera	FILE	file:///home/h3yduck/cloud/circle/vm/operations.py operations	FILE	file:///home/h3yduck/cloud/circle/common/operations.py templat	null	null vmadd	null	null vmdetail	null	null addinterfa	null	null addin	null	null server	null	null Instance	null	null instance	FILE	file:///home/h3yduck/cloud/circle/vm/models/instance.py operat	null	null ins	FILE	file:///home/h3yduck/cloud/circle/vm/models/instance.py vmdetai	null	null operationvi	null	null ser	null	null server.	FILE	file:///home/h3yduck/.virtualenvs/cloud/local/lib/python2.7/site-packages/novaclient/v2/servers.py resources.	FILE	file:///home/h3yduck/cloud/circle/request/templates/request/initials/resources.html vxla	null	null urls	FILE	file:///home/h3yduck/cloud/circle/dashboard/urls.py create	FILE	file:///home/h3yduck/cloud/circle/network/templates/network/vxlan-create.html
"
/>
<property
name=
"SearchEverywhereHistoryKey"
value=
"
indexvi	null	null vmdeta	null	null vm-de	FILE	file:///home/h3yduck/cloud/circle/dashboard/templates/dashboard/vm-detail.html index-v	FILE	file:///home/h3yduck/cloud/circle/dashboard/templates/dashboard/index-vm.html detailvi	null	null network	FILE	file:///home/h3yduck/cloud/circle/dashboard/templates/dashboard/vm-detail/network.html nova.	FILE	file:///home/h3yduck/cloud/circle/circle/os_policies/nova_policy.json operation	FILE	file:///home/h3yduck/cloud/circle/vm/operations.py base	FILE	file:///home/h3yduck/cloud/circle/circle/settings/base.py indev	null	null indexview	null	null operatio	FILE	file:///home/h3yduck/cloud/circle/vm/operations.py vxlanc	null	null plain	null	null base.	FILE	file:///home/h3yduck/cloud/circle/circle/settings/base.py local	FILE	file:///home/h3yduck/cloud/circle/circle/settings/local.py views.	FILE	file:///home/h3yduck/cloud/circle/openstack_auth/views.py login.html	FILE	file:///home/h3yduck/cloud/circle/dashboard/templates/auth/login.html LoginVi	null	null indexv	null	null index-vm	FILE	file:///home/h3yduck/cloud/circle/dashboard/templates/dashboard/index-vm.html index.	FILE	file:///home/h3yduck/cloud/circle/dashboard/views/index.py index	FILE	file:///home/h3yduck/cloud/circle/dashboard/templates/dashboard/index.html bas	FILE	file:///home/h3yduck/cloud/circle/openstack_api/base.py save	null	null plainc	null	null templatedet	null	null instancetemp	null	null instancetem	null	null url	FILE	file:///home/h3yduck/cloud/circle/dashboard/urls.py vmcreate	null	null opera	FILE	file:///home/h3yduck/cloud/circle/vm/operations.py operations	FILE	file:///home/h3yduck/cloud/circle/common/operations.py templat	null	null vmadd	null	null vmdetail	null	null addinterfa	null	null addin	null	null server	null	null Instance	null	null instance	FILE	file:///home/h3yduck/cloud/circle/vm/models/instance.py operat	null	null ins	FILE	file:///home/h3yduck/cloud/circle/vm/models/instance.py vmdetai	null	null operationvi	null	null ser	null	null server.	FILE	file:///home/h3yduck/.virtualenvs/cloud/local/lib/python2.7/site-packages/novaclient/v2/servers.py resources.	FILE	file:///home/h3yduck/cloud/circle/request/templates/request/initials/resources.html vxla	null	null urls	FILE	file:///home/h3yduck/cloud/circle/dashboard/urls.py
"
/>
</component>
<component
name=
"RecentsManager"
>
<key
name=
"CopyFile.RECENT_KEYS"
>
...
...
@@ -415,7 +403,6 @@
</component>
<component
name=
"ToolWindowManager"
>
<frame
x=
"-2"
y=
"-1"
width=
"1370"
height=
"751"
extended-state=
"0"
/>
<editor
active=
"true"
/>
<layout>
<window_info
id=
"TODO"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.32980973"
sideWeight=
"0.4978701"
order=
"6"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Event Log"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.7097792"
sideWeight=
"0.51283985"
order=
"7"
side_tool=
"true"
content_ui=
"tabs"
/>
...
...
@@ -430,7 +417,7 @@
<window_info
id=
"SciView"
active=
"false"
anchor=
"right"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.33"
sideWeight=
"0.5"
order=
"3"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Structure"
active=
"false"
anchor=
"left"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.25"
sideWeight=
"0.5"
order=
"1"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Favorites"
active=
"false"
anchor=
"left"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.33"
sideWeight=
"0.5"
order=
"2"
side_tool=
"true"
content_ui=
"tabs"
/>
<window_info
id=
"Debug"
active=
"
false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"fals
e"
show_stripe_button=
"true"
weight=
"0.7097792"
sideWeight=
"0.48716012"
order=
"3"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Debug"
active=
"
true"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"tru
e"
show_stripe_button=
"true"
weight=
"0.7097792"
sideWeight=
"0.48716012"
order=
"3"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Cvs"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.25"
sideWeight=
"0.5"
order=
"4"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Messages"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.33"
sideWeight=
"0.5"
order=
"7"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Message"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.33"
sideWeight=
"0.5"
order=
"0"
side_tool=
"false"
content_ui=
"tabs"
/>
...
...
@@ -521,7 +508,7 @@
</properties>
</breakpoint>
</default-breakpoints>
<option
name=
"time"
value=
"33
4
"
/>
<option
name=
"time"
value=
"33
6
"
/>
</breakpoint-manager>
<watches-manager
/>
</component>
...
...
@@ -941,14 +928,6 @@ certifi.where()</expression-string>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/circle/dashboard/views/index.py"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"52"
>
<caret
line=
"67"
column=
"13"
lean-forward=
"true"
selection-start-line=
"67"
selection-start-column=
"13"
selection-end-line=
"67"
selection-end-column=
"13"
/>
<folding
/>
</state>
</provider>
</entry>
<entry
file=
"file:///usr/lib/python2.7/SocketServer.py"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"306"
>
...
...
@@ -1015,26 +994,34 @@ certifi.where()</expression-string>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/circle/dashboard/templates/dashboard/
index-vm
.html"
>
<entry
file=
"file://$PROJECT_DIR$/circle/dashboard/templates/dashboard/
vm-detail
.html"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
185
"
>
<caret
line=
"
41"
column=
"55"
lean-forward=
"false"
selection-start-line=
"41"
selection-start-column=
"54"
selection-end-line=
"41"
selection-end-column=
"55
"
/>
<state
relative-caret-position=
"
214
"
>
<caret
line=
"
75"
column=
"96"
lean-forward=
"false"
selection-start-line=
"75"
selection-start-column=
"96"
selection-end-line=
"75"
selection-end-column=
"96
"
/>
<folding
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/circle/dashboard/
templates/dashboard/vm-detail.html
"
>
<entry
file=
"file://$PROJECT_DIR$/circle/dashboard/
views/vm.py
"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
214
"
>
<caret
line=
"
75"
column=
"96"
lean-forward=
"false"
selection-start-line=
"75"
selection-start-column=
"96"
selection-end-line=
"75"
selection-end-column=
"9
6"
/>
<state
relative-caret-position=
"
-308
"
>
<caret
line=
"
94"
column=
"6"
lean-forward=
"false"
selection-start-line=
"94"
selection-start-column=
"6"
selection-end-line=
"94"
selection-end-column=
"
6"
/>
<folding
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/circle/dashboard/views/vm.py"
>
<entry
file=
"file://$PROJECT_DIR$/circle/dashboard/templates/dashboard/index-vm.html"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"180"
>
<caret
line=
"39"
column=
"28"
lean-forward=
"false"
selection-start-line=
"39"
selection-start-column=
"28"
selection-end-line=
"39"
selection-end-column=
"28"
/>
<folding
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/circle/dashboard/views/index.py"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
54
"
>
<caret
line=
"
1396"
column=
"0"
lean-forward=
"false"
selection-start-line=
"1396"
selection-start-column=
"0"
selection-end-line=
"1396"
selection-end-column=
"0
"
/>
<state
relative-caret-position=
"
129
"
>
<caret
line=
"
53"
column=
"46"
lean-forward=
"false"
selection-start-line=
"53"
selection-start-column=
"46"
selection-end-line=
"53"
selection-end-column=
"46
"
/>
<folding
/>
</state>
</provider>
...
...
circle/circle/db.sqlite3
View file @
4444e2b1
No preview for this file type
circle/dashboard/templates/dashboard/index-vm.html
View file @
4444e2b1
...
...
@@ -37,7 +37,7 @@
<small
class=
"text-muted index-vm-list-host"
>
{{ i.short_hostname }}
</small>
<div
class=
"pull-right dashboard-vm-favourite"
data-vm=
"{{ i.
pk
}}"
>
<div
class=
"pull-right dashboard-vm-favourite"
data-vm=
"{{ i.
id
}}"
>
{% if i.fav %}
<i
class=
"fa fa-star text-primary title-favourite"
title=
"{% trans "
Unfavourite
"
%}"
></i>
{% else %}
...
...
circle/dashboard/views/index.py
View file @
4444e2b1
...
...
@@ -20,7 +20,7 @@ import logging
import
openstack_api
from
braces.views
import
LoginRequiredMixin
from
dashboard.models
import
GroupProfile
from
dashboard.models
import
GroupProfile
,
Favourite
from
django.conf
import
settings
from
django.contrib.auth.models
import
Group
,
User
from
django.core.cache
import
cache
...
...
@@ -44,24 +44,21 @@ class IndexView(LoginRequiredMixin, TemplateView):
instances
=
openstack_api
.
nova
.
server_list
(
self
.
request
)[
0
]
#TODO: flatten?
quotas
=
openstack_api
.
nova
.
tenant_quota_get
(
self
.
request
,
user
.
project_id
)
# instances
favs
=
[
f
.
instance
for
f
in
Favourite
.
objects
.
filter
(
user
=
user
.
id
)]
fav_instances
=
[
i
for
i
in
instances
if
i
.
id
in
favs
]
display
=
list
(
fav_instances
)
+
list
(
set
(
instances
)
-
set
(
fav_instances
))
for
d
in
display
:
d
.
fav
=
True
if
d
in
fav_instances
else
False
context
.
update
({
'instances'
:
instances
[:
5
],
'instances'
:
display
[:
5
],
'more_instances'
:
len
(
instances
)
-
len
(
instances
[:
5
]),
'max_instances'
:
quotas
.
get
(
"instances"
)
.
limit
})
# instances
# favs = Instance.objects.filter(favourite__user=self.request.user)
# instances = Instance.get_objects_with_level(
# 'user', user, disregard_superuser=True).filter(destroyed_at=None)
# display = list(favs) + list(set(instances) - set(favs))
# for d in display:
# d.fav = True if d in favs else False
# context.update({
# 'instances': display[:5],
# 'more_instances': instances.count() - len(instances[:5])
# })
running
=
[
i
for
i
in
instances
if
i
.
status
==
"ACTIVE"
]
stopped
=
[
i
for
i
in
instances
if
i
.
status
!=
"ACTIVE"
]
...
...
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