github.com/argoproj/argo-cd/v3@v3.2.1/ui/src/app/applications/components/application-create-panel/set-finalizer-on-application.tsx (about) 1 import {Checkbox, HelpIcon} from 'argo-ui'; 2 import * as React from 'react'; 3 import * as ReactForm from 'react-form'; 4 5 export const SetFinalizerOnApplication = ReactForm.FormField((props: {fieldApi: ReactForm.FieldApi}) => { 6 const { 7 fieldApi: {getValue, setValue} 8 } = props; 9 const finalizerVal = 'resources-finalizer.argocd.argoproj.io'; 10 const currentValue = getValue() || []; 11 const index = currentValue.findIndex((item: string) => item === finalizerVal); 12 const isChecked = index < 0 ? false : true; 13 return ( 14 <div className='small-12 large-6' style={{borderBottom: '0'}}> 15 <Checkbox 16 id='set-finalizer' 17 checked={isChecked} 18 onChange={(state: boolean) => { 19 const value = getValue() || []; 20 if (!state) { 21 const i = value.findIndex((item: string) => item === finalizerVal); 22 if (i >= 0) { 23 const tmp = value.slice(); 24 tmp.splice(i, 1); 25 setValue(tmp); 26 } 27 } else { 28 const tmp = value.slice(); 29 tmp.push(finalizerVal); 30 setValue(tmp); 31 } 32 }} 33 /> 34 <label htmlFor={`set-finalizer`}>Set Deletion Finalizer</label> 35 <HelpIcon title='If checked, the resources deletion finalizer will be set on the application. Potentially destructive, refer to the documentation for more information on the effects of the finalizer.' /> 36 </div> 37 ); 38 });