Skip to content

Commit

Permalink
Merge pull request #508 from TaykYoku/integration
Browse files Browse the repository at this point in the history
[v4r3] v4r3-pre12, notes
  • Loading branch information
TaykYoku authored Jul 28, 2021
2 parents fcd180c + aaddb9a commit 3f6f30d
Show file tree
Hide file tree
Showing 8 changed files with 169 additions and 92 deletions.
9 changes: 8 additions & 1 deletion release.notes
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[v4r3-pre11]
[v4r3-pre12]

NEW: (#501) add VMDIRAC application
CHANGE: (#502) remove Desktop view
FIX: (#500) move run_in_executor part to asyncGen decorated method
FIX: (#499) Create the directory in /WebApp/StaticResourceLinkDir if it doesn't already exist
Expand Down Expand Up @@ -29,6 +30,12 @@ CHANGE: (#467) rename README.md to README.rst
FIX: (#466) fix selector of pilot stats
FIX: (#465) return empty result instead error for no host request

[v4r2p5]

CHANGE: (#506) change datetime field behavior in selector, use Time field
CHANGE: (#505) get hosts from DB for SystemAdministrator
NEW: (#503) declare downtime for the application

[v4r2p4]

FIX: (#495) copy SettingsPanel.js to desktop folder
Expand Down
7 changes: 1 addition & 6 deletions src/WebAppDIRAC/Lib/Conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import uuid
import tempfile
import tornado.process

from DIRAC import gConfig
from DIRAC.Core.Security import Locations, X509Chain, X509CRL
from DIRAC.Core.Utilities.Decorators import deprecated


__RCSID__ = "$Id$"
Expand Down Expand Up @@ -253,11 +253,6 @@ def getIcon():
return getCSValue("Icon", "/static/core/img/icons/system/favicon.ico")


@deprecated("Please, use SSLProtocol instead.")
def SSLProrocol():
return SSLProtocol()


def SSLProtocol():
""" Get ssl protocol
Expand Down
4 changes: 2 additions & 2 deletions src/WebAppDIRAC/Lib/SessionData.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from DIRAC.Core.DISET.AuthManager import AuthManager
from DIRAC.Core.DISET.ThreadConfig import ThreadConfig
from DIRAC.ConfigurationSystem.Client.Helpers import Registry
from DIRAC.ConfigurationSystem.Client.Helpers import CSGlobals
from DIRAC.Core.Utilities.Extensions import extensionsByPriority

from WebAppDIRAC.Lib import Conf

Expand All @@ -36,7 +36,7 @@ def setHandlers(cls, handlers):
cls.__handlers[handler.LOCATION.strip("/")] = handler
# Calculate extensions
# TODO: Remove use of deprecated function
cls.__extensions = CSGlobals.getInstalledExtensions()
cls.__extensions = extensionsByPriority()
for ext in ['DIRAC', 'WebAppDIRAC']:
if ext in cls.__extensions:
cls.__extensions.append(cls.__extensions.pop(cls.__extensions.index(ext)))
Expand Down
11 changes: 4 additions & 7 deletions src/WebAppDIRAC/WebApp/handler/SystemAdministrationHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
import datetime

from DIRAC import gConfig, gLogger
from DIRAC.Core.DISET.RPCClient import RPCClient
from DIRAC.Core.Utilities.List import uniqueElements
import DIRAC.ConfigurationSystem.Client.Helpers.Registry as Registry
from DIRAC.FrameworkSystem.Client.MonitoringClient import gMonitor
from DIRAC.FrameworkSystem.Client.NotificationClient import NotificationClient
from DIRAC.FrameworkSystem.Client.SystemAdministratorClient import SystemAdministratorClient
from DIRAC.FrameworkSystem.Client.ComponentMonitoringClient import ComponentMonitoringClient
Expand Down Expand Up @@ -592,7 +591,7 @@ def web_getSelectionData(self):
setup = self.getUserSetup().split('-')[-1]

hosts = []
result = Registry.getHosts()
result = ComponentMonitoringClient().getHosts()
if result['OK']:
hosts = [[i] for i in result['Value']]
data['Hosts'] = hosts
Expand Down Expand Up @@ -637,13 +636,11 @@ def web_getSelectionData(self):
@asyncGen
def web_ComponentLocation(self):

rpcClient = RPCClient("Framework/Monitoring")

_setup = self.getUserSetup()
setup = _setup.split('-')[-1]

hosts = []
result = Registry.getHosts()
result = ComponentMonitoringClient().getHosts()
if result['OK']:
hosts = result['Value']

Expand Down Expand Up @@ -702,7 +699,7 @@ def web_ComponentLocation(self):
condDict = {'Setup': _setup}

gLogger.debug("condDict" + str(condDict))
retVal = rpcClient.getComponentsStatus(condDict)
retVal = gMonitor.getComponentsStatus(condDict)

today = datetime.datetime.today()
if retVal['OK']:
Expand Down
49 changes: 49 additions & 0 deletions src/WebAppDIRAC/WebApp/static/core/js/core/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,55 @@ Ext.define("Ext.dirac.core.App", {
return sAppName in this.validApplications;
},

/**
* Function to get all application settings
*
* @param {String}
* sAppName The class name of the application
* @return {}
*/
getApplicationSettings: function(sAppName) {
if (sAppName in GLOBAL.APP.configData.configuration) {
return GLOBAL.APP.configData.configuration[sAppName];
} else {
return {};
}
},

/**
* Function that check application downtime settings
*
* @param {String}
* sAppName The class name of the application
* @return {}
*/
applicationInDowntime: function(sAppName) {
if (this.isValidApplication(sAppName)) {
var now = Date.now();
var app = this.validApplications[sAppName];
var downtime = this.getApplicationSettings(app).Downtime;

if (downtime) {
downtime.message = downtime.message || "Sorry, " + app + " application is in downtime";
downtime.message += "\n\n From: " + downtime.start;
downtime.message += "\n To: " + downtime.end;

// Check time
/* The string format should be: YYYY-MM-DDTHH:mm:ss.sssZ, where:
YYYY-MM-DD – is the date: year-month-day.
The character "T" is used as the delimiter.
HH:mm:ss.sss – is the time: hours, minutes, seconds and milliseconds.
The optional 'Z' part denotes the time zone in the format +-hh:mm. A single letter Z would mean UTC+0.
Shorter variants are also possible, like YYYY-MM-DDTHH:mm, YYYY-MM-DD or YYYY-MM or even YYYY.
*/
return !downtime.end ? {} : (!downtime.start || now > Date.parse(downtime.start)) && now < Date.parse(downtime.end) ? downtime : {};
} else {
return {};
}
}
},

/**
* Function that is used to get the title of an application
*
Expand Down
Loading

0 comments on commit 3f6f30d

Please sign in to comment.