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
|
# return
|
||||||
|
|
||||||
def showError(self, e):
|
def showError(self, e):
|
||||||
|
logger.error('got error: {}'.format(e))
|
||||||
self.stopAnim()
|
self.stopAnim()
|
||||||
self.ui.info.setText('UDS Plugin Error') # In fact, main window is hidden, so this is not visible... :)
|
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()
|
self.closeWindow()
|
||||||
|
QtGui.QMessageBox.critical(None, 'UDS Plugin Error', '{}'.format(e), QtGui.QMessageBox.Ok)
|
||||||
self.withError = True
|
self.withError = True
|
||||||
|
|
||||||
def cancelPushed(self):
|
def cancelPushed(self):
|
||||||
|
@ -41,6 +41,8 @@ from uds.models import DeployedServicePublication, getSqlDatetime
|
|||||||
from uds.core.util.State import State
|
from uds.core.util.State import State
|
||||||
from uds.core.util import log
|
from uds.core.util import log
|
||||||
import logging
|
import logging
|
||||||
|
import datetime
|
||||||
|
import pickle
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -91,6 +93,7 @@ class PublicationLauncher(DelayedTask):
|
|||||||
state = pi.publish()
|
state = pi.publish()
|
||||||
deployedService = servicePoolPub.deployed_service
|
deployedService = servicePoolPub.deployed_service
|
||||||
deployedService.current_pub_revision += 1
|
deployedService.current_pub_revision += 1
|
||||||
|
deployedService.storeValue('toBeReplacedIn', pickle.dumps(datetime.datetime.now() + datetime.timedelta(hours=GlobalConfig.SESSION_EXPIRE_TIME.getInt(True))))
|
||||||
deployedService.save()
|
deployedService.save()
|
||||||
PublicationFinishChecker.checkAndUpdateState(servicePoolPub, pi, state)
|
PublicationFinishChecker.checkAndUpdateState(servicePoolPub, pi, state)
|
||||||
except Exception:
|
except Exception:
|
||||||
|
@ -110,6 +110,8 @@ def validateMacRange(macRange):
|
|||||||
|
|
||||||
if macRE.match(macRangeStart) is None or macRE.match(macRangeEnd) is None:
|
if macRE.match(macRangeStart) is None or macRE.match(macRangeEnd) is None:
|
||||||
raise Exception()
|
raise Exception()
|
||||||
|
if macRangeStart > macRangeEnd:
|
||||||
|
raise Exception()
|
||||||
except 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'))
|
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()
|
ds.delete()
|
||||||
return
|
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))
|
logger.debug('Removal process of {0}'.format(ds))
|
||||||
|
|
||||||
publishing = ds.publications.filter(state=State.PREPARING)
|
publishing = ds.publications.filter(state=State.PREPARING)
|
||||||
|
@ -59,8 +59,9 @@ from uds.core.util.calendar import CalendarChecker
|
|||||||
|
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
import logging
|
import logging
|
||||||
|
import pickle
|
||||||
|
|
||||||
__updated__ = '2016-05-18'
|
__updated__ = '2016-05-19'
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@ -191,6 +192,19 @@ class DeployedService(UUIDModel, TaggingMixin):
|
|||||||
def isInMaintenance(self):
|
def isInMaintenance(self):
|
||||||
return self.service is not None and self.service.isInMaintenance()
|
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):
|
def isAccessAllowed(self, chkDateTime=None):
|
||||||
'''
|
'''
|
||||||
Checks if the access for a service pool is allowed or not (based esclusively on associated calendars)
|
Checks if the access for a service pool is allowed or not (based esclusively on associated calendars)
|
||||||
|
@ -25,11 +25,13 @@
|
|||||||
{% if ser.transports %}
|
{% if ser.transports %}
|
||||||
<div class="service-container">
|
<div class="service-container">
|
||||||
{% with trans=ser.transports|first numTransports=ser.transports|length %}
|
{% 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 %}
|
{% if ser.maintenance %}
|
||||||
data-content="{% trans "Under maintenance" %}"
|
data-content="{% trans "Under maintenance" %}"
|
||||||
{% elif ser.not_accesible %}
|
{% elif ser.not_accesible %}
|
||||||
data-content="{% trans "Access limited by calendar" %}"
|
data-content="{% trans "Access limited by calendar" %}"
|
||||||
|
{% elif ser.to_be_replaced %}
|
||||||
|
data-content="{{ ser.to_be_replaced_text }}"
|
||||||
{% elif ser.in_use %}
|
{% elif ser.in_use %}
|
||||||
data-content="{%trans "Currently in use" %}"
|
data-content="{%trans "Currently in use" %}"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -189,6 +191,10 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div.service.to_be_replaced {
|
||||||
|
background-color: #B22222 !important;
|
||||||
|
}
|
||||||
|
|
||||||
div.service-image {
|
div.service-image {
|
||||||
width: 128px;
|
width: 128px;
|
||||||
height: 128px;
|
height: 128px;
|
||||||
|
@ -34,6 +34,7 @@ from django.shortcuts import render_to_response
|
|||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
from django.utils.translation import ugettext
|
from django.utils.translation import ugettext
|
||||||
|
from django.utils import formats
|
||||||
|
|
||||||
from django.template import RequestContext
|
from django.template import RequestContext
|
||||||
|
|
||||||
@ -51,7 +52,7 @@ import logging
|
|||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
__updated__ = '2016-04-22'
|
__updated__ = '2016-05-19'
|
||||||
|
|
||||||
|
|
||||||
def about(request):
|
def about(request):
|
||||||
@ -98,7 +99,7 @@ def index(request):
|
|||||||
|
|
||||||
# Extract required data to show to user
|
# Extract required data to show to user
|
||||||
services = []
|
services = []
|
||||||
# Select assigned user services
|
# Select assigned user services (manually assigned)
|
||||||
for svr in availUserServices:
|
for svr in availUserServices:
|
||||||
trans = []
|
trans = []
|
||||||
for t in svr.transports.all().order_by('priority'):
|
for t in svr.transports.all().order_by('priority'):
|
||||||
@ -134,6 +135,7 @@ def index(request):
|
|||||||
'maintenance': svr.deployed_service.isInMaintenance(),
|
'maintenance': svr.deployed_service.isInMaintenance(),
|
||||||
'not_accesible': not svr.deployed_service.isAccessAllowed(),
|
'not_accesible': not svr.deployed_service.isAccessAllowed(),
|
||||||
'in_use': svr.in_use,
|
'in_use': svr.in_use,
|
||||||
|
'to_be_replaced': False, # Manually assigned will not be autoremoved never
|
||||||
})
|
})
|
||||||
|
|
||||||
logger.debug(services)
|
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
|
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({
|
services.append({
|
||||||
'id': 'F' + svr.uuid,
|
'id': 'F' + svr.uuid,
|
||||||
'name': svr.name,
|
'name': svr.name,
|
||||||
@ -180,6 +189,8 @@ def index(request):
|
|||||||
'maintenance': svr.isInMaintenance(),
|
'maintenance': svr.isInMaintenance(),
|
||||||
'not_accesible': not svr.isAccessAllowed(),
|
'not_accesible': not svr.isAccessAllowed(),
|
||||||
'in_use': in_use,
|
'in_use': in_use,
|
||||||
|
'to_be_replaced': tbr,
|
||||||
|
'to_be_replaced_text': tbrt
|
||||||
})
|
})
|
||||||
|
|
||||||
logger.debug('Services: {0}'.format(services))
|
logger.debug('Services: {0}'.format(services))
|
||||||
|
Loading…
Reference in New Issue
Block a user