Commit 75d2b808 authored by Staiger, Christine's avatar Staiger, Christine
Browse files

Merge branch 'elabjournal' into 'standalone'

Use HTML for data in ELN.

See merge request rdm-infrastructure/irods-clients!12
parents 4886dbcc 9e93e41e
......@@ -268,28 +268,32 @@ class Worker(QObject):
logging.info("ElabUpload data upload and annotation worker: "+repr(e))
print(repr(e))
self.annotateElab()
self.annotateElab({ "file size": str(self.size) + "MB" })
def annotateElab(self):
def annotateElab(self, metadata):
self.errorLabel.setText("Linking data to Elabjournal experiment.")
if self.ic.davrods and "yoda" in self.ic.session.host:
self.elab.addMetadata(
self.ic.davrods+'/'+self.coll.path.split('home/')[1].strip(),
meta=metadata,
title='Data in iRODS')
elif self.ic.davrods and "surfsara.nl" in self.ic.session.host:
self.elab.addMetadata(
self.ic.davrods+'/'+self.coll.path.split(
self.ic.session.zone)[1].strip('/'),
meta=metadata,
title='Data in iRODS')
elif self.ic.davrods:
self.elab.addMetadata(
self.ic.davrods+'/'+self.coll.path.strip('/'),
meta=metadata,
title='Data in iRODS')
else:
self.elab.addMetadata('{'+self.ic.session.host+', \n'\
+self.ic.session.zone+', \n'\
+self.ic.session.username+', \n'\
+str(self.ic.session.port)+'}\n'+
self.coll.path, title='Data in iRODS')
self.coll.path, meta=metadata,
title='Data in iRODS')
......@@ -153,6 +153,12 @@ class elabConnector():
except:
raise
def addMetadata(self, info, title='Title'):
def addMetadata(self, url, meta=None, title='Title'):
info = '<a href="' + url + '">Experiment data in iRODS</a>'
if not meta == None:
info = info + '<br><table style="width: 500px;" cellspacing="1" cellpadding="1" border="1"><tbody>'
for key, value in meta.items():
info = info + '<tr><td>' + key + '</td><td>' + value + '</td></tr>'
info = info + '</tbody></table>'
self.experiment.add(info, title)
return True
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment