Commit 815e5ec8 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Adopted GUI to removed json/zip archive.

parent a5da4b66
Pipeline #71286 passed with stages
in 25 minutes and 26 seconds
......@@ -291,7 +291,7 @@ class Api {
calc_id: calcId
}))
.catch(handleApiError)
.then(response => response.text)
.then(response => response.body)
.finally(this.onFinishLoading)
}
......
......@@ -28,14 +28,8 @@ class LogEntryUnstyled extends React.Component {
render() {
const { classes, entry } = this.props
let data
try {
data = JSON.parse(entry)
} catch (e) {
return <ExpansionPanelSummary>
<Typography>{entry}</Typography>
</ExpansionPanelSummary>
}
const data = entry
const summaryProps = {}
if (data.level === 'ERROR' || data.level === 'CRITICAL') {
summaryProps.color = 'error'
......@@ -135,11 +129,10 @@ class ArchiveLogView extends React.Component {
let content = 'loading ...'
if (data) {
const lines = data.split('\n')
content = <div>
{lines.slice(0, maxLogsToShow).map((entry, i) => <LogEntry key={i} entry={entry}/>)}
{lines.length > maxLogsToShow && <Typography classes={{root: classes.moreLogs}}>
There are {lines.length - maxLogsToShow} more log entries. Download the log to see all of them.
{data.slice(0, maxLogsToShow).map((entry, i) => <LogEntry key={i} entry={entry}/>)}
{data.length > maxLogsToShow && <Typography classes={{root: classes.moreLogs}}>
There are {data.length - maxLogsToShow} more log entries. Download the log to see all of them.
</Typography>}
</div>
}
......
......@@ -26,6 +26,7 @@ import json
import orjson
import importlib
import urllib.parse
from collections.abc import Mapping
import metainfo
......@@ -49,7 +50,7 @@ class ArchiveCalcLogResource(Resource):
@api.doc('get_archive_logs')
@api.response(404, 'The upload or calculation does not exist')
@api.response(401, 'Not authorized to access the data.')
@api.response(200, 'Archive data send', headers={'Content-Type': 'application/plain'})
@api.response(200, 'Archive data send')
@authenticate(signature_token=True)
def get(self, upload_id, calc_id):
'''
......@@ -67,8 +68,8 @@ class ArchiveCalcLogResource(Resource):
try:
with upload_files.read_archive(calc_id) as archive:
data = archive[calc_id]['processing_logs']
return '\n'.join([json.dumps(entry.to_dict()) for entry in data])
return [entry.to_dict() for entry in archive[calc_id]['processing_logs']]
except Restricted:
abort(401, message='Not authorized to access %s/%s.' % (upload_id, calc_id))
except KeyError:
......@@ -98,7 +99,10 @@ class ArchiveCalcResource(Resource):
try:
with upload_files.read_archive(calc_id) as archive:
return archive[calc_id].to_dict()
return {
key: value.to_dict()
for key, value in archive[calc_id].items()
if isinstance(value, Mapping)}
except Restricted:
abort(401, message='Not authorized to access %s/%s.' % (upload_id, calc_id))
except KeyError:
......
......@@ -80,12 +80,15 @@ class TOCPacker(Packer):
# of array items
if len(value) > 0 and isinstance(value[0], dict):
toc[key] = self._stack.pop()
elif isinstance(value, (dict, list, tuple)):
toc[key] = self._stack.pop()
toc_result['toc'] = toc
toc_result['toc'] = {key: value for key, value in reversed(list(toc.items()))}
end = self._pos()
toc_result['pos'] = [start, end]
self._stack.append(toc_result)
elif isinstance(obj, list):
......
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