-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
feat: Configurable ArgoCD binary download links on Help page. Fixes #7698 #7755
Merged
alexmt
merged 12 commits into
argoproj:master
from
terrytangyuan:configurable-download-url
Nov 30, 2021
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
dd2615e
Add BinaryURLs
terrytangyuan 911f1e7
Add to UI
terrytangyuan 6ed91a9
Update configmap
terrytangyuan 944eb44
Lint fix
terrytangyuan 3e51c2e
Add unit tests
terrytangyuan 82c348e
Only append when key exists and fix icons
terrytangyuan 5c00832
Add docs
terrytangyuan e0a5c4d
Remove unnecessary viewPreferences
terrytangyuan a158e42
Retrigger CI pipeline
terrytangyuan 5e93d00
Refactor UI code based on feedback
terrytangyuan ca9de90
Fix crushing and revert refactoring
terrytangyuan efa43e5
chore: Add missing linux-arm64 in the UI
terrytangyuan 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
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
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
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
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
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 |
---|---|---|
@@ -1,40 +1,84 @@ | ||
import * as React from 'react'; | ||
import {Page} from '../../shared/components'; | ||
import {DataLoader, Page} from '../../shared/components'; | ||
import {Consumer} from '../../shared/context'; | ||
import {combineLatest} from 'rxjs'; | ||
import {services} from '../../shared/services'; | ||
import {map} from 'rxjs/operators'; | ||
|
||
require('./help.scss'); | ||
|
||
export const Help = () => ( | ||
<Consumer> | ||
{ctx => ( | ||
<Page title='Help'> | ||
<div className='row'> | ||
<div className='columns large-4 small-6'> | ||
<div className='help-box'> | ||
<p>New to Argo CD?</p> | ||
<a className='user-info-panel-buttons argo-button argo-button--base' href='https://argo-cd.readthedocs.io'> | ||
Read the docs | ||
</a> | ||
</div> | ||
</div> | ||
<div className='columns large-4 small-6'> | ||
<div className='help-box'> | ||
<p>Want to download the CLI tool?</p> | ||
<a href={`download/argocd-linux-${process.env.HOST_ARCH}`} className='user-info-panel-buttons argo-button argo-button--base'> | ||
<i className='fab fa-linux ' /> Linux | ||
</a> | ||
</div> | ||
</div> | ||
<div className='columns large-4 small-6'> | ||
<div className='help-box'> | ||
<p>You want to develop against Argo CD's API?</p> | ||
<a className='user-info-panel-buttons argo-button argo-button--base' href='/swagger-ui'> | ||
Open the API docs | ||
</a> | ||
</div> | ||
</div> | ||
</div> | ||
</Page> | ||
)} | ||
</Consumer> | ||
); | ||
export const Help = () => { | ||
return ( | ||
<DataLoader | ||
load={() => | ||
combineLatest([services.authService.settings()]).pipe( | ||
map(items => { | ||
return { | ||
binaryUrls: items[0].help.binaryUrls || {} | ||
}; | ||
}) | ||
) | ||
}> | ||
{({binaryUrls}: {binaryUrls: Record<string, string>}) => { | ||
return ( | ||
<Consumer> | ||
{() => ( | ||
<Page title='Help'> | ||
<div className='row'> | ||
<div className='columns large-4 small-6'> | ||
<div className='help-box'> | ||
<p>New to Argo CD?</p> | ||
<a className='user-info-panel-buttons argo-button argo-button--base' href='https://argo-cd.readthedocs.io'> | ||
Read the docs | ||
</a> | ||
</div> | ||
</div> | ||
<div className='columns large-4 small-6'> | ||
<div className='help-box'> | ||
<p>Want to download the CLI tool?</p> | ||
<a href={`download/argocd-linux-${process.env.HOST_ARCH}`} className='user-info-panel-buttons argo-button argo-button--base'> | ||
<i className='fab fa-linux' /> Linux (amd64) | ||
</a> | ||
| ||
{binaryUrls.hasOwnProperty('linux-arm64') && ( | ||
<a href={`${binaryUrls['linux-arm64']}`} className='user-info-panel-buttons argo-button argo-button--base'> | ||
<i className='fab fa-linux' /> Linux (arm64) | ||
</a> | ||
)} | ||
| ||
{binaryUrls.hasOwnProperty('darwin-amd64') && ( | ||
<a href={`${binaryUrls['darwin-amd64']}`} className='user-info-panel-buttons argo-button argo-button--base'> | ||
terrytangyuan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<i className='fab fa-apple' /> MacOS (amd64) | ||
</a> | ||
)} | ||
| ||
{binaryUrls.hasOwnProperty('darwin-arm64') && ( | ||
<a href={`${binaryUrls['darwin-arm64']}`} className='user-info-panel-buttons argo-button argo-button--base'> | ||
<i className='fab fa-apple' /> MacOS (arm64) | ||
</a> | ||
)} | ||
| ||
{binaryUrls.hasOwnProperty('windows-amd64') && ( | ||
<a href={`${binaryUrls['windows-amd64']}`} className='user-info-panel-buttons argo-button argo-button--base'> | ||
<i className='fab fa-windows' /> Windows | ||
</a> | ||
)} | ||
</div> | ||
</div> | ||
<div className='columns large-4 small-6'> | ||
<div className='help-box'> | ||
<p>You want to develop against Argo CD's API?</p> | ||
<a className='user-info-panel-buttons argo-button argo-button--base' href='/swagger-ui'> | ||
Open the API docs | ||
</a> | ||
</div> | ||
</div> | ||
</div> | ||
</Page> | ||
)} | ||
</Consumer> | ||
); | ||
}} | ||
</DataLoader> | ||
); | ||
}; |
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
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
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
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.
Page crashes if
binaryUrls
is not defined/null. Instead of writing separate if for every permutation you can use following snipped :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 tried refactoring this in 5e93d00 but got stuck with some additional issues.
Though I was able to fix the page crushing issue very easily. Would you mind leaving the refactoring of typescript code later as I have zero experience and don't have much bandwidth to debug further currently?
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.
Sorry for long response. Thanks for fixing the crash. I think it is ok to keep it as is - refactoring is optional.