diff --git a/esap/esap/esap_accounts_config.sqlite3 b/esap/esap/esap_accounts_config.sqlite3 index bb8afe2e1ed720013c528548ea4431b630736eff..a8c9f299ae7a3481353942144cb07ff083c2187b 100644 Binary files a/esap/esap/esap_accounts_config.sqlite3 and b/esap/esap/esap_accounts_config.sqlite3 differ diff --git a/esap/esap/esap_config.sqlite3 b/esap/esap/esap_config.sqlite3 index fecce1f4247b9ffdab677adebb004c9e352a5f5c..1ccf85820adc833bef82599de736849dac28cbf3 100644 Binary files a/esap/esap/esap_config.sqlite3 and b/esap/esap/esap_config.sqlite3 differ diff --git a/esap/esap/esap_staging_config.sqlite3 b/esap/esap/esap_staging_config.sqlite3 deleted file mode 100644 index ae12217d8e863c7b57d7317dc634f761ff5b351e..0000000000000000000000000000000000000000 Binary files a/esap/esap/esap_staging_config.sqlite3 and /dev/null differ diff --git a/esap/esap/settings/base.py b/esap/esap/settings/base.py index d16701f97f1c2ad1b61518ffdd5175198fc57c6f..36d41c373deb767367ba54c1c722a3962ca8f972 100644 --- a/esap/esap/settings/base.py +++ b/esap/esap/settings/base.py @@ -35,7 +35,6 @@ USE_X_FORWARDED_HOST = True INSTALLED_APPS = [ 'query.apps.MyAppConfig', - 'staging', 'accounts', 'rucio', 'ida', diff --git a/esap/esap/settings/dev.py b/esap/esap/settings/dev.py index 24f821ee99920940bacd9bb6f309263558494077..d229bf1042627d083509d7078d97fbd39773f74c 100644 --- a/esap/esap/settings/dev.py +++ b/esap/esap/settings/dev.py @@ -37,10 +37,6 @@ DATABASES = { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'esap_accounts_config.sqlite3'), }, - 'staging': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(BASE_DIR, 'esap_staging_config.sqlite3'), - }, 'ida': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'esap_ida_config.sqlite3'), diff --git a/esap/esap/settings/docker.py b/esap/esap/settings/docker.py index 272f9f72a0452759456feb63fe9c5c5f4c6f1433..6adbf83a43c228fe68ed8cae7186f4d77fdbdae9 100644 --- a/esap/esap/settings/docker.py +++ b/esap/esap/settings/docker.py @@ -38,10 +38,6 @@ DATABASES = { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': '/shared/esap_accounts_config.sqlite3', }, - 'staging': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': '/shared/esap_staging_config.sqlite3', - }, 'ida': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': '/shared/esap_ida_config.sqlite3', diff --git a/esap/esap/urls.py b/esap/esap/urls.py index da942e8e37a5bdb21f4b9142c6d120eb09aed5c5..7c498e3dab84234f42228674f4649311a4cfa499 100644 --- a/esap/esap/urls.py +++ b/esap/esap/urls.py @@ -18,7 +18,6 @@ from django.urls import include, path, re_path urlpatterns = [ path('esap-api/query/', include('query.api.urls')), - path('esap-api/staging/', include('staging.api.urls')), path('esap-api/rucio/', include('rucio.api.urls')), path('esap-api/accounts/', include('accounts.api.urls')), path('esap-api/ida/', include('ida.api.urls')), diff --git a/esap/query/database_router.py b/esap/query/database_router.py index de3ffd27bc5f9afb99844fb715dd8ff73c3302b3..cfeded5afa32998f33e481e0eef1bfd3961eac06 100644 --- a/esap/query/database_router.py +++ b/esap/query/database_router.py @@ -1,7 +1,7 @@ class QueryRouter: route_app_labels = {'query', 'auth', 'contenttypes', 'sessions', 'admin'} - custom_router_app_labels = {'ida', 'rucio', 'accounts', 'staging'} + custom_router_app_labels = {'ida', 'rucio', 'accounts'} def db_for_read(self, model, **hints): diff --git a/esap/query/templates/query/index.html b/esap/query/templates/query/index.html index 83850492921082daadacbfb8d2c6ff71f3518301..6eadad0f231e606e589790f4aaab361bfa3fd941 100644 --- a/esap/query/templates/query/index.html +++ b/esap/query/templates/query/index.html @@ -70,7 +70,7 @@ </div> -<p class="footer" small>ASTRON - version 12 aug 2021</p> +<p class="footer" small>ASTRON - version 12 aug 2021 - 17:00</p> {% endblock %} diff --git a/esap/rucio/database_router.py b/esap/rucio/database_router.py index c1f7290c9c599ace29f965b7572fecfe465f8172..2894bc6949b15162551fb9a8de4906266c3589d7 100644 --- a/esap/rucio/database_router.py +++ b/esap/rucio/database_router.py @@ -4,20 +4,20 @@ class RucioRouter: def db_for_read(self, model, **hints): """ - Attempts to read staging models go to staging database. + Attempts to read rucio models go to rucio database. """ if model._meta.app_label in self.route_app_labels: return 'rucio' def db_for_write(self, model, **hints): """ - Writes always go to staging. + Writes always go to rucio. """ return 'rucio' def allow_relation(self, obj1, obj2, **hints): """ - Allow relations if a model in the staging apps is + Allow relations if a model in the rucio apps is involved. """ if ( @@ -29,8 +29,8 @@ class RucioRouter: def allow_migrate(self, db, app_label, model_name=None, **hints): """ - Make sure the staging apps only appear in the - 'staging' database. + Make sure the rucio apps only appear in the + 'rucio' database. """ if app_label in self.route_app_labels: return db == 'rucio' diff --git a/esap/staging/__init__.py b/esap/staging/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/esap/staging/admin.py b/esap/staging/admin.py deleted file mode 100644 index 0e4f109a0df514427b63b694ee8553e22420b275..0000000000000000000000000000000000000000 --- a/esap/staging/admin.py +++ /dev/null @@ -1,32 +0,0 @@ -from django.contrib import admin -from .models import Staging - -admin.site.register(Staging) - - - -class MultiDBModelAdmin(admin.ModelAdmin): - # A handy constant for the name of the alternate database. - using = 'staging' - - def save_model(self, request, obj, form, change): - # Tell Django to save objects to the 'other' database. - obj.save(using=self.using) - - def delete_model(self, request, obj): - # Tell Django to delete objects from the 'other' database - obj.delete(using=self.using) - - def get_queryset(self, request): - # Tell Django to look for objects on the 'other' database. - return super().get_queryset(request).using(self.using) - - def formfield_for_foreignkey(self, db_field, request, **kwargs): - # Tell Django to populate ForeignKey widgets using a query - # on the 'other' database. - return super().formfield_for_foreignkey(db_field, request, using=self.using, **kwargs) - - def formfield_for_manytomany(self, db_field, request, **kwargs): - # Tell Django to populate ManyToMany widgets using a query - # on the 'other' database. - return super().formfield_for_manytomany(db_field, request, using=self.using, **kwargs) \ No newline at end of file diff --git a/esap/staging/api/__init__.py b/esap/staging/api/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/esap/staging/api/serializers.py b/esap/staging/api/serializers.py deleted file mode 100644 index ac5c493a90967a701ef418d22ab7ee82e1033da0..0000000000000000000000000000000000000000 --- a/esap/staging/api/serializers.py +++ /dev/null @@ -1,10 +0,0 @@ -from rest_framework import serializers -from ..models import Staging -import logging - -logger = logging.getLogger(__name__) - -class StagingSerializer(serializers.ModelSerializer): - class Meta(): - model = Staging - fields = "__all__" \ No newline at end of file diff --git a/esap/staging/api/urls.py b/esap/staging/api/urls.py deleted file mode 100644 index 8b03957de6ad94a1697b085a638670482a4fa711..0000000000000000000000000000000000000000 --- a/esap/staging/api/urls.py +++ /dev/null @@ -1,18 +0,0 @@ -from django.urls import path -from django.contrib import admin -from rest_framework import routers - -from .views import StagingViewSet -from . import views - -router = routers.DefaultRouter() -router.register('staging', StagingViewSet, 'staging') - -urlpatterns = router.urls - -urlpatterns = [ - # path('admin', admin.site.urls, name='admin-view'), - path('', views.IndexView.as_view(), name='index-view'), - path('staging', views.StagingListViewAPI.as_view(), name='staging-view'), -] - diff --git a/esap/staging/api/views.py b/esap/staging/api/views.py deleted file mode 100644 index 8f8f4b8fa2ebac43742841a4905bb2ce599cd4d3..0000000000000000000000000000000000000000 --- a/esap/staging/api/views.py +++ /dev/null @@ -1,42 +0,0 @@ -from django.views.generic import ListView -from django_filters import rest_framework as filters -from rest_framework import viewsets, permissions - -from staging.models import Staging -from rest_framework import generics - -from .serializers import StagingSerializer - - -class StagingViewSet(viewsets.ModelViewSet): - serializer_class = StagingSerializer - permission_classes = [permissions.IsAuthenticated] - - def get_queryset(self): - return self.request.user.staging.all() - - def perform_create(self, serializer): - serializer.save(owner=self.request.user) - -# example: /esap/staging/ -class IndexView(ListView): - queryset = Staging.objects.all() - serializer_class = StagingSerializer - template_name = 'staging/index.html' - - # by default this returns the list in an object called object_list, so use 'object_list' in the html page. - # but if 'context_object_name' is defined, then this returned list is named and can be accessed that way in html. - context_object_name = 'my_staging' - -# example: /esap-api/staging/staging/ -class StagingListViewAPI(generics.ListCreateAPIView): - """ - A list of Archives - """ - model = Staging - queryset = Staging.objects.all() - serializer_class = StagingSerializer - - # using the Django Filter Backend - https://django-filter.readthedocs.io/en/latest/index.html - # filter_backends = (filters.DjangoFilterBackend,) - # filter_class = StagingFilter \ No newline at end of file diff --git a/esap/staging/apps.py b/esap/staging/apps.py deleted file mode 100644 index cb00000edccdf4528062e6088a72aa46db45c89e..0000000000000000000000000000000000000000 --- a/esap/staging/apps.py +++ /dev/null @@ -1,5 +0,0 @@ -from django.apps import AppConfig - - -class StagingConfig(AppConfig): - name = 'staging' diff --git a/esap/staging/database_router.py b/esap/staging/database_router.py deleted file mode 100644 index b976b35dab605eafd3ecfcbaf1fbcdddc2766671..0000000000000000000000000000000000000000 --- a/esap/staging/database_router.py +++ /dev/null @@ -1,37 +0,0 @@ -class StagingRouter: - - route_app_labels = {'staging'} - - def db_for_read(self, model, **hints): - """ - Attempts to read staging models go to staging database. - """ - if model._meta.app_label in self.route_app_labels: - return 'staging' - - def db_for_write(self, model, **hints): - """ - Writes always go to staging. - """ - return 'staging' - - def allow_relation(self, obj1, obj2, **hints): - """ - Allow relations if a model in the staging apps is - involved. - """ - if ( - obj1._meta.app_label in self.route_app_labels or - obj2._meta.app_label in self.route_app_labels - ): - return True - return None - - def allow_migrate(self, db, app_label, model_name=None, **hints): - """ - Make sure the staging apps only appear in the - 'staging' database. - """ - if app_label in self.route_app_labels: - return db == 'staging' - return None \ No newline at end of file diff --git a/esap/staging/models.py b/esap/staging/models.py deleted file mode 100644 index 376d1bc405ac3128de4a6a60c824b2d644798093..0000000000000000000000000000000000000000 --- a/esap/staging/models.py +++ /dev/null @@ -1,5 +0,0 @@ -from django.db import models - -class Staging(models.Model): - uri = models.CharField(max_length=40, null=False) - status = models.CharField(max_length=40, null=False) \ No newline at end of file diff --git a/esap/staging/templates/staging/base.html b/esap/staging/templates/staging/base.html deleted file mode 100644 index 65791a94d978de9e3129d058de629939b2551537..0000000000000000000000000000000000000000 --- a/esap/staging/templates/staging/base.html +++ /dev/null @@ -1,51 +0,0 @@ - -<!DOCTYPE html> -{% load static %} -<html lang="en"> -<head> - - <!-- Required meta tags --> - <meta charset="utf-8"> - <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> - - <title>{% block myBlockTitle %}ESAP API - Staging{% endblock %}</title> - - <!-- loads the path to static files --> - <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"> - - <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script> - <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script> - <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script> - - <link rel="stylesheet" type="text/css" href="{% static 'query/style.css' %}"/> - <link href='https://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'> - <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.4.2/css/all.css" integrity="sha384-/rXc/GQVaYpyDdyxK+ecHPVYJSN9bmVFBvjA/9eOB+pb3F2w2N6fc5qB9Ew5yIns" crossorigin="anonymous"> - - <link rel="icon" href="http://uilennest.net/static/esap_icon.jpg"> - - {% block extra_js %}{% endblock %} - -</head> -<body> - <nav class="navbar navbar-expand-lg navbar-light bg-light"> - <div class="container-fluid"> - - <!-- Header --> - <div class="navbar-header"> - <a class="navbar-brand mb-0 h1"> - <h2> - <img src="{% static 'query/esap_logo.png' %}" alt=""> - ESAP API Gateway - Staging - </h2> - </a> - </div> - - </div> - </nav> - - <!-- to add blocks of code --> - {% block myBlock %} - {% endblock %} - -</body> -</html> \ No newline at end of file diff --git a/esap/staging/templates/staging/index.html b/esap/staging/templates/staging/index.html deleted file mode 100644 index 906777933b13c8f5845ef07423f2f3d82ee27cf5..0000000000000000000000000000000000000000 --- a/esap/staging/templates/staging/index.html +++ /dev/null @@ -1,50 +0,0 @@ -{% extends 'query/base.html' %} -{% load static %} -{% block myBlock %} - -<div class="container-fluid details-container"> - <div class="row"> - <div class="col-sm-12 col-md-12 col-lg-12"> - <div class="panel panel-success"> - - <div class="panel-body"> - - <h4>API resources</h4> - <table class="table table-striped table-bordered table-sm"> - <thead> - <tr> - <th>Function</th> - <th>URL</th> - </tr> - </thead> - <tbody> - - <div class="row"> - <tr> - <td> - Staging - </td> - <td> - <a href="{% url 'staging-view' %}">{% url 'staging-view' %}</a> - </td> - - </tr> - - </div> - - </tbody> - </table> - - </div> - </div> - </div> - - </div> - -</div> - - -<p class="footer" small>ASTRON 24 jul 2020</p> - -{% endblock %} - diff --git a/esap/staging/tests.py b/esap/staging/tests.py deleted file mode 100644 index 7ce503c2dd97ba78597f6ff6e4393132753573f6..0000000000000000000000000000000000000000 --- a/esap/staging/tests.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.test import TestCase - -# Create your tests here.