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({ ...@@ -63,13 +63,13 @@ const DownloadStructure = StateAction.build({
url = src.params; url = src.params;
break; break;
case 'pdbe-updated': 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; break;
case 'rcsb': 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; break;
case 'bcif-static': 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; break;
default: throw new Error(`${(src as any).name} not supported.`); default: throw new Error(`${(src as any).name} not supported.`);
} }
......
...@@ -96,6 +96,7 @@ export class Log extends PluginComponent<{}, { entries: List<LogEntry> }> { ...@@ -96,6 +96,7 @@ export class Log extends PluginComponent<{}, { entries: List<LogEntry> }> {
private wrapper = React.createRef<HTMLDivElement>(); private wrapper = React.createRef<HTMLDivElement>();
componentDidMount() { componentDidMount() {
// TODO: only show last 100 entries.
this.subscribe(this.plugin.events.log, e => this.setState({ entries: this.state.entries.push(e) })); 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> }> { ...@@ -111,10 +112,12 @@ export class Log extends PluginComponent<{}, { entries: List<LogEntry> }> {
} }
render() { render() {
return <div ref={this.wrapper} style={{ position: 'absolute', top: '0', right: '0', bottom: '0', left: '0', overflowY: 'auto' }}> return <div ref={this.wrapper} className='msp-log' style={{ position: 'absolute', top: '0', right: '0', bottom: '0', left: '0', overflowY: 'auto' }}>
<ul style={{ listStyle: 'none' }} className='msp-log-list'> <ul className='msp-list-unstyled'>
{this.state.entries.map((e, i) => <li key={i}> {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>)} </li>)}
</ul> </ul>
</div>; </div>;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment