[Fleet] Fix edit package policy save button (#116482)
This commit is contained in:
parent
d5963884b6
commit
a23d5e29a4
1 changed files with 4 additions and 1 deletions
|
@ -283,6 +283,7 @@ export const EditPackagePolicyForm = memo<{
|
|||
// Update package policy method
|
||||
const updatePackagePolicy = useCallback(
|
||||
(updatedFields: Partial<UpdatePackagePolicy>) => {
|
||||
setIsEdited(true);
|
||||
const newPackagePolicy = {
|
||||
...packagePolicy,
|
||||
...updatedFields,
|
||||
|
@ -343,6 +344,7 @@ export const EditPackagePolicyForm = memo<{
|
|||
}, [from, getHref, packageInfo, policyId]);
|
||||
|
||||
// Save package policy
|
||||
const [isEdited, setIsEdited] = useState(false);
|
||||
const [formState, setFormState] = useState<PackagePolicyFormState>('INVALID');
|
||||
const savePackagePolicy = async () => {
|
||||
setFormState('LOADING');
|
||||
|
@ -582,7 +584,8 @@ export const EditPackagePolicyForm = memo<{
|
|||
<EuiButton
|
||||
onClick={onSubmit}
|
||||
isLoading={formState === 'LOADING'}
|
||||
disabled={formState !== 'VALID'}
|
||||
// Allow to save only if the package policy is upgraded or had been edited
|
||||
disabled={formState !== 'VALID' || (!isEdited && !isUpgrade)}
|
||||
iconType="save"
|
||||
color="primary"
|
||||
fill
|
||||
|
|
Loading…
Reference in a new issue