diff --git a/dashboard/src/components/BackupDialog.vue b/dashboard/src/components/BackupDialog.vue index a80260128..06251e88f 100644 --- a/dashboard/src/components/BackupDialog.vue +++ b/dashboard/src/components/BackupDialog.vue @@ -121,16 +121,10 @@ async function onSubmit() { data.noHardlinks = !providerConfig.value.useHardlinks; data.preserveAttributes = true; } else if (data.provider === 'gcs') { - // TODO we should probably allow to change the config without reuploading a new .json - if (providerConfig.value.gcsKeyContentJson) return; - data.bucket = providerConfig.value.bucket; data.prefix = providerConfig.value.prefix; - data.projectId = providerConfig.value.gcsKeyContentJson.project_id; - data.credentials = { - client_email: providerConfig.value.gcsKeyContentJson.client_email, - private_key: providerConfig.value.gcsKeyContentJson.private_key - }; + data.projectId = providerConfig.value.projectId; + data.credentials = providerConfig.value.credentials; } const limits = { diff --git a/dashboard/src/components/BackupProviderForm.vue b/dashboard/src/components/BackupProviderForm.vue index dc3a0ff98..f68ea1f36 100644 --- a/dashboard/src/components/BackupProviderForm.vue +++ b/dashboard/src/components/BackupProviderForm.vue @@ -26,8 +26,6 @@ const storageProviders = STORAGE_PROVIDERS.concat([ const blockDevices = ref([]); const disk = ref(''); const gcsKeyFileName = ref(''); -const gcsProjectId = ref(''); -const gcsKeyContentJson = ref(null); const gcsFileParseError = ref(''); const advancedVisible = ref(false); @@ -47,15 +45,20 @@ function onGcsKeyChange(event) { if (!keyJson.client_email) throw new Error('client_email field missing in JSON key file'); if (!keyJson.private_key) throw new Error('private_key field missing in JSON key file'); - gcsProjectId.value = keyJson.project_id; - gcsKeyContentJson.value = keyJson; + providerConfig.value.projectId = keyJson.project_id; + providerConfig.value.credentials = { + client_email: keyJson.client_email, + private_key: keyJson.private_key, + }; } catch (e) { if (e.name === 'SyntaxError') gcsFileParseError.value = 'Invalid JSON'; else gcsFileParseError.value = e.message; - gcsKeyFileName.value = ''; - gcsProjectId.value = ''; - gcsKeyContentJson.value = null; + providerConfig.value.projectId = ''; + providerConfig.value.credentials = { + client_email: '', + private_key: '', + }; } }; fr.readAsText(event.target.files[0]); @@ -263,8 +266,8 @@ onMounted(async () => { - - + +