mirror of
https://github.com/argoproj/argo-cd
synced 2026-05-24 09:50:08 +00:00
Allow Apply Only on sync (#2015)
This commit is contained in:
parent
ab8b435de3
commit
0ef5061e11
3 changed files with 12 additions and 4 deletions
|
|
@ -18,6 +18,7 @@ export const ApplicationSyncPanel = ({application, selectedResource, hide}: {
|
|||
const appResources = (application && selectedResource && application.status && application.status.resources || []).sort(
|
||||
(first, second) => nodeKey(first).localeCompare(nodeKey(second)));
|
||||
const syncResIndex = appResources.findIndex((item) => nodeKey(item) === selectedResource);
|
||||
const syncStrategy = {} as models.SyncStrategy;
|
||||
|
||||
return (
|
||||
<Consumer>
|
||||
|
|
@ -45,8 +46,11 @@ export const ApplicationSyncPanel = ({application, selectedResource, hide}: {
|
|||
if (resources.length === appResources.length) {
|
||||
resources = null;
|
||||
}
|
||||
if (params.applyOnly) {
|
||||
syncStrategy.apply = {};
|
||||
}
|
||||
try {
|
||||
await services.applications.sync(application.metadata.name, params.revision, params.prune, params.dryRun, resources);
|
||||
await services.applications.sync(application.metadata.name, params.revision, params.prune, params.dryRun, syncStrategy, resources);
|
||||
hide();
|
||||
} catch (e) {
|
||||
ctx.notifications.show({
|
||||
|
|
@ -72,7 +76,9 @@ export const ApplicationSyncPanel = ({application, selectedResource, hide}: {
|
|||
<Checkbox id='prune-on-sync-checkbox' field='prune'/> <label htmlFor='prune-on-sync-checkbox'>Prune</label>
|
||||
</span> <span>
|
||||
<Checkbox id='dry-run-checkbox' field='dryRun'/> <label htmlFor='dry-run-checkbox'>Dry Run</label>
|
||||
</span>
|
||||
</span> <span>
|
||||
<Checkbox id='apply-only-checkbox' field='applyOnly'/> <label htmlFor='apply-only-checkbox'>Apply Only</label>
|
||||
</span>
|
||||
</div>
|
||||
<label>Synchronize resources:</label>
|
||||
<div style={{float: 'right'}}>
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ export interface ApplicationList extends ItemsList<Application> { }
|
|||
|
||||
export interface SyncOperationResource { group: string; kind: string; name: string; }
|
||||
|
||||
export interface SyncStrategy { apply: {} | null; hook: {} | null; }
|
||||
|
||||
export interface SyncOperation {
|
||||
revision: string;
|
||||
prune: boolean;
|
||||
|
|
|
|||
|
|
@ -83,8 +83,8 @@ export class ApplicationsService {
|
|||
});
|
||||
}
|
||||
|
||||
public sync(name: string, revision: string, prune: boolean, dryRun: boolean, resources: models.SyncOperationResource[]): Promise<boolean> {
|
||||
return requests.post(`/applications/${name}/sync`).send({revision, prune: !!prune, dryRun: !!dryRun, resources}).then(() => true);
|
||||
public sync(name: string, revision: string, prune: boolean, dryRun: boolean, strategy: models.SyncStrategy, resources: models.SyncOperationResource[]): Promise<boolean> {
|
||||
return requests.post(`/applications/${name}/sync`).send({revision, prune: !!prune, dryRun: !!dryRun, strategy, resources}).then(() => true);
|
||||
}
|
||||
|
||||
public rollback(name: string, id: number): Promise<boolean> {
|
||||
|
|
|
|||
Loading…
Reference in a new issue