1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-11-01 03:54:15 +00:00

Fixed pep8

This commit is contained in:
Retspen 2015-04-06 10:51:50 +03:00
parent 6a066f6e6d
commit 2aa5558df7
14 changed files with 110 additions and 89 deletions

View file

@ -6,7 +6,10 @@ env:
install:
- pip install -r dev/requirements.txt --use-mirrors
script:
- pep8 --exclude=IPy.py --ignore=E501 vrtManager accounts computes console create instances interfaces networks secrets storages
- pyflakes vrtManager accounts computes console create instances interfaces networks secrets storages
- pep8 --exclude=IPy.py --ignore=E501 vrtManager accounts computes \
console create instances interfaces \
networks secrets storages
- pyflakes vrtManager accounts computes console create instances interfaces \
networks secrets storages
- python manage.py migrate
- python manage.py test --settings=webvirtcloud.settings-dev

View file

@ -5,9 +5,10 @@ from django.db import migrations
def add_useradmin(apps, schema_editor):
from django.contrib.auth.models import User
# from django.contrib.auth.models import User
# Broken in Django 1.8
#User.objects.create_superuser("admin", None, "admin")
# User.objects.create_superuser("admin", None, "admin")
pass
class Migration(migrations.Migration):

View file

@ -1,9 +1,11 @@
from django.conf.urls import url
from . import views
urlpatterns =[
url(r'^login/$', 'django.contrib.auth.views.login', {'template_name': 'login.html'}, name='login'),
url(r'^logout/$', 'django.contrib.auth.views.logout', {'template_name': 'logout.html'}, name='logout'),
urlpatterns = [
url(r'^login/$', 'django.contrib.auth.views.login',
{'template_name': 'login.html'}, name='login'),
url(r'^logout/$', 'django.contrib.auth.views.logout',
{'template_name': 'logout.html'}, name='logout'),
url(r'^profile/$', views.profile, name='profile'),
url(r'^$', views.accounts, name='accounts'),
url(r'^profile/(?P<user_id>[0-9]+)/$', views.account, name='account'),

View file

@ -1,5 +1,6 @@
{% extends "base.html" %}
{% load i18n %}
{% load staticfiles %}
{% block title %}{% trans "Overview" %} - {{ compute.name }}{% endblock %}
{% block content %}
<!-- Page Heading -->
@ -81,7 +82,7 @@
</div>
{% endblock %}
{% block script %}
<script src="{{ STATIC_URL }}js/Chart.min.js"></script>
<script src="{% static "js/Chart.min.js" %}"></script>
<script>
var cpuLineData = {
labels : [0, 0, 0, 0, 0],

View file

@ -1,8 +1,9 @@
from django.conf.urls import url
from . import views
urlpatterns =[
urlpatterns = [
url(r'^$', views.computes, name='computes'),
url(r'^overview/(?P<compute_id>[0-9]+)/$', views.overview, name='overview'),
url(r'^statistics/(?P<compute_id>[0-9]+)/$', views.compute_graph, name='compute_graph'),
url(r'^statistics/(?P<compute_id>[0-9]+)/$',
views.compute_graph, name='compute_graph'),
]

View file

@ -1,6 +1,6 @@
{% extends "base.html" %}
{% load i18n %}
{% load static %}
{% load staticfiles %}
{% block title %}{% trans "Create new instance" %}{% endblock %}
{% block style %}
<link href="{% static "css/bootstrap-multiselect.css" %}" rel="stylesheet">
@ -410,7 +410,7 @@
});
});
</script>
<script src="{{ STATIC_URL }}/js/ace.js" type="text/javascript" charset="utf-8"></script>
<script src="{% static "js/ace.js" %}"></script>
<script>
var editor = ace.edit("editor");
editor.getSession().setMode("ace/mode/xml");

View file

@ -1,8 +1,9 @@
{% extends "base.html" %}
{% load i18n %}
{% load staticfiles %}
{% block title %}{% trans "Instances" %}{% endblock %}
{% block style %}
<link rel="stylesheet" href="{{ STATIC_URL }}/css/sortable-theme-bootstrap.css" />
<link rel="stylesheet" href="{% static "css/sortable-theme-bootstrap.css" %}" />
{% endblock %}
{% block content %}
<!-- Page Heading -->
@ -215,7 +216,7 @@
</div>
{% endblock %}
{% block script %}
<script src="{{ STATIC_URL }}js/sortable.min.js"></script>
<script src="{% static "js/sortable.min.js" %}"></script>
<script>
function open_console(uuid) {
window.open("{% url 'console' %}?token=" + uuid, "", "width=850,height=485");

View file

@ -1,8 +1,11 @@
from django.conf.urls import url
from . import views
urlpatterns =[
url(r'^(?P<compute_id>[0-9]+)/(?P<vname>[\w\-\.]+)/$', views.instance, name='instance'),
url(r'^statistics/(?P<compute_id>[0-9]+)/(?P<vname>[\w\-\.]+)/$', views.inst_graph, name='inst_graph'),
url(r'^status/(?P<compute_id>[0-9]+)/(?P<vname>[\w\-\.]+)/$', views.inst_status, name='inst_status'),
urlpatterns = [
url(r'^(?P<compute_id>[0-9]+)/(?P<vname>[\w\-\.]+)/$',
views.instance, name='instance'),
url(r'^statistics/(?P<compute_id>[0-9]+)/(?P<vname>[\w\-\.]+)/$',
views.inst_graph, name='inst_graph'),
url(r'^status/(?P<compute_id>[0-9]+)/(?P<vname>[\w\-\.]+)/$',
views.inst_status, name='inst_status'),
]

View file

@ -1,5 +1,6 @@
{% extends "base.html" %}
{% load i18n %}
{% load staticfiles %}
{% block title %}{% trans "Interfaces" %} - {{ compute.name }}{% endblock %}
{% block content %}
<!-- Page Heading -->
@ -65,29 +66,29 @@
</div>
{% endblock %}
{% block script %}
<script>
$(document).ready(function () {
$('#itype').change(function (eventObject) {
if ($(this).val() == 'bridge') {
$('.bridge_name_form_group').show();
} else {
$('.bridge_name_form_group').hide();
}
}).change();
$('#ipv4').change(function (eventObject) {
if ($(this).val() == 'static') {
$('.static_ipv4_form_group').show();
} else {
$('.static_ipv4_form_group').hide();
}
}).change();
$('#ipv6').change(function (eventObject) {
if ($(this).val() == 'static') {
$('.static_ipv6_form_group').show();
} else {
$('.static_ipv6_form_group').hide();
}
}).change();
});
</script>
<script>
$(document).ready(function () {
$('#itype').change(function (eventObject) {
if ($(this).val() == 'bridge') {
$('.bridge_name_form_group').show();
} else {
$('.bridge_name_form_group').hide();
}
}).change();
$('#ipv4').change(function (eventObject) {
if ($(this).val() == 'static') {
$('.static_ipv4_form_group').show();
} else {
$('.static_ipv4_form_group').hide();
}
}).change();
$('#ipv6').change(function (eventObject) {
if ($(this).val() == 'static') {
$('.static_ipv6_form_group').show();
} else {
$('.static_ipv6_form_group').hide();
}
}).change();
});
</script>
{% endblock %}

View file

@ -2,9 +2,7 @@
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
from django.conf import settings
from django.utils.timezone import utc
class Migration(migrations.Migration):

View file

@ -147,41 +147,41 @@
{% endif %}
{% endblock %}
{% block script %}
<script>
$.expr[':'].Contains = $.expr.createPseudo(function (arg) {
return function (elem) {
return $(elem).text().toUpperCase().indexOf(arg.toUpperCase()) >= 0;
};
<script>
$.expr[':'].Contains = $.expr.createPseudo(function (arg) {
return function (elem) {
return $(elem).text().toUpperCase().indexOf(arg.toUpperCase()) >= 0;
};
});
$(document).ready(function () {
// add event button labeled "filter"
$('#filter_button').click(function (event) {
// get value
var filter_val = $('#filter_input').val();
if (filter_val == '') {
// show all
$('tbody tr').show();
} else {
// show only matches
$('tbody tr:Contains(\'' + filter_val + '\')').show();
// hide non-matching items
$('tbody tr:not(:Contains(\'' + filter_val + '\'))').hide();
}
});
$(document).ready(function () {
// add event button labeled "filter"
$('#filter_button').click(function (event) {
// get value
var filter_val = $('#filter_input').val();
if (filter_val == '') {
// show all
$('tbody tr').show();
} else {
// show only matches
$('tbody tr:Contains(\'' + filter_val + '\')').show();
// hide non-matching items
$('tbody tr:not(:Contains(\'' + filter_val + '\'))').hide();
}
});
// add event button labeled "clear"
$('#filter_clear').click(function (event) {
$('#filter_input').val('');
$('#filter_button').click();
});
// add event button labeled "clear"
$('#filter_clear').click(function (event) {
$('#filter_input').val('');
// trigger filter when enter key pressed
$('#filter_input').keyup(function (event) {
if (event.keyCode == 13) {
$('#filter_button').click();
});
// trigger filter when enter key pressed
$('#filter_input').keyup(function (event) {
if (event.keyCode == 13) {
$('#filter_button').click();
}
});
}
});
</script>
});
</script>
{% endblock %}

View file

@ -1,8 +1,9 @@
{% extends "base.html" %}
{% load i18n %}
{% load staticfiles %}
{% block title %}{% trans "Secrets" %} - {{ compute.name }}{% endblock %}
{% block style %}
<link rel="stylesheet" href="{{ STATIC_URL }}/css/sortable-theme-bootstrap.css" />
<link rel="stylesheet" href="{% static "css/sortable-theme-bootstrap.css" %}" />
{% endblock %}
{% block content %}
<!-- Page Heading -->
@ -117,5 +118,5 @@
</div>
{% endblock %}
{% block script %}
<script src="{{ STATIC_URL }}/js/sortable.min.js"></script>
<script src="{% static "js/sortable.min.js" %}"></script>
{% endblock %}

View file

@ -1,8 +1,9 @@
{% extends "base.html" %}
{% load i18n %}
{% load staticfiles %}
{% block title %}{% trans "Storage" %} - {{ pool }}{% endblock %}
{% block style %}
<link rel="stylesheet" href="{{ STATIC_URL }}css/sortable-theme-bootstrap.css" />
<link rel="stylesheet" href="{% static "css/sortable-theme-bootstrap.css" %}" />
{% endblock %}
{% block content %}
<!-- Page Heading -->
@ -186,7 +187,7 @@
</div>
{% endblock %}
{% block script %}
<script src="{{ STATIC_URL }}/js/sortable.min.js"></script>
<script src="{% static "js/sortable.min.js" %}"></script>
<script>
$('.format-convert').hide();
$(document).on('change', '.volume-convert', function () {

View file

@ -9,14 +9,22 @@ urlpatterns = patterns('',
url(r'^accounts/', include('accounts.urls')),
url(r'^computes/', include('computes.urls')),
url(r'^compute/(?P<compute_id>[0-9]+)/storages/$', 'storages.views.storages', name='storages'),
url(r'^compute/(?P<compute_id>[0-9]+)/storage/(?P<pool>[\w\-\.]+)/$', 'storages.views.storage', name='storage'),
url(r'^compute/(?P<compute_id>[0-9]+)/networks/$', 'networks.views.networks', name='networks'),
url(r'^compute/(?P<compute_id>[0-9]+)/network/(?P<pool>[\w\-\.]+)/$', 'networks.views.network', name='network'),
url(r'^compute/(?P<compute_id>[0-9]+)/interfaces/$', 'interfaces.views.interfaces', name='interfaces'),
url(r'^compute/(?P<compute_id>[0-9]+)/interface/(?P<iface>[\w\-\.\:]+)/$', 'interfaces.views.interface', name='interface'),
url(r'^compute/(?P<compute_id>[0-9]+)/secrets/$', 'secrets.views.secrets', name='secrets'),
url(r'^compute/(?P<compute_id>[0-9]+)/create/$', 'create.views.create_instance', name='create_instance'),
url(r'^compute/(?P<compute_id>[0-9]+)/storages/$',
'storages.views.storages', name='storages'),
url(r'^compute/(?P<compute_id>[0-9]+)/storage/(?P<pool>[\w\-\.]+)/$',
'storages.views.storage', name='storage'),
url(r'^compute/(?P<compute_id>[0-9]+)/networks/$',
'networks.views.networks', name='networks'),
url(r'^compute/(?P<compute_id>[0-9]+)/network/(?P<pool>[\w\-\.]+)/$',
'networks.views.network', name='network'),
url(r'^compute/(?P<compute_id>[0-9]+)/interfaces/$',
'interfaces.views.interfaces', name='interfaces'),
url(r'^compute/(?P<compute_id>[0-9]+)/interface/(?P<iface>[\w\-\.\:]+)/$',
'interfaces.views.interface', name='interface'),
url(r'^compute/(?P<compute_id>[0-9]+)/secrets/$',
'secrets.views.secrets', name='secrets'),
url(r'^compute/(?P<compute_id>[0-9]+)/create/$',
'create.views.create_instance', name='create_instance'),
url(r'^console/$', 'console.views.console', name='console'),
url(r'^logs/$', 'logs.views.showlogs', name='showlogs'),