forked from shaba/openuds
Started deployed services part
This commit is contained in:
parent
3cae37ca5c
commit
2b7ad74f2f
@ -12,6 +12,7 @@ encoding//src/uds/REST/__init__.py=utf-8
|
||||
encoding//src/uds/REST/handlers.py=utf-8
|
||||
encoding//src/uds/REST/methods/authenticators.py=utf-8
|
||||
encoding//src/uds/REST/methods/cache.py=utf-8
|
||||
encoding//src/uds/REST/methods/deployedservices.py=utf-8
|
||||
encoding//src/uds/REST/methods/gui_callback.py=utf-8
|
||||
encoding//src/uds/REST/methods/login_logout.py=utf-8
|
||||
encoding//src/uds/REST/methods/networks.py=utf-8
|
||||
|
@ -45,6 +45,7 @@ function minify_admin() {
|
||||
'gui-d-authenticators',
|
||||
'gui-d-osmanagers',
|
||||
'gui-d-connectivity',
|
||||
'gui-d-deployedservices',
|
||||
];
|
||||
|
||||
var cssFiles = [
|
||||
|
73
server/src/uds/REST/methods/deployedservices.py
Normal file
73
server/src/uds/REST/methods/deployedservices.py
Normal file
@ -0,0 +1,73 @@
|
||||
# -*- 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 django.utils.translation import ugettext as _
|
||||
|
||||
|
||||
from uds.models import DeployedService, Service
|
||||
|
||||
from uds.core.util import log
|
||||
from uds.core.Environment import Environment
|
||||
from uds.REST.model import ModelHandler
|
||||
from uds.REST import NotFound, ResponseError, RequestError
|
||||
from django.db import IntegrityError
|
||||
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class DeployedServices(ModelHandler):
|
||||
model = DeployedService
|
||||
save_fields = ['name', 'comments', 'service', 'osmanager', 'initial_srvs', 'cache_l1_srvs', 'cache_l2_srvs', 'max_srvs']
|
||||
|
||||
table_title = _('Deployed services')
|
||||
table_fields = [
|
||||
{ 'name': {'title': _('Name'), 'visible': True, 'type': 'iconType' } },
|
||||
{ 'comments': {'title': _('Comments')}},
|
||||
]
|
||||
|
||||
def item_as_dict(self, item):
|
||||
type_ = item.getType()
|
||||
return { 'id': item.id,
|
||||
'name': item.name,
|
||||
'comments': item.comments,
|
||||
}
|
||||
|
||||
# Gui related
|
||||
def getGui(self, type_):
|
||||
try:
|
||||
return self.addDefaultFields(['name', 'comments'])
|
||||
except:
|
||||
raise NotFound('type not found')
|
@ -28,7 +28,7 @@
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
'''
|
||||
@provideror: Adolfo Gómez, dkmaster at dkmon dot com
|
||||
@author: Adolfo Gómez, dkmaster at dkmon dot com
|
||||
'''
|
||||
from __future__ import unicode_literals
|
||||
|
||||
@ -165,3 +165,4 @@ class Services(DetailHandler):
|
||||
return log.getLogs(item)
|
||||
except:
|
||||
self.invalidItemException()
|
||||
|
@ -31,15 +31,21 @@ table.dataTable td.dataTables_empty {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
table.dataTable tr.odd { background-color: #E2E4FF; }
|
||||
table.dataTable tr.even { background-color: white; }
|
||||
/*table.dataTable tr.odd { background-color: #F5F5F5; }
|
||||
table.dataTable tr.even { background-color: white; }*/
|
||||
|
||||
table.dataTable tr.odd td.sorting_1 { background-color: #D3D6FF; }
|
||||
table.dataTable tr.odd td.sorting_1 { background-color: #E5E5E5; }
|
||||
table.dataTable tr.even td.sorting_1 { background-color: #F5F5F5; }
|
||||
|
||||
/* Overwrites all color selection on selected rows */
|
||||
.table tbody tr.active td { background-color: #0075B0 !important; }
|
||||
|
||||
/*table.dataTable tr.odd td.sorting_1 { background-color: #D3D6FF; }
|
||||
table.dataTable tr.odd td.sorting_2 { background-color: #DADCFF; }
|
||||
table.dataTable tr.odd td.sorting_3 { background-color: #E0E2FF; }
|
||||
table.dataTable tr.even td.sorting_1 { background-color: #EAEBFF; }
|
||||
table.dataTable tr.even td.sorting_2 { background-color: #F2F3FF; }
|
||||
table.dataTable tr.even td.sorting_3 { background-color: #F9F9FF; }
|
||||
table.dataTable tr.even td.sorting_3 { background-color: #F9F9FF; } */
|
||||
|
||||
|
||||
/*
|
||||
|
@ -35,13 +35,6 @@ body {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/*table.dataTable tr.odd td.sorting_1 { background-color: red; }
|
||||
table.dataTable tr.odd td.sorting_2 { background-color: red; }
|
||||
table.dataTable tr.odd td.sorting_3 { background-color: red; }
|
||||
table.dataTable tr.even td.sorting_1 { background-color: blue; }
|
||||
table.dataTable tr.even td.sorting_2 { background-color: blue; }
|
||||
table.dataTable tr.even td.sorting_3 { background-color: blue; }*/
|
||||
|
||||
/* collapsable && closeable pannels */
|
||||
.chevron:before {
|
||||
content: "\f139";
|
||||
|
@ -476,7 +476,4 @@ api.authenticators = new BasicModelRest('authenticators');
|
||||
api.osmanagers = new BasicModelRest('osmanagers');
|
||||
api.transports = new BasicModelRest('transports');
|
||||
api.networks = new BasicModelRest('networks');
|
||||
|
||||
// Locale related
|
||||
api.locale = new BasicModelRest('locale');
|
||||
api.locale.tableInfo = api.locale.types = undefined;
|
||||
api.deployedservices = new BasicModelRest('deployedservices');
|
||||
|
@ -6,10 +6,6 @@ gui.connectivity = {
|
||||
|
||||
gui.connectivity.link = function(event) {
|
||||
"use strict";
|
||||
// Cleans up memory used by other datatables
|
||||
$.each($.fn.dataTable.fnTables(), function(undefined, tbl){
|
||||
$(tbl).dataTable().fnDestroy();
|
||||
});
|
||||
api.templates.get('connectivity', function(tmpl) {
|
||||
gui.clearWorkspace();
|
||||
gui.appendToWorkspace(api.templates.evaluate(tmpl, {
|
||||
|
17
server/src/uds/static/adm/js/gui-d-deployedservices.js
Normal file
17
server/src/uds/static/adm/js/gui-d-deployedservices.js
Normal file
@ -0,0 +1,17 @@
|
||||
/* jshint strict: true */
|
||||
gui.deployedservices = new GuiElement(api.deployedservices, 'deployedservices');
|
||||
|
||||
|
||||
gui.deployedservices.link = function(event) {
|
||||
"use strict";
|
||||
|
||||
api.templates.get('deployedservices', function(tmpl) {
|
||||
gui.clearWorkspace();
|
||||
gui.appendToWorkspace(api.templates.evaluate(tmpl, {
|
||||
deployed_services : 'deployed-services-placeholder',
|
||||
}));
|
||||
gui.setLinksEvents();
|
||||
});
|
||||
|
||||
|
||||
};
|
@ -1,6 +1,6 @@
|
||||
/* jshint strict: true */
|
||||
|
||||
// Compose gui elements
|
||||
// Basic GUI components
|
||||
gui.dashboard = new BasicGuiElement('Dashboard');
|
||||
gui.dashboard.link = function(event) {
|
||||
"use strict";
|
||||
|
@ -132,12 +132,6 @@
|
||||
$(data).appendTo('#content');
|
||||
};
|
||||
|
||||
// Links methods
|
||||
gui.deployed_services = function() {
|
||||
gui.clearWorkspace();
|
||||
gui.appendToWorkspace(gui.breadcrumbs(gettext('Deployed services')));
|
||||
};
|
||||
|
||||
// Clean up several "internal" data
|
||||
// I have discovered some "items" that are keep in memory, or that adds garbage to body (datatable && tabletools mainly)
|
||||
// Whenever we change "section", we clean up as much as we can, so we can keep things as clean as possible
|
||||
@ -182,7 +176,7 @@
|
||||
cleanup: true,
|
||||
}, {
|
||||
id : 'lnk-deployed_services',
|
||||
exec : gui.deployed_services,
|
||||
exec : gui.deployedservices.link,
|
||||
cleanup: true,
|
||||
}, {
|
||||
id : 'lnk-clear_cache',
|
||||
|
@ -107,6 +107,8 @@
|
||||
<script src="{% get_static_prefix %}adm/js/gui-d-authenticators.js"></script>
|
||||
<script src="{% get_static_prefix %}adm/js/gui-d-osmanagers.js"></script>
|
||||
<script src="{% get_static_prefix %}adm/js/gui-d-connectivity.js"></script>
|
||||
<script src="{% get_static_prefix %}adm/js/gui-d-deployedservices.js"></script>
|
||||
|
||||
{% else %}
|
||||
<!-- minified js from: 'jquery.cookie', 'bootstrap.min', 'bootstrap-switch.min', 'bootstrap-select.min', 'jquery.validate.min', 'jquery.blockUI',
|
||||
'jquery.dataTables.min', 'TableTools.min', 'Blob', 'FileSaver', 'ZeroClipboard', 'dataTables.bootstrap', 'handlebars-v1.1.2', UDS admin JS's -->
|
||||
@ -126,7 +128,10 @@
|
||||
<!-- preloading of templates -->
|
||||
<!-- page contents -->
|
||||
{% js_template 'dashboard' %}
|
||||
{% js_template 'providers' %}
|
||||
{% js_template 'authenticators' %}
|
||||
{% js_template 'connectivity' %}
|
||||
{% js_template 'deployedservices' %}
|
||||
<!-- utility pages -->
|
||||
{% js_template 'request_failed' %}
|
||||
<!-- components -->
|
||||
|
@ -0,0 +1,38 @@
|
||||
{% load i18n %}
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<h1>{% trans 'Deployed Services' %}</h1>
|
||||
<ol class="breadcrumb">
|
||||
<li><a class="lnk-dashboard" href="#"><i class="fa fa-dashboard"></i> Dashboard</a></li>
|
||||
<li>{% trans 'Deployed Services' %}</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div><!-- /.row -->
|
||||
{% verbatim %}
|
||||
<div class="row">
|
||||
<div id="{{ deployed_services }}" class="col-xs-12"></div>
|
||||
</div>
|
||||
<div id="detail-placeholder" class="row hidden">
|
||||
<div class="col-xs-12">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a href="#{{ users }}_tab" data-toggle="tab">{% endverbatim %}{% trans 'Users' %}{% verbatim %}</a></li>
|
||||
<li><a href="#{{ groups }}" data-toggle="tab">{% endverbatim %}{% trans 'Groups' %}{% verbatim %}</a></li>
|
||||
<li><a href="#{{ logs }}" data-toggle="tab">{% endverbatim %}{% trans 'Logs' %}{% verbatim %}</a></li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane fade in active" id="{{ users }}_tab">
|
||||
<div class="row">
|
||||
<div class="col-xs-12" id="{{ users }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-12" id="{{ users_log }}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="{{ groups }}"></div>
|
||||
<div class="tab-pane fade" id="{{ logs }}">...</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endverbatim %}
|
Loading…
Reference in New Issue
Block a user