diff --git a/requirements.txt b/requirements.txt index adbda9c..2a84047 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,6 +2,7 @@ django djangorestframework django-auth-ldap +django-bootstrap4 psycopg2 ldap3 diff --git a/uncloud/settings.py b/uncloud/settings.py index afc6d65..2ac6d69 100644 --- a/uncloud/settings.py +++ b/uncloud/settings.py @@ -51,6 +51,7 @@ INSTALLED_APPS = [ 'django.contrib.staticfiles', 'django_extensions', 'rest_framework', + 'bootstrap4', 'uncloud', 'uncloud_pay', 'uncloud_auth', @@ -164,6 +165,11 @@ USE_TZ = True # https://docs.djangoproject.com/en/3.0/howto/static-files/ STATIC_URL = '/static/' STATICFILES_DIRS = [ os.path.join(BASE_DIR, "static") ] +STATICFILES_FINDERS = [ + 'django.contrib.staticfiles.finders.FileSystemFinder', + 'django.contrib.staticfiles.finders.AppDirectoriesFinder', +] + # XML-RPC interface of opennebula OPENNEBULA_URL = 'https://opennebula.example.com:2634/RPC2' diff --git a/uncloud/templates/uncloud/base.html b/uncloud/templates/uncloud/base.html index 034fa7c..2273591 100644 --- a/uncloud/templates/uncloud/base.html +++ b/uncloud/templates/uncloud/base.html @@ -1,3 +1,8 @@ +{% extends 'bootstrap4/bootstrap4.html' %} + +{% load bootstrap4 %} + + @@ -5,10 +10,17 @@ - {% block title %}Welcome to uncloud{% endblock %} + {% block bootstrap4_title %}{% block title %}Welcome to uncloud{% endblock %}{% endblock %} + {% block header %}{% endblock %} - {% block body %}{% endblock %} +{% block bootstrap4_content %} +
+ {% block body %}{% endblock %} +
+ + {% autoescape off %}{% bootstrap_messages %}{% endautoescape %} +{% endblock %} diff --git a/uncloud/templates/uncloud/index.html b/uncloud/templates/uncloud/index.html index e5a8318..6a88f99 100644 --- a/uncloud/templates/uncloud/index.html +++ b/uncloud/templates/uncloud/index.html @@ -2,19 +2,61 @@ {% block title %}{% endblock %} {% block body %} -
+

Welcome to uncloud

- Welcome to uncloud, checkout the following locations: +
+ Welcome to uncloud, the Open Source cloud management + system by ungleich. + It is an API driven system with + some convience views provided by + the Django Rest + Framework. You can + freely access + the source code of uncloud. -
    -
  • The uncloud API -
  • Register a credit card - (this is required to be done via Javascript so that we never see - your credit card, but it is sent directly to stripe) - You can list your credit card via the API. +
    +

    Credit cards

    +
    + Credit cards are registered with stripe. We only save a the + last 4 digits and the expiry date of the card to make + identification for you easier. +
    +
    +
      +
    • Register a credit card + (this is required to be done via Javascript so that we never see + your credit card, but it is sent directly to stripe) +
    • You can list your + credit cards + By default the first credit card is used for charging + ("active: true") and later added cards will not be + used. To change this, first disable the active flag and + then set it on another credit card. +
    +
    +
    +

    Payments and Balance

    + To trigger a payment + + +
    +
    +

    Networking

    + With uncloud you can use a variety of network related services. + + +
    -
{% endblock %} diff --git a/uncloud/urls.py b/uncloud/urls.py index 15623bd..82bce86 100644 --- a/uncloud/urls.py +++ b/uncloud/urls.py @@ -26,38 +26,27 @@ router = routers.DefaultRouter() router.register(r'beta/vm', vmviews.NicoVMProductViewSet, basename='nicovmproduct') # VM -router.register(r'v1/vm/snapshot', vmviews.VMSnapshotProductViewSet, basename='vmsnapshotproduct') -router.register(r'v1/vm/diskimage', vmviews.VMDiskImageProductViewSet, basename='vmdiskimageproduct') -router.register(r'v1/vm/disk', vmviews.VMDiskProductViewSet, basename='vmdiskproduct') -router.register(r'v1/vm/vm', vmviews.VMProductViewSet, basename='vmproduct') - - -# creates VM from os image -#router.register(r'vm/ipv6onlyvm', vmviews.VMProductViewSet, basename='vmproduct') -# ... AND adds IPv4 mapping -#router.register(r'vm/dualstackvm', vmviews.VMProductViewSet, basename='vmproduct') +# router.register(r'v1/vm/snapshot', vmviews.VMSnapshotProductViewSet, basename='vmsnapshotproduct') +# router.register(r'v1/vm/diskimage', vmviews.VMDiskImageProductViewSet, basename='vmdiskimageproduct') +# router.register(r'v1/vm/disk', vmviews.VMDiskProductViewSet, basename='vmdiskproduct') +# router.register(r'v1/vm/vm', vmviews.VMProductViewSet, basename='vmproduct') # Services -router.register(r'v1/service/matrix', serviceviews.MatrixServiceProductViewSet, basename='matrixserviceproduct') -router.register(r'v1/service/generic', serviceviews.GenericServiceProductViewSet, basename='genericserviceproduct') - +# router.register(r'v1/service/matrix', serviceviews.MatrixServiceProductViewSet, basename='matrixserviceproduct') +# router.register(r'v1/service/generic', serviceviews.GenericServiceProductViewSet, basename='genericserviceproduct') # Pay -router.register(r'v1/my/address', payviews.BillingAddressViewSet, basename='billingaddress') -router.register(r'v1/my/bill', payviews.BillViewSet, basename='bill') -router.register(r'v1/my/order', payviews.OrderViewSet, basename='order') -#router.register(r'v1/my/payment', payviews.PaymentViewSet, basename='payment') -router.register(r'v1/my/payment-method', payviews.PaymentMethodViewSet, basename='payment-method') +# router.register(r'v1/my/address', payviews.BillingAddressViewSet, basename='billingaddress') +# router.register(r'v1/my/bill', payviews.BillViewSet, basename='bill') +# router.register(r'v1/my/order', payviews.OrderViewSet, basename='order') +# router.register(r'v1/my/payment-method', payviews.PaymentMethodViewSet, basename='payment-method') # admin/staff urls -router.register(r'v1/admin/bill', payviews.AdminBillViewSet, basename='admin/bill') -#router.register(r'v1/admin/payment', payviews.AdminPaymentViewSet, basename='admin/payment') -router.register(r'v1/admin/order', payviews.AdminOrderViewSet, basename='admin/order') -router.register(r'v1/admin/vmhost', vmviews.VMHostViewSet) -router.register(r'v1/admin/vmcluster', vmviews.VMClusterViewSet) -#router.register(r'v1/admin/vpnpool', netviews.VPNPoolViewSet) -#router.register(r'v1/admin/opennebula', oneviews.VMViewSet, basename='opennebula') +# router.register(r'v1/admin/bill', payviews.AdminBillViewSet, basename='admin/bill') +# router.register(r'v1/admin/order', payviews.AdminOrderViewSet, basename='admin/order') +# router.register(r'v1/admin/vmhost', vmviews.VMHostViewSet) +# router.register(r'v1/admin/vmcluster', vmviews.VMClusterViewSet) # User/Account router.register(r'v1/my/user', authviews.UserViewSet, basename='user') @@ -73,7 +62,7 @@ router.register(r'v2/net/wireguardvpn', netviews.WireGuardVPNViewSet, basename=' router.register(r'v2/net/wireguardvpnsizes', netviews.WireGuardVPNSizes, basename='wireguardvpnnetworksizes') # Payment related -router.register(r'v2/payment/credit-card', payviews.CreditCardViewSet, basename='credit-card') +router.register(r'v2/payment/credit-card', payviews.CreditCardViewSet, basename='stripecreditcard') router.register(r'v2/payment/payment', payviews.PaymentViewSet, basename='payment') router.register(r'v2/payment/balance', payviews.BalanceViewSet, basename='payment-balance') diff --git a/uncloud_pay/serializers.py b/uncloud_pay/serializers.py index 361ff1c..00e969b 100644 --- a/uncloud_pay/serializers.py +++ b/uncloud_pay/serializers.py @@ -10,7 +10,7 @@ from uncloud import AMOUNT_DECIMALS, AMOUNT_MAX_DIGITS ### # 2020-12 Checked code -class StripeCreditCardSerializer(serializers.ModelSerializer): +class StripeCreditCardSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = StripeCreditCard exclude = [ "card_id", "owner" ] diff --git a/uncloud_pay/templates/uncloud_pay/register_stripe.html b/uncloud_pay/templates/uncloud_pay/register_stripe.html index eaf1da4..7bb0110 100644 --- a/uncloud_pay/templates/uncloud_pay/register_stripe.html +++ b/uncloud_pay/templates/uncloud_pay/register_stripe.html @@ -2,13 +2,6 @@ {% block header %} - - {% endblock %} {% block body %}