cleaning for new angular interface

This commit is contained in:
Adolfo Gómez García 2018-09-14 05:50:26 +02:00
parent 44feef783b
commit 33a02ee8f3
11 changed files with 77 additions and 52 deletions

View File

@ -44,6 +44,10 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
web-animations-js@2.3.1
Apache-2.0
Apache-2.0
zone.js@0.8.26
MIT
The MIT License
@ -68,7 +72,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
rxjs@6.2.2
rxjs@6.3.2
Apache-2.0
Apache License
Version 2.0, January 2004

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -8,6 +8,7 @@ gettext("Please wait");
gettext("Remember that UDS Plugin is required in order for this service to be launched");
gettext("Warning");
gettext("Service is in maintenance and cannot be executed");
gettext("Invalid error string");
gettext("seconds");
gettext("Launcher");
gettext("Service is in maintenance and cannot be launched");

View File

@ -1,17 +1,14 @@
{% extends "uds/html5/templates/base.html" %}
{% load i18n static %}
{% block title %}{% trans 'Page not found' %}{% endblock %}
{% block css %}
<style>
.center {text-align: center; margin-left: auto; margin-right: auto; margin-bottom: auto; margin-top: auto;}
</style>
{% endblock %}
{% block body %}
<div class="jumbotron center">
<h1>Page Not Found <small><font face="Tahoma" color="red">Error 404</font></small></h1>
<br />
<p>The page you requested could not be found, either contact your webmaster or try again. Use your browsers <b>Back</b> button to navigate to the page you have prevously come from</p>
<p><b>Or you could just press this neat little button:</b></p>
<a href="/" class="btn btn-lg btn-info"><i class="fa fa-home"></i> Take Me Home</a>
</div>
{% endblock %}
{% load i18n %}
<html>
<head>
<script type="text/javascript" src="{% url 'uds.web.views.jsCatalog' LANGUAGE_CODE %}"></script>
<script type="text/javascript">
function onLoad() {
var msg = window.btoa(django.gettext('Page not found'));
window.location.href = "{% url 'page.error' 'param' %}".replace('param', msg);
}
</script>
</head>
<body onload="onLoad()">
</body>
</html>

View File

@ -1,17 +1,14 @@
{% extends "uds/html5/templates/base.html" %}
{% load i18n static %}
{% block title %}{% trans 'Page not found' %}{% endblock %}
{% block css %}
<style>
.center {text-align: center; margin-left: auto; margin-right: auto; margin-bottom: auto; margin-top: auto;}
</style>
{% endblock %}
{% block body %}
<div class="jumbotron center">
<h1>Ooops<small><font face="Tahoma" color="red">Error 500</font></small></h1>
<br />
<p>The server raised an unexpected error, either contact your webmaster or try again. Use your browsers <b>Back</b> button to navigate to the page you have prevously come from</p>
<p><b>Or you could just press this neat little button:</b></p>
<a href="/" class="btn btn-large btn-info"><i class="fa fa-home"></i> Take Me Home</a>
</div>
{% endblock %}
{% load i18n %}
<html>
<head>
<script type="text/javascript" src="{% url 'uds.web.views.jsCatalog' LANGUAGE_CODE %}"></script>
<script type="text/javascript">
function onLoad() {
var msg = window.btoa(django.gettext('Internal server error'));
window.location.href = "{% url 'page.error' 'param' %}".replace('param', msg);
}
</script>
</head>
<body onload="onLoad()">
</body>
</html>

View File

@ -142,11 +142,17 @@ def udsJs(context):
# Update bypass configuration with user information
config['bypassPluginDetection'] = prefs.get('bypassPluginDetection') == '1'
errors = []
if 'errors' in request.session:
errors = request.session['errors']
del request.session['errors']
uds = {
'profile': profile,
'config': config,
'plugins': plugins,
'actors': actors,
'errors': errors
}
javascript = 'var udsData = ' + json.dumps(uds) + ';\n';

View File

@ -46,13 +46,14 @@ js_info_dict = {
urlpatterns = [
# Root url placeholder
path('', RedirectView.as_view(pattern_name='page.index', permanent=False), name='page.index.placeholder'),
path(r'', RedirectView.as_view(pattern_name='page.index', permanent=False), name='page.index.placeholder'),
# Compat redirections
path('login/', RedirectView.as_view(pattern_name='page.login', permanent=False), name='page.login.placeholder'),
path(r'login/', RedirectView.as_view(pattern_name='page.login', permanent=False), name='page.login.compat'),
path(r'logout/', RedirectView.as_view(pattern_name='page.logut'), name='page.logout.compat'),
# Javascript
path('uds/js', uds.web.views.modern.js, name="uds.js"),
path(r'uds/js', uds.web.views.modern.js, name="uds.js"),
# Index
path(r'uds/page/services/', uds.web.views.modern.index, name='page.index'),
@ -60,13 +61,13 @@ urlpatterns = [
# Login/logout
path(r'uds/page/login/', uds.web.views.modern.login, name='page.login'),
re_path(r'^uds/page/login/(?P<tag>.+)$', uds.web.views.modern.login, name='page.login.tag'),
path(r'uds/page/logout/', uds.web.views.logout, name='page.logout'),
path(r'uds/page/logout/', uds.web.views.modern.logout, name='page.logout'),
# Error URL
re_path(r'^uds/page/error/(?P<error>.+)$', uds.web.views.error, name='page.error'),
# This must be the last, so any patition will be managed by client in fact
re_path(r'uds/page/.*', uds.web.views.modern.index, name='page.plageholder'),
re_path(r'uds/page/.*', uds.web.views.modern.index, name='page.placeholder'),
# WEB API path (not REST api, frontend)
re_path(r'^uds/webapi/img/transport/(?P<idTrans>.+)$', uds.web.views.transportIcon, name='webapi.transportIcon'),
@ -92,7 +93,7 @@ urlpatterns = [
# re_path(r'^$', uds.web.views.index, name='uds.web.views.index'),
# re_path(r'^login/$', uds.web.views.login, name='uds.web.views.login'),
# re_path(r'^login/(?P<tag>.+)$', uds.web.views.login, name='uds.web.views.login'),
re_path(r'^logout$', uds.web.views.logout, name='uds.web.views.logout'),
# re_path(r'^logout$', uds.web.views.logout, name='uds.web.views.logout'),
# Icons
# re_path(r'^transicon/(?P<idTrans>.+)$', uds.web.views.transportIcon, name='uds.web.views.transportIcon'),

View File

@ -62,6 +62,8 @@ SERVICE_IN_MAINTENANCE = 12
SERVICE_NOT_READY = 13
SERVICE_IN_PREPARATION = 14
SERVICE_CALENDAR_DENIED = 15
PAGE_NOT_FOUND = 16
INTERNAL_SERVER_ERROR = 17
strings = [
_('Unknown error'),
@ -79,7 +81,9 @@ strings = [
_('The requested service is in maintenance mode'),
_('The service is not ready.\nPlease, try again in a few moments.'),
_('Preparing service'),
_('Service access denied by calendars')
_('Service access denied by calendars'),
_('Page not found'),
_('Unexpected error'),
]
@ -98,7 +102,7 @@ def errorView(request, error):
if code != 0:
errStr += ' (code {0:04X})'.format(code)
errStr = encoders.encode(str(errStr), 'base64', asText=True)[:-3]
errStr = encoders.encode(str(errStr), 'base64', asText=True)[:-1]
return HttpResponseRedirect(reverse('page.error', kwargs={'error': errStr}))

View File

@ -32,7 +32,7 @@ from __future__ import unicode_literals
import logging
from .login import login, logout
# from .login import login, logout
from .index import index, about
from .prefs import prefs
from .service import transportOwnLink, transportIcon, clientEnabler, serviceImage, release, reset
@ -44,6 +44,6 @@ from .images import image
from .file_storage import file_storage
from . import modern
__updated__ = '2018-09-12'
__updated__ = '2018-09-14'
logger = logging.getLogger(__name__)

View File

@ -34,9 +34,13 @@ import json
from django.shortcuts import render
from django.http import HttpResponse
from django.urls import reverse
from uds.web.errors import errorView
from uds.core.auths.auth import (
getUDSCookie,
denyNonAuthenticated
denyNonAuthenticated,
webLoginRequired,
authLogLogout,
webLogout,
)
from uds.web.services import getServicesData
@ -44,8 +48,7 @@ logger = logging.getLogger(__name__)
def index(request):
from uds.web.errors import errorView
return errorView(request, 1)
# return errorView(request, 1)
response = render(request, 'uds/modern/index.html', {})
@ -74,14 +77,26 @@ def login(request, tag=None):
else:
# If error is numeric, redirect...
# Error, set error on session for process for js
request.session['errors'] = data
return HttpResponse(data);
if isinstance(data, int):
return errorView(request, data)
request.session['errors'] = [data]
return index(request)
else:
response = index(request)
return response
@webLoginRequired(admin=False)
def logout(request):
authLogLogout(request)
logoutUrl = request.user.logout()
if logoutUrl is None:
logoutUrl = request.session.get('logouturl', None)
return webLogout(request, logoutUrl)
def js(request):
return render(request, 'uds/js.js', content_type='text/javascript')