diff --git a/README.md b/README.md index 122ab1a4..8c7f0d8b 100644 --- a/README.md +++ b/README.md @@ -13,12 +13,20 @@ python -m venv venv ``` pip install -r requirements.txt ``` -3. Install custos client SDK in the virtual env (Follow instructions in "Install Custos Client SDK") -4. Run django server using manage.py file in custos_portal directory. +3. Install custos client SDK in the virtual env (Follow instructions in "Install Custos Client SDK") +4. Make migrations +``` +python manage.py migrate +``` +5. Run django server using manage.py file in custos_portal directory. ``` python manage.py runserver ``` -5. Run webpack development server from custos_portal/custos_portal/static/common using: +7. Install all the npm dependencies +``` +npm install +``` +6. Run webpack development server from custos_portal/custos_portal/static/common using: ``` npm run serve ``` @@ -39,4 +47,4 @@ This Django projects consists of 3 apps - Workspace: Handles all the requests for a regular users like 'create new tenant requests' We also use vuejs for the screens in Admin and Workspace folders. The components and other javascript files can be found -at ```custos_portal\static\common``` \ No newline at end of file +at ```custos_portal\static\common``` diff --git a/custos_portal/custos_portal/__init__.py b/custos_portal/custos_portal/__init__.py index 11a6430a..9d908c4a 100644 --- a/custos_portal/custos_portal/__init__.py +++ b/custos_portal/custos_portal/__init__.py @@ -1,5 +1,16 @@ -from clients.identity_management_client import IdentityManagementClient -from clients.user_management_client import UserManagementClient +from custos.clients.identity_management_client import IdentityManagementClient +from custos.clients.user_management_client import UserManagementClient +from custos.transport.settings import CustosServerClientSettings +import os -user_management_client = UserManagementClient() -identity_management_client = IdentityManagementClient() +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +settings = os.path.join(BASE_DIR, 'transport', 'settings.ini') + +custos_settings = CustosServerClientSettings(custos_host=custos_host, + custos_port=custos_port, + custos_client_id=custos_client_id, + custos_client_sec=custos_client_sec, + configuration_file_location=None) + +identity_management_client = IdentityManagementClient(custos_settings) +user_management_client = UserManagementClient(custos_settings) \ No newline at end of file diff --git a/custos_portal/custos_portal/apps/admin/apps.py b/custos_portal/custos_portal/apps/admin/apps.py index 7e638120..97b64030 100644 --- a/custos_portal/custos_portal/apps/admin/apps.py +++ b/custos_portal/custos_portal/apps/admin/apps.py @@ -13,7 +13,15 @@ class AdminConfig(CustosAppConfig): """ nav = [ { - 'label': 'Application Catalog', + 'label': 'Create new tenant request', + 'icon': 'fa fa-plus-square', + 'url': 'custos_portal_admin:request_new_tenant', + 'active_prefixes': ['applications', 'request-new-tenant'], + 'enabled': lambda req: (req.is_gateway_admin or + req.is_read_only_gateway_admin), + }, + { + 'label': 'List of all existing tenant requests', 'icon': 'fa fa-list', 'url': 'custos_portal_admin:list_requests', 'active_prefixes': ['applications', 'list-requests'], diff --git a/custos_portal/custos_portal/apps/admin/urls.py b/custos_portal/custos_portal/apps/admin/urls.py index 8c634327..f5258305 100644 --- a/custos_portal/custos_portal/apps/admin/urls.py +++ b/custos_portal/custos_portal/apps/admin/urls.py @@ -5,7 +5,8 @@ app_name = 'custos_portal_admin' urlpatterns = [ + url(r'^request-new-tenant', views.request_new_tenant, name='request_new_tenant'), url(r'^list-requests', views.list_new_tenant_requests, name='list_requests'), - url(r'^request/(?P[^/]+)/$', views.view_tenant_request, name="view_tenant_request"), - url(r'^edit-tenant-request/(?P[^/]+)/$', views.edit_tenant_request, name="edit_tenant_request") + url(r'^request/(?P[^/]+)/$', views.view_tenant_request, name="view_tenant_request"), + url(r'^edit-tenant-request/(?P[^/]+)/$', views.edit_tenant_request, name="edit_tenant_request") ] diff --git a/custos_portal/custos_portal/apps/admin/views.py b/custos_portal/custos_portal/apps/admin/views.py index 6be76036..ad8f6cdc 100644 --- a/custos_portal/custos_portal/apps/admin/views.py +++ b/custos_portal/custos_portal/apps/admin/views.py @@ -1,26 +1,44 @@ from django.shortcuts import render +from custos_portal import identity_management_client +from django.conf import settings +def request_new_tenant(request): + if request.method == 'POST': + logger.debug("Form is posted") + request.active_nav_item = 'admin-request-new-tenant' + token = request.COOKIES['token'] + + return render(request, 'workspace/request_new_tenant.html', { + 'bundle_name': 'admin-request-new-tenant', + 'data': token + }) def list_new_tenant_requests(request): request.active_nav_item = 'list-requests' - + # TODO fetch all the tenant requests from airavata here. + token = request.COOKIES['token'] return render(request, 'workspace/list_requests.html', { 'bundle_name': 'admin-list-requests', + 'data': token }) -def view_tenant_request(request, tenant_request_id): - print("Admin view Tenant request Id: {}".format(tenant_request_id)), +def view_tenant_request(request, client_id): + token = request.COOKIES['token'] + return render(request, 'workspace/view_tenant_request.html', { 'bundle_name': 'admin-view-request', - 'tenant_request_id': tenant_request_id + 'tenant_client_id': client_id, + 'data': token }) -def edit_tenant_request(request, tenant_request_id): - print("Edit Tenant request Id: {}".format(tenant_request_id)), +def edit_tenant_request(request, client_id): + token = request.COOKIES['token'] + return render(request, 'workspace/view_tenant_request.html', { 'bundle_name': 'admin-edit-request', - 'tenant_request_id': tenant_request_id - }) + 'tenant_client_id': client_id, + 'data': token + }) \ No newline at end of file diff --git a/custos_portal/custos_portal/apps/auth/backends.py b/custos_portal/custos_portal/apps/auth/backends.py index 33b4c4b4..0980a9f5 100644 --- a/custos_portal/custos_portal/apps/auth/backends.py +++ b/custos_portal/custos_portal/apps/auth/backends.py @@ -22,6 +22,7 @@ class CustosAuthBackend(ModelBackend): def authenticate(self, request=None, username=None, password=None, refresh_token=None): try: if username and password: + print("Entered username and password") token = self._get_token_and_userinfo_password_flow(username, password) request.session["ACCESS_TOKEN"] = token userinfo = self._get_userinfo_from_token(token) @@ -69,8 +70,6 @@ def _get_token_and_userinfo_redirect_flow(self, request): if state == saved_state: response = identity_management_client.token(settings.CUSTOS_TOKEN, redirect_uri, code) token = MessageToDict(response) - - logger.debug(token["access_token"]) return token return diff --git a/custos_portal/custos_portal/apps/auth/forms.py b/custos_portal/custos_portal/apps/auth/forms.py index d4970ff2..e5ab3fbf 100644 --- a/custos_portal/custos_portal/apps/auth/forms.py +++ b/custos_portal/custos_portal/apps/auth/forms.py @@ -1,13 +1,22 @@ import logging -from clients.user_management_client import UserManagementClient -from custos.core import IamAdminService_pb2 +from custos.clients.user_management_client import UserManagementClient +from custos.transport.settings import CustosServerClientSettings +from custos.server.core import IamAdminService_pb2 from django import forms from django.conf import settings from django.core import validators +import os logger = logging.getLogger(__name__) -user_management_client = UserManagementClient() +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +settings = os.path.join(BASE_DIR, 'transport', 'settings.ini') +custos_settings = CustosServerClientSettings(custos_host=custos_host, + custos_port=custos_port, + custos_client_id=custos_client_id, + custos_client_sec=custos_client_sec, + configuration_file_location=None) +user_management_client = UserManagementClient(custos_settings) USERNAME_VALIDATOR = validators.RegexValidator( regex=r"^[a-z0-9_-]+$", @@ -219,9 +228,9 @@ def clean(self): username = cleaned_data.get('username') check_username = user_management_client.is_username_available(settings.CUSTOS_TOKEN, username) - print(check_username.is_exist) + try: - if user_management_client.is_username_available(settings.CUSTOS_TOKEN, username).is_exist: + if user_management_client.is_username_available(settings.CUSTOS_TOKEN, username).status: logger.info("Username is available"); else: logger.info("Username is not available"); diff --git a/custos_portal/custos_portal/apps/auth/views.py b/custos_portal/custos_portal/apps/auth/views.py index ddf0f55c..f4898582 100644 --- a/custos_portal/custos_portal/apps/auth/views.py +++ b/custos_portal/custos_portal/apps/auth/views.py @@ -18,12 +18,14 @@ from django.views.decorators.debug import sensitive_variables from google.protobuf.json_format import MessageToDict from requests_oauthlib import OAuth2Session +from google.auth import jwt from . import utils from . import models from . import forms from ... import identity_management_client from ... import user_management_client +from . import backends logger = logging.getLogger(__name__) @@ -33,7 +35,15 @@ def callback(request): user = authenticate(request=request) logger.debug("Saving user to session: {}".format(user)) login(request, user) - return _handle_login_redirect(request) + sess = request.session + token = sess['ACCESS_TOKEN'] + code = request.GET.get('code').strip() + logger.info(code) + redirect_uri = request.build_absolute_uri(reverse('custos_portal_auth:callback')) + response = _handle_login_redirect(request) + response.set_cookie('token', value=token, secure=False, httponly=True) + return response + except Exception as err: logger.exception("An error occurred while processing OAuth2 " "callback: {}".format(request.build_absolute_uri())) @@ -59,43 +69,9 @@ def callback_error(request, idp_alias): def create_account(request): - if request.method == 'POST': - form = forms.CreateAccountForm(request.POST) - if form.is_valid(): - try: - username = form.cleaned_data['username'] - email = form.cleaned_data['email'] - first_name = form.cleaned_data['first_name'] - last_name = form.cleaned_data['last_name'] - password = form.cleaned_data['password'] - is_temp_password = False - result = user_management_client.register_user(settings.CUSTOS_TOKEN, username, first_name, last_name, - password, email, is_temp_password) - if result.is_registered: - logger.debug("User account successfully created for : {}".format(username)) - _create_and_send_email_verification_link(request, username, email, first_name, last_name, - settings.LOGIN_URL) - messages.success( - request, - "Account request processed successfully. Before you " - "can login you need to confirm your email address. " - "We've sent you an email with a link that you should " - "click on to complete the account creation process.") - else: - form.add_error(None, ValidationError("Failed to register the user with IAM service")) - except TypeError as e: - logger.exception( - "Failed to create account for user", exc_info=e) - form.add_error(None, ValidationError(e)) - return render(request, 'custos_portal_auth/create_account.html', { - 'options': settings.AUTHENTICATION_OPTIONS, - 'form': form - }) - else: - form = forms.CreateAccountForm() - return render(request, 'custos_portal_auth/create_account.html', { + return render(request, 'custos_portal_auth/form_create_account.html', { + 'next': request.GET.get('next', None), 'options': settings.AUTHENTICATION_OPTIONS, - 'form': form }) @@ -174,7 +150,11 @@ def handle_login(request): try: if user is not None: login(request, user) - return _handle_login_redirect(request) + response = identity_management_client.authenticate(settings.CUSTOS_TOKEN, username, password) + token = MessageToDict(response)["accessToken"] + response = _handle_login_redirect(request) + response.set_cookie('token', value=token, secure=False, httponly=True) + return response else: messages.error(request, "Login failed. Please try again.") except Exception as err: @@ -194,8 +174,7 @@ def redirect_login(request, idp_alias): client_id = settings.KEYCLOAK_CLIENT_ID auth_base_url = identity_management_client.get_oidc_configuration(settings.CUSTOS_TOKEN, client_id) - # auth_base_url = json.loads(auth_base_url.) - # print(auth_base_url) + base_authorize_url = settings.KEYCLOAK_AUTHORIZE_URL redirect_uri = request.build_absolute_uri( @@ -208,6 +187,7 @@ def redirect_login(request, idp_alias): authorization_url += '&kc_idp_hint=' + quote("oidc") # Store state in session for later validation (see backends.py) + request.session['OAUTH2_STATE'] = state request.session['OAUTH2_REDIRECT_URI'] = redirect_uri @@ -318,7 +298,9 @@ def start_login(request): def start_logout(request): logout(request) redirect_url = request.build_absolute_uri(resolve_url(settings.LOGOUT_REDIRECT_URL)) - return redirect(settings.KEYCLOAK_LOGOUT_URL + "?redirect_uri=" + quote(redirect_url)) + response = redirect(settings.KEYCLOAK_LOGOUT_URL + "?redirect_uri=" + quote(redirect_url)) + response.delete_cookie('token') + return response def start_username_password_login(request): @@ -346,8 +328,7 @@ def verify_email(request, code): if email_verification.next: login_url += "?" + urlencode({'next': email_verification.next}) - print(user_management_client.is_user_enabled(settings.CUSTOS_TOKEN, "shivam_testing_3")) - if user_management_client.is_user_enabled(settings.CUSTOS_TOKEN, username).is_exist: + if user_management_client.is_user_enabled(settings.CUSTOS_TOKEN, username).status: logger.debug("User {} is already enabled".format(username)) messages.success( request, diff --git a/custos_portal/custos_portal/apps/workspace/urls.py b/custos_portal/custos_portal/apps/workspace/urls.py index cd01d392..dab8968b 100644 --- a/custos_portal/custos_portal/apps/workspace/urls.py +++ b/custos_portal/custos_portal/apps/workspace/urls.py @@ -6,5 +6,6 @@ urlpatterns = [ url(r'^request-new-tenant', views.request_new_tenant, name='request_new_tenant'), url(r'^list-requests', views.list_new_tenant_requests, name='list_requests'), - url(r'request/(?P[^/]+)/$', views.view_tenant_request, name="view_tenant_request") + url(r'^request/(?P[^/]+)/$', views.view_tenant_request, name="view_tenant_request"), + # url(r'request/(?P[^/]+)/$', views.view_tenant_request, name="view_tenant_request") ] diff --git a/custos_portal/custos_portal/apps/workspace/views.py b/custos_portal/custos_portal/apps/workspace/views.py index a9d477ad..5a92af41 100644 --- a/custos_portal/custos_portal/apps/workspace/views.py +++ b/custos_portal/custos_portal/apps/workspace/views.py @@ -10,23 +10,31 @@ def request_new_tenant(request): if request.method == 'POST': logger.debug("Form is posted") request.active_nav_item = 'request-new-tenant' + token = request.COOKIES['token'] return render(request, 'workspace/request_new_tenant.html', { 'bundle_name': 'request-new-tenant', + 'data': token }) def list_new_tenant_requests(request): request.active_nav_item = 'list-requests' + if request.user: - print("hell") + token = request.COOKIES['token'] + return render(request, 'workspace/list_requests.html', { 'bundle_name': 'list-requests', + 'data': token }) -def view_tenant_request(request, tenant_request_id): +def view_tenant_request(request, client_id): + token = request.COOKIES['token'] + return render(request, 'workspace/view_tenant_request.html', { 'bundle_name': 'view-request', - 'tenant_request_id': tenant_request_id + 'tenant_client_id': client_id, + 'data': token }) diff --git a/custos_portal/custos_portal/context_processors.py b/custos_portal/custos_portal/context_processors.py index d1f4fd4b..90240ebe 100644 --- a/custos_portal/custos_portal/context_processors.py +++ b/custos_portal/custos_portal/context_processors.py @@ -2,27 +2,33 @@ import logging import re -from clients.identity_management_client import IdentityManagementClient -from clients.user_management_client import UserManagementClient +from custos.clients.identity_management_client import IdentityManagementClient +from custos.clients.user_management_client import UserManagementClient from django.apps import apps from django.conf import settings +from custos.transport.settings import CustosServerClientSettings +import os + from custos_portal.app_config import CustosAppConfig logger = logging.getLogger(__name__) # load APIServerClient with default configuration -client = UserManagementClient() -id_client = IdentityManagementClient() - -token = "Y3VzdG9zLTZud29xb2RzdHBlNW12Y3EwOWxoLTEwMDAwMTAxOkdpS3JHR1ZMVzd6RG9QWnd6Z0NpRk03V1V6M1BoSXVtVG1GeEFrcjc="; - +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +settings = os.path.join(BASE_DIR, 'transport', 'settings.ini') +custos_settings = CustosServerClientSettings(custos_host=custos_host, + custos_port=custos_port, + custos_client_id=custos_client_id, + custos_client_sec=custos_client_sec, + configuration_file_location=None) +client = UserManagementClient(custos_settings) +id_client = IdentityManagementClient(custos_settings) def register_user(): response = client.register_user(token, "TestingUser", "Jhon", "Smith", "12345", "jhon@iu.edu", True) - print(response) def airavata_app_registry(request): diff --git a/custos_portal/custos_portal/settings.ini b/custos_portal/custos_portal/settings.ini index ce676b80..39806e8d 100644 --- a/custos_portal/custos_portal/settings.ini +++ b/custos_portal/custos_portal/settings.ini @@ -1,4 +1,5 @@ [CustosServer] SERVER_HOST = custos.scigap.org -SERVER_SSL_PORT = 32036 -CERTIFICATE_FILE_PATH = ../cert.pem \ No newline at end of file +SERVER_SSL_PORT = 45996 +CLIENT_ID = custos Id +CLIENT_SEC = custos Sec \ No newline at end of file diff --git a/custos_portal/custos_portal/settings.py b/custos_portal/custos_portal/settings.py index 960825b6..8c400019 100644 --- a/custos_portal/custos_portal/settings.py +++ b/custos_portal/custos_portal/settings.py @@ -21,8 +21,6 @@ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = '3=(o1!l-)1p#evd@aviv56^piimx)!p=^t=#5))yn547yr9f2&' -# Custos server secret key -CUSTOS_TOKEN = 'Y3VzdG9zLTZud29xb2RzdHBlNW12Y3EwOWxoLTEwMDAwMTAxOkdpS3JHR1ZMVzd6RG9QWnd6Z0NpRk03V1V6M1BoSXVtVG1GeEFrcjc=' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True @@ -125,6 +123,7 @@ STATIC_URL = '/static/' STATICFILES_DIRS = [os.path.join(BASE_DIR, "custos_portal", "static")] + LOGIN_URL = 'custos_portal_auth:login' LOGIN_REDIRECT_URL = 'custos_portal_auth:dashboard' LOGOUT_REDIRECT_URL = '/' @@ -209,3 +208,5 @@ from custos_portal.settings_local import * # noqa except ImportError: pass + + diff --git a/custos_portal/custos_portal/settings_local.py b/custos_portal/custos_portal/settings_local.py index 81b94ae4..832a1dd9 100644 --- a/custos_portal/custos_portal/settings_local.py +++ b/custos_portal/custos_portal/settings_local.py @@ -11,14 +11,6 @@ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) -# Keycloak Configuration -KEYCLOAK_CLIENT_ID = 'custos-6nwoqodstpe5mvcq09lh-10000101' -KEYCLOAK_CLIENT_SECRET = 'GiKrGGVLW7zDoPZwzgCiFM7WUz3PhIumTmFxAkr7' -KEYCLOAK_AUTHORIZE_URL = 'https://keycloak.custos.scigap.org:31000/auth/realms/10000101/protocol/openid-connect/auth' -KEYCLOAK_TOKEN_URL = 'https://airavata.host:8443/auth/realms/default/protocol/openid-connect/token' -KEYCLOAK_LOGOUT_URL = 'https://keycloak.custos.scigap.org:31000/auth/realms/10000101/protocol/openid-connect/logout' -# Optional: specify if using self-signed certificate or certificate from unrecognized CA -# KEYCLOAK_CA_CERTFILE = os.path.join(BASE_DIR, "django_airavata", "resources", "incommon_rsa_server_ca.pem") KEYCLOAK_VERIFY_SSL = False SESSION_COOKIE_SECURE = False diff --git a/custos_portal/custos_portal/static/common/dist/webpack-stats.json b/custos_portal/custos_portal/static/common/dist/webpack-stats.json index dfe69515..fc4eb7c8 100644 --- a/custos_portal/custos_portal/static/common/dist/webpack-stats.json +++ b/custos_portal/custos_portal/static/common/dist/webpack-stats.json @@ -1 +1 @@ -{"status":"done","publicPath":"http://localhost:9000/static/common/dist/","chunks":{"admin-edit-request":[{"name":"admin-edit-request.js","publicPath":"http://localhost:9000/static/common/dist/admin-edit-request.js","path":"/home/shivam/Programming/airavata-custos-portal/custos_portal/custos_portal/static/common/dist/admin-edit-request.js"},{"name":"admin-edit-request.js.map","publicPath":"http://localhost:9000/static/common/dist/admin-edit-request.js.map","path":"/home/shivam/Programming/airavata-custos-portal/custos_portal/custos_portal/static/common/dist/admin-edit-request.js.map"}],"admin-list-requests":[{"name":"admin-list-requests.js","publicPath":"http://localhost:9000/static/common/dist/admin-list-requests.js","path":"/home/shivam/Programming/airavata-custos-portal/custos_portal/custos_portal/static/common/dist/admin-list-requests.js"},{"name":"admin-list-requests.js.map","publicPath":"http://localhost:9000/static/common/dist/admin-list-requests.js.map","path":"/home/shivam/Programming/airavata-custos-portal/custos_portal/custos_portal/static/common/dist/admin-list-requests.js.map"}],"admin-view-request":[{"name":"admin-view-request.js","publicPath":"http://localhost:9000/static/common/dist/admin-view-request.js","path":"/home/shivam/Programming/airavata-custos-portal/custos_portal/custos_portal/static/common/dist/admin-view-request.js"},{"name":"admin-view-request.js.map","publicPath":"http://localhost:9000/static/common/dist/admin-view-request.js.map","path":"/home/shivam/Programming/airavata-custos-portal/custos_portal/custos_portal/static/common/dist/admin-view-request.js.map"}],"app":[{"name":"app.js","publicPath":"http://localhost:9000/static/common/dist/app.js","path":"/home/shivam/Programming/airavata-custos-portal/custos_portal/custos_portal/static/common/dist/app.js"},{"name":"app.js.map","publicPath":"http://localhost:9000/static/common/dist/app.js.map","path":"/home/shivam/Programming/airavata-custos-portal/custos_portal/custos_portal/static/common/dist/app.js.map"}],"chunk-vendors":[{"name":"chunk-vendors.js","publicPath":"http://localhost:9000/static/common/dist/chunk-vendors.js","path":"/home/shivam/Programming/airavata-custos-portal/custos_portal/custos_portal/static/common/dist/chunk-vendors.js"},{"name":"chunk-vendors.js.map","publicPath":"http://localhost:9000/static/common/dist/chunk-vendors.js.map","path":"/home/shivam/Programming/airavata-custos-portal/custos_portal/custos_portal/static/common/dist/chunk-vendors.js.map"}],"cms":[{"name":"cms.js","publicPath":"http://localhost:9000/static/common/dist/cms.js","path":"/home/shivam/Programming/airavata-custos-portal/custos_portal/custos_portal/static/common/dist/cms.js"},{"name":"cms.js.map","publicPath":"http://localhost:9000/static/common/dist/cms.js.map","path":"/home/shivam/Programming/airavata-custos-portal/custos_portal/custos_portal/static/common/dist/cms.js.map"}],"list-requests":[{"name":"list-requests.js","publicPath":"http://localhost:9000/static/common/dist/list-requests.js","path":"/home/shivam/Programming/airavata-custos-portal/custos_portal/custos_portal/static/common/dist/list-requests.js"},{"name":"list-requests.js.map","publicPath":"http://localhost:9000/static/common/dist/list-requests.js.map","path":"/home/shivam/Programming/airavata-custos-portal/custos_portal/custos_portal/static/common/dist/list-requests.js.map"}],"request-new-tenant":[{"name":"request-new-tenant.js","publicPath":"http://localhost:9000/static/common/dist/request-new-tenant.js","path":"/home/shivam/Programming/airavata-custos-portal/custos_portal/custos_portal/static/common/dist/request-new-tenant.js"},{"name":"request-new-tenant.js.map","publicPath":"http://localhost:9000/static/common/dist/request-new-tenant.js.map","path":"/home/shivam/Programming/airavata-custos-portal/custos_portal/custos_portal/static/common/dist/request-new-tenant.js.map"}],"view-request":[{"name":"view-request.js","publicPath":"http://localhost:9000/static/common/dist/view-request.js","path":"/home/shivam/Programming/airavata-custos-portal/custos_portal/custos_portal/static/common/dist/view-request.js"},{"name":"view-request.js.map","publicPath":"http://localhost:9000/static/common/dist/view-request.js.map","path":"/home/shivam/Programming/airavata-custos-portal/custos_portal/custos_portal/static/common/dist/view-request.js.map"}]}} \ No newline at end of file +{"status":"done","publicPath":"http://localhost:9000/static/common/dist/","chunks":{"admin-edit-request":[{"name":"admin-edit-request.js","publicPath":"http://localhost:9000/static/common/dist/admin-edit-request.js","path":"D:\\airavata-final\\airavata-custos-portal-1\\custos_portal\\custos_portal\\static\\common\\dist\\admin-edit-request.js"},{"name":"admin-edit-request.js.map","publicPath":"http://localhost:9000/static/common/dist/admin-edit-request.js.map","path":"D:\\airavata-final\\airavata-custos-portal-1\\custos_portal\\custos_portal\\static\\common\\dist\\admin-edit-request.js.map"}],"admin-list-requests":[{"name":"admin-list-requests.js","publicPath":"http://localhost:9000/static/common/dist/admin-list-requests.js","path":"D:\\airavata-final\\airavata-custos-portal-1\\custos_portal\\custos_portal\\static\\common\\dist\\admin-list-requests.js"},{"name":"admin-list-requests.js.map","publicPath":"http://localhost:9000/static/common/dist/admin-list-requests.js.map","path":"D:\\airavata-final\\airavata-custos-portal-1\\custos_portal\\custos_portal\\static\\common\\dist\\admin-list-requests.js.map"}],"admin-request-new-tenant":[{"name":"admin-request-new-tenant.js","publicPath":"http://localhost:9000/static/common/dist/admin-request-new-tenant.js","path":"D:\\airavata-final\\airavata-custos-portal-1\\custos_portal\\custos_portal\\static\\common\\dist\\admin-request-new-tenant.js"},{"name":"admin-request-new-tenant.js.map","publicPath":"http://localhost:9000/static/common/dist/admin-request-new-tenant.js.map","path":"D:\\airavata-final\\airavata-custos-portal-1\\custos_portal\\custos_portal\\static\\common\\dist\\admin-request-new-tenant.js.map"}],"admin-view-request":[{"name":"admin-view-request.js","publicPath":"http://localhost:9000/static/common/dist/admin-view-request.js","path":"D:\\airavata-final\\airavata-custos-portal-1\\custos_portal\\custos_portal\\static\\common\\dist\\admin-view-request.js"},{"name":"admin-view-request.js.map","publicPath":"http://localhost:9000/static/common/dist/admin-view-request.js.map","path":"D:\\airavata-final\\airavata-custos-portal-1\\custos_portal\\custos_portal\\static\\common\\dist\\admin-view-request.js.map"}],"app":[{"name":"app.js","publicPath":"http://localhost:9000/static/common/dist/app.js","path":"D:\\airavata-final\\airavata-custos-portal-1\\custos_portal\\custos_portal\\static\\common\\dist\\app.js"},{"name":"app.js.map","publicPath":"http://localhost:9000/static/common/dist/app.js.map","path":"D:\\airavata-final\\airavata-custos-portal-1\\custos_portal\\custos_portal\\static\\common\\dist\\app.js.map"}],"chunk-vendors":[{"name":"chunk-vendors.js","publicPath":"http://localhost:9000/static/common/dist/chunk-vendors.js","path":"D:\\airavata-final\\airavata-custos-portal-1\\custos_portal\\custos_portal\\static\\common\\dist\\chunk-vendors.js"},{"name":"chunk-vendors.js.map","publicPath":"http://localhost:9000/static/common/dist/chunk-vendors.js.map","path":"D:\\airavata-final\\airavata-custos-portal-1\\custos_portal\\custos_portal\\static\\common\\dist\\chunk-vendors.js.map"}],"cms":[{"name":"cms.js","publicPath":"http://localhost:9000/static/common/dist/cms.js","path":"D:\\airavata-final\\airavata-custos-portal-1\\custos_portal\\custos_portal\\static\\common\\dist\\cms.js"},{"name":"cms.js.map","publicPath":"http://localhost:9000/static/common/dist/cms.js.map","path":"D:\\airavata-final\\airavata-custos-portal-1\\custos_portal\\custos_portal\\static\\common\\dist\\cms.js.map"}],"list-requests":[{"name":"list-requests.js","publicPath":"http://localhost:9000/static/common/dist/list-requests.js","path":"D:\\airavata-final\\airavata-custos-portal-1\\custos_portal\\custos_portal\\static\\common\\dist\\list-requests.js"},{"name":"list-requests.9a2297f2e96ba99a7f97.hot-update.js","publicPath":"http://localhost:9000/static/common/dist/list-requests.9a2297f2e96ba99a7f97.hot-update.js","path":"D:\\airavata-final\\airavata-custos-portal-1\\custos_portal\\custos_portal\\static\\common\\dist\\list-requests.9a2297f2e96ba99a7f97.hot-update.js"},{"name":"list-requests.js.map","publicPath":"http://localhost:9000/static/common/dist/list-requests.js.map","path":"D:\\airavata-final\\airavata-custos-portal-1\\custos_portal\\custos_portal\\static\\common\\dist\\list-requests.js.map"},{"name":"list-requests.9a2297f2e96ba99a7f97.hot-update.js.map","publicPath":"http://localhost:9000/static/common/dist/list-requests.9a2297f2e96ba99a7f97.hot-update.js.map","path":"D:\\airavata-final\\airavata-custos-portal-1\\custos_portal\\custos_portal\\static\\common\\dist\\list-requests.9a2297f2e96ba99a7f97.hot-update.js.map"}],"request-new-tenant":[{"name":"request-new-tenant.js","publicPath":"http://localhost:9000/static/common/dist/request-new-tenant.js","path":"D:\\airavata-final\\airavata-custos-portal-1\\custos_portal\\custos_portal\\static\\common\\dist\\request-new-tenant.js"},{"name":"request-new-tenant.js.map","publicPath":"http://localhost:9000/static/common/dist/request-new-tenant.js.map","path":"D:\\airavata-final\\airavata-custos-portal-1\\custos_portal\\custos_portal\\static\\common\\dist\\request-new-tenant.js.map"}],"view-request":[{"name":"view-request.js","publicPath":"http://localhost:9000/static/common/dist/view-request.js","path":"D:\\airavata-final\\airavata-custos-portal-1\\custos_portal\\custos_portal\\static\\common\\dist\\view-request.js"},{"name":"view-request.js.map","publicPath":"http://localhost:9000/static/common/dist/view-request.js.map","path":"D:\\airavata-final\\airavata-custos-portal-1\\custos_portal\\custos_portal\\static\\common\\dist\\view-request.js.map"}]}} \ No newline at end of file diff --git a/custos_portal/custos_portal/static/common/js/apps/config/config.js b/custos_portal/custos_portal/static/common/js/apps/config/config.js new file mode 100644 index 00000000..aa4fa350 --- /dev/null +++ b/custos_portal/custos_portal/static/common/js/apps/config/config.js @@ -0,0 +1,2 @@ +export const CLIENT_ID = CLIENT_ID; +export const CLIENT_SECRET = CLIENT_SECRET; \ No newline at end of file diff --git a/custos_portal/custos_portal/static/common/js/apps/custos_portal_admin/EditTenantRequest.vue b/custos_portal/custos_portal/static/common/js/apps/custos_portal_admin/EditTenantRequest.vue index 511b4b84..71752035 100755 --- a/custos_portal/custos_portal/static/common/js/apps/custos_portal_admin/EditTenantRequest.vue +++ b/custos_portal/custos_portal/static/common/js/apps/custos_portal_admin/EditTenantRequest.vue @@ -2,10 +2,10 @@
-

Update Tenant Request Form

+

Update Tenant Request Form

-
+
@@ -29,6 +29,7 @@ label-for="input-1" :invalid-feedback="invalidFeedback" :valid-feedback="validFeedback" + class="inputLabels" > - - -
+
- + - - + - - - Update - Discard - - - + +
+ +

Tenant is updated

+
+
+ Update +
@@ -285,6 +301,8 @@ \ No newline at end of file + + \ No newline at end of file diff --git a/custos_portal/custos_portal/static/common/js/apps/custos_portal_admin/ListTenantRequestsContainer.vue b/custos_portal/custos_portal/static/common/js/apps/custos_portal_admin/ListTenantRequestsContainer.vue index 8bd2add8..17cbf8a0 100644 --- a/custos_portal/custos_portal/static/common/js/apps/custos_portal_admin/ListTenantRequestsContainer.vue +++ b/custos_portal/custos_portal/static/common/js/apps/custos_portal_admin/ListTenantRequestsContainer.vue @@ -2,44 +2,123 @@
-

Existing Tenants Request

+

Existing Tenants Request

-
-
-
-
- - +
+
+ + + + + + Search + + +
+
+
+ + + + + + + + + + + + +
Client IDClient Name
+ {{tR.client_id}} + {{tR.client_name}}
+
+
+
+
Requested
+
Active
+
Deactivated
+
+
+ + - - - - + + + - - - + + + - + + + + +
Request IdClient NameCreation TimeStatusClient IDClient NameStatus
- {{tR.requestId}} + {{tR.client_id}} {{tR.clientName}}{{tR.client_name}}{{tR.tenant_status}}
+
+
+ + +
+
+
+ + + + + + + + + + + + + + +
Client IDClient NameStatus
- {{ tR.creationTime }} + {{tR.client_id}} {{tR.client_name}}{{tR.tenant_status}}
+
+
+ + +
+
+
+ + + + + + + + + + + + - -
Client IDClient NameStatus
- {{tR.status}} + {{tR.client_id}} + N/A {{tR.client_name}}{{tR.tenant_status}}
+ + +
+
+ +
+
@@ -48,36 +127,362 @@ import {now} from "moment"; import urls from "./utils/urls"; + import axios from 'axios'; + import {CLIENT_ID, CLIENT_SECRET} from '../config/config'; + import VueJwtDecode from 'vue-jwt-decode' export default { - + props: { + tokenData: { + type: String + } + }, data() { return { - tenantRequests: [] + requested: [], + active: [], + deactivated: [], + value: 1, + searchID: '', + searchList: [], + searchInd: false, + perPage: 10, + active_page: 1, + active_pages: [], + active_display: [], + requested_page: 1, + requested_pages: [], + requested_display: [], + deactivated_page: 1, + deactivated_pages: [], + deactivated_display: [], + req_offset: 0, + active_offset: 0, + deactivated_offset: 0, + req_limit: 0, + active_limit: 0, + deactive_limit: 0 + } + }, + computed: { + rows() { + return this.searchList.length; } }, beforeMount() { - this.tenantRequests.push({ - requestId: '234234324', - clientName: 'scigap', - creationTime: now(), - status: 'Active' - }); - this.tenantRequests.push({ - requestId: '54645645', - clientName: 'scigap', - creationTime: now(), - status: 'Active' + let token = this.tokenData; + + let encodedString = btoa(CLIENT_ID+":"+CLIENT_SECRET); + let decodedEmail = VueJwtDecode.decode(token).email; + + axios.get(`https://custos.scigap.org/apiserver/tenant-management/v1.0.0/tenants?limit=10&offset=${this.req_offset}`, { + headers: { + 'Authorization': `Bearer ${encodedString}` + } + }) + .then(response => { + const {tenant} = response.data; + this.requested_display = tenant; + }) + + axios.get(`https://custos.scigap.org/apiserver/tenant-management/v1.0.0/tenants?limit=10&offset=${this.offset}&status=ACTIVE`, { + headers: { + 'Authorization': `Bearer ${encodedString}` + } + }) + .then(response => { + const {tenant} = response.data; + this.active_display = tenant; + }) + + axios.get(`https://custos.scigap.org/apiserver/tenant-management/v1.0.0/tenants?limit=10&offset=${this.offset}&status=DEACTIVATED`, { + headers: { + 'Authorization': `Bearer ${encodedString}` + } + }) + .then(response => { + const {tenant} = response.data; + this.deactivated_display = tenant; }) }, methods: { viewLink(tenantRequest) { - console.log("Executed view link",tenantRequest) return urls.navigateToAdminViewRequest(tenantRequest) + }, + onClickHandler(step) + { + this.value = step; + }, + searchHandler() { + this.searchInd = true; + + let encodedString = btoa(CLIENT_ID+":"+CLIENT_SECRET); + + axios.get(`https://custos.scigap.org/apiserver/tenant-management/v1.0.0/oauth2/tenant?client_id=${this.searchID}`, { + headers: { + 'Authorization': `Bearer ${encodedString}` + } + }) + .then(res => { + this.searchList.push(res.data); + }) + }, + paginateActive(active_page) { + this.active_page = active_page; + let page = active_page; + let perPage = this.perPage; + let from = (page * perPage) - perPage; + let to = page * perPage; + this.active_display = this.active.slice(from, to); + }, + paginateRequested(active_page) { + this.requested_page = active_page; + let page = active_page; + let perPage = this.perPage; + let from = (page * perPage) - perPage; + let to = page * perPage; + this.requested_display = this.requested.slice(from, to); + }, + paginateDeactivated(active_page) { + this.deactivated_page = active_page; + let page = active_page; + let perPage = this.perPage; + let from = (page * perPage) - perPage; + let to = page * perPage; + this.deactivated_display = this.deactivated.slice(from, to); + }, + loadNextPageRequested(offset) { + let encodedString = btoa(CLIENT_ID+":"+CLIENT_SECRET); + axios.get(`https://custos.scigap.org/apiserver/tenant-management/v1.0.0/tenants?limit=10&offset=${offset}`, { + headers: { + 'Authorization': `Bearer ${encodedString}` + } + }) + .then(response => { + const {tenant} = response.data; + if(tenant.length > 0) + { + this.requested_page++; + this.requested_display = tenant; + this.req_offset = offset; + } + else + this.req_limit = 1; + }) + }, + loadPrevPageRequested(offset) + { + let encodedString = btoa(CLIENT_ID+":"+CLIENT_SECRET); + axios.get(`https://custos.scigap.org/apiserver/tenant-management/v1.0.0/tenants?limit=10&offset=${offset}`, { + headers: { + 'Authorization': `Bearer ${encodedString}` + } + }) + .then(response => { + this.req_limit = 0; + const {tenant} = response.data; + if(tenant.length > 0) + { + this.requested_page++; + this.requested_display = tenant; + this.req_offset = offset; + } + }) + }, + loadNextPageActive(offset) { + let encodedString = btoa(CLIENT_ID+":"+CLIENT_SECRET); + axios.get(`https://custos.scigap.org/apiserver/tenant-management/v1.0.0/tenants?limit=10&offset=${offset}&status=ACTIVE`, { + headers: { + 'Authorization': `Bearer ${encodedString}` + } + }) + .then(response => { + const {tenant} = response.data; + if(tenant.length > 0) + { + this.active_page++; + this.active_display = tenant; + this.active_offset = offset; + } + else + this.active_limit = 1; + }) + }, + loadPrevPageActive(offset) + { + let encodedString = btoa(CLIENT_ID+":"+CLIENT_SECRET); + axios.get(`https://custos.scigap.org/apiserver/tenant-management/v1.0.0/tenants?limit=10&offset=${offset}&status=ACTIVE`, { + headers: { + 'Authorization': `Bearer ${encodedString}` + } + }) + .then(response => { + this.active_limit = 0; + const {tenant} = response.data; + if(tenant.length > 0) + { + this.active_page++; + this.active_display = tenant; + this.active_offset = offset; + } + }) + }, + loadNextPageDeactive(offset) { + let encodedString = btoa(CLIENT_ID+":"+CLIENT_SECRET); + axios.get(`https://custos.scigap.org/apiserver/tenant-management/v1.0.0/tenants?limit=10&offset=${offset}&status=DEACTIVATED`, { + headers: { + 'Authorization': `Bearer ${encodedString}` + } + }) + .then(response => { + const {tenant} = response.data; + if(tenant.length > 0) + { + this.deactive_page++; + this.deactivated_display = tenant; + this.deactivated_offset = offset; + } + else + this.deactive_limit = 1; + }) + }, + loadPrevPageDeactive(offset) + { + let encodedString = btoa(CLIENT_ID+":"+CLIENT_SECRET); + axios.get(`https://custos.scigap.org/apiserver/tenant-management/v1.0.0/tenants?limit=10&offset=${offset}&status=DEACTIVATED`, { + headers: { + 'Authorization': `Bearer ${encodedString}` + } + }) + .then(response => { + this.deactive_limit = 0; + const {tenant} = response.data; + if(tenant.length > 0) + { + this.deactive_page++; + this.deactivated_display = tenant; + this.deactivated_offset = offset; + } + }) + }, + }, + watch: { + requested() { + let numberOfPages = Math.ceil(this.requested.length/this.perPage); + for(let i=1; i<=numberOfPages; i++) + this.requested_pages.push(i); + }, + active() { + let numberOfPages = Math.ceil(this.active.length/ this.perPage); + this.active_pages = []; + for(let i=1; i<=numberOfPages; i++) + this.active_pages.push(i); + }, + deactivated() { + let numberOfPages = Math.ceil(this.deactivated.length/this.perPage); + for(let i=1; i<=numberOfPages; i++) + this.deactivated_pages.push(i); } } }; - + \ No newline at end of file diff --git a/custos_portal/custos_portal/static/common/js/apps/custos_portal_admin/RequestNewTenantContainer.vue b/custos_portal/custos_portal/static/common/js/apps/custos_portal_admin/RequestNewTenantContainer.vue new file mode 100644 index 00000000..d466dd78 --- /dev/null +++ b/custos_portal/custos_portal/static/common/js/apps/custos_portal_admin/RequestNewTenantContainer.vue @@ -0,0 +1,729 @@ + + + + + \ No newline at end of file diff --git a/custos_portal/custos_portal/static/common/js/apps/custos_portal_admin/ViewTenantRequestContainer.vue b/custos_portal/custos_portal/static/common/js/apps/custos_portal_admin/ViewTenantRequestContainer.vue index f414cd64..2467386f 100644 --- a/custos_portal/custos_portal/static/common/js/apps/custos_portal_admin/ViewTenantRequestContainer.vue +++ b/custos_portal/custos_portal/static/common/js/apps/custos_portal_admin/ViewTenantRequestContainer.vue @@ -2,7 +2,7 @@
-

Tenant Request Details

+

Tenant Request Details

@@ -12,57 +12,72 @@ - + + + + + - + - + - + - - + + - - + + - + - + - + - + + + + + - + +
@@ -82,12 +99,15 @@ Edit Reject
@@ -98,8 +118,6 @@
- -
Request IdClient ID -
{{tenantRequestId}}
+
{{tenantRequest.client_id}}
Client Name -
{{request.client_name}}
+
{{tenantRequest.client_name}}
Issued At{{tenantRequest.client_id_issued_at}}
Requester Email{{request.requester_email}}{{tenantRequest.requester_email}}
Admin Username{{request.admin_username}}{{tenantRequest.admin_username}}
Admin Name{{request.admin_first_name}} {{ " " }} {{request.admin_last_name}}{{tenantRequest.admin_first_name}} {{ " " }} {{tenantRequest.admin_last_name}}
Primary contact{{request.primary_contact}}Primary Contact{{tenantRequest.contacts[0]}}
Secondary contact{{request.secondary_contact}}Secondary Contact{{tenantRequest.contacts[1]}}
Redirect URI Name{{request.redirect_uris}} + + + {{uri}} + +
+
Scope{{request.scope}}{{tenantRequest.scope}}
Domain{{request.domain}}{{tenantRequest.domain}}
Client URI{{request.client_uri}}{{tenantRequest.client_uri}}
Logo URI{{tenantRequest.logo_uri}}
Comment{{request.comment}}{{tenantRequest.comment}}
@@ -111,40 +129,81 @@ \ No newline at end of file + + + \ No newline at end of file diff --git a/custos_portal/custos_portal/static/common/js/apps/custos_portal_admin/entry-admin-edit-tenant-request.js b/custos_portal/custos_portal/static/common/js/apps/custos_portal_admin/entry-admin-edit-tenant-request.js index 4d8f496b..ef88a050 100755 --- a/custos_portal/custos_portal/static/common/js/apps/custos_portal_admin/entry-admin-edit-tenant-request.js +++ b/custos_portal/custos_portal/static/common/js/apps/custos_portal_admin/entry-admin-edit-tenant-request.js @@ -1,6 +1,11 @@ import { entry } from "../../index"; import MainLayout from "../../components/MainLayout"; import EditTenantRequest from "./EditTenantRequest"; +import axios from 'axios'; +import VueJwtDecode from 'vue-jwt-decode' +import {CLIENT_ID, CLIENT_SECRET} from '../config/config'; + +// import store from '../../store'; // Expect a template with id "edit-experiment" and experiment-id data attribute // @@ -12,19 +17,29 @@ entry(Vue => { return h(MainLayout, [ h(EditTenantRequest, { props: { - tenantRequestId: this.tenantRequestId + tenantRequest: this.tenantRequest } }) ]); }, data() { return { - tenantRequestId: null + tenantRequest: null }; }, beforeMount() { - this.tenantRequestId = JSON.parse(this.$el.dataset.tenantRequestId); - console.log("Entry for admin edit tenant request is executed") + this.tenantRequestId = this.$el.dataset.tenantClientId; + + let encodedString = btoa(CLIENT_ID+":"+CLIENT_SECRET); + + axios.get(`https://custos.scigap.org/apiserver/tenant-management/v1.0.0/oauth2/tenant?client_id=${this.tenantRequestId}`, { + headers: { + 'Authorization': `Bearer ${encodedString}` + } + }) + .then(res => { + this.tenantRequest = res.data; + }) } }).$mount("#admin-edit-request"); }); diff --git a/custos_portal/custos_portal/static/common/js/apps/custos_portal_admin/entry-admin-list-new-tenant-requests.js b/custos_portal/custos_portal/static/common/js/apps/custos_portal_admin/entry-admin-list-new-tenant-requests.js index 3676b1ca..b3aafc3f 100644 --- a/custos_portal/custos_portal/static/common/js/apps/custos_portal_admin/entry-admin-list-new-tenant-requests.js +++ b/custos_portal/custos_portal/static/common/js/apps/custos_portal_admin/entry-admin-list-new-tenant-requests.js @@ -10,16 +10,22 @@ entry(Vue => { new Vue({ render(h) { return h(MainLayout, [ - h(ListTenantRequestsContainer) + h(ListTenantRequestsContainer, { + props: { + tokenData: this.tokenData + } + }) ]); }, data() { return { - experimentId: null + experimentId: null, + tokenData: null }; }, beforeMount() { console.log("Entry for list-admin-new-tenant-request is executed") + this.tokenData = this.$el.dataset.token; } }).$mount("#admin-list-requests"); }); diff --git a/custos_portal/custos_portal/static/common/js/apps/custos_portal_admin/entry-admin-request-new-tenant.js b/custos_portal/custos_portal/static/common/js/apps/custos_portal_admin/entry-admin-request-new-tenant.js new file mode 100644 index 00000000..40950fd1 --- /dev/null +++ b/custos_portal/custos_portal/static/common/js/apps/custos_portal_admin/entry-admin-request-new-tenant.js @@ -0,0 +1,33 @@ +import { entry } from "../../index"; +import RequestNewTenantContainer from "./RequestNewTenantContainer"; +import MainLayout from "../../components/MainLayout"; +import VueJwtDecode from 'vue-jwt-decode' + +// Expect a template with id "edit-experiment" and experiment-id data attribute +// +//
+ +entry(Vue => { + new Vue({ + render(h) { + return h(MainLayout, [ + h(RequestNewTenantContainer, { + props : { + requesterEmail : this.decodedEmail + } + }) + ]); + }, + data() { + return { + experimentId: null, + decodedEmail: null + }; + }, + beforeMount() { + let token = this.$el.dataset.token; + + this.decodedEmail = VueJwtDecode.decode(token).email; + } + }).$mount("#admin-request-new-tenant"); +}); diff --git a/custos_portal/custos_portal/static/common/js/apps/custos_portal_admin/entry-admin-view-tenant-request.js b/custos_portal/custos_portal/static/common/js/apps/custos_portal_admin/entry-admin-view-tenant-request.js index aa242498..f85041db 100644 --- a/custos_portal/custos_portal/static/common/js/apps/custos_portal_admin/entry-admin-view-tenant-request.js +++ b/custos_portal/custos_portal/static/common/js/apps/custos_portal_admin/entry-admin-view-tenant-request.js @@ -1,6 +1,11 @@ import { entry } from "../../index"; import ViewTenantRequestContainer from "./ViewTenantRequestContainer"; import MainLayout from "../../components/MainLayout"; +import axios from 'axios'; +import VueJwtDecode from 'vue-jwt-decode' +import {CLIENT_ID, CLIENT_SECRET} from '../config/config'; + +// import store from '../../store'; // Expect a template with id "edit-experiment" and experiment-id data attribute // @@ -12,20 +17,36 @@ entry(Vue => { return h(MainLayout, [ h(ViewTenantRequestContainer, { props: { - tenantRequestId: this.tenantRequestId + tenantRequest: this.tenant, + tokenData: this.token } }) ]); }, data() { return { - tenantRequestId: null + tenant: null, + token : null }; }, beforeMount() { - this.tenantRequestId = JSON.parse(this.$el.dataset.tenantRequestId); - console.log("Entry adming view request is executed"); - console.log(this.$el.dataset) + this.tenantRequestId = this.$el.dataset.tenantClientId; + let token = this.$el.dataset.token; + this.token = token; + let encodedString = btoa(CLIENT_ID+":"+CLIENT_SECRET); + + axios.get(`https://custos.scigap.org/apiserver/tenant-management/v1.0.0/oauth2/tenant?client_id=${this.tenantRequestId}`, { + headers: { + 'Authorization': `Bearer ${encodedString}` + } + }) + .then(res => { + this.tenant = res.data; + var d = new Date(0); + d.setUTCSeconds(this.tenant.client_id_issued_at); + this.tenant.client_id_issued_at = d; + const tenantRequest = res.data; + }) } }).$mount("#admin-view-request"); }); diff --git a/custos_portal/custos_portal/static/common/js/apps/custos_portal_admin/utils/urls.js b/custos_portal/custos_portal/static/common/js/apps/custos_portal_admin/utils/urls.js index c096ad18..7c8a5f62 100644 --- a/custos_portal/custos_portal/static/common/js/apps/custos_portal_admin/utils/urls.js +++ b/custos_portal/custos_portal/static/common/js/apps/custos_portal_admin/utils/urls.js @@ -3,7 +3,7 @@ export default { viewAdminTenantRequest(tenantRequest) { return ( "/admin/request/" + - encodeURIComponent(tenantRequest.requestId) + + encodeURIComponent(tenantRequest.client_id) + "/" ); }, @@ -15,7 +15,7 @@ export default { adminEditTenantRequest(tenantRequest) { return ( "/admin/edit-tenant-request/" + - encodeURIComponent(tenantRequest.request_id) + + encodeURIComponent(tenantRequest.client_id) + "/" ); }, diff --git a/custos_portal/custos_portal/static/common/js/apps/workspace/ListTenantRequestsContainer.vue b/custos_portal/custos_portal/static/common/js/apps/workspace/ListTenantRequestsContainer.vue index 67a827ff..2d909063 100644 --- a/custos_portal/custos_portal/static/common/js/apps/workspace/ListTenantRequestsContainer.vue +++ b/custos_portal/custos_portal/static/common/js/apps/workspace/ListTenantRequestsContainer.vue @@ -2,44 +2,127 @@
-

Existing Tenants Request

+

Existing Tenants Request

-
-
-
-
- - +
+
+ + + + + + Search + + +
+
+
+ - - - - + + - - - + + + + + + + +
Request IdClient NameCreation TimeStatusClient IDClient Name
+ {{tR.client_id}} + {{tR.client_name}}
+
+
+
+
Requested
+
Active
+
Deactivated
+
+
+ + + + + + + + + + - + + + + +
Client IDClient NameStatus
- {{tR.requestId}} + {{tR.client_id}} {{tR.clientName}}{{tR.client_name}}{{tR.tenant_status}}
+
+
+ + {{requested_pageNumber}} + + +
+
+
+ + + + + + + + + + + + + + +
Client IDClient NameStatus
- {{ tR.creationTime }} + {{tR.client_id}} {{tR.client_name}}{{tR.tenant_status}}
+
+
+ + +
+
+
+ + + + + + + + + + + + - -
Client IDClient NameStatus
- {{tR.status}} + {{tR.client_id}} + N/A {{tR.client_name}}{{tR.tenant_status}}
+ + +
+
+ + {{deactivated_pageNumber}} + +
+
@@ -48,36 +131,252 @@ import {now} from "moment"; import urls from "./utils/urls"; + import axios from 'axios'; + import {CLIENT_ID, CLIENT_SECRET} from '../config/config'; + import VueJwtDecode from 'vue-jwt-decode' export default { - + props: { + tokenData: { + type: String + } + }, data() { return { - tenantRequests: [] + requested: [], + active: [], + deactivated: [], + value: 1, + searchID: '', + searchList: [], + searchInd: false, + perPage: 10, + active_page: 1, + active_pages: [], + active_display: [], + requested_page: 1, + requested_pages: [], + requested_display: [], + deactivated_page: 1, + deactivated_pages: [], + deactivated_display: [] + } + }, + computed: { + rows() { + return this.searchList.length; } }, beforeMount() { - this.tenantRequests.push({ - requestId: '234234324', - clientName: 'scigap', - creationTime: now(), - status: 'Active' - }); - this.tenantRequests.push({ - requestId: '54645645', - clientName: 'scigap', - creationTime: now(), - status: 'Active' + let token = this.tokenData; + + let encodedString = btoa(CLIENT_ID+":"+CLIENT_SECRET); + let decodedEmail = VueJwtDecode.decode(token).email; + + axios.get(`https://custos.scigap.org/apiserver/tenant-management/v1.0.0/tenants?offset=0&status=ACTIVE&requester_email=${decodedEmail}`, { + headers: { + 'Authorization': `Bearer ${encodedString}` + } }) + .then(response => { + const {tenant} = response.data; + + this.active = tenant.filter(t => { + if(t.tenant_status === 'ACTIVE') + return true; + }) + + this.requested = tenant.filter(t => { + if(t.tenant_status === 'REQUESTED') + return true; + }) + + this.deactivated = tenant.filter(t => { + if(t.tenant_status === 'DEACTIVATED') + return true; + }) + }) + .then(response1 => { + this.paginateRequested(1); + }) + .then(response2 => { + this.paginateActive(1); + }) + .then(response3 => { + this.paginateDeactivated(1); + }) + }, methods: { viewLink(tenantRequest) { - console.log("Executed view link",tenantRequest) return urls.navigateToViewRequest(tenantRequest) + }, + onClickHandler(step) + { + this.value = step; + }, + searchHandler() { + this.searchInd = true; + + let encodedString = btoa(CLIENT_ID+":"+CLIENT_SECRET); + let decodedEmail = VueJwtDecode.decode(this.tokenData).email; + + axios.get(`https://custos.scigap.org/apiserver/tenant-management/v1.0.0/tenants?offset=0&status=ACTIVE&requester_email=${decodedEmail}`, { + headers: { + 'Authorization': `Bearer ${encodedString}` + } + }) + .then(response => { + const {tenant} = response.data; + + this.searchList = tenant.filter(t => { + if(t.client_id === this.searchID) + return true; + }); + }) + }, + paginateActive(active_page) { + this.active_page = active_page; + let page = active_page; + let perPage = this.perPage; + let from = (page * perPage) - perPage; + let to = page * perPage; + this.active_display = this.active.slice(from, to); + }, + paginateRequested(active_page) { + this.requested_page = active_page; + let page = active_page; + let perPage = this.perPage; + let from = (page * perPage) - perPage; + let to = page * perPage; + this.requested_display = this.requested.slice(from, to); + }, + paginateDeactivated(active_page) { + this.deactivated_page = active_page; + let page = active_page; + let perPage = this.perPage; + let from = (page * perPage) - perPage; + let to = page * perPage; + this.deactivated_display = this.deactivated.slice(from, to); + } + }, + watch: { + requested() { + let numberOfPages = Math.ceil(this.requested.length/this.perPage); + for(let i=1; i<=numberOfPages; i++) + this.requested_pages.push(i); + }, + active() { + let numberOfPages = Math.ceil(this.active.length/ this.perPage); + this.active_pages = []; + for(let i=1; i<=numberOfPages; i++) + this.active_pages.push(i); + }, + deactivated() { + let numberOfPages = Math.ceil(this.deactivated.length/this.perPage); + for(let i=1; i<=numberOfPages; i++) + this.deactivated_pages.push(i); } } }; - + \ No newline at end of file diff --git a/custos_portal/custos_portal/static/common/js/apps/workspace/RequestNewTenantContainer.vue b/custos_portal/custos_portal/static/common/js/apps/workspace/RequestNewTenantContainer.vue index 795ca4a0..66d3d948 100755 --- a/custos_portal/custos_portal/static/common/js/apps/workspace/RequestNewTenantContainer.vue +++ b/custos_portal/custos_portal/static/common/js/apps/workspace/RequestNewTenantContainer.vue @@ -2,21 +2,26 @@
-

New Tenant Request Form

+

New Tenant Request Form

-
- - - - - +
+
+
User Info
+
Gateway Admin details
+
Gateway details
+
Client details
+
+
+ + v-model="requesterEmail" + readonly> - + - - - - - +
+
+ - - - + + + + + + + +
+
+ - - -
+
- + - - Submit + +
+ +

New Tenant is created

+
+
+ Request Tenant
- - - - -
- - Previous - - Next - -
Current Tab: {{ tabIndex+1 }} of 3
+
+
+
+
+
+

Please create a new tenant to view ClientID and Client Secret

+
+
+
+
+
+
+

Tenant Request Details

+
+
+
+
+
+
+ + + + + + + + + + + +
Client ID +
{{this.clientID}}
+
Client Secret +
{{this.clientSecret}}
+
+
+
+
+
+
+
+
+ + Previous + Next + +
-
+
\ No newline at end of file + + + \ No newline at end of file diff --git a/custos_portal/custos_portal/static/common/js/apps/workspace/ViewTenantRequestContainer.vue b/custos_portal/custos_portal/static/common/js/apps/workspace/ViewTenantRequestContainer.vue index 68f30d5b..072ef833 100644 --- a/custos_portal/custos_portal/static/common/js/apps/workspace/ViewTenantRequestContainer.vue +++ b/custos_portal/custos_portal/static/common/js/apps/workspace/ViewTenantRequestContainer.vue @@ -2,7 +2,7 @@
-

Tenant Request Details

+

Tenant Request Details

@@ -11,74 +11,67 @@
- - + + + + + - + - + - + - - + + - - + + - + - + - + - + - - - - - - - - - - - +
Request IdClient ID -
{{tenantRequestId}}
+
{{tenantRequest.client_id}}
Client Name -
{{request.client_name}}
+
{{tenantRequest.client_name}}
Issued At{{tenantRequest.client_id_issued_at}}
Requester Email{{request.requester_email}}{{tenantRequest.requester_email}}
Admin Username{{request.admin_username}}{{tenantRequest.admin_username}}
Admin Name{{request.admin_first_name}} {{ " " }} {{request.admin_last_name}}{{tenantRequest.admin_first_name}} {{ " " }} {{tenantRequest.admin_last_name}}
Primary contact{{request.primary_contact}}Primary Contact{{tenantRequest.contacts[0]}}
Secondary contact{{request.secondary_contact}}Secondary Contact{{tenantRequest.contacts[1]}}
Redirect URI Name{{request.redirect_uris}} + + + {{uri}} + +
+
Scope{{request.scope}}{{tenantRequest.scope}}
Domain{{request.domain}}{{tenantRequest.domain}}
Client URI{{request.client_uri}}{{tenantRequest.client_uri}}
Comment{{request.comment}}
Custos Key{{custosKey}} - - -
Custos Secret{{custosSecret}} - - - {{tenantRequest.comment}}
@@ -90,39 +83,29 @@ \ No newline at end of file + + + \ No newline at end of file diff --git a/custos_portal/custos_portal/static/common/js/apps/workspace/entry-list-new-tenant-requests.js b/custos_portal/custos_portal/static/common/js/apps/workspace/entry-list-new-tenant-requests.js index eaa85c40..1d91171a 100644 --- a/custos_portal/custos_portal/static/common/js/apps/workspace/entry-list-new-tenant-requests.js +++ b/custos_portal/custos_portal/static/common/js/apps/workspace/entry-list-new-tenant-requests.js @@ -10,16 +10,22 @@ entry(Vue => { new Vue({ render(h) { return h(MainLayout, [ - h(ListTenantRequestsContainer) + h(ListTenantRequestsContainer, { + props: { + tokenData: this.token + } + }) ]); }, data() { return { - experimentId: null + experimentId: null, + token: null }; }, beforeMount() { - console.log("Entry for list-new-tenant-request is executed") + console.log("Entry for list-new-tenant-request is executed"); + this.token = this.$el.dataset.token; } }).$mount("#list-requests"); }); diff --git a/custos_portal/custos_portal/static/common/js/apps/workspace/entry-request-new-tenant.js b/custos_portal/custos_portal/static/common/js/apps/workspace/entry-request-new-tenant.js index 9d369c21..5ae9eb7e 100755 --- a/custos_portal/custos_portal/static/common/js/apps/workspace/entry-request-new-tenant.js +++ b/custos_portal/custos_portal/static/common/js/apps/workspace/entry-request-new-tenant.js @@ -1,6 +1,7 @@ import { entry } from "../../index"; import RequestNewTenantContainer from "./RequestNewTenantContainer"; import MainLayout from "../../components/MainLayout"; +import VueJwtDecode from 'vue-jwt-decode' // Expect a template with id "edit-experiment" and experiment-id data attribute // @@ -10,16 +11,23 @@ entry(Vue => { new Vue({ render(h) { return h(MainLayout, [ - h(RequestNewTenantContainer) + h(RequestNewTenantContainer, { + props : { + requesterEmail : this.decodedEmail + } + }) ]); }, data() { return { - experimentId: null + experimentId: null, + decodedEmail: null }; }, beforeMount() { - console.log("Entry is executed") + let token = this.$el.dataset.token; + + this.decodedEmail = VueJwtDecode.decode(token).email; } }).$mount("#request-new-tenant"); }); diff --git a/custos_portal/custos_portal/static/common/js/apps/workspace/entry-view-tenant-request.js b/custos_portal/custos_portal/static/common/js/apps/workspace/entry-view-tenant-request.js index 11ae71d7..db8b36cc 100644 --- a/custos_portal/custos_portal/static/common/js/apps/workspace/entry-view-tenant-request.js +++ b/custos_portal/custos_portal/static/common/js/apps/workspace/entry-view-tenant-request.js @@ -1,6 +1,9 @@ import { entry } from "../../index"; import ViewTenantRequestContainer from "./ViewTenantRequestContainer"; import MainLayout from "../../components/MainLayout"; +import axios from 'axios'; +import VueJwtDecode from 'vue-jwt-decode' +import {CLIENT_ID, CLIENT_SECRET} from '../config/config'; // Expect a template with id "edit-experiment" and experiment-id data attribute // @@ -12,20 +15,40 @@ entry(Vue => { return h(MainLayout, [ h(ViewTenantRequestContainer, { props: { - tenantRequestId: this.tenantRequestId + tenantRequest: this.tenant, + tokenData: this.token } }) ]); }, data() { return { - tenantRequestId: null + tenant: null, + token: null }; }, beforeMount() { - this.tenantRequestId = JSON.parse(this.$el.dataset.tenantRequestId); - console.log("Entry is executed"); - console.log(this.$el.dataset) + this.tenantRequestId = this.$el.dataset.tenantRequestId; + this.tenantClientId = this.$el.dataset.tenantClientId; + let token = this.$el.dataset.token; + + let decodedEmail = VueJwtDecode.decode(token).email; + let encodedString = btoa(CLIENT_ID+":"+CLIENT_SECRET); + + axios.get(`https://custos.scigap.org/apiserver/tenant-management/v1.0.0/oauth2/tenant?client_id=${this.tenantClientId}`, { + headers: { + 'Authorization': `Bearer ${encodedString}` + } + }) + .then(res => { + this.tenant = res.data; + + var d = new Date(0); + d.setUTCSeconds(this.tenant.client_id_issued_at); + this.tenant.client_id_issued_at = d; + const tenantRequest = res.data; + }) + } }).$mount("#view-request"); }); diff --git a/custos_portal/custos_portal/static/common/js/apps/workspace/utils/urls.js b/custos_portal/custos_portal/static/common/js/apps/workspace/utils/urls.js index ef4061e2..8e76d660 100644 --- a/custos_portal/custos_portal/static/common/js/apps/workspace/utils/urls.js +++ b/custos_portal/custos_portal/static/common/js/apps/workspace/utils/urls.js @@ -3,7 +3,7 @@ export default { viewTenantRequest(tenantRequest) { return ( "/workspace/request/" + - encodeURIComponent(tenantRequest.requestId) + + encodeURIComponent(tenantRequest.client_id) + "/" ); }, diff --git a/custos_portal/custos_portal/static/common/js/store/index.js b/custos_portal/custos_portal/static/common/js/store/index.js new file mode 100644 index 00000000..80cbead7 --- /dev/null +++ b/custos_portal/custos_portal/static/common/js/store/index.js @@ -0,0 +1,10 @@ +import Vue from 'vue'; +import Vuex from 'vuex'; + +Vue.use(Vuex); + +export default new Vuex.Store({ + modules: { + tenant + } +}) \ No newline at end of file diff --git a/custos_portal/custos_portal/static/common/js/store/modules/store.js b/custos_portal/custos_portal/static/common/js/store/modules/store.js new file mode 100644 index 00000000..a6e4db78 --- /dev/null +++ b/custos_portal/custos_portal/static/common/js/store/modules/store.js @@ -0,0 +1,32 @@ +import axios from 'axios'; + +export const state = { + tenant: { + tenant_id: '', + tenant_status: '', + admin_email: '', + admin_first_name: '', + admin_last_name: '', + admin_password: '', + admin_username: '', + application_type: '', + client_id: '', + client_name: '', + client_uri: '', + comment: '', + contacts: '', + domain: '', + logo_url: '', + parent_tenant_id: '', + redirect_uris: '', + scope: '' + } +}; + +export const getters = { + getTenant = (state) => state.tenant +}; + +export const actions = {}; + +export const mutations = {}; \ No newline at end of file diff --git a/custos_portal/custos_portal/static/common/package-lock.json b/custos_portal/custos_portal/static/common/package-lock.json index fc49d8d8..251e3291 100755 --- a/custos_portal/custos_portal/static/common/package-lock.json +++ b/custos_portal/custos_portal/static/common/package-lock.json @@ -2033,6 +2033,37 @@ "integrity": "sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug==", "dev": true }, + "axios": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz", + "integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==", + "requires": { + "follow-redirects": "1.5.10" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "requires": { + "ms": "2.0.0" + } + }, + "follow-redirects": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz", + "integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==", + "requires": { + "debug": "=3.1.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + } + } + }, "babel-code-frame": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", @@ -11929,6 +11960,14 @@ "integrity": "sha512-BXq3jwIagosjgNVae6tkHzzIk6a8MHFtzAdwhnV5VlvPTFxDCvIttgSiHWjdGoTJvXtmRu5HacExfdarRcFhog==", "dev": true }, + "vue-jwt-decode": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/vue-jwt-decode/-/vue-jwt-decode-0.1.0.tgz", + "integrity": "sha512-4iP0NzYHkAF7G13tYPc/nudk4oNpB8GCVZupc7lekxXok1XKEgefNaGTpDT14g7RKe5H9GaMphPduDj4UVfZwQ==", + "requires": { + "vue": "^2.3.3" + } + }, "vue-loader": { "version": "15.9.0", "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-15.9.0.tgz", @@ -11973,6 +12012,11 @@ "resolved": "https://registry.npmjs.org/vuelidate/-/vuelidate-0.7.5.tgz", "integrity": "sha512-GAAG8QAFVp7BFeQlNaThpTbimq3+HypBPNwdkCkHZZeVaD5zmXXfhp357dcUJXHXTZjSln0PvP6wiwLZXkFTwg==" }, + "vuex": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/vuex/-/vuex-3.5.1.tgz", + "integrity": "sha512-w7oJzmHQs0FM9LXodfskhw9wgKBiaB+totOdb8sNzbTB2KDCEEwEs29NzBZFh/lmEK1t5tDmM1vtsO7ubG1DFw==" + }, "watchpack": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.6.0.tgz", diff --git a/custos_portal/custos_portal/static/common/package.json b/custos_portal/custos_portal/static/common/package.json index b16b8fba..f85b6eac 100755 --- a/custos_portal/custos_portal/static/common/package.json +++ b/custos_portal/custos_portal/static/common/package.json @@ -15,6 +15,7 @@ }, "dependencies": { "@fortawesome/fontawesome-free": "^5.6.3", + "axios": "^0.19.2", "bootstrap": "^4.3.1", "bootstrap-vue": "2.0.0-rc.26", "clipboard": "^2.0.4", @@ -23,7 +24,9 @@ "popper.js": "^1.14.6", "terser": "^4.1.2", "vue": "^2.5.22", - "vuelidate": "0.7.5" + "vue-jwt-decode": "^0.1.0", + "vuelidate": "0.7.5", + "vuex": "^3.5.1" }, "devDependencies": { "@vue/cli-plugin-babel": "^3.1.1", diff --git a/custos_portal/custos_portal/static/common/scss/main.scss b/custos_portal/custos_portal/static/common/scss/main.scss index 008a79a8..b6f685a1 100755 --- a/custos_portal/custos_portal/static/common/scss/main.scss +++ b/custos_portal/custos_portal/static/common/scss/main.scss @@ -48,7 +48,7 @@ body { } .c-nav { - background-color: #444; + background-color: #b4b3b3; min-width: 70px; min-height: 60px; padding: 1rem 0; @@ -56,7 +56,7 @@ body { display: flex; &__item { - color: #ccc; + color: #eeeeee; font-size: 1.5rem; display: block; text-align: center; @@ -65,15 +65,15 @@ body { &:hover, &:focus { - color: #ffffff; + color: #444444; } &:active { - color: #bbb; + color: #444444; } &.is-active { - color: #ffffff; + color: #444444; } } } diff --git a/custos_portal/custos_portal/static/common/vue.config.js b/custos_portal/custos_portal/static/common/vue.config.js index 21a668de..94486720 100755 --- a/custos_portal/custos_portal/static/common/vue.config.js +++ b/custos_portal/custos_portal/static/common/vue.config.js @@ -11,7 +11,8 @@ module.exports = { 'view-request': "./js/apps/workspace/entry-view-tenant-request", 'admin-view-request': "./js/apps/custos_portal_admin/entry-admin-view-tenant-request", 'admin-edit-request': "./js/apps/custos_portal_admin/entry-admin-edit-tenant-request", - 'admin-list-requests': "./js/apps/custos_portal_admin/entry-admin-list-new-tenant-requests" + 'admin-list-requests': "./js/apps/custos_portal_admin/entry-admin-list-new-tenant-requests", + 'admin-request-new-tenant': "./js/apps/custos_portal_admin/entry-admin-request-new-tenant" }, css: { loaderOptions: { diff --git a/custos_portal/custos_portal/static/images/auth.jpg b/custos_portal/custos_portal/static/images/auth.jpg new file mode 100644 index 00000000..dd2206e3 Binary files /dev/null and b/custos_portal/custos_portal/static/images/auth.jpg differ diff --git a/custos_portal/custos_portal/static/images/auth.png b/custos_portal/custos_portal/static/images/auth.png new file mode 100644 index 00000000..676451ff Binary files /dev/null and b/custos_portal/custos_portal/static/images/auth.png differ diff --git a/custos_portal/custos_portal/static/images/custos-logo_custos-logo-color-v2.png b/custos_portal/custos_portal/static/images/custos-logo_custos-logo-color-v2.png new file mode 100644 index 00000000..644886de Binary files /dev/null and b/custos_portal/custos_portal/static/images/custos-logo_custos-logo-color-v2.png differ diff --git a/custos_portal/custos_portal/static/images/custos-logo_custos-logomark-color.png b/custos_portal/custos_portal/static/images/custos-logo_custos-logomark-color.png new file mode 100644 index 00000000..c1f1d8f7 Binary files /dev/null and b/custos_portal/custos_portal/static/images/custos-logo_custos-logomark-color.png differ diff --git a/custos_portal/custos_portal/static/images/custos-logo_custos-logomark-dark.png b/custos_portal/custos_portal/static/images/custos-logo_custos-logomark-dark.png new file mode 100644 index 00000000..057b9712 Binary files /dev/null and b/custos_portal/custos_portal/static/images/custos-logo_custos-logomark-dark.png differ diff --git a/custos_portal/custos_portal/static/images/home.PNG b/custos_portal/custos_portal/static/images/home.PNG new file mode 100644 index 00000000..2698f039 Binary files /dev/null and b/custos_portal/custos_portal/static/images/home.PNG differ diff --git a/custos_portal/custos_portal/templates/base.html b/custos_portal/custos_portal/templates/base.html index d07d9852..30911cb6 100644 --- a/custos_portal/custos_portal/templates/base.html +++ b/custos_portal/custos_portal/templates/base.html @@ -145,7 +145,7 @@
{% block header %} - + {% endblock %} diff --git a/custos_portal/custos_portal/templates/custos_portal/home.html b/custos_portal/custos_portal/templates/custos_portal/home.html index a22b3d87..75fc1aff 100644 --- a/custos_portal/custos_portal/templates/custos_portal/home.html +++ b/custos_portal/custos_portal/templates/custos_portal/home.html @@ -1,16 +1,66 @@ {% extends 'base.html' %} - +{% load static %} {% block content %} + +
-
-

Welcome!

-

This is the Django based web portal for Custos.

- {% if not user.is_authenticated %} -

Login »

-

Register

- {% endif %} +
+
+
+

Welcome!

+

This is the Django based web portal for Custos.

+ {% if not user.is_authenticated %} +

Login »

+

Register

+ {% endif %} +
+
+ {% if not user.is_authenticated %} + + {% endif %} +
+
{% if user.is_authenticated %}
diff --git a/custos_portal/custos_portal/templates/custos_portal_auth/forgot_password.html b/custos_portal/custos_portal/templates/custos_portal_auth/forgot_password.html index d40d14ff..b0656f17 100644 --- a/custos_portal/custos_portal/templates/custos_portal_auth/forgot_password.html +++ b/custos_portal/custos_portal/templates/custos_portal_auth/forgot_password.html @@ -5,7 +5,7 @@
-
+
diff --git a/custos_portal/custos_portal/templates/custos_portal_auth/form_create_account.html b/custos_portal/custos_portal/templates/custos_portal_auth/form_create_account.html new file mode 100644 index 00000000..2e85d10d --- /dev/null +++ b/custos_portal/custos_portal/templates/custos_portal_auth/form_create_account.html @@ -0,0 +1,44 @@ +{% extends 'base.html' %} +{% load static %} +{% block content %} + + + +
+
+

Sign Up

+
+
+ {% if options.external %} + {% include "./partials/externals_login_form.html" %} + {% endif %} +
+
+ +
+
+
+
+{% endblock content %} diff --git a/custos_portal/custos_portal/templates/custos_portal_auth/login.html b/custos_portal/custos_portal/templates/custos_portal_auth/login.html index 9c4d9782..f6b0b757 100644 --- a/custos_portal/custos_portal/templates/custos_portal_auth/login.html +++ b/custos_portal/custos_portal/templates/custos_portal_auth/login.html @@ -1,16 +1,43 @@ {% extends 'base.html' %} - +{% load static %} {% block content %} -
-
- {% if options.external %} - {% include "./partials/externals_login_form.html" %} - {% endif %} + - {% if options.password %} - {% include "./partials/username_password_login_form.html" %} - {% endif %} +
+
+

Sign In

+
+
+ +
+
+ {% if options.external %} + {% include "./partials/externals_login_form.html" %} + {% endif %} + + {% if options.password %} + {% include "./partials/username_password_login_form.html" %} + {% endif %} +
+
{% endblock content %} diff --git a/custos_portal/custos_portal/templates/custos_portal_auth/partials/externals_login_form.html b/custos_portal/custos_portal/templates/custos_portal_auth/partials/externals_login_form.html index 7ea8ceb3..82eaadd6 100644 --- a/custos_portal/custos_portal/templates/custos_portal_auth/partials/externals_login_form.html +++ b/custos_portal/custos_portal/templates/custos_portal_auth/partials/externals_login_form.html @@ -1,20 +1,59 @@ -
-
-
-
-
{{ title|default:"Log in with your existing organizational login" }}
- {% for external in options.external %} - - Sign in with {{ external.name }} - - {% endfor %} -
-
-
+{% load static %} + + + +
+
{{ title|default:"Log in with your existing organizational login" }}
+ {% for external in options.external %} + + Sign in with {{ external.name }} + + {% endfor %}
diff --git a/custos_portal/custos_portal/templates/custos_portal_auth/partials/form.html b/custos_portal/custos_portal/templates/custos_portal_auth/partials/form.html index ce558f75..03a05c8b 100644 --- a/custos_portal/custos_portal/templates/custos_portal_auth/partials/form.html +++ b/custos_portal/custos_portal/templates/custos_portal_auth/partials/form.html @@ -1,3 +1,19 @@ +
{% include "./non_field_errors.html" %} @@ -7,7 +23,7 @@ {% include './form_field.html' %} {% endfor %} -
diff --git a/custos_portal/custos_portal/templates/custos_portal_auth/partials/username_password_login_form.html b/custos_portal/custos_portal/templates/custos_portal_auth/partials/username_password_login_form.html index 9b4ceef7..d0d88f21 100644 --- a/custos_portal/custos_portal/templates/custos_portal_auth/partials/username_password_login_form.html +++ b/custos_portal/custos_portal/templates/custos_portal_auth/partials/username_password_login_form.html @@ -1,31 +1,69 @@ -
-
-
-
-
Log in with {{ options.password.name|default:"a username and password" }}
- {% include "./messages.html" %} -
- {% csrf_token %} -
- - -
-
- - - Forgot your password? -
- {% if next %} - - {% endif %} - {% if login_type and login_type == 'password' %} - - {% endif %} - -
-
+ + + +
+
Log in with {{ options.password.name|default:"a username and password" }}
+ {% include "./messages.html" %} +
+
+ {% csrf_token %} +
+ +
-
+
+ + + Forgot your password? +
+ {% if next %} + + {% endif %} + {% if login_type and login_type == 'password' %} + + {% endif %} + +
+ diff --git a/custos_portal/custos_portal/templates/workspace/list_requests.html b/custos_portal/custos_portal/templates/workspace/list_requests.html index 3019d78f..cf9a31bb 100644 --- a/custos_portal/custos_portal/templates/workspace/list_requests.html +++ b/custos_portal/custos_portal/templates/workspace/list_requests.html @@ -3,6 +3,6 @@ {% block content %} -
+
{% endblock content %} \ No newline at end of file diff --git a/custos_portal/custos_portal/templates/workspace/request_new_tenant.html b/custos_portal/custos_portal/templates/workspace/request_new_tenant.html index 55de6e56..bbe84cf7 100644 --- a/custos_portal/custos_portal/templates/workspace/request_new_tenant.html +++ b/custos_portal/custos_portal/templates/workspace/request_new_tenant.html @@ -3,6 +3,6 @@ {% block content %} -
+
{% endblock content %} diff --git a/custos_portal/custos_portal/templates/workspace/view_tenant_request.html b/custos_portal/custos_portal/templates/workspace/view_tenant_request.html index 4b331165..a181305c 100644 --- a/custos_portal/custos_portal/templates/workspace/view_tenant_request.html +++ b/custos_portal/custos_portal/templates/workspace/view_tenant_request.html @@ -3,7 +3,7 @@ {% block content %} -
+
{% endblock content %} \ No newline at end of file