diff --git a/.gitignore b/.gitignore index 82f321e..8860fff 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ webvirtcloud/settings.py .coverage htmlcov *.log +templates/webvirtcloud.code-workspace diff --git a/accounts/templates/account.html b/accounts/templates/account.html index dfd51dd..3dc7768 100644 --- a/accounts/templates/account.html +++ b/accounts/templates/account.html @@ -1,7 +1,7 @@ {% extends "base.html" %} {% load i18n %} -{% load icons %} +{% load bootstrap_icons %} {% load qr_code %} {% block title %}{% trans "User Profile" %} - {{ user }}{% endblock %} @@ -10,14 +10,14 @@ {% block page_heading_extra %} {% if otp_enabled %} - {% icon 'qrcode' %} + {% bs_icon 'qr-code' %} {% endif %} - {% icon 'pencil' %} + {% bs_icon 'pencil' %} - {% icon 'plus' %} + {% bs_icon 'plus-circle-fill' %} {% endblock page_heading_extra %} @@ -58,12 +58,12 @@ {{ inst.is_delete }} - {% icon 'pencil' %} + {% bs_icon 'pencil' %} - {% icon 'trash' %} + {% bs_icon 'trash' %} diff --git a/accounts/templates/accounts/change_password_form.html b/accounts/templates/accounts/change_password_form.html index d1f8f39..3df2d0e 100644 --- a/accounts/templates/accounts/change_password_form.html +++ b/accounts/templates/accounts/change_password_form.html @@ -2,7 +2,7 @@ {% load django_bootstrap5 %} {% load i18n %} -{% load icons %} +{% load bootstrap_icons %} {% block title %}{%trans "Change Password" %}{% endblock title %} @@ -21,10 +21,10 @@ diff --git a/accounts/templates/accounts/email_otp_form.html b/accounts/templates/accounts/email_otp_form.html index 2eb8ce7..83ba2d9 100644 --- a/accounts/templates/accounts/email_otp_form.html +++ b/accounts/templates/accounts/email_otp_form.html @@ -1,6 +1,6 @@ {% extends "base.html" %} {% load django_bootstrap5 %} -{% load icons %} +{% load bootstrap_icons %} {% load i18n %} {% block title %}{{ title }}{% endblock %} @@ -22,9 +22,9 @@ diff --git a/accounts/templates/profile.html b/accounts/templates/profile.html index 107ea7f..6e1cd5b 100644 --- a/accounts/templates/profile.html +++ b/accounts/templates/profile.html @@ -1,7 +1,7 @@ {% extends "base.html" %} {% load i18n %} {% load django_bootstrap5 %} -{% load icons %} +{% load bootstrap_icons %} {% load tags_fingerprint %} {% block title %}{% trans "Profile" %}: {{ request.user.first_name }} {{ request.user.last_name}}{% endblock %} @@ -30,12 +30,12 @@ {% bootstrap_form profile_form layout='horizontal' %} {% if perms.accounts.change_password %} - {% icon 'lock' %} {% trans "Change Password" %} + {% bs_icon 'lock' %} {% trans "Change Password" %} {% endif %}
@@ -53,7 +53,7 @@ {{ key.keyname }} ({% ssh_to_fingerprint key.keypublic %}) - {% icon 'trash' %} + {% bs_icon 'trash' %} @@ -73,7 +73,7 @@ {% bootstrap_form ssh_key_form layout='horizontal' %}
diff --git a/accounts/urls.py b/accounts/urls.py index 2fa8e26..211b057 100644 --- a/accounts/urls.py +++ b/accounts/urls.py @@ -4,6 +4,7 @@ from django.urls import path from django_otp.forms import OTPAuthenticationForm from . import views +from .views import CustomLoginView app_name = "accounts" @@ -50,5 +51,5 @@ if settings.OTP_ENABLED: ] else: urlpatterns += ( - path("login/", LoginView.as_view(template_name="login.html"), name="login"), + path("login/", CustomLoginView.as_view(template_name="login.html"), name="login"), ) diff --git a/accounts/views.py b/accounts/views.py index f973676..a7da98a 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -1,11 +1,12 @@ from admin.decorators import superuser_only from django.conf import settings from django.contrib import messages -from django.contrib.auth import get_user_model, update_session_auth_hash +from django.contrib.auth import get_user_model, update_session_auth_hash, login as auth_login from django.contrib.auth.decorators import permission_required from django.contrib.auth.forms import PasswordChangeForm from django.shortcuts import get_object_or_404, redirect, render from django.urls import reverse +from django.http import HttpResponseRedirect from django.utils.translation import gettext_lazy as _ from instances.models import Instance @@ -14,7 +15,20 @@ from accounts.models import * from . import forms from .utils import get_user_totp_device, send_email_with_otp +from django.contrib.auth.views import LoginView +from logs.views import addlogmsg +class CustomLoginView(LoginView): + def form_valid(self, form): + username = form.cleaned_data['username'] + addlogmsg(username, "-", "-", "Logged In") + auth_login(self.request, form.get_user()) + return HttpResponseRedirect(self.get_success_url()) + + def form_invalid(self, form): + username = form.cleaned_data['username'] + addlogmsg(username, "-", "-", "Failed Login Attempt") + return self.render_to_response(self.get_context_data(form=form)) def profile(request): publickeys = UserSSHKey.objects.filter(user_id=request.user.id) diff --git a/admin/templates/admin/group_list.html b/admin/templates/admin/group_list.html index cd2ee9d..3b9c95c 100644 --- a/admin/templates/admin/group_list.html +++ b/admin/templates/admin/group_list.html @@ -1,13 +1,13 @@ {% extends "base.html" %} {% load i18n %} {% load static %} -{% load icons %} +{% load bootstrap_icons %} {% block title %}{% trans "Users" %}{% endblock %} {% block content %}
- {% icon 'plus' %} + {% bs_icon 'plus-circle-fill' %} {% include 'search_block.html' %}

