Skip to content
Snippets Groups Projects
Commit 3b95de51 authored by David Sehnal's avatar David Sehnal
Browse files

mol-plugin: better Log styling

parent 4e6861e8
No related branches found
No related tags found
No related merge requests found
......@@ -63,13 +63,13 @@ const DownloadStructure = StateAction.build({
url = src.params;
break;
case 'pdbe-updated':
url = { url: `https://www.ebi.ac.uk/pdbe/static/entry/${src.params.id.toLowerCase()}_updated.cif`, isBinary: false, label: `PDBe: ${src.params}` };
url = { url: `https://www.ebi.ac.uk/pdbe/static/entry/${src.params.id.toLowerCase()}_updated.cif`, isBinary: false, label: `PDBe: ${src.params.id}` };
break;
case 'rcsb':
url = { url: `https://files.rcsb.org/download/${src.params.id.toUpperCase()}.cif`, isBinary: false, label: `RCSB: ${src.params}` };
url = { url: `https://files.rcsb.org/download/${src.params.id.toUpperCase()}.cif`, isBinary: false, label: `RCSB: ${src.params.id}` };
break;
case 'bcif-static':
url = { url: `https://webchem.ncbr.muni.cz/ModelServer/static/bcif/${src.params.id.toLowerCase()}`, isBinary: true, label: `BinaryCIF: ${src.params}` };
url = { url: `https://webchem.ncbr.muni.cz/ModelServer/static/bcif/${src.params.id.toLowerCase()}`, isBinary: true, label: `BinaryCIF: ${src.params.id}` };
break;
default: throw new Error(`${(src as any).name} not supported.`);
}
......
......@@ -96,6 +96,7 @@ export class Log extends PluginComponent<{}, { entries: List<LogEntry> }> {
private wrapper = React.createRef<HTMLDivElement>();
componentDidMount() {
// TODO: only show last 100 entries.
this.subscribe(this.plugin.events.log, e => this.setState({ entries: this.state.entries.push(e) }));
}
......@@ -111,10 +112,12 @@ export class Log extends PluginComponent<{}, { entries: List<LogEntry> }> {
}
render() {
return <div ref={this.wrapper} style={{ position: 'absolute', top: '0', right: '0', bottom: '0', left: '0', overflowY: 'auto' }}>
<ul style={{ listStyle: 'none' }} className='msp-log-list'>
return <div ref={this.wrapper} className='msp-log' style={{ position: 'absolute', top: '0', right: '0', bottom: '0', left: '0', overflowY: 'auto' }}>
<ul className='msp-list-unstyled'>
{this.state.entries.map((e, i) => <li key={i}>
<b>[{formatTime(e!.timestamp)} | {e!.type}]</b> {e!.message}
<div className={'msp-log-entry-badge msp-log-entry-' + e!.type} />
<div className='msp-log-timestamp'>{formatTime(e!.timestamp)}</div>
<div className='msp-log-entry'>{e!.message}</div>
</li>)}
</ul>
</div>;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment