Updated to new admin interface

This commit is contained in:
Adolfo Gómez García 2019-02-04 09:15:46 +01:00
parent 2641fbbfcc
commit c1e8f6afe1
14 changed files with 22 additions and 355 deletions

View File

@ -210,3 +210,8 @@ class MetaPools(ModelHandler):
def getFallbackAccess(self, item):
return item.fallbackAccess
# Returns the action list based on current element, for calendar
def actionsList(self, item):
validActions = ()
return validActions

View File

@ -34,10 +34,8 @@ from django.conf.urls import url
import uds.admin.views
__updated__ = '2016-08-26'
__updated__ = '2019-02-04'
urlpatterns = [
url(r'^$', uds.admin.views.index, name='uds.admin.views.index'),
url(r'^tmpl/(?P<template>[a-zA-Z0-9_-]*)$', uds.admin.views.tmpl, name='uds.admin.views.tmpl'),
url(r'^sample$', uds.admin.views.sample, name='uds.admin.views.sample'),
url(r'^.*$', uds.admin.views.index, name='uds.admin.views.index'),
]

View File

@ -1,34 +0,0 @@
# -*- coding: utf-8 -*-
#
# Copyright (c) 2014 Virtual Cable S.L.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of Virtual Cable S.L. nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
@author: Adolfo Gómez, dkmaster at dkmon dot com
"""
from __future__ import unicode_literals
from .usage import usage
from .users import users

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

View File

@ -1,40 +0,0 @@
# -*- coding: utf-8 -*-
#
# Copyright (c) 2012 Virtual Cable S.L.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of Virtual Cable S.L. nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
@author: Adolfo Gómez, dkmaster at dkmon dot com
"""
from __future__ import unicode_literals
import os.path
import sys
from PIL import Image
def getImagePath(imageName):
pkgpath = os.path.dirname(sys.modules[__name__].__file__)
return os.path.join(os.path.join(pkgpath, 'images'), imageName)

View File

@ -1,41 +0,0 @@
# -*- coding: utf-8 -*-
#
# Copyright (c) 2012 Virtual Cable S.L.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of Virtual Cable S.L. nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
@author: Adolfo Gómez, dkmaster at dkmon dot com
"""
from __future__ import unicode_literals
from django.conf.urls import patterns
__updated__ = '2015-04-24'
urlpatterns = patterns(
'uds.admin.views.reporting',
(r'^usage$', 'usage'),
(r'^users/(?P<idAuth>.+)$', 'users')
)

View File

@ -1,116 +0,0 @@
# -*- coding: utf-8 -*-
#
# Copyright (c) 2012 Virtual Cable S.L.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of Virtual Cable S.L. nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
@author: Adolfo Gómez, dkmaster at dkmon dot com
"""
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render_to_response
import Image as PILImage
from uds.core.util.stats import charts
from uds.core.auths.auth import webLoginRequired
from uds.core.util.decorators import denyBrowsers
import io
import six
from geraldo.generators.pdf import PDFGenerator
from geraldo import Report, landscape, ReportBand, ObjectValue, SystemField, BAND_WIDTH, Label
from reportlab.lib.pagesizes import A4
from reportlab.lib.units import cm
from reportlab.lib.enums import TA_RIGHT, TA_CENTER
import logging
logger = logging.getLogger(__name__)
__updated__ = '2015-04-27'
class TestReport(Report):
title = 'Test report'
author = 'UDS Enterprise'
print_if_empty = True
page_size = A4
margin_left = 2 * cm
margin_top = 0.5 * cm
margin_right = 0.5 * cm
margin_bottom = 0.5 * cm
class band_detail(ReportBand):
height = 0.5 * cm
elements = (
ObjectValue(attribute_name='name', left=0.5 * cm),
ObjectValue(attribute_name='age', left=3 * cm,
get_value=lambda instance: six.text_type(instance['age'])),
)
class band_page_header(ReportBand):
height = 1.3 * cm
elements = [
SystemField(expression='%(report_title)s', top=0.1 * cm, left=0, width=BAND_WIDTH,
style={'fontName': 'Helvetica-Bold', 'fontSize': 14, 'alignment': TA_CENTER}),
Label(text="ID", top=0.8 * cm, left=0.5 * cm),
Label(text=u"Creation Date", top=0.8 * cm, left=3 * cm),
SystemField(expression=_('Page %(page_number)d of %(page_count)d'), top=0.1 * cm,
width=BAND_WIDTH, style={'alignment': TA_RIGHT}),
]
borders = {'bottom': True}
class band_page_footer(ReportBand):
height = 0.5 * cm
elements = [
Label(text='Geraldo Reports', top=0.1 * cm),
SystemField(expression=_('Printed in %(now:%Y, %b %d)s at %(now:%H:%M)s'), top=0.1 * cm,
width=BAND_WIDTH, style={'alignment': TA_RIGHT}),
]
borders = {'top': True}
@denyBrowsers(browsers=['ie<9'])
@webLoginRequired(admin='admin')
def usage(request):
resp = HttpResponse(content_type='application/pdf')
family = [
{'name': 'Leticia', 'age': 29, 'weight': 55.7, 'genre': 'female', 'status': 'parent'},
{'name': 'Marinho', 'age': 28, 'weight': 76, 'genre': 'male', 'status': 'parent'},
{'name': 'Tarsila', 'age': 4, 'weight': 16.2, 'genre': 'female', 'status': 'child'},
{'name': 'Linus', 'age': 0, 'weight': 1.5, 'genre': 'male', 'status': 'child'},
{'name': 'Mychelle', 'age': 19, 'weight': 50, 'genre': 'female', 'status': 'nephew'},
{'name': 'Mychell', 'age': 17, 'weight': 55, 'genre': 'male', 'status': 'niece'},
]
report = TestReport(queryset=family)
report.generate_by(PDFGenerator, filename=resp)
return resp
# return HttpResponse(pdf, content_type='application/pdf')

