Skip to content

Conversation

@jamescdavis
Copy link
Member

Purpose

Add a loading indicator to the file-renderer (used on the file detail page).

Summary of Changes

  • converted file-renderer component to TypeScript w/ decorators
  • added loading indicator and styled it to float behind file iframe

Side Effects / Testing Notes

Use a large file to see the loader.

Ticket

https://openscience.atlassian.net/browse/EMB-137

Reviewer Checklist

  • meets requirements
  • easy to understand
  • DRY
  • testable and includes test(s)
  • changes described in CHANGELOG.md

@jamescdavis
Copy link
Member Author

@coveralls
Copy link

coveralls commented Mar 27, 2018

Coverage Status

Coverage decreased (-0.4%) to 30.55% when pulling 5cdabb0 on jamescdavis:EMB-137_quick_files_Add_loading_indicator_to_file_detail_page into 8e6c285 on CenterForOpenScience:develop.

download: string;
width: string = this.width || '100%';
height: string = this.height || '100%';
allowfullscreen: boolean = this.allowfullscreen || true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

camelCase?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, should be &&, so passing false isn't overwritten.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like camelCase here, but we should be careful about subtle API changes. Big breaking changes are easier to spot.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yikes, booleans!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, re: camelCase, this directly maps to iframe's allowfullscreen so maybe it should remain all lowercased?

height: string = this.height || '100%';
allowfullscreen: boolean = this.allowfullscreen || true;
version: string | null = this.version || null;
isLoading: boolean = this.isLoading || true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

&&

get mfrUrl(this: FileRenderer) {
let download = `${this.get('download')}?direct&mode=render&initialWidth=766`;
if (this.get('version')) {
download += `&version=${this.get('version')}`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is TS smart enough to know that this.get('version') isn't null here? Or does that only work for normal variables?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears to not. Even though it does know that this.get('version') is string | null, the type guard doesn't seem to guarantee that it's just string. Maybe because the .get() could potentially return something different on the second call?

{{#if download}}
<iframe src={{mfrUrl}} width={{width}} title={{t 'file_detail.mfr_iframe_title'}} height={{height}} scrolling="yes" marginheight="0" frameborder="0" allowfullscreen={{allowfullscreen}}>
{{#if isLoading}}
<div class='Loader ball-scale ball-dark'><div></div></div>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to use {{loading-indicator}}, if we can.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol, I forgot we had a component for that

width: string = this.width || '100%';
height: string = this.height || '100%';
allowfullscreen: boolean = this.allowfullscreen || true;
version: string | null = this.version || null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forget, can a file's version be 0?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope, starts at 1

@jamescdavis jamescdavis force-pushed the EMB-137_quick_files_Add_loading_indicator_to_file_detail_page branch 5 times, most recently from 73dee7e to 8980492 Compare April 3, 2018 06:41
@jamescdavis jamescdavis force-pushed the EMB-137_quick_files_Add_loading_indicator_to_file_detail_page branch from 8980492 to 5cdabb0 Compare April 3, 2018 07:17
@jamescdavis jamescdavis requested a review from icereval April 4, 2018 23:27
@binoculars binoculars merged commit a11d9fd into CenterForOpenScience:develop Apr 5, 2018
@jamescdavis jamescdavis deleted the EMB-137_quick_files_Add_loading_indicator_to_file_detail_page branch April 5, 2018 22:59
@jamescdavis jamescdavis added this to the 0.3.0 milestone May 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants