mirror of
https://github.com/dkmstr/openuds.git
synced 2024-12-22 13:34:04 +03:00
* Fixed client to better show errors
* Adding new publication warn for currently logged in users
This commit is contained in:
parent
59179b818e
commit
ba4eeffc77
@ -99,10 +99,11 @@ class UDSClient(QtGui.QMainWindow):
|
||||
# return
|
||||
|
||||
def showError(self, e):
|
||||
logger.error('got error: {}'.format(e))
|
||||
self.stopAnim()
|
||||
self.ui.info.setText('UDS Plugin Error') # In fact, main window is hidden, so this is not visible... :)
|
||||
QtGui.QMessageBox.critical(None, 'UDS Plugin Error', '{}'.format(e), QtGui.QMessageBox.Ok)
|
||||
self.closeWindow()
|
||||
QtGui.QMessageBox.critical(None, 'UDS Plugin Error', '{}'.format(e), QtGui.QMessageBox.Ok)
|
||||
self.withError = True
|
||||
|
||||
def cancelPushed(self):
|
||||
|
@ -41,6 +41,8 @@ from uds.models import DeployedServicePublication, getSqlDatetime
|
||||
from uds.core.util.State import State
|
||||
from uds.core.util import log
|
||||
import logging
|
||||
import datetime
|
||||
import pickle
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -91,6 +93,7 @@ class PublicationLauncher(DelayedTask):
|
||||
state = pi.publish()
|
||||
deployedService = servicePoolPub.deployed_service
|
||||
deployedService.current_pub_revision += 1
|
||||
deployedService.storeValue('toBeReplacedIn', pickle.dumps(datetime.datetime.now() + datetime.timedelta(hours=GlobalConfig.SESSION_EXPIRE_TIME.getInt(True))))
|
||||
deployedService.save()
|
||||
PublicationFinishChecker.checkAndUpdateState(servicePoolPub, pi, state)
|
||||
except Exception:
|
||||
|
@ -110,6 +110,8 @@ def validateMacRange(macRange):
|
||||
|
||||
if macRE.match(macRangeStart) is None or macRE.match(macRangeEnd) is None:
|
||||
raise Exception()
|
||||
if macRangeStart > macRangeEnd:
|
||||
raise Exception()
|
||||
except Exception:
|
||||
raise Module.ValidationException(_('Invalid mac range. Mac range must be in format XX:XX:XX:XX:XX:XX-XX:XX:XX:XX:XX:XX'))
|
||||
|
||||
|
@ -70,7 +70,7 @@ class DeployedServiceRemover(Job):
|
||||
ds.delete()
|
||||
return
|
||||
|
||||
# Get publications in course...., can be at most 1!!!
|
||||
# Get publications in course...., that only can be one :)
|
||||
logger.debug('Removal process of {0}'.format(ds))
|
||||
|
||||
publishing = ds.publications.filter(state=State.PREPARING)
|
||||
|
@ -59,8 +59,9 @@ from uds.core.util.calendar import CalendarChecker
|
||||
|
||||
from datetime import datetime, timedelta
|
||||
import logging
|
||||
import pickle
|
||||
|
||||
__updated__ = '2016-05-18'
|
||||
__updated__ = '2016-05-19'
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@ -191,6 +192,19 @@ class DeployedService(UUIDModel, TaggingMixin):
|
||||
def isInMaintenance(self):
|
||||
return self.service is not None and self.service.isInMaintenance()
|
||||
|
||||
def toBeReplaced(self):
|
||||
# return datetime.now()
|
||||
activePub = self.activePublication()
|
||||
if activePub is None or activePub.revision == self.current_pub_revision - 1:
|
||||
return None
|
||||
|
||||
# Return the date
|
||||
ret = self.recoverValue('toBeReplacedIn')
|
||||
if ret is not None:
|
||||
return pickle.loads(ret)
|
||||
return None
|
||||
|
||||
|
||||
def isAccessAllowed(self, chkDateTime=None):
|
||||
'''
|
||||
Checks if the access for a service pool is allowed or not (based esclusively on associated calendars)
|
||||
|
@ -25,11 +25,13 @@
|
||||
{% if ser.transports %}
|
||||
<div class="service-container">
|
||||
{% with trans=ser.transports|first numTransports=ser.transports|length %}
|
||||
<div class="service{% if ser.maintenance %} maintenance{% endif %}{% if ser.not_accesible %} notaccesible{% endif %}{% if ser.in_use %} inuse{% endif %}"
|
||||
<div class="service{% if ser.maintenance %} maintenance{% endif %}{% if ser.not_accesible %} notaccesible{% endif %}{% if ser.in_use %} inuse{% endif %}{% if ser.to_be_replaced %} to_be_replaced{% endif %}"
|
||||
{% if ser.maintenance %}
|
||||
data-content="{% trans "Under maintenance" %}"
|
||||
{% elif ser.not_accesible %}
|
||||
data-content="{% trans "Access limited by calendar" %}"
|
||||
{% elif ser.to_be_replaced %}
|
||||
data-content="{{ ser.to_be_replaced_text }}"
|
||||
{% elif ser.in_use %}
|
||||
data-content="{%trans "Currently in use" %}"
|
||||
{% endif %}
|
||||
@ -189,6 +191,10 @@
|
||||
|
||||
}
|
||||
|
||||
div.service.to_be_replaced {
|
||||
background-color: #B22222 !important;
|
||||
}
|
||||
|
||||
div.service-image {
|
||||
width: 128px;
|
||||
height: 128px;
|
||||
|
@ -34,6 +34,7 @@ from django.shortcuts import render_to_response
|
||||
from django.shortcuts import render
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.utils.translation import ugettext
|
||||
from django.utils import formats
|
||||
|
||||
from django.template import RequestContext
|
||||
|
||||
@ -51,7 +52,7 @@ import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
__updated__ = '2016-04-22'
|
||||
__updated__ = '2016-05-19'
|
||||
|
||||
|
||||
def about(request):
|
||||
@ -98,7 +99,7 @@ def index(request):
|
||||
|
||||
# Extract required data to show to user
|
||||
services = []
|
||||
# Select assigned user services
|
||||
# Select assigned user services (manually assigned)
|
||||
for svr in availUserServices:
|
||||
trans = []
|
||||
for t in svr.transports.all().order_by('priority'):
|
||||
@ -134,6 +135,7 @@ def index(request):
|
||||
'maintenance': svr.deployed_service.isInMaintenance(),
|
||||
'not_accesible': not svr.deployed_service.isAccessAllowed(),
|
||||
'in_use': svr.in_use,
|
||||
'to_be_replaced': False, # Manually assigned will not be autoremoved never
|
||||
})
|
||||
|
||||
logger.debug(services)
|
||||
@ -169,6 +171,13 @@ def index(request):
|
||||
|
||||
group = svr.servicesPoolGroup.as_dict if svr.servicesPoolGroup is not None else ServicesPoolGroup.default().as_dict
|
||||
|
||||
tbr = svr.toBeReplaced()
|
||||
if tbr is not None:
|
||||
tbr = formats.date_format(tbr, "SHORT_DATETIME_FORMAT")
|
||||
tbrt = ugettext('This service is about to be replaced by a new version. Please, close the session & save all your work to avoid loosing it.<br>This action will be executed at {}').format(tbr)
|
||||
else:
|
||||
tbrt = ''
|
||||
|
||||
services.append({
|
||||
'id': 'F' + svr.uuid,
|
||||
'name': svr.name,
|
||||
@ -180,6 +189,8 @@ def index(request):
|
||||
'maintenance': svr.isInMaintenance(),
|
||||
'not_accesible': not svr.isAccessAllowed(),
|
||||
'in_use': in_use,
|
||||
'to_be_replaced': tbr,
|
||||
'to_be_replaced_text': tbrt
|
||||
})
|
||||
|
||||
logger.debug('Services: {0}'.format(services))
|
||||
|
Loading…
Reference in New Issue
Block a user