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
291e2a3c
authored
Mar 12, 2015
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
request: basic detail page
parent
e70928dd
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
111 additions
and
2 deletions
+111
-2
circle/request/tables.py
+2
-1
circle/request/templates/request/detail.html
+98
-0
circle/request/views.py
+11
-1
No files found.
circle/request/tables.py
View file @
291e2a3c
...
...
@@ -11,7 +11,7 @@ from request.models import Request, LeaseType, TemplateAccessType
class
RequestTable
(
Table
):
pk
=
LinkColumn
(
'
dashboard.views.disk
-detail'
,
'
request.views.request
-detail'
,
args
=
[
A
(
'pk'
)],
verbose_name
=
_
(
"ID"
),
)
...
...
@@ -21,6 +21,7 @@ class RequestTable(Table):
attrs
=
{
'class'
:
(
'table table-bordered table-striped table-hover'
),
'id'
:
"request-list-table"
}
fields
=
(
"pk"
,
"status"
,
"type"
,
"user"
,
)
order_by
=
(
"-pk"
,
)
empty_text
=
_
(
"No more requests."
)
...
...
circle/request/templates/request/detail.html
0 → 100644
View file @
291e2a3c
{% extends "dashboard/base.html" %}
{% load staticfiles %}
{% load i18n %}
{% load render_table from django_tables2 %}
{% block title-page %}{% trans "Group list" %}{% endblock %}
{% block content %}
<div
class=
"row"
>
<div
class=
"col-md-12"
>
<div
class=
"panel panel-default"
>
<div
class=
"panel-heading"
>
<a
href=
"{% url "
request
.
views
.
request-list
"
%}"
class=
"btn btn-default btn-xs pull-right"
>
{% trans "Back" %}
</a>
<h3
class=
"no-margin"
>
<i
class=
"fa fa-{{ object.get_icon }}"
></i>
{% trans "Request" %}
</h3>
</div>
<div
class=
"panel-body"
>
<div
class=
"label label-{{ object.get_effect }} pull-right"
style=
"font-size: 1.5em; margin-top: 10px;"
>
{{ object.get_readable_status|upper }}
</div>
<p>
<img
src=
"{{ object.user.profile.get_avatar_url }}"
width=
"50"
height=
"50"
/>
<a
href=
"{{ object.user.profile.get_absolute_url }} "
>
{{ object.user.profile.get_display_name }}
</a>
</p>
<p>
<pre>
{{ object.reason }}
</pre>
</p>
<hr
/>
{% if object.type == "lease" %}
<dl>
<dt>
{% trans "VM name" %}
</dt>
<dd><a
href=
"{{ action.instance.get_absolute_url }}"
>
{{ action.instance.name }}
</a></dd>
<dt>
{% trans "VM description" %}
</dt>
<dd>
{{ action.instance.description }}
</dd>
<dt>
{% trans "Current Lease" %}
</dt>
<dd>
{{ action.instance.lease }}
</dd>
<dt>
{% trans "Requested Lease" %}
</dt>
<dd>
{{ action.lease_type.lease }}
</dd>
</dl>
{% elif object.type == "template" %}
<dl>
<dt>
{% trans "Template type" %}:
<span
style=
"font-weight: normal;"
>
{{ action.template_type.name }}
</span>
</dt>
<dd>
<ul>
{% for t in action.template_type.templates.all %}
<li><a
href=
"{{ t.get_absolute_url }}"
>
{{ t }}
</a></li>
{% endfor %}
</ul>
</dd>
<dt>
{% trans "Level" %}
<dt>
<dd>
{{ action.get_readable_level }}
</dd>
</dl>
{% elif object.type == "resource" %}
<dl>
<dt>
{% trans "VM name" %}
</dt>
<dd><a
href=
"{{ action.instance.get_absolute_url }}"
>
{{ action.instance.name }}
</a></dd>
<dt>
{% trans "VM description" %}
</dt>
<dd>
{{ action.instance.description }}
</dd>
<dt>
{% trans "Priority" %}
<span
class=
"text-muted"
style=
"font-weight: normal;"
>
{% trans "(old values in parentheses)" %}
</span>
</dt>
<dd>
{{ action.priority }} ({{ action.instance.priority }})
</dd>
<dt>
{% trans "Number of cores" %}
</dt>
<dd>
{{ action.num_cores }} ({{ action.instance.num_cores }})
</dd>
<dt>
{% trans "Ram size" %}
</dt>
<dd>
{{ action.ram_size }} ({{ action.instance.ram_size }}) MiB
</dd>
</dl>
{% else %}
hacks!!!
{% endif %}
<hr
/>
<div
class=
"pull-right"
>
<button
class=
"btn btn-danger"
>
<i
class=
"fa fa-thumbs-down"
></i>
nope
</button>
<button
class=
"btn btn-success"
>
<i
class=
"fa fa-thumbs-up"
></i>
yep
</button>
</div>
</div>
<!-- .panel-body -->
</div>
</div>
</div>
{% endblock %}
circle/request/views.py
View file @
291e2a3c
...
...
@@ -21,7 +21,6 @@ from request.forms import (
LeaseTypeForm
,
TemplateAccessTypeForm
,
TemplateRequestForm
,
LeaseRequestForm
,
ResourceRequestForm
,
)
from
dashboard.forms
import
VmResourcesForm
class
RequestList
(
LoginRequiredMixin
,
SuperuserRequiredMixin
,
SingleTableView
):
...
...
@@ -47,6 +46,17 @@ class RequestDetail(LoginRequiredMixin, SuperuserRequiredMixin, DetailView):
model
=
Request
template_name
=
"request/detail.html"
def
get_context_data
(
self
,
**
kwargs
):
request
=
self
.
object
context
=
super
(
RequestDetail
,
self
)
.
get_context_data
(
**
kwargs
)
context
[
'action'
]
=
request
.
action
if
request
.
status
==
Request
.
STATUSES
.
UNSEEN
:
request
.
status
=
Request
.
STATUSES
.
PENDING
request
.
save
()
return
context
class
TemplateAccessTypeDetail
(
LoginRequiredMixin
,
SuperuserRequiredMixin
,
UpdateView
):
...
...
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