Commit 70cb3792 by Estók Dániel

setty: elements hold position rate vertically.

parent 37c7213d
{% load i18n %}
<div class="panel panel-default">
<div class="panel-heading">
<span class="btn btn-default btn-xs infobtn pull-right" data-container="body" title="{% trans 'List of your Setty services. You can create new ones or customize existing ones.' %}">
<i class="fa fa-info-circle"></i>
</span>
<h3 class="no-margin"><i class="fa fa-server"></i> {% trans 'Services' %}
</h3>
</div>
<div class="list-group" id="template-list-view">
<div id="dashboard-service-list">
{% for s in services %}
<a href="{% url 'setty.views.service-detail' pk=s.pk %}" class="list-group-item
{% if forloop.last and templates|length < 5 %} list-group-item-last{% endif %}">
<span class="index-template-list-name">
{{ s.name }}
</span>
<small class="text-muted index-template-list-system">{{ s.status }}</small>
<div data-href="{% url 'setty.views.service-start' pk=s.pk %}" class="pull-right">
{% if s.status == "stopped" %}
<i data-container="body" title="{% trans 'Start service' %}"
class="fa fa-play"></i>
{% else %}
<i data-container="body" title="{% trans 'Stop service' %}"
class="fa fa-stop"></i>
{% endif %}
</div>
<div class="clearfix"></div>
</a>
{% empty %}
<div class="list-group-item">
<div class="alert alert-warning" style="margin: 10px;">
<p>
{% trans "You don't have any services, however you can create new ones!" %}
</p>
</div>
</div>
{% endfor %}
</div>
<div class="list-group-item list-group-footer">
<div class="row">
<div class="col-xs-5 col-sm-6">
<form action="{% url 'setty.views.service-list' %}" method="GET" id="dashboard-service-search-form">
<div class="input-group input-group-sm">
<input name="serviceSearch" type="text" class="form-control" placeholder="{% trans 'Search...' %}" />
<div class="input-group-btn">
<button type="submit" class="btn btn-primary"><i class="fa fa-search"></i></button>
</div>
</div>
</form>
</div>
<div class="col-xs-7 col-sm-6 text-right">
<a href="{% url 'setty.views.service-list' %}" class="btn btn-primary btn-xs">
<i class="fa fa-chevron-circle-right"></i> {% trans "list" %}
</a>
<a href="{% url 'setty.views.service-create' %}" class="btn btn-success btn-xs">
<i class="fa fa-plus-circle"></i> {% trans "new" %}
</a>
</div>
</div>
</div>
</div>
</div>
...@@ -43,6 +43,12 @@ ...@@ -43,6 +43,12 @@
</div> </div>
{% endif %} {% endif %}
{% if perms.vm.create_template %}
<div class="col-lg-4 col-sm-6">
{% include "dashboard/index-setty.html" %}
</div>
{% endif %}
{% if perms.vm.view_statistics %} {% if perms.vm.view_statistics %}
<div class="col-lg-4 col-sm-6"> <div class="col-lg-4 col-sm-6">
{% include "dashboard/index-nodes.html" %} {% include "dashboard/index-nodes.html" %}
......
...@@ -29,6 +29,7 @@ from braces.views import LoginRequiredMixin ...@@ -29,6 +29,7 @@ from braces.views import LoginRequiredMixin
from dashboard.models import GroupProfile from dashboard.models import GroupProfile
from vm.models import Instance, Node, InstanceTemplate from vm.models import Instance, Node, InstanceTemplate
from dashboard.views.vm import vm_ops from dashboard.views.vm import vm_ops
from setty.models import Service
from ..store_api import Store from ..store_api import Store
...@@ -100,6 +101,10 @@ class IndexView(LoginRequiredMixin, TemplateView): ...@@ -100,6 +101,10 @@ class IndexView(LoginRequiredMixin, TemplateView):
context['templates'] = InstanceTemplate.get_objects_with_level( context['templates'] = InstanceTemplate.get_objects_with_level(
'operator', user, disregard_superuser=True).all()[:5] 'operator', user, disregard_superuser=True).all()[:5]
# setty services
if user.has_perm('vm.create_template'):
context['services'] = Service.objects.filter(user=user).order_by('-pk')[:5]
# toplist # toplist
if settings.STORE_URL: if settings.STORE_URL:
cache_key = "files-%d" % self.request.user.pk cache_key = "files-%d" % self.request.user.pk
......
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('setty', '0009_element_anchors'),
]
operations = [
migrations.AlterField(
model_name='element',
name='pos_x',
field=models.FloatField(),
),
migrations.AlterField(
model_name='element',
name='pos_y',
field=models.FloatField(),
),
]
...@@ -48,8 +48,8 @@ class Element(Model): ...@@ -48,8 +48,8 @@ class Element(Model):
service = models.ForeignKey(Service, on_delete=models.CASCADE) service = models.ForeignKey(Service, on_delete=models.CASCADE)
parameters = models.TextField() parameters = models.TextField()
display_id = models.TextField() display_id = models.TextField()
pos_x = models.PositiveSmallIntegerField() pos_x = models.FloatField() # Stores a rate.
pos_y = models.PositiveSmallIntegerField() pos_y = models.FloatField() # Stores concrete position.
anchors = models.PositiveSmallIntegerField() anchors = models.PositiveSmallIntegerField()
def __unicode__(self): def __unicode__(self):
......
[flake8]
exclude = circle/static_collected/*, circle/bower_components/*, */migrations/*
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment