Commit 8cb59bab authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Added upload name to calc index. #247

parent b3f87eba
Pipeline #68335 passed with stages
in 15 minutes and 3 seconds
......@@ -148,6 +148,10 @@ class UploadListUnstyled extends React.Component {
label: 'Upload time',
render: (upload) => new Date(upload.example.upload_time).toLocaleString()
},
upload_name: {
label: 'Name',
render: (upload) => upload.example.upload_name || ''
},
upload_id: {
label: 'Id',
render: (upload) => <UploadId uploadId={upload.example.upload_id} />
......@@ -213,7 +217,7 @@ class UploadListUnstyled extends React.Component {
id={row => row.id}
total={total}
columns={this.columns}
selectedColumns={['upload_time', 'upload_name', 'upload_id', 'entries', 'published']}
selectedColumns={['upload_time', 'upload_id', 'entries', 'published']}
entryActions={this.renderEntryActions}
data={results}
rows={per_page}
......
......@@ -90,6 +90,7 @@ class CalcWithMetadata(Mapping):
# basic upload and processing related metadata
self.upload_time: datetime.datetime = None
self.upload_name: str = None
self.files: List[str] = None
self.uploader: str = None
self.processed: bool = False
......
......@@ -212,6 +212,7 @@ class Calc(Proc):
calc_with_metadata.published = False
calc_with_metadata.uploader = self.upload.user_id
calc_with_metadata.upload_time = self.upload.upload_time
calc_with_metadata.upload_name = self.upload.name
calc_with_metadata.nomad_version = config.version
calc_with_metadata.nomad_commit = config.commit
calc_with_metadata.last_processing = datetime.utcnow()
......@@ -989,6 +990,7 @@ class Upload(Proc):
calc_metadatas[calc['mainfile']] = calc
user_upload_time = upload_metadata.get('_upload_time', None)
user_upload_name = upload_metadata.get('_upload_name', None)
def get_metadata(calc: Calc):
"""
......@@ -1002,6 +1004,8 @@ class Upload(Proc):
calc_with_metadata.apply_user_metadata(calc_metadata)
if calc_with_metadata.upload_time is None:
calc_with_metadata.upload_time = self.upload_time if user_upload_time is None else user_upload_time
if calc_with_metadata.upload_name is None:
calc_with_metadata.upload_name = self.name if user_upload_name is None else user_upload_name
return calc_with_metadata
else:
......@@ -1010,6 +1014,7 @@ class Upload(Proc):
def get_metadata(calc: Calc):
calc_with_metadata = datamodel.CalcWithMetadata(**calc.metadata)
calc_with_metadata.upload_time = self.upload_time
calc_with_metadata.upload_name = self.name
return calc_with_metadata
......
......@@ -84,6 +84,7 @@ class Entry(Document, metaclass=WithDomain):
upload_id = Keyword()
upload_time = Date()
upload_name = Keyword()
calc_id = Keyword()
calc_hash = Keyword()
pid = Keyword()
......@@ -116,6 +117,7 @@ class Entry(Document, metaclass=WithDomain):
def update(self, source: datamodel.CalcWithMetadata) -> None:
self.upload_id = source.upload_id
self.upload_time = source.upload_time
self.upload_name = source.upload_name
self.calc_id = source.calc_id
self.calc_hash = source.calc_hash
self.pid = None if source.pid is None else str(source.pid)
......
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