From eff5e3ea8f528854568225871c7100fb823b947e Mon Sep 17 00:00:00 2001 From: juanf <juanf> Date: Mon, 4 Apr 2016 14:50:02 +0000 Subject: [PATCH] SSDM-3449 : Read properties from reporting plugin to obtain ftp/sftp protocol link SVN: 36071 --- .../eln-lims/html/js/config/Profile.js | 16 +++++++++- .../eln-lims/html/js/server/ServerFacade.js | 4 +++ .../reporting-plugins/newbrowserapi/script.py | 31 ++++++++++++++++++- 3 files changed, 49 insertions(+), 2 deletions(-) diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/Profile.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/Profile.js index d8f043becb4..e461f3940c9 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/Profile.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/Profile.js @@ -57,6 +57,8 @@ $.extend(DefaultProfile.prototype, { return ($.inArray(spaceCode, this.inventorySpaces) !== -1); } + this.directLinkURL = null; //To be set during initialization using info retrieved from the DSS configuration by the reporting plugin + this.hideCodes = true; this.hideTypes = { "sampleTypeCodes" : [], @@ -651,6 +653,16 @@ $.extend(DefaultProfile.prototype, { }); } + this.initDirectLinkURL = function(callback) { + var _this = this; + this.serverFacade.getDirectLinkURL(function(error, result) { + if(!error) { + _this.directLinkURL = result.data; + } + callback(); + }); + } + // // Initializes // @@ -660,7 +672,9 @@ $.extend(DefaultProfile.prototype, { this.initPropertyTypes(function(){ _this.initVocabulariesForSampleTypes(function() { _this.initSearchDomains(function() { - callbackWhenDone(); + _this.initDirectLinkURL(function() { + callbackWhenDone(); + }); }); }); }); diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/server/ServerFacade.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/server/ServerFacade.js index 5dde2000fa8..521527813e4 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/server/ServerFacade.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/server/ServerFacade.js @@ -403,6 +403,10 @@ function ServerFacade(openbisServer) { return GET; } + this.getDirectLinkURL = function(callbackFunction) { + this.customELNApi({ "method" : "getDirectLinkURL"}, callbackFunction); + } + // // Sample Others functions // diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/dss/reporting-plugins/newbrowserapi/script.py b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/dss/reporting-plugins/newbrowserapi/script.py index 2ad300ef2ce..a4b44caba9e 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/dss/reporting-plugins/newbrowserapi/script.py +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/dss/reporting-plugins/newbrowserapi/script.py @@ -60,12 +60,38 @@ from ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.id import SamplePermId from ch.ethz.sis.openbis.generic.asapi.v3.dto.experiment.id import ExperimentIdentifier; from ch.ethz.sis.openbis.generic.server.sharedapi.v3.json import GenericObjectMapper; from ch.systemsx.cisd.openbis.dss.generic.server import DataStoreServer - +from ch.systemsx.cisd.common.shared.basic.string import StringUtils + #from ch.systemsx.cisd.common.ssl import SslCertificateHelper; #Plasmapper server used PLASMAPPER_BASE_URL = "http://wishart.biology.ualberta.ca" OPENBISURL = DataStoreServer.getConfigParameters().getServerURL() + "/openbis/openbis" +def getConfigParameterAsString(propertyKey): + properties = DataStoreServer.getConfigParameters().getProperties(); + property = properties.getProperty(propertyKey); + if StringUtils.isBlank(property): + return None; + else: + return property; + +def getDirectLinkURL(): + ftpServerEnable = getConfigParameterAsString("ftp.server.enable"); + ftpServerPort = getConfigParameterAsString("ftp.server.port"); + ftpServerUseSsl = getConfigParameterAsString("ftp.server.use-ssl"); + useSsl = getConfigParameterAsString("use-ssl"); + protocol = None; + if ftpServerEnable == "true" and (ftpServerUseSsl == "true" or useSsl == "true"): + protocol = "ftps"; + elif ftpServerEnable == "true": + protocol = "ftp"; + + directLinkURL = None; + if protocol is not None: + directLinkURL = protocol + "://$URL:" + str(ftpServerPort) + "/"; + + return getJsonForData(directLinkURL); + def getProperties(tr, parameters): sessionToken = parameters.get("sessionToken"); servFinder = ServiceFinder("openbis", IGeneralInformationService.SERVICE_URL); @@ -132,6 +158,9 @@ def process(tr, parameters, tableBuilder): isOk = True; if method == "registerUserPassword": isOk = registerUserPassword(tr, parameters, tableBuilder); + if method == "getDirectLinkURL": + result = getDirectLinkURL(); + isOk = True; if method == "copyAndLinkAsParent": isOk = copyAndLinkAsParent(tr, parameters, tableBuilder); -- GitLab