mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-08-16 12:49:14 +00:00
feat(forklift): Added better handling on the saving and testing
Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com>
This commit is contained in:
parent
dc6ae60b9d
commit
c887186e1a
@ -41,6 +41,7 @@ const createdSecret = ref(null);
|
|||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
const testPassed = ref(false);
|
const testPassed = ref(false);
|
||||||
const testing = ref(false);
|
const testing = ref(false);
|
||||||
|
const saving = ref(false);
|
||||||
|
|
||||||
const isFormValid = computed(() => !!providerName.value && !!url.value && !!username.value && !!password.value);
|
const isFormValid = computed(() => !!providerName.value && !!url.value && !!username.value && !!password.value);
|
||||||
|
|
||||||
@ -75,6 +76,7 @@ const testConnection = async(buttonCb) => {
|
|||||||
|
|
||||||
if (!providerName.value || !url.value || !username.value || !password.value) {
|
if (!providerName.value || !url.value || !username.value || !password.value) {
|
||||||
testError.value = t('harvester.addons.forklift.configureProvider.testMissingFields');
|
testError.value = t('harvester.addons.forklift.configureProvider.testMissingFields');
|
||||||
|
testing.value = false;
|
||||||
buttonCb(false);
|
buttonCb(false);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -230,6 +232,7 @@ const testConnection = async(buttonCb) => {
|
|||||||
|
|
||||||
const saveProvider = async(buttonCb) => {
|
const saveProvider = async(buttonCb) => {
|
||||||
errors.value = [];
|
errors.value = [];
|
||||||
|
saving.value = true;
|
||||||
|
|
||||||
if (!testPassed.value) {
|
if (!testPassed.value) {
|
||||||
// Test hasn't passed yet — run it first
|
// Test hasn't passed yet — run it first
|
||||||
@ -244,6 +247,7 @@ const saveProvider = async(buttonCb) => {
|
|||||||
query: { provider: providerName.value }
|
query: { provider: providerName.value }
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
saving.value = false;
|
||||||
buttonCb(false);
|
buttonCb(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -350,7 +354,9 @@ init();
|
|||||||
{{ t('harvester.addons.forklift.configureProvider.skipSslHint') }}
|
{{ t('harvester.addons.forklift.configureProvider.skipSslHint') }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
{{ isFormValid }}
|
||||||
|
{{ testing }}
|
||||||
|
{{ saving }}
|
||||||
<div class="mb-20">
|
<div class="mb-20">
|
||||||
<button
|
<button
|
||||||
v-if="testPassed"
|
v-if="testPassed"
|
||||||
@ -362,7 +368,7 @@ init();
|
|||||||
<AsyncButton
|
<AsyncButton
|
||||||
v-else
|
v-else
|
||||||
mode="test"
|
mode="test"
|
||||||
:disabled="!isFormValid"
|
:disabled="!isFormValid || testing || saving"
|
||||||
:action-label="t('harvester.addons.forklift.configureProvider.testConnection')"
|
:action-label="t('harvester.addons.forklift.configureProvider.testConnection')"
|
||||||
:waiting-label="t('harvester.addons.forklift.configureProvider.testConnection')"
|
:waiting-label="t('harvester.addons.forklift.configureProvider.testConnection')"
|
||||||
:success-label="t('harvester.addons.forklift.configureProvider.testConnection')"
|
:success-label="t('harvester.addons.forklift.configureProvider.testConnection')"
|
||||||
@ -403,7 +409,7 @@ init();
|
|||||||
{{ t('generic.cancel') }}
|
{{ t('generic.cancel') }}
|
||||||
</button>
|
</button>
|
||||||
<AsyncButton
|
<AsyncButton
|
||||||
:disabled="!isFormValid || testing"
|
:disabled="!isFormValid || testing || saving"
|
||||||
:action-label="t('harvester.addons.forklift.configureProvider.save')"
|
:action-label="t('harvester.addons.forklift.configureProvider.save')"
|
||||||
:waiting-label="t('harvester.addons.forklift.configureProvider.save')"
|
:waiting-label="t('harvester.addons.forklift.configureProvider.save')"
|
||||||
:success-label="t('harvester.addons.forklift.configureProvider.save')"
|
:success-label="t('harvester.addons.forklift.configureProvider.save')"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user