Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Record landing page UI improvements #1822

Merged
merged 2 commits into from
Feb 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions webui/src/components/editfiles.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ export const FileRecordRow = React.createClass({
propTypes: {
file: PT.object.isRequired,
remove: PT.func,
b2noteWidget: PT.object,
b2noteWidget: PT.oneOfType([PT.object, PT.bool]),
},

getInitialState() {
Expand All @@ -692,6 +692,11 @@ export const FileRecordRow = React.createClass({
};
},

copyIdentifier(id, msg='Item') {
copyToClipboard(id);
alert(msg + ' copied to clipboard!');
},

render() {
let file = this.props.file;
file = file.toJS ? file.toJS() : file;
Expand Down Expand Up @@ -727,14 +732,14 @@ export const FileRecordRow = React.createClass({
}</div>
<div className="col-sm-2 buttons">
{ this.props.b2noteWidget }
{/* !file.checksum ? false :
<button type="button" className="btn btn-default btn-xs" onClick={() => copyToClipboard(file.checksum)} title="Copy checksum to clipboard">
{ !file.checksum ? false :
<button type="button" className="btn btn-default btn-xs" onClick={() => this.copyIdentifier(file.checksum, 'File checksum')} title="Copy checksum to clipboard">
<i className="glyphicon glyphicon-asterisk"/>
</button> }
{ !file.ePIC_PID ? false :
<button type="button" className="btn btn-default btn-xs" onClick={() => copyToClipboard(file.ePIC_PID)} title="Copy PID to clipboard">
<button type="button" className="btn btn-default btn-xs" onClick={() => this.copyIdentifier(file.ePIC_PID, 'File EPIC PID')} title="Copy PID to clipboard">
<i className="glyphicon glyphicon-globe"/>
</button>*/ }
</button> }
{ !this.props.remove ? false :
<button type="button" className="btn btn-default btn-xs remove" onClick={()=>this.setState({remove:true})} title="Delete">
<i className="glyphicon glyphicon-remove"/>
Expand Down
7 changes: 4 additions & 3 deletions webui/src/components/record.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ export const RecordRoute = React.createClass({

render() {
const record = this.getRecordOrDraft();
const b2noteUrl = serverCache.getInfo().get('b2note_url');
if (!record || !b2noteUrl) {
const b2noteUrl = serverCache.getInfo().get('b2note_url', '');
if (!record || b2noteUrl === null) {
return <Wait/>;
}
if (record instanceof Error) {
Expand Down Expand Up @@ -508,7 +508,8 @@ const Record = React.createClass({
const blockSchemas = this.props.blockSchemas;
const record = this.props.record;
const b2noteUrl = this.props.b2noteUrl;
if (!record || !rootSchema || !b2noteUrl) {

if (!record || !rootSchema) {
return <Wait/>;
}

Expand Down