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
2a333e50
authored
Jan 29, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: working template list on index view
parent
8fb63c4f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
15 deletions
+13
-15
circle/dashboard/static/dashboard/dashboard.js
+4
-0
circle/dashboard/templates/dashboard/index-templates.html
+6
-14
circle/dashboard/views.py
+2
-0
circle/vm/models/instance.py
+1
-1
No files found.
circle/dashboard/static/dashboard/dashboard.js
View file @
2a333e50
$
(
function
()
{
$
(
function
()
{
$
(
'.vm-create'
).
click
(
function
(
e
)
{
$
(
'.vm-create'
).
click
(
function
(
e
)
{
var
template
=
$
(
this
).
data
(
"template"
);
$
.
ajax
({
$
.
ajax
({
type
:
'GET'
,
type
:
'GET'
,
url
:
'/dashboard/vm/create/'
,
url
:
'/dashboard/vm/create/'
,
...
@@ -11,6 +12,9 @@ $(function () {
...
@@ -11,6 +12,9 @@ $(function () {
$
(
'#create-modal'
).
on
(
'hidden.bs.modal'
,
function
()
{
$
(
'#create-modal'
).
on
(
'hidden.bs.modal'
,
function
()
{
$
(
'#create-modal'
).
remove
();
$
(
'#create-modal'
).
remove
();
});
});
if
(
template
)
{
$
(
'#vm-create-template-select option[value="'
+
template
+
'"]'
).
prop
(
"selected"
,
true
).
trigger
(
"change"
);
}
}
}
});
});
return
false
;
return
false
;
...
...
circle/dashboard/templates/dashboard/index-templates.html
View file @
2a333e50
{% load i18n %}
<div
class=
"panel panel-default"
>
<div
class=
"panel panel-default"
>
<div
class=
"panel-heading"
>
<div
class=
"panel-heading"
>
<span
class=
"btn btn-default btn-xs infobtn pull-right"
title=
"Halp"
>
<span
class=
"btn btn-default btn-xs infobtn pull-right"
title=
"Halp"
>
...
@@ -7,21 +8,12 @@
...
@@ -7,21 +8,12 @@
</h3>
</h3>
</div>
</div>
<div
class=
"list-group"
id=
"vm-list-view"
>
<div
class=
"list-group"
id=
"vm-list-view"
>
<a
href=
"#"
class=
"list-group-item"
>
{% for t in templates %}
<i
class=
"icon-linux"
></i>
ALMA
<small
class=
"text-muted"
>
CentOS 6
</small><div
class=
"pull-right"
><i
class=
"icon-play "
></i></div>
<a
href=
"{% url "
dashboard
.
views
.
template-detail
"
pk=
t.pk
%}"
class=
"list-group-item"
>
</a>
<i
class=
"icon-{{ t.os_type }}"
></i>
{{ t.name }}
<small
class=
"text-muted"
>
{{ t.system }}
</small>
<a
href=
"#"
class=
"list-group-item"
>
<div
class=
"pull-right vm-create"
data-template=
"{{ t.pk }}"
><i
title=
"{% trans "
Start
vm
instance
"
%}"
class=
"icon-play"
></i></div>
<i
class=
"icon-windows"
></i>
ALMA
<small
class=
"text-muted"
>
Windows 7
</small><div
class=
"pull-right"
><i
class=
"icon-play "
></i></div>
</a>
<a
href=
"#"
class=
"list-group-item"
>
<i
class=
"icon-linux"
></i>
ALMA
<small
class=
"text-muted"
>
Gentoo
</small><div
class=
"pull-right"
><i
class=
"icon-play "
></i></div>
</a>
<a
href=
"#"
class=
"list-group-item"
>
<i
class=
"icon-linux"
></i>
ALMA
<small
class=
"text-muted"
>
Ubuntu 12.04 LTS
</small><div
class=
"pull-right"
><i
class=
"icon-play "
></i></div>
</a>
<a
href=
"#"
class=
"list-group-item"
>
<i
class=
"icon-windows"
></i>
ALMA
<small
class=
"text-muted"
>
Windows 7
</small><div
class=
"pull-right"
><i
class=
"icon-play "
></i></div>
</a>
</a>
{% endfor %}
<div
href=
"#"
class=
"list-group-item list-group-footer text-right"
>
<div
href=
"#"
class=
"list-group-item list-group-footer text-right"
>
<p>
<p>
<a
href=
"{% url "
dashboard
.
views
.
template-list
"
%}"
class=
"btn btn-primary btn-xs"
><i
class=
"icon-chevron-sign-right"
></i>
show all
</a>
<a
href=
"{% url "
dashboard
.
views
.
template-list
"
%}"
class=
"btn btn-primary btn-xs"
><i
class=
"icon-chevron-sign-right"
></i>
show all
</a>
...
...
circle/dashboard/views.py
View file @
2a333e50
...
@@ -94,6 +94,8 @@ class IndexView(LoginRequiredMixin, TemplateView):
...
@@ -94,6 +94,8 @@ class IndexView(LoginRequiredMixin, TemplateView):
'stopped_vm_num'
:
instances
.
exclude
(
'stopped_vm_num'
:
instances
.
exclude
(
state__in
=
[
'RUNNING'
,
'NOSTATE'
])
.
count
()
state__in
=
[
'RUNNING'
,
'NOSTATE'
])
.
count
()
})
})
context
[
'templates'
]
=
InstanceTemplate
.
objects
.
all
()[:
5
]
return
context
return
context
...
...
circle/vm/models/instance.py
View file @
2a333e50
...
@@ -142,7 +142,7 @@ class InstanceTemplate(AclBase, VirtualMachineDescModel, TimeStampedModel):
...
@@ -142,7 +142,7 @@ class InstanceTemplate(AclBase, VirtualMachineDescModel, TimeStampedModel):
"""Get the type of the template's operating system.
"""Get the type of the template's operating system.
"""
"""
if
self
.
access_method
==
'rdp'
:
if
self
.
access_method
==
'rdp'
:
return
'win'
return
'win
dows
'
else
:
else
:
return
'linux'
return
'linux'
...
...
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