Skip to content
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 32 commits into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
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 Jun 16, 2023
cc248fa
EDSC-3762: Adding some styling moving extra os selection to landing page
eudoroolivares2016 Jun 19, 2023
5337b70
EDSC-3762: Update route name to earthdataDownload; add container test
eudoroolivares2016 Jun 19, 2023
88daa80
EDSC-3762: cleaning up; adding null user-agent parsing response
eudoroolivares2016 Jun 19, 2023
38a823b
EDSC-3762: Address PR comments && update package for snyk
eudoroolivares2016 Jun 20, 2023
2454c26
EDSC-3762: Remove line for testing to fix unit test
eudoroolivares2016 Jun 20, 2023
fb229b8
EDSDC-3762: conventionalize classNames for scss
eudoroolivares2016 Jun 20, 2023
a2ef857
EDSC-3762: screenshot update
eudoroolivares2016 Jun 21, 2023
b42abf9
EDSC-3672: Tweaking earthdata download page
trevorlang Jun 22, 2023
52bf488
EDSC-3762: Styling updates on EDD landing page; fix macOS
eudoroolivares2016 Jun 22, 2023
358a34e
EDSC-3762: Fix test after last commit
eudoroolivares2016 Jun 22, 2023
b5fe77c
EDSC-3762: Fixing button styling UI
eudoroolivares2016 Jun 23, 2023
493297b
EDSC-3762: Adding eddLanding page and link to the modal
eudoroolivares2016 Jun 16, 2023
2d4a089
EDSC-3762: Adding some styling moving extra os selection to landing page
eudoroolivares2016 Jun 19, 2023
f030f3a
EDSC-3762: Update route name to earthdataDownload; add container test
eudoroolivares2016 Jun 19, 2023
b8fb978
EDSC-3762: cleaning up; adding null user-agent parsing response
eudoroolivares2016 Jun 19, 2023
a3aa64f
EDSC-3762: Address PR comments && update package for snyk
eudoroolivares2016 Jun 20, 2023
6932a6e
EDSC-3762: Remove line for testing to fix unit test
eudoroolivares2016 Jun 20, 2023
9a01741
EDSDC-3762: conventionalize classNames for scss
eudoroolivares2016 Jun 20, 2023
5ed6c10
EDSC-3762: screenshot update
eudoroolivares2016 Jun 21, 2023
f6fb128
EDSC-3672: Tweaking earthdata download page
trevorlang Jun 22, 2023
e5fcc7e
EDSC-3762: Styling updates on EDD landing page; fix macOS
eudoroolivares2016 Jun 22, 2023
3863422
EDSC-3762: Fix test after last commit
eudoroolivares2016 Jun 22, 2023
c9f363c
EDSC-3762: Fixing button styling UI
eudoroolivares2016 Jun 23, 2023
90650bb
Merge branch 'EDSC-3762' of https://github.com/eudoroolivares2016/ear…
eudoroolivares2016 Jun 23, 2023
d5e8f82
EDSC-3762: Adding executable size to bamboo
eudoroolivares2016 Jun 23, 2023
2a8ed47
EDSC-3762: Updating PR comments
eudoroolivares2016 Jun 26, 2023
7ddaefe
Merge remote-tracking branch 'upstream/main' into EDSC-3762
eudoroolivares2016 Jun 26, 2023
1fe16d1
EDSC-3762: Update package-lock
eudoroolivares2016 Jun 26, 2023
9edcea1
EDSC-3762: Revert package lock to main
eudoroolivares2016 Jun 26, 2023
0fca2b9
EDSC-3672: Final styles
trevorlang Jun 30, 2023
f9dc7f6
EDSC-3762: Minor test fixes
eudoroolivares2016 Jun 30, 2023
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
739 changes: 358 additions & 381 deletions package-lock.json
Copy link
Contributor

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?

Copy link
Contributor Author

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 the EDSC-3804 vulnerability

Copy link
Contributor

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

Copy link
Contributor Author

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

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion static.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@
"client": "eed-PORTAL-ENV-serverless-client",
"lambda": "eed-PORTAL-ENV-serverless-lambda"
},
"disableEddDownload": "false"
"disableEddDownload": "false",
"macOsEDDExecutableSize":130,
eudoroolivares2016 marked this conversation as resolved.
Show resolved Hide resolved
"windowsEDDExecutableSize":100,
"linuxEDDExecutableSize":90
},
"environment": {
"test": {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions static/src/js/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import history from './util/history'
import { getApplicationConfig, getEnvironmentConfig } from '../../../sharedUtils/config'

import Admin from './routes/Admin/Admin'
import EarthdataDownload from './routes/EarthdataDownload/EarthdataDownload'
import ContactInfo from './routes/ContactInfo/ContactInfo'
import Downloads from './routes/Downloads/Downloads'
import FooterContainer from './containers/FooterContainer/FooterContainer'
Expand Down Expand Up @@ -122,6 +123,12 @@ class App extends Component {
</AuthRequiredContainer>
)}
/>
<Route
path={this.portalPaths('/earthdata-download')}
render={() => (
<EarthdataDownload />
)}
/>
<Route
path={this.portalPaths('/preferences')}
render={() => (
Expand Down
162 changes: 162 additions & 0 deletions static/src/js/components/EarthdataDownload/EarthdataDownload.js
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 static/src/js/components/EarthdataDownload/EarthdataDownload.scss
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%;
}
}
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)
})
})
Loading