feat: lots more improvements
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, watch } from 'vue'
|
||||
import { ref, shallowRef, computed, watch } from 'vue'
|
||||
import { useIntegrationStore } from '@KTXC/stores/integrationStore'
|
||||
import { useServicesStore } from '@MailManager/stores/servicesStore'
|
||||
import { useProvidersStore } from '@MailManager/stores/providersStore'
|
||||
@@ -58,8 +58,8 @@ const discoverSecret = ref<string | null>(null)
|
||||
const discoverHostname = ref<string | null>(null)
|
||||
|
||||
// Step 2: Discovery Status / Provider Selection
|
||||
const selectedProvider = ref<ProviderObject | null>(null)
|
||||
const selectedService = ref<ServiceObject | null>(null)
|
||||
const selectedProvider = shallowRef<ProviderObject | null>(null)
|
||||
const selectedService = shallowRef<ServiceObject | null>(null)
|
||||
|
||||
// Step 5: Test & Save
|
||||
const testAndSaveValid = ref(false)
|
||||
@@ -162,7 +162,7 @@ function createServiceObject(
|
||||
auxiliary: data.auxiliary ?? {}
|
||||
}
|
||||
|
||||
const factoryItem = integrationStore.getItemById('mail_service_factory', providerId) as any
|
||||
const factoryItem = integrationStore.getItemById('mail_provider_factory_service', providerId) as any
|
||||
const factory = factoryItem?.factory
|
||||
return factory ? factory(model) : new ServiceObject().fromJson(model)
|
||||
}
|
||||
@@ -175,16 +175,13 @@ function setSelectedProviderAndService(providerId: string, service: ServiceObjec
|
||||
|
||||
function handleServiceUpdate(service: ServiceObject) {
|
||||
selectedService.value = service
|
||||
testAndSaveValid.value = false
|
||||
}
|
||||
|
||||
function handleServiceTested(success: boolean) {
|
||||
testAndSaveValid.value = success
|
||||
}
|
||||
|
||||
watch(selectedService, () => {
|
||||
testAndSaveValid.value = false
|
||||
}, { deep: true })
|
||||
|
||||
// Navigation methods
|
||||
function handlePreviousStep() {
|
||||
if (currentStep.value > 1) {
|
||||
@@ -370,8 +367,7 @@ async function testConnection() {
|
||||
}
|
||||
}
|
||||
|
||||
const serviceData = selectedService.value.toJson()
|
||||
if (!serviceData.location || !serviceData.identity) {
|
||||
if (!selectedService.value.location || !selectedService.value.identity) {
|
||||
return {
|
||||
success: false,
|
||||
message: 'Missing configuration'
|
||||
@@ -381,8 +377,8 @@ async function testConnection() {
|
||||
const testResult = await servicesStore.test(
|
||||
selectedProvider.value.identifier,
|
||||
null,
|
||||
serviceData.location,
|
||||
serviceData.identity
|
||||
selectedService.value.location,
|
||||
selectedService.value.identity
|
||||
)
|
||||
|
||||
return testResult
|
||||
|
||||
Reference in New Issue
Block a user