Commit 9e93e41e authored by Felix A. Croes's avatar Felix A. Croes
Browse files

Use HTML for data in ELN.

Add an optional dictionary argument to addMetadata, which will be displayed
as a table if present.  Currently it is used for the file size, but this
should include other relevant metadata from iRODS.
parent 375a2580
......@@ -264,28 +264,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