1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-12-25 15:45:23 +00:00

Merge pull request #450 from catborise/master

Django Update & other
This commit is contained in:
catborise 2021-06-15 14:30:45 +03:00 committed by GitHub
commit 375479cf2f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
47 changed files with 156 additions and 157 deletions

View file

@ -2,14 +2,14 @@ language: python
python: python:
- "3.6" - "3.6"
env: env:
- DJANGO=2.2.16 - DJANGO=3.2.4
install: install:
- pip install -r dev/requirements.txt - pip install -r dev/requirements.txt
script: script:
- pep8 --exclude=IPy.py --ignore=E501 vrtManager accounts admin appsettings computes \ - pep8 --exclude=IPy.py --ignore=E501 vrtManager accounts admin appsettings computes \
console create datasource instances interfaces \ console create datasource instances interfaces \
logs networks nwfilters secrets storages logs networks nwfilters storages virtsecrets
- pyflakes vrtManager accounts admin appsettings computes console create datasource instances interfaces \ - pyflakes vrtManager accounts admin appsettings computes console create datasource instances interfaces \
nwfilters networks secrets storages logs logs networks nwfilters storages virtsecrets
- python manage.py migrate - python manage.py migrate
- python manage.py test --settings=webvirtcloud.settings-dev - python manage.py test --settings=webvirtcloud.settings-dev

View file

@ -1,4 +1,4 @@
FROM phusion/baseimage:18.04-1.0.0 FROM phusion/baseimage:focal-1.0.0
EXPOSE 80 EXPOSE 80
EXPOSE 6080 EXPOSE 6080

View file

@ -1,7 +1,7 @@
[![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/retspen/webvirtcloud) [![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/retspen/webvirtcloud)
# WebVirtCloud # WebVirtCloud
###### Python3 & Django 2.2 ###### Python 3.x & Django 3.2 LTS
## Features ## Features
* QEMU/KVM Hypervisor Management * QEMU/KVM Hypervisor Management

View file

@ -9,9 +9,7 @@
<a href="{% url 'admin:group_create' %}" class="btn btn-success btn-header float-right"> <a href="{% url 'admin:group_create' %}" class="btn btn-success btn-header float-right">
{% icon 'plus' %} {% icon 'plus' %}
</a> </a>
<div class="float-right search"> {% include 'search_block.html' %}
<input id="filter" class="form-control" type="text" placeholder="{% trans "Search" %}">
</div>
<h1 class="page-header">{% trans "Groups" %}</h1> <h1 class="page-header">{% trans "Groups" %}</h1>
</div> </div>
</div> </div>

View file

@ -12,9 +12,7 @@
<a href="{% url 'admin:user_create' %}" class="btn btn-success btn-header float-right"> <a href="{% url 'admin:user_create' %}" class="btn btn-success btn-header float-right">
{% icon 'plus' %} {% icon 'plus' %}
</a> </a>
<div class="float-right search"> {% include 'search_block.html' %}
<input id="filter" class="form-control" type="text" placeholder="{% trans "Search" %}">
</div>
{% endblock page_heading_extra %} {% endblock page_heading_extra %}
{% block content %} {% block content %}

View file

@ -1,6 +1,6 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load i18n %} {% load i18n %}
{% load staticfiles %} {% load static %}
{% load icons %} {% load icons %}
{% block title %}{% trans "Instances" %} - {{ compute.name }}{% endblock %} {% block title %}{% trans "Instances" %} - {{ compute.name }}{% endblock %}
{% block style %} {% block style %}
@ -14,9 +14,7 @@
{% icon 'plus' %} {% icon 'plus' %}
</a> </a>
{% if instances %} {% if instances %}
<div class="float-right search"> {% include 'search_block.html' %}
<input id="filter" class="form-control" type="text" placeholder="{% trans 'Search' %}">
</div>
{% endif %} {% endif %}
{% endblock page_heading_extra %} {% endblock page_heading_extra %}
@ -44,7 +42,7 @@
<a href="{% url 'nwfilters' compute.id %}">{% icon 'filter' %} {% trans "NWFilters" %}</a> <a href="{% url 'nwfilters' compute.id %}">{% icon 'filter' %} {% trans "NWFilters" %}</a>
</li> </li>
<li class="breadcrumb-item"> <li class="breadcrumb-item">
<a href="{% url 'secrets' compute.id %}">{% icon 'key' %} {% trans "Secrets" %}</a> <a href="{% url 'virtsecrets' compute.id %}">{% icon 'key' %} {% trans "Secrets" %}</a>
</li> </li>
</ol> </ol>
</nav> </nav>

View file

@ -22,9 +22,9 @@
</div> </div>
{% else %} {% else %}
<div class="col-lg-12"> <div class="col-lg-12">
<table class="table table-striped table-hover"> <table class="table table-striped table-hover sortable-theme-bootstrap" data-sortable>
<thead> <thead>
<tr class="d-flex"> <tr>
<th span="col" class="col-sm-3">{% trans "Name" %}</th> <th span="col" class="col-sm-3">{% trans "Name" %}</th>
<th span="col" class="col-sm-2">{% trans "Status" %}</th> <th span="col" class="col-sm-2">{% trans "Status" %}</th>
<th span="col" class="col-sm-5">{% trans "Details" %}</th> <th span="col" class="col-sm-5">{% trans "Details" %}</th>
@ -33,7 +33,7 @@
</thead> </thead>
<tbody class="searchable"> <tbody class="searchable">
{% for compute in computes %} {% for compute in computes %}
<tr class="d-flex"> <tr>
<td class="col-sm-3"> <td class="col-sm-3">
{{ compute.name }} {{ compute.name }}
</td> </td>
@ -64,5 +64,6 @@
{% endblock content %} {% endblock content %}
{% block script %} {% block script %}
<script src="{% static "js/filter-table.js" %}"></script> <script src="{% static 'js/sortable.min.js' %}"></script>
<script src="{% static 'js/filter-table.js' %}"></script>
{% endblock script %} {% endblock script %}

View file

@ -1,6 +1,6 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load i18n %} {% load i18n %}
{% load staticfiles %} {% load static %}
{% load icons %} {% load icons %}
{% block title %}{% trans "Overview" %} - {{ compute.name }}{% endblock %} {% block title %}{% trans "Overview" %} - {{ compute.name }}{% endblock %}
@ -31,7 +31,7 @@
<a href="{% url 'nwfilters' compute.id %}">{% icon 'filter' %} {% trans "NWFilters" %}</a> <a href="{% url 'nwfilters' compute.id %}">{% icon 'filter' %} {% trans "NWFilters" %}</a>
</li> </li>
<li class="breadcrumb-item"> <li class="breadcrumb-item">
<a href="{% url 'secrets' compute.id %}">{% icon 'key' %} {% trans "Secrets" %}</a> <a href="{% url 'virtsecrets' compute.id %}">{% icon 'key' %} {% trans "Secrets" %}</a>
</li> </li>
</ol> </ol>
</nav> </nav>

View file

@ -115,7 +115,7 @@ class ComputesTestCase(TestCase):
# TODO: add test for single nwfilter # TODO: add test for single nwfilter
def test_secrets(self): def test_secrets(self):
response = self.client.get(reverse('secrets', args=[1])) response = self.client.get(reverse('virtsecrets', args=[1]))
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
# def test_create_instance_select_type(self): # def test_create_instance_select_type(self):

View file

@ -1,4 +1,4 @@
from secrets.views import secrets from virtsecrets.views import secrets
from django.urls import include, path from django.urls import include, path
# from instances.views import create_instance, create_instance_select_type # from instances.views import create_instance, create_instance_select_type
@ -33,7 +33,7 @@ urlpatterns = [
path('interface/<str:iface>/', interface, name='interface'), path('interface/<str:iface>/', interface, name='interface'),
path('nwfilters/', nwfilters, name='nwfilters'), path('nwfilters/', nwfilters, name='nwfilters'),
path('nwfilter/<str:nwfltr>/', nwfilter, name='nwfilter'), path('nwfilter/<str:nwfltr>/', nwfilter, name='nwfilter'),
path('secrets/', secrets, name='secrets'), path('virtsecrets/', secrets, name='virtsecrets'),
# path('create/', create_instance_select_type, name='create_instance_select_type'), # path('create/', create_instance_select_type, name='create_instance_select_type'),
# path('create/archs/<str:arch>/machines/<str:machine>/', create_instance, name='create_instance'), # path('create/archs/<str:arch>/machines/<str:machine>/', create_instance, name='create_instance'),
path('archs/<str:arch>/machines/', views.get_compute_machine_types, name='machines'), path('archs/<str:arch>/machines/', views.get_compute_machine_types, name='machines'),

View file

@ -1,4 +1,4 @@
Django==2.2.22 Django==3.2.4
django-bootstrap4==3.0.1 django-bootstrap4==3.0.1
django-icons==4.0.0 django-icons==4.0.0
django-login-required-middleware==0.6.1 django-login-required-middleware==0.6.1

View file

@ -1,4 +1,4 @@
{% load staticfiles %} {% load static %}
{% load i18n %} {% load i18n %}
<html> <html>

View file

@ -24,7 +24,7 @@
--> -->
{% extends "console-base.html" %} {% extends "console-base.html" %}
{% load i18n %} {% load i18n %}
{% load staticfiles %} {% load static %}
{% block head %} {% block head %}
<title>WebVirtCloud - Spice Client - Full</title> <title>WebVirtCloud - Spice Client - Full</title>

View file

@ -24,7 +24,7 @@
--> -->
{% extends "console-base.html" %} {% extends "console-base.html" %}
{% load i18n %} {% load i18n %}
{% load staticfiles %} {% load static %}
{% block head %} {% block head %}
<title>WebVirtCloud - Spice - Lite</title> <title>WebVirtCloud - Spice - Lite</title>

View file

@ -1,6 +1,6 @@
{% extends "console-base.html" %} {% extends "console-base.html" %}
{% load i18n %} {% load i18n %}
{% load staticfiles %} {% load static %}
{% block head %} {% block head %}
<!-- <!--

View file

@ -1,6 +1,6 @@
{% extends "console-base.html" %} {% extends "console-base.html" %}
{% load i18n %} {% load i18n %}
{% load staticfiles %} {% load static %}
{% block head %} {% block head %}
<!-- <!--

View file

@ -1,10 +1,10 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load i18n %} {% load i18n %}
{% load icons %} {% load icons %}
{% load staticfiles %} {% load static %}
{% block title %}{% trans "Instances" %}{% endblock %} {% block title %}{% trans "Instances" %}{% endblock %}
{% block style %} {% block style %}
<link rel="stylesheet" href="{% static "css/sortable-theme-bootstrap.css" %}" /> <link rel="stylesheet" href="{% static 'css/sortable-theme-bootstrap.css' %}" />
{% endblock %} {% endblock %}
{% block page_heading %}{% trans "Instances" %}{% endblock page_heading %} {% block page_heading %}{% trans "Instances" %}{% endblock page_heading %}
@ -12,9 +12,7 @@
{% if request.user.is_superuser %} {% if request.user.is_superuser %}
{% include 'create_inst_block.html' %} {% include 'create_inst_block.html' %}
{% endif %} {% endif %}
<div class="float-right search"> {% include 'search_block.html' %}
<input id="filter" class="form-control" type="text" placeholder="{% trans 'Search' %}">
</div>
{% endblock page_heading_extra %} {% endblock page_heading_extra %}
{% block content %} {% block content %}
@ -37,7 +35,7 @@
</div> </div>
{% endblock content %} {% endblock content %}
{% block script %} {% block script %}
<script src="{% static "js/sortable.min.js" %}"></script> <script src="{% static 'js/sortable.min.js' %}"></script>
<script src="{% static 'js/filter-table.js' %}"></script> <script src="{% static 'js/filter-table.js' %}"></script>
{% if request.user.is_superuser %} {% if request.user.is_superuser %}
<script> <script>

View file

@ -1,6 +1,6 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load i18n %} {% load i18n %}
{% load staticfiles %} {% load static %}
{% block title %}{% trans "Create new instance" %} - {% trans "Select Type" %}{% endblock %} {% block title %}{% trans "Create new instance" %} - {% trans "Select Type" %}{% endblock %}

View file

@ -1,6 +1,6 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load i18n %} {% load i18n %}
{% load staticfiles %} {% load static %}
{% load icons %} {% load icons %}
{% block title %}{% trans "Create new instance" %}{% endblock %} {% block title %}{% trans "Create new instance" %}{% endblock %}

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load staticfiles %} {% load static %}
{% load i18n %} {% load i18n %}
{% block title %}{% trans "Instance" %} - {{ instance.name }}{% endblock %} {% block title %}{% trans "Instance" %} - {{ instance.name }}{% endblock %}

View file

@ -121,7 +121,7 @@
<div class="clearfix"></div> <div class="clearfix"></div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">{% trans "Close" %}</button> <button type="button" class="btn btn-secondary" data-dismiss="modal">{% trans "Close" %}</button>
<button type="submit" class="btn btn-success" name="edit_volume">{% trans "Save" %}</button> <button type="submit" class="btn btn-success" name="edit_volume" onclick="return confirm('{% trans "Are you sure to change volume properties?" %}')">{% trans "Save" %}</button>
</div><!-- /.modal-footer --> </div><!-- /.modal-footer -->
</div> <!-- /.modal-content --> </div> <!-- /.modal-content -->

