Adds a refresh button to list and tile view. Closes #1606 (#2027)

This commit is contained in:
Alex Collins 2019-07-29 15:32:16 -07:00 committed by GitHub
parent 488bdcf0e3
commit 4ec2ed3fe6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 4 deletions

View file

@ -218,11 +218,13 @@ export const ApplicationsList = (props: RouteComponentProps<{}>) => {
<ApplicationTiles
applications={data}
syncApplication={(appName) => ctx.navigation.goto('.', { syncApp: appName })}
refreshApplication={(appName) => services.applications.get(appName, 'normal')}
deleteApplication={(appName) => AppUtils.deleteApplication(appName, ctx)}
/>
) || (
<ApplicationsTable applications={data}
syncApplication={(appName) => ctx.navigation.goto('.', { syncApp: appName })}
refreshApplication={(appName) => services.applications.get(appName, 'normal')}
deleteApplication={(appName) => AppUtils.deleteApplication(appName, ctx)}
/>
)

View file

@ -8,7 +8,8 @@ import * as AppUtils from '../utils';
export const ApplicationsTable = (props: {
applications: models.Application[];
syncApplication: (appName: string, revision: string) => any;
syncApplication: (appName: string) => any;
refreshApplication: (appName: string) => any;
deleteApplication: (appName: string) => any;
}) => (
<Consumer>
@ -54,7 +55,8 @@ export const ApplicationsTable = (props: {
</button>
)
} items={[
{ title: 'Sync', action: () => props.syncApplication(app.metadata.name, app.spec.source.targetRevision || 'HEAD') },
{ title: 'Sync', action: () => props.syncApplication(app.metadata.name) },
{ title: 'Refresh', action: () => props.refreshApplication(app.metadata.name) },
{ title: 'Delete', action: () => props.deleteApplication(app.metadata.name) },
]} />
</div>

View file

@ -10,13 +10,14 @@ import * as AppUtils from '../utils';
export interface ApplicationTilesProps {
applications: models.Application[];
syncApplication: (appName: string) => any;
refreshApplication: (appName: string) => any;
deleteApplication: (appName: string) => any;
}
export const ApplicationTiles = ({applications, syncApplication, deleteApplication}: ApplicationTilesProps) => (
export const ApplicationTiles = ({applications, syncApplication, refreshApplication, deleteApplication}: ApplicationTilesProps) => (
<Consumer>
{(ctx) => (
<div className='argo-table-list argo-table-list--clickable row small-up-1 medium-up-2 large-up-4'>
<div className='argo-table-list argo-table-list--clickable row small-up-1 medium-up-2 large-up-3'>
{applications.map((app) => (
<div key={app.metadata.name} className='column column-block'>
<div className={`argo-table-list__row
@ -77,6 +78,12 @@ export const ApplicationTiles = ({applications, syncApplication, deleteApplicati
syncApplication(app.metadata.name);
}}><i className='fa fa-sync'/> Sync</a>
&nbsp;
<a className='argo-button argo-button--base'
onClick={(e) => {
e.stopPropagation();
refreshApplication(app.metadata.name);
}}><i className='fa fa-redo'/> Refresh</a>
&nbsp;
<a className='argo-button argo-button--base' onClick={(e) => {
e.stopPropagation();
deleteApplication(app.metadata.name);