Skip to content

Commit

Permalink
fix(ui): show prompt when using prune option
Browse files Browse the repository at this point in the history
Signed-off-by: ashutosh16 <11219262+ashutosh16@users.noreply.github.com>
  • Loading branch information
ashutosh16 committed Dec 14, 2023
1 parent d0aa0b5 commit e4c844f
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const ApplicationSyncPanel = ({application, selectedResource, hide}: {app
const syncStrategy = {} as models.SyncStrategy;
const [isPending, setPending] = React.useState(false);
const source = getAppDefaultSource(application);

return (
<Consumer>
{ctx => (
Expand Down Expand Up @@ -57,8 +58,11 @@ export const ApplicationSyncPanel = ({application, selectedResource, hide}: {app
onSubmit={async (params: any) => {
setPending(true);
let resources = appResources.filter((_, i) => params.resources[i]);

const syncFlags = {...params.syncFlags} as SyncFlags;
if (syncFlags.Prune && resources.length === appResources.length) {
const prune = syncFlags.Prune || false;

if (prune && resources.length === appResources.length) {
const confirmed = await ctx.popup.confirm('Synchronize with prune?', () => (
<div>
<i className='fa fa-exclamation-triangle' style={{color: ARGO_WARNING_COLOR}} />
Expand All @@ -70,6 +74,7 @@ export const ApplicationSyncPanel = ({application, selectedResource, hide}: {app
return;
}
}

if (resources.length === appResources.length) {
resources = null;
}
Expand All @@ -85,6 +90,7 @@ export const ApplicationSyncPanel = ({application, selectedResource, hide}: {app
return;
}
}

const force = syncFlags.Force || false;

if (syncFlags.ApplyOnly) {
Expand Down

0 comments on commit e4c844f

Please sign in to comment.