View file

@ -290,7 +290,7 @@
<input type="hidden" name="dev" value="{{ disk.dev }}"> <input type="hidden" name="dev" value="{{ disk.dev }}">
<input type="hidden" name="storage" value="{{ disk.storage }}"> <input type="hidden" name="storage" value="{{ disk.storage }}">
<input type="hidden" name="name" value="{{ disk.image }}"> <input type="hidden" name="name" value="{{ disk.image }}">
{% include 'edit_instance_volume.html' with id=forloop.counter0 %} {% include 'instances/edit_instance_volume.html' with id=forloop.counter0 %}
</form> </form>
<form class="d-inline" action="{% url 'instances:detach_vol' instance.id %}" method="post"> <form class="d-inline" action="{% url 'instances:detach_vol' instance.id %}" method="post">
{% csrf_token %} {% csrf_token %}

View file

@ -596,8 +596,8 @@ def edit_volume(request, pk):
shareable = bool(request.POST.get("vol_shareable", False)) shareable = bool(request.POST.get("vol_shareable", False))
readonly = bool(request.POST.get("vol_readonly", False)) readonly = bool(request.POST.get("vol_readonly", False))
disk_type = request.POST.get("vol_type", "") disk_type = request.POST.get("vol_type", "")
new_bus = request.POST.get("vol_bus", "")
bus = request.POST.get("vol_bus_old", "") bus = request.POST.get("vol_bus_old", "")
new_bus = request.POST.get("vol_bus", bus)
serial = request.POST.get("vol_serial", "") serial = request.POST.get("vol_serial", "")
format = request.POST.get("vol_format", "") format = request.POST.get("vol_format", "")
cache = request.POST.get("vol_cache", app_settings.INSTANCE_VOLUME_DEFAULT_CACHE) cache = request.POST.get("vol_cache", app_settings.INSTANCE_VOLUME_DEFAULT_CACHE)

View file

@ -28,7 +28,7 @@
<a href="{% url 'nwfilters' compute.id %}"> <i class="fa fa-filter"></i> {% trans "NWFilters" %}</a> <a href="{% url 'nwfilters' compute.id %}"> <i class="fa fa-filter"></i> {% trans "NWFilters" %}</a>
</li> </li>
<li class="breadcrumb-item"> <li class="breadcrumb-item">
<a href="{% url 'secrets' compute.id %}"><i class="fa fa-key"></i> {% trans "Secrets" %}</a> <a href="{% url 'virtsecrets' compute.id %}"><i class="fa fa-key"></i> {% trans "Secrets" %}</a>
</li> </li>
</ol> </ol>
</div> </div>

View file

@ -1,6 +1,6 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load i18n %} {% load i18n %}
{% load staticfiles %} {% load static %}
{% block title %}{% trans "Interfaces" %} - {{ compute.name }}{% endblock %} {% block title %}{% trans "Interfaces" %} - {{ compute.name }}{% endblock %}
@ -32,7 +32,7 @@
<a href="{% url 'nwfilters' compute.id %}"><i class="fa fa-filter"></i> {% trans "NWFilters" %}</a> <a href="{% url 'nwfilters' compute.id %}"><i class="fa fa-filter"></i> {% trans "NWFilters" %}</a>
</li> </li>
<li class="breadcrumb-item"> <li class="breadcrumb-item">
<a href="{% url 'secrets' compute.id %}"><i class="fa fa-key"></i> {% trans "Secrets" %}</a> <a href="{% url 'virtsecrets' compute.id %}"><i class="fa fa-key"></i> {% trans "Secrets" %}</a>
</li> </li>
</ol> </ol>
</nav> </nav>

View file

@ -1,6 +1,6 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load i18n %} {% load i18n %}
{% load staticfiles %} {% load static %}
{% block title %}{% trans "Network" %} - {{ pool }}{% endblock %} {% block title %}{% trans "Network" %} - {{ pool }}{% endblock %}
@ -29,7 +29,7 @@
<a href="{% url 'nwfilters' compute.id %}"><i class="fa fa-filter"></i> {% trans "NWFilters" %}</a> <a href="{% url 'nwfilters' compute.id %}"><i class="fa fa-filter"></i> {% trans "NWFilters" %}</a>
</li> </li>
<li class="breadcrumb-item"> <li class="breadcrumb-item">
<a href="{% url 'secrets' compute.id %}"><i class="fa fa-key"></i> {% trans "Secrets" %}</a> <a href="{% url 'virtsecrets' compute.id %}"><i class="fa fa-key"></i> {% trans "Secrets" %}</a>
</li> </li>
</ol> </ol>