View File

@ -1,115 +0,0 @@
# -*- coding: utf-8 -*-
#
# Copyright (c) 2012 Virtual Cable S.L.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of Virtual Cable S.L. nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
@author: Adolfo Gómez, dkmaster at dkmon dot com
"""
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render_to_response
from uds.core.auths.auth import webLoginRequired
from uds.core.util.decorators import denyBrowsers
from uds.models import Authenticator
from uds.models.Util import NEVER
from . import tools
import io
import six
from geraldo.generators.pdf import PDFGenerator
from geraldo import Report, landscape, ReportBand, ObjectValue, SystemField, BAND_WIDTH, Label, Image
from reportlab.lib.pagesizes import A4
from reportlab.lib.units import cm
from reportlab.lib.enums import TA_RIGHT, TA_CENTER
import logging
logger = logging.getLogger(__name__)
__updated__ = '2015-04-27'
class UsersReport(Report):
title = 'Test report'
author = 'UDS Enterprise'
print_if_empty = True
page_size = A4
margin_left = 2 * cm
margin_top = 0.5 * cm
margin_right = 0.5 * cm
margin_bottom = 0.5 * cm
class band_detail(ReportBand):
height = 0.5 * cm
elements = (
ObjectValue(attribute_name='name', left=0.5 * cm),
ObjectValue(attribute_name='real_name', left=3 * cm),
ObjectValue(attribute_name='last_access', left=7 * cm),
)
class band_page_header(ReportBand):
height = 2.0 * cm
elements = [
SystemField(expression='%(report_title)s', top=0.5 * cm, left=0, width=BAND_WIDTH,
style={'fontName': 'Helvetica-Bold', 'fontSize': 14, 'alignment': TA_CENTER}),
Label(text="User ID", top=1.5 * cm, left=0.5 * cm),
Label(text="Real Name", top=1.5 * cm, left=3 * cm),
Label(text="Last access", top=1.5 * cm, left=7 * cm),
SystemField(expression=_('Page %(page_number)d of %(page_count)d'), top=0.1 * cm,
width=BAND_WIDTH, style={'alignment': TA_RIGHT}),
Image(filename=tools.getImagePath('logo.png'), left=0.1 * cm, top=0.0 * cm, width=2 * cm, height=2 * cm),
]
borders = {'bottom': True}
class band_page_footer(ReportBand):
height = 0.5 * cm
elements = [
Label(text='Generated by UDS', top=0.1 * cm),
SystemField(expression=_('Printed in %(now:%Y, %b %d)s at %(now:%H:%M)s'), top=0.1 * cm,
width=BAND_WIDTH, style={'alignment': TA_RIGHT}),
]
borders = {'top': True}
@denyBrowsers(browsers=['ie<9'])
@webLoginRequired(admin='admin')
def users(request, idAuth):
resp = HttpResponse(content_type='application/pdf')
auth = Authenticator.objects.get(uuid=idAuth)
users = auth.users.order_by('name')
report = UsersReport(queryset=users)
report.title = _('Users List for {}').format(auth.name)
report.generate_by(PDFGenerator, filename=resp)
return resp
# return HttpResponse(pdf, content_type='application/pdf')

View File

@ -55,12 +55,13 @@ class State(object):
REMOVING = 'M'
PREPARING = 'P'
REMOVABLE = 'R'
RESTRAINED = 'T' # "Visual" state, no element will in fact be in this state, but admins uses it to "notily" user
REMOVED = 'S'
USABLE = 'U'
RUNNING = 'W'
FOR_EXECUTE = 'X'
MAINTENANCE = 'Y' # "Visual" state, no element will be in fact in maintenance, but used to show "Services Pools" for which a Provider is in maintenance
WAITING_OS = 'Z' # "Visual" state, no element will be in fact in WAITING_OS, but used to show "User Services" that are whating for os manager
WAITING_OS = 'Z' # "Visual" state, no element will be in fact in WAITING_OS, but used to show "User Services" that are waiting for os manager
string = {
ACTIVE: _('Active'),
@ -70,6 +71,7 @@ class State(object):
PREPARING: _('In preparation'),
USABLE: _('Valid'),
REMOVABLE: _('Waiting for removal'),
RESTRAINED: _('Restrained'),
REMOVING: _('Removing'),
REMOVED: _('Removed'),
CANCELED: _('Canceled'),

File diff suppressed because one or more lines are too long

View File

@ -187,6 +187,14 @@ gettext("Save error");
gettext("Communication error");
gettext("provider");
gettext("service");
gettext("service pool");
gettext("authenticator");
gettext("user");
gettext("group");
gettext("transport");
gettext("OS manager");
gettext("calendar");
gettext("pool group");
gettext("Go to");
gettext("Items per page");
gettext("Sunday");

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -62,7 +62,7 @@
</style>
<base href="/uds/page">
<base href="/uds/adm">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/png" href="/uds/res/modern/img/favicon.png">