mirror of
https://github.com/dkmstr/openuds.git
synced 2025-01-08 21:18:00 +03:00
Updated user services
This commit is contained in:
parent
03feee9ebc
commit
b0756d8e3e
@ -104,6 +104,7 @@ class ServicesPools(ModelHandler):
|
||||
'label': ugettext('Base service'),
|
||||
'tooltip': ugettext('Service used as base of this service pool'),
|
||||
'type': gui.InputField.CHOICE_TYPE,
|
||||
'rdonly' : True,
|
||||
'order': 100, # At end
|
||||
},{
|
||||
'name': 'osmanager_id',
|
||||
@ -111,6 +112,7 @@ class ServicesPools(ModelHandler):
|
||||
'label': ugettext('OS Manager'),
|
||||
'tooltip': ugettext('OS Manager used as base of this service pool'),
|
||||
'type': gui.InputField.CHOICE_TYPE,
|
||||
'rdonly' : True,
|
||||
'order': 101, # At end
|
||||
},{
|
||||
'name': 'initial_srvs',
|
||||
|
@ -101,6 +101,14 @@ class AssignedService(DetailHandler):
|
||||
{ 'state': { 'title': _('State'), 'type': 'dict', 'dict': State.dictionary() } },
|
||||
{ 'owner': { 'title': _('Owner') } },
|
||||
]
|
||||
|
||||
def getLogs(self, parent, item):
|
||||
try:
|
||||
item = parent.assignedUserServices().get(pk=item)
|
||||
logger.debug('Getting logs for {0}'.format(item))
|
||||
return log.getLogs(item)
|
||||
except:
|
||||
self.invalidItemException()
|
||||
|
||||
|
||||
class CachedService(AssignedService):
|
||||
@ -130,6 +138,14 @@ class CachedService(AssignedService):
|
||||
{ 'cache_level': { 'title': _('Cache level') } },
|
||||
]
|
||||
|
||||
def getLogs(self, parent, item):
|
||||
try:
|
||||
item = parent.cachedUserServices().get(pk=item)
|
||||
logger.debug('Getting logs for {0}'.format(item))
|
||||
return log.getLogs(item)
|
||||
except:
|
||||
self.invalidItemException()
|
||||
|
||||
class Groups(DetailHandler):
|
||||
def getItems(self, parent, item):
|
||||
return [{
|
||||
|
@ -16,8 +16,10 @@ gui.servicesPools.link = function(event) {
|
||||
$tbl.fnDestroy();
|
||||
});
|
||||
|
||||
$('#assigned-services-placeholder').empty();
|
||||
$('#cache-placeholder').empty();
|
||||
$('#assigned-services-placeholder_tbl').empty();
|
||||
$('#assigned-services-placeholder_log').empty();
|
||||
$('#cache-placeholder_tbl').empty();
|
||||
$('#cache-placeholder_log').empty();
|
||||
$('#transports-placeholder').empty();
|
||||
$('#groups-placeholder').empty();
|
||||
$('#logs-placeholder').empty();
|
||||
@ -109,6 +111,9 @@ gui.servicesPools.link = function(event) {
|
||||
gui.doLog('Select', counter.toString(), val, value);
|
||||
};
|
||||
|
||||
/*
|
||||
* Services pools part
|
||||
*/
|
||||
var tableId = gui.servicesPools.table({
|
||||
container : 'deployed-services-placeholder',
|
||||
rowSelect : 'single',
|
||||
@ -122,7 +127,7 @@ gui.servicesPools.link = function(event) {
|
||||
|
||||
clearDetails();
|
||||
$('#detail-placeholder').removeClass('hidden');
|
||||
// If service does not supports cache, do not show it
|
||||
|
||||
var service = null;
|
||||
try {
|
||||
service = availableServices[servPool.service_id];
|
||||
@ -132,28 +137,54 @@ gui.servicesPools.link = function(event) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Cache Part
|
||||
*/
|
||||
|
||||
var cachedItems = null;
|
||||
// If service does not supports cache, do not show it
|
||||
// Shows/hides cache
|
||||
if( service.info.uses_cache || service.info.uses_cache_l2 ) {
|
||||
$('#cache-placeholder_tab').removeClass('hidden');
|
||||
cachedItems = new GuiElement(api.servicesPools.detail(servPool.id, 'cache'), 'cache');
|
||||
// Cached items table
|
||||
var prevCacheLogTbl = null;
|
||||
var cachedItemsTable = cachedItems.table({
|
||||
container : 'cache-placeholder',
|
||||
rowSelect : 'single'
|
||||
container : 'cache-placeholder_tbl',
|
||||
buttons : [ 'delete', 'xls' ],
|
||||
rowSelect : 'single',
|
||||
onRowSelect : function(selected) {
|
||||
var cached = selected[0];
|
||||
if( prevAssignedLogTbl ) {
|
||||
var $tbl = $(prevCacheLogTbl).dataTable();
|
||||
$tbl.fnClearTable();
|
||||
$tbl.fnDestroy();
|
||||
}
|
||||
prevCacheLogTbl = cachedItems.logTable(cached.id, {
|
||||
container : 'cache-placeholder_log',
|
||||
});
|
||||
}
|
||||
});
|
||||
prevTables.push(cachedItemsTable);
|
||||
} else {
|
||||
$('#cache-placeholder_tab').addClass('hidden');
|
||||
}
|
||||
|
||||
/*
|
||||
* Groups part
|
||||
*/
|
||||
|
||||
var groups = null;
|
||||
// Shows/hides groups
|
||||
if( service.info.must_assign_manually === false ) {
|
||||
$('#groups-placeholder_tab').removeClass('hidden');
|
||||
groups = new GuiElement(api.servicesPools.detail(servPool.id, 'groups'), 'groups');
|
||||
// Groups items table
|
||||
var groupsTable = groups.table({
|
||||
container : 'groups-placeholder',
|
||||
rowSelect : 'single',
|
||||
onData: function(data) {
|
||||
buttons : [ 'new', 'delete', 'xls' ],
|
||||
onData : function(data) {
|
||||
$.each(data, function(undefined, value){
|
||||
value.group_name = '<b>' + value.auth_name + '</b>\\' + value.name;
|
||||
});
|
||||
@ -164,17 +195,41 @@ gui.servicesPools.link = function(event) {
|
||||
$('#groups-placeholder_tab').addClass('hidden');
|
||||
}
|
||||
|
||||
/*
|
||||
* Assigned services part
|
||||
*/
|
||||
var prevAssignedLogTbl = null;
|
||||
var assignedServices = new GuiElement(api.servicesPools.detail(servPool.id, 'services'), 'services');
|
||||
var assignedServicesTable = assignedServices.table({
|
||||
container: 'assigned-services-placeholder',
|
||||
rowSelect: 'single',
|
||||
container: 'assigned-services-placeholder_tbl',
|
||||
rowSelect: 'single',
|
||||
buttons: service.info.must_assign_manually ? ['new', 'delete', 'xls'] : ['delete', 'xls'],
|
||||
onRowSelect: function(selected) {
|
||||
var service = selected[0];
|
||||
if( prevAssignedLogTbl ) {
|
||||
var $tbl = $(prevAssignedLogTbl).dataTable();
|
||||
$tbl.fnClearTable();
|
||||
$tbl.fnDestroy();
|
||||
}
|
||||
prevAssignedLogTbl = assignedServices.logTable(service.id, {
|
||||
container : 'assigned-services-placeholder_log',
|
||||
});
|
||||
}
|
||||
});
|
||||
// Log of assigned services (right under assigned services)
|
||||
|
||||
prevTables.push(assignedServicesTable);
|
||||
|
||||
/*
|
||||
* Transports part
|
||||
*/
|
||||
|
||||
var transports = new GuiElement(api.servicesPools.detail(servPool.id, 'transports'), 'transports');
|
||||
// Transports items table
|
||||
var transportsTable = transports.table({
|
||||
container: 'transports-placeholder',
|
||||
rowSelect: 'single',
|
||||
buttons : [ 'new', 'delete', 'xls' ],
|
||||
onData: function(data) {
|
||||
$.each(data, function(undefined, value){
|
||||
var style = 'display:inline-block; background: url(data:image/png;base64,' +
|
||||
@ -186,11 +241,15 @@ gui.servicesPools.link = function(event) {
|
||||
});
|
||||
prevTables.push(transportsTable);
|
||||
|
||||
/*
|
||||
* Publications part
|
||||
*/
|
||||
var publications = null;
|
||||
if( service.info.needs_publication ) {
|
||||
$('#publications-placeholder_tab').removeClass('hidden');
|
||||
var pubApi = api.servicesPools.detail(servPool.id, 'publications');
|
||||
publications = new GuiElement(pubApi, 'publications');
|
||||
// Publications table
|
||||
var publicationsTable = publications.table({
|
||||
container : 'publications-placeholder',
|
||||
rowSelect : 'single',
|
||||
@ -224,6 +283,10 @@ gui.servicesPools.link = function(event) {
|
||||
$('#publications-placeholder_tab').addClass('hidden');
|
||||
}
|
||||
|
||||
/*
|
||||
* Log table
|
||||
*/
|
||||
|
||||
var logTable = gui.servicesPools.logTable(servPool.id, {
|
||||
container : 'logs-placeholder',
|
||||
});
|
||||
|
@ -23,8 +23,26 @@
|
||||
<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="{{ assigned_services }}">...</div>
|
||||
<div class="tab-pane fade" id="{{ cache }}">...</div>
|
||||
<div class="tab-pane fade in active" id="{{ assigned_services }}">
|
||||
<div class="row">
|
||||
<div class="col-xs-12" id="{{ assigned_services }}_tbl">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-12" id="{{ assigned_services }}_log">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="{{ cache }}">
|
||||
<div class="row">
|
||||
<div class="col-xs-12" id="{{ cache }}_tbl">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-12" id="{{ cache }}_log">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="{{ groups }}">...</div>
|
||||
<div class="tab-pane fade" id="{{ transports }}">...</div>
|
||||
<div class="tab-pane fade" id="{{ publications }}">...</div>
|
||||
|
Loading…
Reference in New Issue
Block a user