{% trans "Groups" %}

@@ -17,7 +17,7 @@ {% if not groups %}
- {% icon 'exclamation-triangle '%} {% trans "Warning" %}: {% trans "You don't have any groups" %} + {% bs_icon 'exclamation-triangle '%} {% trans "Warning" %}: {% trans "You don't have any groups" %}
{% else %} @@ -38,10 +38,10 @@ diff --git a/admin/templates/admin/logs.html b/admin/templates/admin/logs.html index a6c8f0d..74fc05b 100644 --- a/admin/templates/admin/logs.html +++ b/admin/templates/admin/logs.html @@ -1,6 +1,7 @@ {% extends "base.html" %} {% load i18n %} {% load django_bootstrap5 %} +{% load bootstrap_icons %} {% block title %}{% trans "Logs" %}{% endblock %} @@ -18,7 +19,7 @@ {% if not logs %}
- {% trans "Warning" %}: {% trans "You don't have any Logs" %} + {% bs_icon 'exclamation-triangle'%} {% trans "Warning" %}: {% trans "You don't have any Logs" %}
{% else %} diff --git a/admin/templates/admin/user_form.html b/admin/templates/admin/user_form.html index b26f7a9..47d6b2c 100644 --- a/admin/templates/admin/user_form.html +++ b/admin/templates/admin/user_form.html @@ -1,6 +1,6 @@ {% extends "base.html" %} {% load django_bootstrap5 %} -{% load icons %} +{% load bootstrap_icons %} {% load i18n %} {% block title %}{{ title }}{% endblock %} @@ -16,9 +16,10 @@ {% bootstrap_form attributes_form layout='horizontal' %}
- {% icon 'times' %} {% trans "Cancel" %} + + {% bs_icon 'x-square-fill' %} {% trans "Cancel" %}
diff --git a/admin/templates/admin/user_list.html b/admin/templates/admin/user_list.html index 521fed4..2e0518b 100644 --- a/admin/templates/admin/user_list.html +++ b/admin/templates/admin/user_list.html @@ -2,7 +2,7 @@ {% load i18n %} {% load static %} {% load common_tags %} -{% load icons %} +{% load bootstrap_icons %} {% block title %}{{ title }}{% endblock %} @@ -10,7 +10,7 @@ {% block page_heading_extra %} - {% icon 'plus' %} + {% bs_icon 'plus-circle-fill' %} {% include 'search_block.html' %} {% endblock page_heading_extra %} @@ -20,7 +20,7 @@ {% if not users %}
- {% icon 'exclamation-triangle '%} {% trans "Warning" %}: {% trans "You don't have any user" %} + {% bs_icon 'exclamation-triangle '%} {% trans "Warning" %}: {% trans "You don't have any user" %}
{% else %} @@ -50,19 +50,19 @@ {% trans "Blocked" %} {% endif %} - {% if user.is_staff %}{% icon 'check' %}{% endif %} - {% if user.is_superuser %}{% icon 'check' %}{% endif %} - {% if can_clone %}{% icon 'check' %}{% endif %} + {% if user.is_staff %}{% bs_icon 'check' %}{% endif %} + {% if user.is_superuser %}{% bs_icon 'check' %}{% endif %} + {% if can_clone %}{% bs_icon 'check' %}{% endif %}
- {% icon 'eye' %} - {% icon 'pencil' %} + {% bs_icon 'eye-fill' %} + {% bs_icon 'pencil-fill' %} {% if user.is_active %} - {% icon 'stop' %} + {% bs_icon 'stop-fill' %} {% else %} - {% icon 'play' %} + {% bs_icon 'play-fill' %} {% endif %} - {% icon 'times' %} + {% bs_icon 'x-circle-fill' %}
diff --git a/computes/templates/computes/form.html b/computes/templates/computes/form.html index 5b74ca5..d867ab4 100644 --- a/computes/templates/computes/form.html +++ b/computes/templates/computes/form.html @@ -1,6 +1,6 @@ {% extends "base.html" %} {% load django_bootstrap5 %} -{% load icons %} +{% load bootstrap_icons %} {% load i18n %} {% block title %}{% trans "Add Compute" %}{% endblock %} @@ -18,9 +18,10 @@ {% bootstrap_form form layout='horizontal' %}
- {% icon 'times' %} {% trans "Cancel" %} + + {% bs_icon 'x-square-fill' %} {% trans "Cancel" %}
diff --git a/computes/templates/computes/instances.html b/computes/templates/computes/instances.html index 5cf561d..8a41bc9 100644 --- a/computes/templates/computes/instances.html +++ b/computes/templates/computes/instances.html @@ -1,7 +1,7 @@ {% extends "base.html" %} {% load i18n %} {% load static %} -{% load icons %} +{% load bootstrap_icons %} {% block title %}{% trans "Instances" %} - {{ compute.name }}{% endblock %} {% block style %} @@ -11,7 +11,7 @@ {% block page_heading_extra %} - {% icon 'plus' %} + {% bs_icon 'plus-circle-fill' %} {% if instances %} {% include 'search_block.html' %} @@ -24,25 +24,25 @@ @@ -52,7 +52,7 @@
{% if not instances %}
- {% icon 'exclamation-triangle' %} {% trans "Warning" %}: + {% bs_icon 'exclamation-triangle' %} {% trans "Warning" %}: {% trans "Hypervisor doesn't have any Instances" %}
@@ -64,7 +64,7 @@ {% trans 'User' %} {% trans 'Status' %} {% trans 'VCPU' %} - {% trans 'Memory' %} + {% trans 'Memory' %} {% trans 'Actions' %} @@ -87,15 +87,18 @@ - {% if instance.proxy.instance.info.0 == 1 %}{% trans "Active" %}{% endif %} - {% if instance.proxy.instance.info.0 == 5 %}{% trans "Off" %}{% endif %} - {% if instance.proxy.instance.info.0 == 3 %}{% trans "Suspended" %}{% endif %} + {% if instance.proxy.instance.info.0 == 1 %} + {% trans "Active" %} + {% endif %} + {% if instance.proxy.instance.info.0 == 5 %} + {% trans "Off" %} + {% endif %} + {% if instance.proxy.instance.info.0 == 3 %} + {% trans "Suspended" %} + {% endif %} {{ instance.proxy.instance.info.3 }} - {% widthratio instance.proxy.instance.info.1 1024 1 %} MiB +

