Several fixes for dashboard && new command to clean up cache

This commit is contained in:
Adolfo Gómez García 2015-10-29 06:57:02 +01:00
parent 962f1fcc1c
commit e23f22d92d
5 changed files with 72 additions and 9 deletions

View File

@ -32,7 +32,7 @@
'''
from __future__ import unicode_literals
from .UniqueIDGenerator import UniqueIDGenerator
from .UniqueIDGenerator import UniqueIDGenerator, MAX_SEQ
import logging
logger = logging.getLogger(__name__)
@ -48,5 +48,5 @@ class UniqueGIDGenerator(UniqueIDGenerator):
raise KeyError('No more GIDS available.')
return "%s%0*d" % (self._baseName, 8, seq)
def get(self):
def get(self, rangeStart=0, rangeEnd=MAX_SEQ):
return self.__toName(super(UniqueGIDGenerator, self).get())

View File

@ -0,0 +1,60 @@
# -*- 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.core.management.base import BaseCommand
from django.core.cache import cache
from uds.core.util.Config import GlobalConfig
from uds.core.util.Cache import Cache
import logging
import sys
logger = logging.getLogger(__name__)
class Command(BaseCommand):
args = "None"
help = "Clean up all uneeded data from UDS (cache, ...). This is mainly used for versions installations, so he have clean data"
def handle(self, *args, **options):
sys.stdout.write("Cleaning up UDS\n")
GlobalConfig.initialize()
# UDSs cache
Cache.cleanUp()
# Django caches
cache.clear()
sys.stdout.write("UDS Cleaned UP\n")

View File

@ -63,6 +63,7 @@ gui.providers.link = (event) ->
true
onRefresh: (tbl) ->
gui.doLog 'Invoked onRefresh for a provider'
clearDetails()
return
@ -178,7 +179,7 @@ gui.providers.link = (event) ->
select: (vals, value, btn, tbl, refreshFnc) ->
unless vals.length == 1
$(btn).removeClass("btn-warning").removeClass("btn-info").addClass "disabled"
$(btn).removeClass("btn-warning").removeClass("btn-info").addClass("disabled").prop('disabled', true)
$(btn).empty().append(maintenanceText('fa-ambulance', gettext("Maintenance")))
return
val = vals[0]
@ -189,7 +190,7 @@ gui.providers.link = (event) ->
content = maintenanceText('fa-truck',gettext('Exit Maintenance Mode'))
cls = 'btn-info'
$(btn).removeClass("disabled").addClass(cls)
$(btn).removeClass("disabled").addClass(cls).prop('disabled', false)
$(btn).empty().append(content)
return
}

View File

@ -153,6 +153,10 @@ gui.servicesPools.link = (event) ->
"xls"
"permissions"
]
onRefresh: () ->
clearDetails()
return
onRowDeselect: (deselected, dtable) ->
gui.doLog "Selecteds: ", dtable.rows({selected: true}).length
if dtable.rows({selected: true}).count() == 0
@ -470,11 +474,9 @@ gui.servicesPools.link = (event) ->
# Waiting for publication, Preparing or running
gui.doLog "State: ", val.state
if ["P", "W", "L", "K"].indexOf(val.state) != -1
$(btn).removeClass("disabled")
$(btn).prop('disabled', false)
$(btn).removeClass("disabled").prop('disabled', false)
else
$(btn).addClass("disabled")
$(btn).prop('disabled', true)
$(btn).addClass("disabled").prop('disabled', true)
return
}

View File

@ -215,7 +215,7 @@
tblParams.onRefresh = (tbl) ->
return
self.refresh = refreshFnc = () ->
self.refresh = refreshFnc = () ->
# Refreshes table content
tbl = $("#" + tableId).DataTable()