mirror of
https://github.com/retspen/webvirtcloud
synced 2024-12-24 15:15:22 +00:00
commit
375479cf2f
47 changed files with 156 additions and 157 deletions
|
@ -2,14 +2,14 @@ language: python
|
|||
python:
|
||||
- "3.6"
|
||||
env:
|
||||
- DJANGO=2.2.16
|
||||
- DJANGO=3.2.4
|
||||
install:
|
||||
- pip install -r dev/requirements.txt
|
||||
script:
|
||||
- pep8 --exclude=IPy.py --ignore=E501 vrtManager accounts admin appsettings computes \
|
||||
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 \
|
||||
nwfilters networks secrets storages logs
|
||||
logs networks nwfilters storages virtsecrets
|
||||
- python manage.py migrate
|
||||
- python manage.py test --settings=webvirtcloud.settings-dev
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FROM phusion/baseimage:18.04-1.0.0
|
||||
FROM phusion/baseimage:focal-1.0.0
|
||||
|
||||
EXPOSE 80
|
||||
EXPOSE 6080
|
||||
|
|
|
@ -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)
|
||||
|
||||
# WebVirtCloud
|
||||
###### Python3 & Django 2.2
|
||||
###### Python 3.x & Django 3.2 LTS
|
||||
|
||||
## Features
|
||||
* QEMU/KVM Hypervisor Management
|
||||
|
|
|
@ -9,9 +9,7 @@
|
|||
<a href="{% url 'admin:group_create' %}" class="btn btn-success btn-header float-right">
|
||||
{% icon 'plus' %}
|
||||
</a>
|
||||
<div class="float-right search">
|
||||
<input id="filter" class="form-control" type="text" placeholder="{% trans "Search" %}">
|
||||
</div>
|
||||
{% include 'search_block.html' %}
|
||||
<h1 class="page-header">{% trans "Groups" %}</h1>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -12,9 +12,7 @@
|
|||
<a href="{% url 'admin:user_create' %}" class="btn btn-success btn-header float-right">
|
||||
{% icon 'plus' %}
|
||||
</a>
|
||||
<div class="float-right search">
|
||||
<input id="filter" class="form-control" type="text" placeholder="{% trans "Search" %}">
|
||||
</div>
|
||||
{% include 'search_block.html' %}
|
||||
{% endblock page_heading_extra %}
|
||||
|
||||
{% block content %}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{% extends "base.html" %}
|
||||
{% load i18n %}
|
||||
{% load staticfiles %}
|
||||
{% load static %}
|
||||
{% load icons %}
|
||||
{% block title %}{% trans "Instances" %} - {{ compute.name }}{% endblock %}
|
||||
{% block style %}
|
||||
|
@ -14,9 +14,7 @@
|
|||
{% icon 'plus' %}
|
||||
</a>
|
||||
{% if instances %}
|
||||
<div class="float-right search">
|
||||
<input id="filter" class="form-control" type="text" placeholder="{% trans 'Search' %}">
|
||||
</div>
|
||||
{% include 'search_block.html' %}
|
||||
{% endif %}
|
||||
{% endblock page_heading_extra %}
|
||||
|
||||
|
@ -44,7 +42,7 @@
|
|||
<a href="{% url 'nwfilters' compute.id %}">{% icon 'filter' %} {% trans "NWFilters" %}</a>
|
||||
</li>
|
||||
<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>
|
||||
</ol>
|
||||
</nav>
|
||||
|
|
|
@ -22,9 +22,9 @@
|
|||
</div>
|
||||
{% else %}
|
||||
<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>
|
||||
<tr class="d-flex">
|
||||
<tr>
|
||||
<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-5">{% trans "Details" %}</th>
|
||||
|
@ -33,7 +33,7 @@
|
|||
</thead>
|
||||
<tbody class="searchable">
|
||||
{% for compute in computes %}
|
||||
<tr class="d-flex">
|
||||
<tr>
|
||||
<td class="col-sm-3">
|
||||
{{ compute.name }}
|
||||
</td>
|
||||
|
@ -64,5 +64,6 @@
|
|||
{% endblock content %}
|
||||
|
||||
{% 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 %}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{% extends "base.html" %}
|
||||
{% load i18n %}
|
||||
{% load staticfiles %}
|
||||
{% load static %}
|
||||
{% load icons %}
|
||||
|
||||
{% block title %}{% trans "Overview" %} - {{ compute.name }}{% endblock %}
|
||||
|
@ -31,7 +31,7 @@
|
|||
<a href="{% url 'nwfilters' compute.id %}">{% icon 'filter' %} {% trans "NWFilters" %}</a>
|
||||
</li>
|
||||
<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>
|
||||
</ol>
|
||||
</nav>
|
||||
|
|
|
@ -115,7 +115,7 @@ class ComputesTestCase(TestCase):
|
|||
# TODO: add test for single nwfilter
|
||||
|
||||
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)
|
||||
|
||||
# def test_create_instance_select_type(self):
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from secrets.views import secrets
|
||||
from virtsecrets.views import secrets
|
||||
|
||||
from django.urls import include, path
|
||||
# from instances.views import create_instance, create_instance_select_type
|
||||
|
@ -33,7 +33,7 @@ urlpatterns = [
|
|||
path('interface/<str:iface>/', interface, name='interface'),
|
||||
path('nwfilters/', nwfilters, name='nwfilters'),
|
||||
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/archs/<str:arch>/machines/<str:machine>/', create_instance, name='create_instance'),
|
||||
path('archs/<str:arch>/machines/', views.get_compute_machine_types, name='machines'),
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Django==2.2.22
|
||||
Django==3.2.4
|
||||
django-bootstrap4==3.0.1
|
||||
django-icons==4.0.0
|
||||
django-login-required-middleware==0.6.1
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{% load staticfiles %}
|
||||
{% load static %}
|
||||
{% load i18n %}
|
||||
<html>
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
-->
|
||||
{% extends "console-base.html" %}
|
||||
{% load i18n %}
|
||||
{% load staticfiles %}
|
||||
{% load static %}
|
||||
|
||||
{% block head %}
|
||||
<title>WebVirtCloud - Spice Client - Full</title>
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
-->
|
||||
{% extends "console-base.html" %}
|
||||
{% load i18n %}
|
||||
{% load staticfiles %}
|
||||
{% load static %}
|
||||
|
||||
{% block head %}
|
||||
<title>WebVirtCloud - Spice - Lite</title>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{% extends "console-base.html" %}
|
||||
{% load i18n %}
|
||||
{% load staticfiles %}
|
||||
{% load static %}
|
||||
|
||||
{% block head %}
|
||||
<!--
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{% extends "console-base.html" %}
|
||||
{% load i18n %}
|
||||
{% load staticfiles %}
|
||||
{% load static %}
|
||||
|
||||
{% block head %}
|
||||
<!--
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
{% extends "base.html" %}
|
||||
{% load i18n %}
|
||||
{% load icons %}
|
||||
{% load staticfiles %}
|
||||
{% load static %}
|
||||
{% block title %}{% trans "Instances" %}{% endblock %}
|
||||
{% block style %}
|
||||
<link rel="stylesheet" href="{% static "css/sortable-theme-bootstrap.css" %}" />
|
||||
<link rel="stylesheet" href="{% static 'css/sortable-theme-bootstrap.css' %}" />
|
||||
{% endblock %}
|
||||
{% block page_heading %}{% trans "Instances" %}{% endblock page_heading %}
|
||||
|
||||
|
@ -12,9 +12,7 @@
|
|||
{% if request.user.is_superuser %}
|
||||
{% include 'create_inst_block.html' %}
|
||||
{% endif %}
|
||||
<div class="float-right search">
|
||||
<input id="filter" class="form-control" type="text" placeholder="{% trans 'Search' %}">
|
||||
</div>
|
||||
{% include 'search_block.html' %}
|
||||
{% endblock page_heading_extra %}
|
||||
|
||||
{% block content %}
|
||||
|
@ -37,7 +35,7 @@
|
|||
</div>
|
||||
{% endblock content %}
|
||||
{% 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>
|
||||
{% if request.user.is_superuser %}
|
||||
<script>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{% extends "base.html" %}
|
||||
{% load i18n %}
|
||||
{% load staticfiles %}
|
||||
{% load static %}
|
||||
|
||||
{% block title %}{% trans "Create new instance" %} - {% trans "Select Type" %}{% endblock %}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{% extends "base.html" %}
|
||||
{% load i18n %}
|
||||
{% load staticfiles %}
|
||||
{% load static %}
|
||||
{% load icons %}
|
||||
{% block title %}{% trans "Create new instance" %}{% endblock %}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% extends "base.html" %}
|
||||
{% load staticfiles %}
|
||||
{% load static %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block title %}{% trans "Instance" %} - {{ instance.name }}{% endblock %}
|
||||
|
|
|
@ -121,7 +121,7 @@
|
|||
<div class="clearfix"></div>
|
||||
<div class="modal-footer">
|
||||
<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-content -->
|
|
@ -290,7 +290,7 @@
|
|||
<input type="hidden" name="dev" value="{{ disk.dev }}">
|
||||
<input type="hidden" name="storage" value="{{ disk.storage }}">
|
||||
<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 class="d-inline" action="{% url 'instances:detach_vol' instance.id %}" method="post">
|
||||
{% csrf_token %}
|
||||
|
|
|
@ -596,8 +596,8 @@ def edit_volume(request, pk):
|
|||
shareable = bool(request.POST.get("vol_shareable", False))
|
||||
readonly = bool(request.POST.get("vol_readonly", False))
|
||||
disk_type = request.POST.get("vol_type", "")
|
||||
new_bus = request.POST.get("vol_bus", "")
|
||||
bus = request.POST.get("vol_bus_old", "")
|
||||
new_bus = request.POST.get("vol_bus", bus)
|
||||
serial = request.POST.get("vol_serial", "")
|
||||
format = request.POST.get("vol_format", "")
|
||||
cache = request.POST.get("vol_cache", app_settings.INSTANCE_VOLUME_DEFAULT_CACHE)
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
<a href="{% url 'nwfilters' compute.id %}"> <i class="fa fa-filter"></i> {% trans "NWFilters" %}</a>
|
||||
</li>
|
||||
<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>
|
||||
</ol>
|
||||
</div>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{% extends "base.html" %}
|
||||
{% load i18n %}
|
||||
{% load staticfiles %}
|
||||
{% load static %}
|
||||
|
||||
{% 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>
|
||||
</li>
|
||||
<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>
|
||||
</ol>
|
||||
</nav>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{% extends "base.html" %}
|
||||
{% load i18n %}
|
||||
{% load staticfiles %}
|
||||
{% load static %}
|
||||
|
||||
{% 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>
|
||||
</li>
|
||||
<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>
|
||||
</ol>
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
<a href="{% url 'nwfilters' compute.id %}"><i class="fa fa-filter"></i> {% trans "NWFilters" %}</a>
|
||||
</li>
|
||||
<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>
|
||||
</ol>
|
||||
</nav>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{% extends "base.html" %}
|
||||
{% load i18n %}
|
||||
{% load staticfiles %}
|
||||
{% load static %}
|
||||
|
||||
{% 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>
|
||||
</li>
|
||||
<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>
|
||||
</ol>
|
||||
</div>
|
||||
|
@ -66,8 +66,6 @@
|
|||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<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 %}
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
|
@ -108,7 +106,7 @@
|
|||
<td style="width:30px;">
|
||||
<form action="" method="post" role="form" aria-label="Delete NWFilter form">{% csrf_token %}
|
||||
<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>
|
||||
</button>
|
||||
</form>
|
||||
|
@ -148,7 +146,7 @@
|
|||
<input type="hidden" name="action" value="{{ rule.action }}">
|
||||
<input type="hidden" name="direction" value="{{ rule.direction }}">
|
||||
<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>
|
||||
</button>
|
||||
</form>
|
||||
|
@ -162,21 +160,8 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block script %}
|
||||
<script src="{% static "js/sortable.min.js" %}"></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>
|
||||
<script src="{% static "js/ace/ace.js" %}"></script>
|
||||
<script src="{% static 'js/sortable.min.js' %}"></script>
|
||||
<script src="{% static 'js/ace/ace.js' %}"></script>
|
||||
<script>
|
||||
var editor = ace.edit("edit_editor");
|
||||
editor.getSession().setMode("ace/mode/xml");
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{% extends "base.html" %}
|
||||
{% load i18n %}
|
||||
{% load staticfiles %}
|
||||
{% load static %}
|
||||
|
||||
{% block title %}{% trans "NWFilters" %} - {{ compute.name }}{% endblock %}
|
||||
|
||||
|
@ -8,9 +8,7 @@
|
|||
|
||||
{% block page_heading_extra %}
|
||||
{% include 'create_nwfilter_block.html' %}
|
||||
<div class="float-right search">
|
||||
<input id="filter" class="form-control" type="text" placeholder="{% trans 'Search' %}">
|
||||
</div>
|
||||
{% include 'search_block.html' %}
|
||||
{% endblock page_heading_extra %}
|
||||
|
||||
{% block content %}
|
||||
|
@ -37,7 +35,7 @@
|
|||
<span class="font-weight-bold"><i class="fa fa-filter"></i> {% trans "NWFilters" %}</span>
|
||||
</li>
|
||||
<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>
|
||||
</ol>
|
||||
</nav>
|
||||
|
@ -142,24 +140,11 @@
|
|||
{% endblock %}
|
||||
|
||||
{% 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/ace/ace.js' %}"></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>
|
||||
|
||||
<script src="{% static "js/ace/ace.js" %}"></script>
|
||||
<script>
|
||||
var editor = ace.edit("editor");
|
||||
var editor = ace.edit("editor");
|
||||
editor.getSession().setMode("ace/mode/xml");
|
||||
|
||||
var input = $('input[name="nwfilter_xml"]');
|
||||
|
|
|
@ -4,12 +4,12 @@ function filter_table() {
|
|||
$('.searchable tr').filter(function () {
|
||||
return rex.test($(this).text());
|
||||
}).show();
|
||||
Cookies.set("instances_filter", $(this).val(), { expires: 1 });
|
||||
Cookies.set(document.title + "_filter", $(this).val(), { expires: 1 });
|
||||
}
|
||||
$(document).ready(function () {
|
||||
instances_filter_cookie = Cookies.get("instances_filter");
|
||||
if (instances_filter_cookie) {
|
||||
$('#filter').val(instances_filter_cookie);
|
||||
filter_cookie = Cookies.get(document.title + "_filter");
|
||||
if (filter_cookie) {
|
||||
$('#filter').val(filter_cookie);
|
||||
$('#filter').each(filter_table);
|
||||
}
|
||||
(function ($) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{% extends "base.html" %}
|
||||
{% load i18n %}
|
||||
{% load staticfiles %}
|
||||
{% load static %}
|
||||
{% block title %}{{ compute }} - {% trans "Storage" %}: {{ pool }}{% endblock %}
|
||||
{% block style %}
|
||||
<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>
|
||||
</li>
|
||||
<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>
|
||||
</ol>
|
||||
</div>
|
||||
|
@ -81,10 +81,10 @@
|
|||
</dl>
|
||||
|
||||
{% if state %}
|
||||
<div class="row">
|
||||
<h5 class="page-header mr-auto">{% trans "Volumes" %}</h5>
|
||||
<div class="col-3 ">
|
||||
<input id="filter" class="form-control" type="text" placeholder="{% trans 'Search' %}">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<h5 class="page-header mr-auto">{% trans "Volumes" %}</h5>
|
||||
{% include 'search_block.html' %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -194,7 +194,8 @@
|
|||
{% include 'pleasewaitdialog.html' %}
|
||||
{% endblock %}
|
||||
{% 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>
|
||||
$('.format-convert').hide();
|
||||
$(document).on('change', '.volume-convert', function () {
|
||||
|
@ -216,17 +217,4 @@
|
|||
}
|
||||
});
|
||||
</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 %}
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
<a href="{% url 'nwfilters' compute.id %}"><i class="fa fa-filter"></i> {% trans "NWFilters" %}</a>
|
||||
</li>
|
||||
<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>
|
||||
</ol>
|
||||
</nav>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{% load i18n %}
|
||||
<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>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{% extends "base.html" %}
|
||||
{% load i18n %}
|
||||
{% load staticfiles %}
|
||||
{% load static %}
|
||||
{% block title %}{% trans "Secrets" %} - {{ compute.name }}{% endblock %}
|
||||
|
||||
{% block style %}
|
|
@ -1,4 +1,4 @@
|
|||
from secrets.forms import AddSecret
|
||||
from virtsecrets.forms import AddSecret
|
||||
|
||||
from admin.decorators import superuser_only
|
||||
from computes.models import Compute
|
||||
|
@ -13,7 +13,7 @@ from libvirt import (
|
|||
VIR_SECRET_USAGE_TYPE_VOLUME,
|
||||
libvirtError,
|
||||
)
|
||||
from vrtManager.secrets import wvmSecrets
|
||||
from vrtManager.virtsecrets import wvmSecrets
|
||||
|
||||
|
||||
@superuser_only
|
16
webvirtcloud/asgi.py
Normal file
16
webvirtcloud/asgi.py
Normal 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()
|
|
@ -11,33 +11,35 @@ try:
|
|||
#/srv/webvirtcloud/ldap/ldapbackend.py
|
||||
class LdapAuthenticationBackend(ModelBackend):
|
||||
|
||||
def get_LDAP_user(self, username, password, filterString):
|
||||
print('get_LDAP_user')
|
||||
try:
|
||||
server = Server(settings.LDAP_URL, port=settings.LDAP_PORT,
|
||||
use_ssl=settings.USE_SSL,get_info=ALL)
|
||||
connection = Connection(server,
|
||||
settings.LDAP_MASTER_DN,
|
||||
settings.LDAP_MASTER_PW, auto_bind=True)
|
||||
def get_LDAP_user(self, username, password, filterString):
|
||||
print('get_LDAP_user')
|
||||
try:
|
||||
server = Server(settings.LDAP_URL, port=settings.LDAP_PORT,
|
||||
use_ssl=settings.USE_SSL,get_info=ALL)
|
||||
connection = Connection(server,
|
||||
settings.LDAP_MASTER_DN,
|
||||
settings.LDAP_MASTER_PW, auto_bind=True)
|
||||
|
||||
connection.search(settings.LDAP_ROOT_DN,
|
||||
'(&({attr}={login})({filter}))'.format(
|
||||
attr=settings.LDAP_USER_UID_PREFIX,
|
||||
login=username,
|
||||
filter=filterString), attributes=['*'])
|
||||
|
||||
if len(connection.response) == 0:
|
||||
print('get_LDAP_user-no response')
|
||||
return None
|
||||
specificUser = connection.response[0]
|
||||
userDn = str(specificUser.get('raw_dn'),'utf-8')
|
||||
with Connection(server,
|
||||
userDn,
|
||||
password) as con:
|
||||
return username
|
||||
except:
|
||||
return None
|
||||
return None
|
||||
|
||||
connection.search(settings.LDAP_ROOT_DN,
|
||||
'(&({attr}={login})({filter}))'.format(
|
||||
attr=settings.LDAP_USER_UID_PREFIX,
|
||||
login=username,
|
||||
filter=filterString), attributes=['*'])
|
||||
|
||||
if len(connection.response) == 0:
|
||||
print('get_LDAP_user-no response')
|
||||
return None
|
||||
specificUser = connection.response[0]
|
||||
userDn = str(specificUser.get('raw_dn'),'utf-8')
|
||||
with Connection(server,
|
||||
userDn,
|
||||
password) as con:
|
||||
return username
|
||||
return None
|
||||
|
||||
def authenticate(self, request, username=None, password=None, **kwargs):
|
||||
def authenticate(self, request, username=None, password=None, **kwargs):
|
||||
if not settings.LDAP_ENABLED:
|
||||
return None
|
||||
print("authenticate_ldap")
|
||||
|
@ -96,7 +98,7 @@ try:
|
|||
print("authenticate-user created")
|
||||
return user
|
||||
|
||||
def get_user(self, user_id):
|
||||
def get_user(self, user_id):
|
||||
if not settings.LDAP_ENABLED:
|
||||
return None
|
||||
print("get_user_ldap")
|
||||
|
|
|
@ -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, ...)
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
|
||||
SECRET_KEY = ""
|
||||
|
||||
|
@ -36,7 +36,7 @@ INSTALLED_APPS = [
|
|||
"interfaces",
|
||||
"nwfilters",
|
||||
"storages",
|
||||
"secrets",
|
||||
"virtsecrets",
|
||||
"logs",
|
||||
"qr_code",
|
||||
]
|
||||
|
@ -63,7 +63,7 @@ TEMPLATES = [
|
|||
{
|
||||
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
||||
"DIRS": [
|
||||
os.path.join(BASE_DIR, "templates"),
|
||||
Path.joinpath(BASE_DIR, "templates"),
|
||||
],
|
||||
"APP_DIRS": True,
|
||||
"OPTIONS": {
|
||||
|
@ -83,6 +83,7 @@ TEMPLATES = [
|
|||
|
||||
WSGI_APPLICATION = "webvirtcloud.wsgi.application"
|
||||
|
||||
|
||||
# Settings for django-icons
|
||||
DJANGO_ICONS = {
|
||||
|
||||
|
@ -96,13 +97,14 @@ DJANGO_ICONS = {
|
|||
},
|
||||
}
|
||||
|
||||
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
|
||||
|
||||
DATABASES = {
|
||||
"default": {
|
||||
"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/"
|
||||
|
||||
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/",
|
||||
]
|
||||
|
||||
|
||||
# Settings for django-icons
|
||||
DJANGO_ICONS = {
|
||||
|
||||
'DEFAULTS': {
|
||||
'renderer': 'fontawesome4',
|
||||
},
|
||||
|
||||
'RENDERERS': {
|
||||
'fontawesome4': 'FontAwesome4Renderer',
|
||||
'bootstrap3': 'Bootstrap3Renderer',
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
LOGGING = {
|
||||
"version": 1,
|
||||
"disable_existing_loggers": False,
|
||||
|
@ -150,6 +174,7 @@ LOGGING = {
|
|||
},
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# WebVirtCloud settings
|
||||
#
|
||||
|
@ -223,10 +248,15 @@ ALLOW_EMPTY_PASSWORD = False
|
|||
NEW_USER_DEFAULT_INSTANCES = []
|
||||
SHOW_PROFILE_EDIT_PASSWORD = True
|
||||
|
||||
|
||||
# OTP Config
|
||||
OTP_ENABLED = False
|
||||
|
||||
LOGIN_REQUIRED_IGNORE_VIEW_NAMES = ["accounts:login", "accounts:email_otp"]
|
||||
|
||||
# LDAP Config
|
||||
#
|
||||
|
||||
LDAP_ENABLED = False
|
||||
LDAP_URL = ''
|
||||
LDAP_PORT = 389
|
||||
|
|
|
@ -4,7 +4,7 @@ WSGI config for webvirtcloud project.
|
|||
It exposes the WSGI callable as a module-level variable named ``application``.
|
||||
|
||||
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
|
||||
|
|
|
@ -4,7 +4,7 @@ WSGI config for webvirtcloud project.
|
|||
It exposes the WSGI callable as a module-level variable named ``application``.
|
||||
|
||||
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 sys
|
||||
|
|
Loading…
Reference in a new issue