{% widthratio instance.proxy.instance.info.1 1024 1 %} MiB

{% include 'instance_actions.html' %} diff --git a/computes/templates/computes/list.html b/computes/templates/computes/list.html index cc60e2e..1a59d50 100644 --- a/computes/templates/computes/list.html +++ b/computes/templates/computes/list.html @@ -2,7 +2,7 @@ {% load i18n %} {% load static %} {% load common_tags %} -{% load icons %} +{% load bootstrap_icons %} {% block title %}{% trans "Computes" %}{% endblock %} {% block content %}
@@ -16,7 +16,7 @@ {% if not computes %}
- {% icon 'exclamation-triangle '%} {% trans "Warning" %}: {% trans "You don't have any computes" %} + {% bs_icon 'exclamation-triangle '%} {% trans "Warning" %}: {% trans "You don't have any computes" %}
{% else %} @@ -45,12 +45,12 @@
{% if compute.status is True %} - {% icon 'eye' %} + {% bs_icon 'eye-fill' %} {% else %} - {% icon 'eye' %} + {% bs_icon 'eye' %} {% endif %} - {% icon 'pencil' %} - {% icon 'times' %} + {% bs_icon 'pencil-fill' %} + {% bs_icon 'x-circle-fill' %}
diff --git a/computes/templates/create_comp_block.html b/computes/templates/create_comp_block.html index ee74bf1..3d1b6b0 100644 --- a/computes/templates/create_comp_block.html +++ b/computes/templates/create_comp_block.html @@ -1,10 +1,11 @@ {% load i18n %} {% load django_bootstrap5 %} -{% load icons %} +{% load bootstrap_icons %} +
{% trans "TCP" %} {% trans "SSH" %} {% trans "TLS" %} {% trans "Local" %} - {% icon "plus" %} + {% bs_icon "plus-circle-fill" %}
diff --git a/computes/templates/overview.html b/computes/templates/overview.html index 24c1939..0837983 100644 --- a/computes/templates/overview.html +++ b/computes/templates/overview.html @@ -1,7 +1,7 @@ {% extends "base.html" %} {% load i18n %} {% load static %} -{% load icons %} +{% load bootstrap_icons %} {% block title %}{% trans "Overview" %} - {{ compute.name }}{% endblock %} @@ -12,25 +12,25 @@ @@ -96,7 +96,7 @@
- + {% bs_icon 'arrow-right' %} {% trans "CPU Utilization" %}
@@ -106,7 +106,7 @@
- {% trans "RAM Utilization" %} + {% bs_icon 'arrow-right'%} {% trans "RAM Utilization" %}
diff --git a/conf/requirements.txt b/conf/requirements.txt index 31fede1..72985da 100644 --- a/conf/requirements.txt +++ b/conf/requirements.txt @@ -1,22 +1,22 @@ Django==3.2.20 django_bootstrap5==23.3 +django-bootstrap-icons==0.8.3 django-login-required-middleware==0.9.0 django-otp==1.2.2 -django-icons==23.3 django-qr-code==3.1.1 -gunicorn==20.1.0 +gunicorn==21.2.0 libsass==0.22.0 -libvirt-python==9.5.0 +libvirt-python==9.6.0 lxml==4.9.3 qrcode==7.4.2 rwlock==0.0.7 websockify==0.10.0 -zipp==3.13.0 +zipp==3.16.2 ldap3==2.9.1 python-engineio==4.5.1 python-socketio==5.8.0 eventlet==0.33.3 djangorestframework==3.14.0 drf-nested-routers==0.93.4 -drf-yasg==1.21.6 +drf-yasg==1.21.7 markdown>=3.4.1 diff --git a/dev/requirements.txt b/dev/requirements.txt index bc65fd9..0ff16a8 100644 --- a/dev/requirements.txt +++ b/dev/requirements.txt @@ -1,8 +1,9 @@ -r ../conf/requirements.txt -coverage==7.2.7 -django-debug-toolbar==4.1.0 -pycodestyle==2.10.0 -pyflakes==3.0.1 -pylint==2.17.4 -yapf==0.33.0 +coverage==7.3.0 +django-debug-toolbar==4.2.0 +django-debug-toolbar-template-profiler +pycodestyle==2.11.0 +pyflakes==3.1.0 +pylint==2.17.5 +yapf==0.40.1 black==23.7.0 diff --git a/dev/scss/wvc-themes/zephyr/_bootswatch.scss b/dev/scss/wvc-themes/zephyr/_bootswatch.scss index 497d461..084f7bc 100755 --- a/dev/scss/wvc-themes/zephyr/_bootswatch.scss +++ b/dev/scss/wvc-themes/zephyr/_bootswatch.scss @@ -1 +1,14 @@ -@import "dev/scss/bootswatch/zephyr/bootswatch"; \ No newline at end of file +// Override importing Google APIs for inter font +$web-font-path: '' !default; + +/* inter-regular - latin */ +@font-face { + font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */ + font-family: 'Inter'; + font-style: normal; + font-weight: 400; + src: url('/static/fonts/inter-v12-latin-regular.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */ + } + +@import "dev/scss/bootswatch/zephyr/bootswatch"; + diff --git a/instances/models.py b/instances/models.py index 978d118..0a20031 100644 --- a/instances/models.py +++ b/instances/models.py @@ -252,6 +252,7 @@ class CreateInstance(models.Model): error_messages={"required": _("No Network pool has been choosen")}, ) nwfilter = models.CharField(max_length=256, blank=True) + net_model = models.CharField(max_length=256, blank=True) storage = models.CharField(max_length=256, blank=True) template = models.CharField(max_length=256, blank=True) images = models.CharField(max_length=256, blank=True) diff --git a/instances/templates/add_instance_network_block.html b/instances/templates/add_instance_network_block.html index bfb374c..c00b115 100644 --- a/instances/templates/add_instance_network_block.html +++ b/instances/templates/add_instance_network_block.html @@ -1,7 +1,8 @@ {% load i18n %} +{% load bootstrap_icons %} {% if request.user.is_superuser %} @@ -44,6 +45,16 @@
+
+ +
+ +
+