View file

@ -31,7 +31,7 @@
<a href="{% url 'nwfilters' compute.id %}"><i class="fa fa-filter"></i> {% trans "NWFilters" %}</a> <a href="{% url 'nwfilters' compute.id %}"><i class="fa fa-filter"></i> {% trans "NWFilters" %}</a>
</li> </li>
<li class="breadcrumb-item"> <li class="breadcrumb-item">
<a href="{% url 'secrets' compute.id %}"><i class="fa fa-key"></i> {% trans "Secrets" %}</a> <a href="{% url 'virtsecrets' compute.id %}"><i class="fa fa-key"></i> {% trans "Secrets" %}</a>
</li> </li>
</ol> </ol>
</nav> </nav>

View file

@ -1,6 +1,6 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load i18n %} {% load i18n %}
{% load staticfiles %} {% load static %}
{% block title %}{% trans "NWFilter" %}: {{ name }}{% endblock %} {% block title %}{% trans "NWFilter" %}: {{ name }}{% endblock %}
@ -29,7 +29,7 @@
<a href="{% url 'nwfilters' compute.id %}"><i class="fa fa-filter"></i> {% trans "NWFilters" %}</a> <a href="{% url 'nwfilters' compute.id %}"><i class="fa fa-filter"></i> {% trans "NWFilters" %}</a>
</li> </li>
<li class="breadcrumb-item"> <li class="breadcrumb-item">
<a href="{% url 'secrets' compute.id %}"><i class="fa fa-key"></i> {% trans "Secrets" %}</a> <a href="{% url 'virtsecrets' compute.id %}"><i class="fa fa-key"></i> {% trans "Secrets" %}</a>
</li> </li>
</ol> </ol>
</div> </div>
@ -66,8 +66,6 @@
<div class="row"> <div class="row">
<div class="col-lg-12"> <div class="col-lg-12">
<h5 class="page-header mr-auto">{% trans "Filter References" %} <h5 class="page-header mr-auto">{% trans "Filter References" %}
<form class="form-inline float-right" method="post" role="form" aria-label="Add NWFilter form">{% csrf_token %} <form class="form-inline float-right" method="post" role="form" aria-label="Add NWFilter form">{% csrf_token %}
<div class="form-group"> <div class="form-group">
<div class="input-group"> <div class="input-group">
@ -108,7 +106,7 @@
<td style="width:30px;"> <td style="width:30px;">
<form action="" method="post" role="form" aria-label="Delete NWFilter form">{% csrf_token %} <form action="" method="post" role="form" aria-label="Delete NWFilter form">{% csrf_token %}
<input type="hidden" name="ref" value="{{ ref }}"> <input type="hidden" name="ref" value="{{ ref }}">
<button type="submit" class="btn btn-sm btn-danger" name="del_nwfilter_ref" title="{% trans "Delete" %}" onclick="return confirm('{% trans "Are you sure?" %}')"> <button type="submit" class="btn btn-sm btn-danger" name="del_nwfilter_ref" title="{% trans "Delete" %}" onclick="return confirm('{% trans "Are you sure?" %}');">
<i class="fa fa-trash"></i> <i class="fa fa-trash"></i>
</button> </button>
</form> </form>
@ -148,7 +146,7 @@
<input type="hidden" name="action" value="{{ rule.action }}"> <input type="hidden" name="action" value="{{ rule.action }}">
<input type="hidden" name="direction" value="{{ rule.direction }}"> <input type="hidden" name="direction" value="{{ rule.direction }}">
<input type="hidden" name="priority" value="{{ rule.priority }}"> <input type="hidden" name="priority" value="{{ rule.priority }}">
<button type="submit" class="btn btn-sm btn-danger" name="del_nwfilter_rule" title="{% trans "Delete" %}" onclick="return confirm('{% trans "Are you sure?" %}')"> <button type="submit" class="btn btn-sm btn-danger" name="del_nwfilter_rule" title="{% trans 'Delete' %}" onclick="return confirm('{% trans "Are you sure?" %}');">
<i class="fa fa-trash"></i> <i class="fa fa-trash"></i>
</button> </button>
</form> </form>
@ -162,21 +160,8 @@
{% endblock %} {% endblock %}
{% block script %} {% block script %}
<script src="{% static "js/sortable.min.js" %}"></script> <script src="{% static 'js/sortable.min.js' %}"></script>
<script> <script src="{% static 'js/ace/ace.js' %}"></script>
$(document).ready(function () {
(function ($) {
$('#filter').keyup(function () {
var rex = new RegExp($(this).val(), 'i');
$('.searchable tr').hide();
$('.searchable tr').filter(function () {
return rex.test($(this).text());
}).show();
})
}(jQuery));
});
</script>
<script src="{% static "js/ace/ace.js" %}"></script>
<script> <script>
var editor = ace.edit("edit_editor"); var editor = ace.edit("edit_editor");
editor.getSession().setMode("ace/mode/xml"); editor.getSession().setMode("ace/mode/xml");

