diff --git a/apimanager/apimanager/settings.py b/apimanager/apimanager/settings.py index 14fd4c7..eedbec2 100644 --- a/apimanager/apimanager/settings.py +++ b/apimanager/apimanager/settings.py @@ -51,22 +51,47 @@ INSTALLED_APPS = [ 'obp', 'consumers', 'users', + 'branches', + 'atms', 'entitlementrequests', 'customers', 'metrics', 'config', + 'webui', + 'methodrouting', + 'dynamicendpoints', + 'apicollections' ] MIDDLEWARE = [ + # 'django.middleware.cache.UpdateCacheMiddleware', 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.locale.LocaleMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', + # 'django.middleware.cache.FetchFromCacheMiddleware', ] +#cache the view page, we set 60s = 1m, +# CACHE_MIDDLEWARE_SECONDS = 60 + +# TIMEOUT is 31104000 seconds = 60*60*24*30*12 (1 year) +# MAX_ENTRIES is 1000000 entities +CACHES = { + 'default': { + 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', + 'LOCATION': 'unique-snowflake', + 'TIMEOUT': 31104000, + 'OPTIONS': { + 'MAX_ENTRIES': 10000000 + } + } +} + ROOT_URLCONF = 'apimanager.urls' TEMPLATES = [ @@ -84,6 +109,9 @@ TEMPLATES = [ 'base.context_processors.api_username', 'base.context_processors.api_user_id', 'base.context_processors.api_tester_url', + 'base.context_processors.portal_page', + 'base.context_processors.logo_url', + 'base.context_processors.override_css_url' ], }, }, @@ -141,6 +169,17 @@ USE_TZ = True STATIC_URL = '/static/' +from django.utils.translation import gettext_lazy as _ + +#LANGUAGES = ( +# ("en", _("English")), +# ("fr", _("French")), +#) + +LOCALE_PATHS = ( + os.path.join(BASE_DIR, "locale/"), +) + # Set this to your local directory for static files STATIC_ROOT = os.path.join(BASE_DIR, '..', '..', 'static-collected') @@ -192,15 +231,20 @@ LOGGING = { LOGIN_URL = reverse_lazy('home') - +#Map Java: yyyy-MM-dd'T'HH:mm'Z' API_DATETIMEFORMAT = '%Y-%m-%dT%H:%M:%SZ' -#API_DATEFORMAT = '%Y-%m-%d' -API_DATEFORMAT = '%Y-%m-%dT%H:%M:%S' +#Map Java: yyyy-MM-dd'T'HH:mm:ss.SSS'Z' +API_DATEFORMAT = '%Y-%m-%dT%H:%M:%S.%fZ' + +# the API_Manager the web form date format, eg: 2020-10-11 +API_MANAGER_DATE_FORMAT= '%Y-%m-%d' API_HOST = 'http://127.0.0.1:8080' +# Only override this if you have a separate portal instance +API_PORTAL = API_HOST API_BASE_PATH = '/obp/v' -API_VERSION = '3.1.0' +API_VERSION = '4.0.0' # URL to API Tester if it is running on API_HOST API_TESTER_URL = '' @@ -223,30 +267,40 @@ DIRECTLOGIN_PATH = '/my/logins/direct' # Set to true if the API is connected to a core banking system GATEWAYLOGIN_HAS_CBS = False + +# Use BOOTSTRAP3 if you are using Bootstrap 3 +BOOTSTRAP4 = { + 'include_jquery': True, +} + +# Apps to exclude when request to OBP-API's api +EXCLUDE_APPS = [] +# Functions to exclude when request to OBP-API's api +EXCLUDE_FUNCTIONS = [] +# Url Patterns to exclude when reqeust to OBP-API's api +EXCLUDE_URL_PATTERN = [] +# App Name to aggregate metrics +API_EXPLORER_APP_NAME = 'API Explorer' + +LOGO_URL = 'https://static.openbankproject.com/images/OBP/favicon.png' +OVERRIDE_CSS_URL = None + +VERIFY = True + # Local settings can override anything in here try: - from apimanager.local_settings import * # noqa + from apimanager.local_settings import * # noqa except ImportError: pass - -if not OAUTH_CONSUMER_KEY: - raise ImproperlyConfigured('Missing settings for OAUTH_CONSUMER_KEY') -if not OAUTH_CONSUMER_SECRET: - raise ImproperlyConfigured('Missing settings for OAUTH_CONSUMER_SECRET') +# EVERYTHING BELOW HERE WILL NOT BE OVERWRITTEN BY LOCALSETTINGS! +# DO NOT TRY TO DO SO YOU WILL BE IGNORED! # Settings here might use parts overwritten in local settings API_ROOT = API_HOST + API_BASE_PATH + API_VERSION # For some reason, swagger is not available at the latest API version API_URL_SWAGGER = API_HOST + '/obp/v1.4.0/resource-docs/v' + API_VERSION + '/swagger' # noqa -CACHES = { - 'default': { - 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', - 'LOCATION': 'unix:/tmp/memcached.sock', - } -} - -# Use BOOTSTRAP3 if you are using Bootstrap 3 -BOOTSTRAP4 = { - 'include_jquery': True, -} +if not OAUTH_CONSUMER_KEY: + raise ImproperlyConfigured('Missing settings for OAUTH_CONSUMER_KEY') +if not OAUTH_CONSUMER_SECRET: + raise ImproperlyConfigured('Missing settings for OAUTH_CONSUMER_SECRET') diff --git a/apimanager/apimanager/urls.py b/apimanager/apimanager/urls.py index 353914e..245b936 100644 --- a/apimanager/apimanager/urls.py +++ b/apimanager/apimanager/urls.py @@ -14,10 +14,7 @@ from obp.views import ( LogoutView, ) - urlpatterns = [ - - # Defining authentication URLs here and not including oauth.urls for # backward compatibility ] diff --git a/apimanager/atms/forms.py b/apimanager/atms/forms.py index 23cdc87..c082421 100644 --- a/apimanager/atms/forms.py +++ b/apimanager/atms/forms.py @@ -55,7 +55,7 @@ class CreateAtmForm(forms.Form): label='Latitude', widget=forms.TextInput( attrs={ - 'placeholder': 37.0, + 'placeholder': " ", 'class': 'form-control', } ), @@ -66,7 +66,7 @@ class CreateAtmForm(forms.Form): label='Longitude', widget=forms.TextInput( attrs={ - 'placeholder': 110.0, + 'placeholder': " ", 'class': 'form-control', } ), diff --git a/apimanager/atms/templates/atms/index.html b/apimanager/atms/templates/atms/index.html index d6229b8..22589fe 100644 --- a/apimanager/atms/templates/atms/index.html +++ b/apimanager/atms/templates/atms/index.html @@ -1,6 +1,7 @@ -{% extends 'base.html' %} {% load static %} {% block page_title %}{{ block.super }} / atms{% endblock page_title %} {% block content %} +{% extends 'base.html' %} {% load static i18n %} +{% block page_title %}{{ block.super }} / atms{% endblock page_title %} {% block content %}
| ATM Id | -Bank Id | -ATM Name | -More_info | -Update Button | +{% trans "ATM Id" %} | +{% trans "Bank Id" %} | +{% trans "ATM Name" %} | +{% trans "More info" %} | + - {% for atm in atms_list %} {% url 'atms_update' atm.id atm.bank_id as url_atm_update %} -
|---|---|---|---|---|
| {{ atm.id }} | {{ atm.bank_id }} | {{ atm.name }} | @@ -269,12 +272,13 @@ -Update | +View |
- This app gives you access to management functionality for the sandbox at {{ API_HOST }}. You have to register an account before being able to proceed. The logged-in user needs to have specific roles granted to use the functionality. -
-+ {% trans "This app gives you access to management functionality for the OBP instance at" %} {{ API_HOST }}. {% trans "You have to" %} {% trans "register" %} {% trans "an account before being able to proceed" %}.{% trans "The logged-in user needs to have specific roles granted to use the functionality." %} +
+| Branch Id | -Bank Id | -Branch Name | -More_info | -Update Button | +{% trans "Branch Id" %} | +{% trans "Bank Id" %} | +{% trans "Branch Name" %} | +{% trans "More_info" %} | +{% trans "Update Button" %} | {% for branch in branches_list %} @@ -173,40 +173,40 @@
|
diff --git a/apimanager/branches/views.py b/apimanager/branches/views.py
index 8013e8f..f3d5cc2 100644
--- a/apimanager/branches/views.py
+++ b/apimanager/branches/views.py
@@ -234,7 +234,6 @@ class UpdateBranchesView(LoginRequiredMixin, FormView):
urlpath = "/banks/{}/branches/{}".format(self.kwargs['bank_id'], self.kwargs['branch_id'])
try:
fields['bank_id'].choices = self.api.get_bank_id_choices()
-
except APIError as err:
messages.error(self.request, err)
except:
@@ -265,9 +264,7 @@ class UpdateBranchesView(LoginRequiredMixin, FormView):
messages.error(self.request, err)
except Exception as err:
messages.error(self.request, "Unknown Error {}".format(err))
-
return form
-
def form_valid(self, form):
data = form.cleaned_data
urlpath = '/banks/{}/branches/{}'.format(data["bank_id"], data["branch_id"])
diff --git a/apimanager/consumers/templates/consumers/includes/filter_apptype.html b/apimanager/consumers/templates/consumers/includes/filter_apptype.html
index cd9adc1..49aed8c 100644
--- a/apimanager/consumers/templates/consumers/includes/filter_apptype.html
+++ b/apimanager/consumers/templates/consumers/includes/filter_apptype.html
@@ -1,3 +1,4 @@
-Web
-Mobile
-All
+{% load i18n %}
+{% trans "Web" %}
+{% trans "Mobile" %}
+{% trans "All" %}
diff --git a/apimanager/consumers/templates/consumers/includes/filter_enabled.html b/apimanager/consumers/templates/consumers/includes/filter_enabled.html
index c00f4fe..673afa8 100644
--- a/apimanager/consumers/templates/consumers/includes/filter_enabled.html
+++ b/apimanager/consumers/templates/consumers/includes/filter_enabled.html
@@ -1,3 +1,4 @@
-Enabled
-Disabled
-All
+{% load i18n %}
+{% trans "Enabled" %}
+{% trans "Disabled" %}
+{% trans "All" %}
diff --git a/apimanager/consumers/templates/consumers/includes/filter_time.html b/apimanager/consumers/templates/consumers/includes/filter_time.html
index 3ffddb2..426a9ef 100644
--- a/apimanager/consumers/templates/consumers/includes/filter_time.html
+++ b/apimanager/consumers/templates/consumers/includes/filter_time.html
@@ -1,6 +1,7 @@
-Last Hour
-Last Day
-Last Week
-Last Month
-Last Year
-All
+{% load i18n %}
+{% trans "Last Hour" %}
+{% trans "Last Day" %}
+{% trans "Last Week" %}
+{% trans "Last Month" %}
+{% trans "Last Year" %}
+{% trans "All" %}
diff --git a/apimanager/consumers/templates/consumers/index.html b/apimanager/consumers/templates/consumers/index.html
index bcaad52..b5a8c23 100644
--- a/apimanager/consumers/templates/consumers/index.html
+++ b/apimanager/consumers/templates/consumers/index.html
@@ -1,11 +1,13 @@
{% extends 'base.html' %}
+{% load i18n %}
+
{% load humanize static %}
{% block page_title %}{{ block.super }} / Consumers{% endblock page_title %}
{% block content %}
|---|
| ID | -Name | -Description | -Created | -Action | +{% trans "ID" %} | +{% trans "Name" %} | +{% trans "Description" %} | +{% trans "Created" %} | +{% trans "Action" %} | diff --git a/apimanager/customers/templates/customers/create.html b/apimanager/customers/templates/customers/create.html index 991c31d..1eaf1a3 100644 --- a/apimanager/customers/templates/customers/create.html +++ b/apimanager/customers/templates/customers/create.html @@ -1,12 +1,13 @@ {% extends 'base.html' %} {% load static %} +{% load i18n %} {% block page_title %}{{ block.super }} / Customers{% endblock page_title %} {% block content %}
|---|