From 835fbfe337dd8dc0d0b0318c7227e174484e1328 Mon Sep 17 00:00:00 2001 From: Shireen Missi <94372015+ShireenMissi@users.noreply.github.com> Date: Mon, 11 Nov 2024 08:53:07 +0000 Subject: [PATCH] fix: Credentials save button is hidden unless you make changes to the (#11492) --- .../CredentialEdit/CredentialEdit.vue | 9 ++- .../__tests__/CredentialEdit.test.ts | 70 +++++++++++++++++++ 2 files changed, 76 insertions(+), 3 deletions(-) create mode 100644 packages/editor-ui/src/components/CredentialEdit/__tests__/CredentialEdit.test.ts diff --git a/packages/editor-ui/src/components/CredentialEdit/CredentialEdit.vue b/packages/editor-ui/src/components/CredentialEdit/CredentialEdit.vue index b1b6c653ad783..2ac4cf16d1ce7 100644 --- a/packages/editor-ui/src/components/CredentialEdit/CredentialEdit.vue +++ b/packages/editor-ui/src/components/CredentialEdit/CredentialEdit.vue @@ -88,6 +88,7 @@ const isDeleting = ref(false); const isSaving = ref(false); const isTesting = ref(false); const hasUnsavedChanges = ref(false); +const isSaved = ref(false); const loading = ref(false); const showValidationWarning = ref(false); const testedSuccessfully = ref(false); @@ -317,8 +318,8 @@ const defaultCredentialTypeName = computed(() => { const showSaveButton = computed(() => { return ( - (hasUnsavedChanges.value || !!credentialId.value) && - (credentialPermissions.value.create || credentialPermissions.value.update) + (props.mode === 'new' || hasUnsavedChanges.value || isSaved.value) && + (credentialPermissions.value.create ?? credentialPermissions.value.update) ); }); @@ -838,6 +839,7 @@ async function updateCredential( isSharedWithChanged.value = false; } hasUnsavedChanges.value = false; + isSaved.value = true; if (credential) { await externalHooks.run('credential.saved', { @@ -889,6 +891,7 @@ async function deleteCredential() { isDeleting.value = true; await credentialsStore.deleteCredential({ id: credentialId.value }); hasUnsavedChanges.value = false; + isSaved.value = true; } catch (error) { toast.showError( error, @@ -1074,7 +1077,7 @@ function resetCredentialData(): void { />