-
Notifications
You must be signed in to change notification settings - Fork 223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EDSC-3762: As a user, I want to download the downloader app if it is not available on my machine #1643
Merged
Merged
EDSC-3762: As a user, I want to download the downloader app if it is not available on my machine #1643
Changes from 6 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
a502b63
EDSC-3762: Adding eddLanding page and link to the modal
eudoroolivares2016 cc248fa
EDSC-3762: Adding some styling moving extra os selection to landing page
eudoroolivares2016 5337b70
EDSC-3762: Update route name to earthdataDownload; add container test
eudoroolivares2016 88daa80
EDSC-3762: cleaning up; adding null user-agent parsing response
eudoroolivares2016 38a823b
EDSC-3762: Address PR comments && update package for snyk
eudoroolivares2016 2454c26
EDSC-3762: Remove line for testing to fix unit test
eudoroolivares2016 fb229b8
EDSDC-3762: conventionalize classNames for scss
eudoroolivares2016 a2ef857
EDSC-3762: screenshot update
eudoroolivares2016 b42abf9
EDSC-3672: Tweaking earthdata download page
trevorlang 52bf488
EDSC-3762: Styling updates on EDD landing page; fix macOS
eudoroolivares2016 358a34e
EDSC-3762: Fix test after last commit
eudoroolivares2016 b5fe77c
EDSC-3762: Fixing button styling UI
eudoroolivares2016 493297b
EDSC-3762: Adding eddLanding page and link to the modal
eudoroolivares2016 2d4a089
EDSC-3762: Adding some styling moving extra os selection to landing page
eudoroolivares2016 f030f3a
EDSC-3762: Update route name to earthdataDownload; add container test
eudoroolivares2016 b8fb978
EDSC-3762: cleaning up; adding null user-agent parsing response
eudoroolivares2016 a3aa64f
EDSC-3762: Address PR comments && update package for snyk
eudoroolivares2016 6932a6e
EDSC-3762: Remove line for testing to fix unit test
eudoroolivares2016 9a01741
EDSDC-3762: conventionalize classNames for scss
eudoroolivares2016 5ed6c10
EDSC-3762: screenshot update
eudoroolivares2016 f6fb128
EDSC-3672: Tweaking earthdata download page
trevorlang e5fcc7e
EDSC-3762: Styling updates on EDD landing page; fix macOS
eudoroolivares2016 3863422
EDSC-3762: Fix test after last commit
eudoroolivares2016 c9f363c
EDSC-3762: Fixing button styling UI
eudoroolivares2016 90650bb
Merge branch 'EDSC-3762' of https://github.com/eudoroolivares2016/ear…
eudoroolivares2016 d5e8f82
EDSC-3762: Adding executable size to bamboo
eudoroolivares2016 2a8ed47
EDSC-3762: Updating PR comments
eudoroolivares2016 7ddaefe
Merge remote-tracking branch 'upstream/main' into EDSC-3762
eudoroolivares2016 1fe16d1
EDSC-3762: Update package-lock
eudoroolivares2016 9edcea1
EDSC-3762: Revert package lock to main
eudoroolivares2016 0fca2b9
EDSC-3672: Final styles
trevorlang f9dc7f6
EDSC-3762: Minor test fixes
eudoroolivares2016 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
162 changes: 162 additions & 0 deletions
162
static/src/js/components/EarthdataDownload/EarthdataDownload.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
import React from 'react' | ||
import { FaDownload } from 'react-icons/fa' | ||
import { capitalize } from 'lodash' | ||
import Button from '../Button/Button' | ||
|
||
import eddLogo from '../../../assets/images/earthdataDownload-screenshot.png' | ||
import unavailableImg from '../../../assets/images/image-unavailable.svg' | ||
import { getOperatingSystem } from '../../util/files/parseUserAgent' | ||
|
||
import { getApplicationConfig } from '../../../../../sharedUtils/config' | ||
|
||
import './EarthdataDownload.scss' | ||
|
||
export const EarthdataDownload = () => { | ||
const { userAgent } = navigator | ||
let operatingSystem = getOperatingSystem(userAgent) | ||
let downloadLink | ||
|
||
let executableSize | ||
const windowsDownloadLink = '//github.com/nasa/earthdata-download/releases/latest/download/Earthdata-Download-x64.exe' | ||
const macDownloadLink = '//github.com/nasa/earthdata-download/releases/latest/download/Earthdata-Download-x64.dmg' | ||
const macSiliconDownloadLink = '//github.com/nasa/earthdata-download/releases/latest/download/Earthdata-Download-arm64.dmg' | ||
const linuxDownloadLink = '//github.com/nasa/earthdata-download/releases/latest/download/Earthdata.Download-amd64.deb' | ||
const { | ||
macOsEDDExecutableSize, | ||
windowsEDDExecutableSize, | ||
linuxEDDExecutableSize | ||
} = getApplicationConfig() | ||
|
||
let isMacOs = false | ||
eudoroolivares2016 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
let isLinux = false | ||
let isWindows = false | ||
|
||
switch (operatingSystem) { | ||
case 'macOs': { | ||
// Apple standard is not to capitalize macOs | ||
isMacOs = true | ||
downloadLink = macDownloadLink | ||
executableSize = macOsEDDExecutableSize | ||
break | ||
} | ||
case 'windows': { | ||
operatingSystem = capitalize(operatingSystem) | ||
isWindows = true | ||
downloadLink = windowsDownloadLink | ||
executableSize = windowsEDDExecutableSize | ||
break | ||
} | ||
case 'linux': { | ||
operatingSystem = capitalize(operatingSystem) | ||
isLinux = true | ||
downloadLink = linuxDownloadLink | ||
executableSize = linuxEDDExecutableSize | ||
break | ||
} | ||
default: | ||
{ | ||
operatingSystem = 'macOs' | ||
downloadLink = macDownloadLink | ||
isMacOs = true | ||
executableSize = macOsEDDExecutableSize | ||
break | ||
} | ||
} | ||
const downloaderSize = `${executableSize}mb` | ||
const osLinkFileExt = `(.${downloadLink.split('.').pop()})` | ||
|
||
return ( | ||
<div className="earthdataDownload"> | ||
|
||
<div className="earthdataDownload__imageContainer"> | ||
<img className="earthdataDownload__screenshot" src={eddLogo} alt={unavailableImg} /> | ||
</div> | ||
|
||
<div className="earthdataDownload__content"> | ||
<h2 className="earthdataDownload__header-primary"> | ||
Download your files from Earthdata Search | ||
<br /> | ||
with only one click! | ||
</h2> | ||
<br /> | ||
<div className="earthdataDownload__content-container"> | ||
<h3 className="earthdataDownload__header-secondary">Earthdata Downloader Features</h3> | ||
<br /> | ||
<br /> | ||
<ul className="earthdataDownload__list-group"> | ||
<li className="earthdataDownload__list-item">Easily Authenticate with Earthdata login</li> | ||
<li className="earthdataDownload__list-item">Manage your downloads and preferences</li> | ||
<li className="earthdataDownload__list-item">Works on Mac, Windows, and Linux</li> | ||
</ul> | ||
</div> | ||
<div className="earthdataDownload__install-content"> | ||
<Button dataTestId="eddDownloadButton" className="earthdataDownload__install-button" type="button" icon={FaDownload} bootstrapVariant="primary" href={downloadLink}> | ||
Download for | ||
{' '} | ||
{operatingSystem} | ||
</Button> | ||
{' '} | ||
<span className="earthdataDownload__downloaderSize"> | ||
{downloaderSize} | ||
</span> | ||
{' '} | ||
<span className="earthdataDownload__osLinkFileExt"> | ||
{osLinkFileExt} | ||
</span> | ||
</div> | ||
</div> | ||
<div className="earthdataDownload__other-links"> | ||
|
||
<div className="other-links__item"> | ||
Apple silicon? | ||
<br /> | ||
Download for | ||
{' '} | ||
<a data-testid="earthdataDownload-link-macOsSilicone" download href={macSiliconDownloadLink}> | ||
Apple silicon Mac | ||
</a> | ||
<br /> | ||
</div> | ||
{ !isWindows ? ( | ||
<div className="other-links__item"> | ||
Windows? | ||
<br /> | ||
Download for | ||
{' '} | ||
<a data-testid="earthdataDownload-link-windows" download href={windowsDownloadLink}> | ||
Windows | ||
</a> | ||
<br /> | ||
</div> | ||
) : null} | ||
{' '} | ||
{ !isLinux ? ( | ||
<div className="other-links__item"> | ||
Linux? | ||
<br /> | ||
Download for | ||
{' '} | ||
<a className="eddLinuxLink" data-testid="earthdataDownload-link-linux" download href={linuxDownloadLink}> | ||
Linux | ||
</a> | ||
<br /> | ||
</div> | ||
) : null} | ||
{' '} | ||
{ !isMacOs ? ( | ||
<div className="other-links__item"> | ||
MacOs? | ||
<br /> | ||
Download for | ||
{' '} | ||
<a className="eddMacOsLink" data-testid="earthdataDownload-link-macosx64" download href={macDownloadLink}> | ||
Intel Macs | ||
</a> | ||
</div> | ||
) : null} | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default EarthdataDownload |
94 changes: 94 additions & 0 deletions
94
static/src/js/components/EarthdataDownload/EarthdataDownload.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
.earthdataDownload { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: space-between; | ||
align-items: center; | ||
|
||
&__imageContainer{ | ||
max-width: 100%; | ||
max-height: 100%; | ||
max-width: 50vw; | ||
position: fixed; | ||
top: 50%; | ||
left: 20%; | ||
transform: translate(0, -50%); | ||
} | ||
|
||
&__screenshot { | ||
height: 500px; | ||
width: 500px; | ||
} | ||
|
||
&__content { | ||
flex: 1; | ||
top: 50%; | ||
right: 0; | ||
width: 50%; | ||
padding: 0 20px; | ||
max-width: 100%; | ||
max-height: 100%; | ||
max-width: 50vw; | ||
position: fixed; | ||
top: 50%; | ||
transform: translate(0, -50%); | ||
} | ||
|
||
&__header-primary { | ||
position: absolute; | ||
top: 50; | ||
left: 0; | ||
} | ||
|
||
&__list-group { | ||
text-align: left; | ||
font-size: larger; | ||
margin: 0; | ||
} | ||
|
||
&__list-item { | ||
text-align: left; | ||
} | ||
|
||
&__content-container { | ||
position: relative; | ||
margin-top: 100px; | ||
text-align: left; | ||
list-style-position: inside; /* Places the bullets inside the list items */ | ||
background-color: rgba(204, 204, 204, 0.685); | ||
display: inline-block; | ||
padding: 15px; | ||
} | ||
|
||
&__header-secondary { | ||
position: absolute; | ||
top: 0; | ||
left: 10; | ||
margin: 0; | ||
} | ||
|
||
&__install_content { | ||
eudoroolivares2016 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
bottom: 0; | ||
left: 0; | ||
position: absolute; | ||
} | ||
|
||
&__downloaderSize { | ||
eudoroolivares2016 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
font-weight: 400; | ||
} | ||
|
||
&__osLinkFileExt { | ||
eudoroolivares2016 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
font-weight: 400; | ||
color: #6f6e6e; | ||
font-style: italic; | ||
} | ||
|
||
&__other-links{ | ||
display: flex; | ||
justify-content: space-around; | ||
position: fixed; | ||
right: 0; | ||
bottom: 0; | ||
margin-bottom: 250px; | ||
width: 50%; | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
static/src/js/components/EarthdataDownload/__tests__/EarthdataDownload.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import React from 'react' | ||
import { render, screen } from '@testing-library/react' | ||
import '@testing-library/jest-dom' | ||
|
||
import EarthdataDownload from '../EarthdataDownload' | ||
|
||
import { getOperatingSystem } from '../../../util/files/parseUserAgent' | ||
|
||
const windowsDownloadLink = '//github.com/nasa/earthdata-download/releases/latest/download/Earthdata-Download-x64.exe' | ||
const macDownloadLink = '//github.com/nasa/earthdata-download/releases/latest/download/Earthdata-Download-x64.dmg' | ||
const linuxDownloadLink = '//github.com/nasa/earthdata-download/releases/latest/download/Earthdata.Download-amd64.deb' | ||
|
||
jest.mock('../../../util/files/parseUserAgent', () => ({ | ||
getOperatingSystem: jest.fn() | ||
})) | ||
|
||
const setup = () => { | ||
render( | ||
<EarthdataDownload> </EarthdataDownload> | ||
) | ||
} | ||
|
||
describe('EarthdataDownload component', () => { | ||
test('Render the download link for windows', () => { | ||
getOperatingSystem.mockImplementation(() => 'windows') | ||
setup() | ||
expect(screen.getByTestId('eddDownloadButton')).toBeInTheDocument() | ||
expect(screen.getByTestId('eddDownloadButton')).toHaveAttribute('href', windowsDownloadLink) | ||
}) | ||
|
||
test('Render the download link for macOs', () => { | ||
getOperatingSystem.mockImplementation(() => 'macOs') | ||
setup() | ||
expect(screen.getByTestId('eddDownloadButton')).toBeInTheDocument() | ||
expect(screen.getByTestId('eddDownloadButton')).toHaveAttribute('href', macDownloadLink) | ||
}) | ||
|
||
test('Render the download link for linux', () => { | ||
getOperatingSystem.mockImplementation(() => 'linux') | ||
setup() | ||
expect(screen.getByTestId('eddDownloadButton')).toBeInTheDocument() | ||
expect(screen.getByTestId('eddDownloadButton')).toHaveAttribute('href', linuxDownloadLink) | ||
}) | ||
}) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are there changes to
package-lock.json
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did an
npm audit fix
for theEDSC-3804
vulnerabilityThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we already have a ticket to update libraries, they need to be updated in that ticket, not added on to a separate effort where we can't track that change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted package-lock switch. Tracking separately