View file

@ -1,6 +1,6 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load i18n %} {% load i18n %}
{% load staticfiles %} {% load static %}
{% block title %}{% trans "NWFilters" %} - {{ compute.name }}{% endblock %} {% block title %}{% trans "NWFilters" %} - {{ compute.name }}{% endblock %}
@ -8,9 +8,7 @@
{% block page_heading_extra %} {% block page_heading_extra %}
{% include 'create_nwfilter_block.html' %} {% include 'create_nwfilter_block.html' %}
<div class="float-right search"> {% include 'search_block.html' %}
<input id="filter" class="form-control" type="text" placeholder="{% trans 'Search' %}">
</div>
{% endblock page_heading_extra %} {% endblock page_heading_extra %}
{% block content %} {% block content %}
@ -37,7 +35,7 @@
<span class="font-weight-bold"><i class="fa fa-filter"></i> {% trans "NWFilters" %}</span> <span class="font-weight-bold"><i class="fa fa-filter"></i> {% trans "NWFilters" %}</span>
</li> </li>
<li class="breadcrumb-item"> <li class="breadcrumb-item">
<a href="{% url 'secrets' compute.id %}"><i class="fa fa-key"></i> {% trans "Secrets" %}</a> <a href="{% url 'virtsecrets' compute.id %}"><i class="fa fa-key"></i> {% trans "Secrets" %}</a>
</li> </li>
</ol> </ol>
</nav> </nav>
@ -142,22 +140,9 @@
{% endblock %} {% endblock %}
{% block script %} {% block script %}
<script src="{% static "js/sortable.min.js" %}"></script> <script src="{% static 'js/sortable.min.js' %}"></script>
<script> <script src="{% static 'js/filter-table.js' %}"></script>
$(document).ready(function () { <script src="{% static 'js/ace/ace.js' %}"></script>
(function ($) {
$('#filter').keyup(function () {
var rex = new RegExp($(this).val(), 'i');
$('.searchable tr').hide();
$('.searchable tr').filter(function () {
return rex.test($(this).text());
}).show();
})
}(jQuery));
});
</script>
<script src="{% static "js/ace/ace.js" %}"></script>
<script> <script>
var editor = ace.edit("editor"); var editor = ace.edit("editor");
editor.getSession().setMode("ace/mode/xml"); editor.getSession().setMode("ace/mode/xml");

View file

@ -4,12 +4,12 @@ function filter_table() {
$('.searchable tr').filter(function () { $('.searchable tr').filter(function () {
return rex.test($(this).text()); return rex.test($(this).text());
}).show(); }).show();
Cookies.set("instances_filter", $(this).val(), { expires: 1 }); Cookies.set(document.title + "_filter", $(this).val(), { expires: 1 });
} }
$(document).ready(function () { $(document).ready(function () {
instances_filter_cookie = Cookies.get("instances_filter"); filter_cookie = Cookies.get(document.title + "_filter");
if (instances_filter_cookie) { if (filter_cookie) {
$('#filter').val(instances_filter_cookie); $('#filter').val(filter_cookie);
$('#filter').each(filter_table); $('#filter').each(filter_table);
} }
(function ($) { (function ($) {

View file

@ -1,6 +1,6 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load i18n %} {% load i18n %}
{% load staticfiles %} {% load static %}
{% block title %}{{ compute }} - {% trans "Storage" %}: {{ pool }}{% endblock %} {% block title %}{{ compute }} - {% trans "Storage" %}: {{ pool }}{% endblock %}
{% block style %} {% block style %}
<link rel="stylesheet" href="{% static "css/sortable-theme-bootstrap.css" %}"/> <link rel="stylesheet" href="{% static "css/sortable-theme-bootstrap.css" %}"/>
@ -34,7 +34,7 @@
<a href="{% url 'nwfilters' compute.id %}"><i class="fa fa-filter"></i> {% trans "NWFilters" %}</a> <a href="{% url 'nwfilters' compute.id %}"><i class="fa fa-filter"></i> {% trans "NWFilters" %}</a>
</li> </li>
<li class="breadcrumb-item"> <li class="breadcrumb-item">
<a href="{% url 'secrets' compute.id %}"><i class="fa fa-key"></i> {% trans "Secrets" %}</a> <a href="{% url 'virtsecrets' compute.id %}"><i class="fa fa-key"></i> {% trans "Secrets" %}</a>
</li> </li>
</ol> </ol>
</div> </div>
@ -81,10 +81,10 @@
</dl> </dl>
{% if state %} {% if state %}
<div class="container">
<div class="row"> <div class="row">
<h5 class="page-header mr-auto">{% trans "Volumes" %}</h5> <h5 class="page-header mr-auto">{% trans "Volumes" %}</h5>
<div class="col-3 "> {% include 'search_block.html' %}
<input id="filter" class="form-control" type="text" placeholder="{% trans 'Search' %}">
</div> </div>
</div> </div>
@ -194,7 +194,8 @@
{% include 'pleasewaitdialog.html' %} {% include 'pleasewaitdialog.html' %}
{% endblock %} {% endblock %}
{% block script %} {% block script %}
<script src="{% static "js/sortable.min.js" %}"></script> <script src="{% static 'js/sortable.min.js' %}"></script>
<script src="{% static 'js/filter-table.js' %}"></script>
<script> <script>
$('.format-convert').hide(); $('.format-convert').hide();
$(document).on('change', '.volume-convert', function () { $(document).on('change', '.volume-convert', function () {
@ -216,17 +217,4 @@
} }
}); });
</script> </script>
<script>
$(document).ready(function () {
(function ($) {
$('#filter').keyup(function () {
var rex = new RegExp($(this).val(), 'i');
$('.searchable tr').hide();
$('.searchable tr').filter(function () {
return rex.test($(this).text());
}).show();
})
}(jQuery));
});
</script>
{% endblock %} {% endblock %}

View file

@ -31,7 +31,7 @@
<a href="{% url 'nwfilters' compute.id %}"><i class="fa fa-filter"></i> {% trans "NWFilters" %}</a> <a href="{% url 'nwfilters' compute.id %}"><i class="fa fa-filter"></i> {% trans "NWFilters" %}</a>
</li> </li>
<li class="breadcrumb-item"> <li class="breadcrumb-item">
<a href="{% url 'secrets' compute.id %}"><i class="fa fa-key"></i> {% trans "Secrets" %}</a> <a href="{% url 'virtsecrets' compute.id %}"><i class="fa fa-key"></i> {% trans "Secrets" %}</a>
</li> </li>
</ol> </ol>
</nav> </nav>

View file

@ -1,4 +1,4 @@
{% load i18n %} {% load i18n %}
<div class="float-right search"> <div class="float-right search">
<input id="filter" class="form-control" type="text" placeholder="{% trans "Search" %}"> <input id="filter" class="form-control" type="text" placeholder="{% trans 'Search' %}">
</div> </div>

View file

@ -1,6 +1,6 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load i18n %} {% load i18n %}
{% load staticfiles %} {% load static %}
{% block title %}{% trans "Secrets" %} - {{ compute.name }}{% endblock %} {% block title %}{% trans "Secrets" %} - {{ compute.name }}{% endblock %}
{% block style %} {% block style %}

View file

@ -1,4 +1,4 @@
from secrets.forms import AddSecret from virtsecrets.forms import AddSecret
from admin.decorators import superuser_only from admin.decorators import superuser_only
from computes.models import Compute from computes.models import Compute
@ -13,7 +13,7 @@ from libvirt import (
VIR_SECRET_USAGE_TYPE_VOLUME, VIR_SECRET_USAGE_TYPE_VOLUME,
libvirtError, libvirtError,
) )
from vrtManager.secrets import wvmSecrets from vrtManager.virtsecrets import wvmSecrets
@superuser_only @superuser_only

16
webvirtcloud/asgi.py Normal file
View file

@ -0,0 +1,16 @@
"""
ASGI config for webvirtcloud project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'webvirtcloud.settings')
application = get_asgi_application()

View file

@ -35,6 +35,8 @@ try:
userDn, userDn,
password) as con: password) as con:
return username return username
except:
return None
return None return None
def authenticate(self, request, username=None, password=None, **kwargs): def authenticate(self, request, username=None, password=None, **kwargs):

View file

@ -3,10 +3,10 @@ Django settings for webvirtcloud project.
""" """
import os from pathlib import Path
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) # Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) BASE_DIR = Path(__file__).resolve().parent.parent
SECRET_KEY = "" SECRET_KEY = ""
@ -36,7 +36,7 @@ INSTALLED_APPS = [
"interfaces", "interfaces",
"nwfilters", "nwfilters",
"storages", "storages",
"secrets", "virtsecrets",
"logs", "logs",
"qr_code", "qr_code",
] ]
@ -63,7 +63,7 @@ TEMPLATES = [
{ {
"BACKEND": "django.template.backends.django.DjangoTemplates", "BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [ "DIRS": [
os.path.join(BASE_DIR, "templates"), Path.joinpath(BASE_DIR, "templates"),
], ],
"APP_DIRS": True, "APP_DIRS": True,
"OPTIONS": { "OPTIONS": {
@ -83,6 +83,7 @@ TEMPLATES = [
WSGI_APPLICATION = "webvirtcloud.wsgi.application" WSGI_APPLICATION = "webvirtcloud.wsgi.application"
# Settings for django-icons # Settings for django-icons
DJANGO_ICONS = { DJANGO_ICONS = {
@ -96,13 +97,14 @@ DJANGO_ICONS = {
}, },
} }
# Database # Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases # https://docs.djangoproject.com/en/3.0/ref/settings/#databases
DATABASES = { DATABASES = {
"default": { "default": {
"ENGINE": "django.db.backends.sqlite3", "ENGINE": "django.db.backends.sqlite3",
"NAME": os.path.join(BASE_DIR, "db.sqlite3"), "NAME": Path.joinpath(BASE_DIR, "db.sqlite3"),
} }
} }
@ -128,13 +130,35 @@ USE_TZ = True
STATIC_URL = "/static/" STATIC_URL = "/static/"
STATICFILES_DIRS = [ STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static"), Path.joinpath(BASE_DIR, "static"),
] ]
# Default primary key field type
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
LOCALE_PATHS = [ LOCALE_PATHS = [
"locale/", "locale/",
] ]
# Settings for django-icons
DJANGO_ICONS = {
'DEFAULTS': {
'renderer': 'fontawesome4',
},
'RENDERERS': {
'fontawesome4': 'FontAwesome4Renderer',
'bootstrap3': 'Bootstrap3Renderer',
},
}
LOGGING = { LOGGING = {
"version": 1, "version": 1,
"disable_existing_loggers": False, "disable_existing_loggers": False,
@ -150,6 +174,7 @@ LOGGING = {
}, },
} }
# #
# WebVirtCloud settings # WebVirtCloud settings
# #
@ -223,10 +248,15 @@ ALLOW_EMPTY_PASSWORD = False
NEW_USER_DEFAULT_INSTANCES = [] NEW_USER_DEFAULT_INSTANCES = []
SHOW_PROFILE_EDIT_PASSWORD = True SHOW_PROFILE_EDIT_PASSWORD = True
# OTP Config
OTP_ENABLED = False OTP_ENABLED = False
LOGIN_REQUIRED_IGNORE_VIEW_NAMES = ["accounts:login", "accounts:email_otp"] LOGIN_REQUIRED_IGNORE_VIEW_NAMES = ["accounts:login", "accounts:email_otp"]
# LDAP Config
#
LDAP_ENABLED = False LDAP_ENABLED = False
LDAP_URL = '' LDAP_URL = ''
LDAP_PORT = 389 LDAP_PORT = 389

View file

@ -4,7 +4,7 @@ WSGI config for webvirtcloud project.
It exposes the WSGI callable as a module-level variable named ``application``. It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see For more information on this file, see
https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/ https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/
""" """
import os import os

View file

@ -4,7 +4,7 @@ WSGI config for webvirtcloud project.
It exposes the WSGI callable as a module-level variable named ``application``. It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see For more information on this file, see
https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/ https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/
""" """
import os import os
import sys import sys