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

chore(ui): Refactor code for rendering CLI download buttons #8587

Merged
merged 2 commits into from
Feb 22, 2022
Merged
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
44 changes: 21 additions & 23 deletions ui/src/app/help/components/help.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {Consumer} from '../../shared/context';
import {combineLatest} from 'rxjs';
import {services} from '../../shared/services';
import {map} from 'rxjs/operators';
import classNames from 'classnames';

require('./help.scss');

Expand Down Expand Up @@ -40,29 +41,26 @@ export const Help = () => {
<i className='fab fa-linux' /> Linux (amd64)
</a>
&nbsp;
{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>
)}
&nbsp;
{binaryUrls.hasOwnProperty('darwin-amd64') && (
<a href={`${binaryUrls['darwin-amd64']}`} className='user-info-panel-buttons argo-button argo-button--base'>
<i className='fab fa-apple' /> MacOS (amd64)
</a>
)}
&nbsp;
{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>
)}
&nbsp;
{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>
)}
{Object.keys(binaryUrls || {}).map(binaryName => {
const url = binaryUrls[binaryName];
const match = binaryName.match(/.*(darwin|windows|linux)-(amd64|arm64)/);
const [platform, arch] = match ? match.slice(1) : ['', ''];
return (
<>
&nbsp;
<a key={binaryName} href={url} className='user-info-panel-buttons argo-button argo-button--base'>
<i
className={classNames('fab', {
'fa-windows': platform === 'windows',
'fa-apple': platform === 'darwin',
'fa-linux': platform === 'linux'
})}
/>
{` ${platform}`} {arch && `(${arch})`}
</a>
</>
);
})}
</div>
</div>
<div className='columns large-4 small-6'>
Expand Down