|
|
@ -3,14 +3,16 @@ const props = defineProps<{ |
|
|
|
category: string |
|
|
|
category: string |
|
|
|
}>() |
|
|
|
}>() |
|
|
|
|
|
|
|
|
|
|
|
const { categorizeApps, resetPlugin, showPluginUninstallModal, activePlugin } = useAccountSetupStoreOrThrow() |
|
|
|
const { categorizeApps, resetPlugin: _resetPlugin, showPluginUninstallModal, activePlugin } = useAccountSetupStoreOrThrow() |
|
|
|
|
|
|
|
|
|
|
|
const apps = computed(() => categorizeApps.value?.[props.category?.toLowerCase()] || []) |
|
|
|
const apps = computed(() => categorizeApps.value?.[props.category?.toLowerCase()] || []) |
|
|
|
const showResetActiveAppMsg = ref(false) |
|
|
|
const showResetActiveAppMsg = ref(false) |
|
|
|
|
|
|
|
const switchingTo = ref(null) |
|
|
|
|
|
|
|
|
|
|
|
const selectApp = (app: any) => { |
|
|
|
const selectApp = (app: any) => { |
|
|
|
const activeApp = !app.active && apps.value.find((a: any) => a.active) |
|
|
|
const activeApp = !app.active && apps.value.find((a: any) => a.active) |
|
|
|
if (activeApp) { |
|
|
|
if (activeApp) { |
|
|
|
|
|
|
|
switchingTo.value = app |
|
|
|
return showResetPluginModal(activeApp, true) |
|
|
|
return showResetPluginModal(activeApp, true) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -22,6 +24,22 @@ const showResetPluginModal = async (app: any, resetActiveAppMsg = false) => { |
|
|
|
showPluginUninstallModal.value = true |
|
|
|
showPluginUninstallModal.value = true |
|
|
|
activePlugin.value = app |
|
|
|
activePlugin.value = app |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const resetPlugin = async () => { |
|
|
|
|
|
|
|
await _resetPlugin(activePlugin.value) |
|
|
|
|
|
|
|
if (showResetActiveAppMsg.value) { |
|
|
|
|
|
|
|
await selectApp(switchingTo.value) |
|
|
|
|
|
|
|
switchingTo.value = null |
|
|
|
|
|
|
|
showResetActiveAppMsg.value = false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const closeResetModal = () => { |
|
|
|
|
|
|
|
activePlugin.value = null |
|
|
|
|
|
|
|
switchingTo.value = null |
|
|
|
|
|
|
|
showResetActiveAppMsg.value = false |
|
|
|
|
|
|
|
showPluginUninstallModal.value = false |
|
|
|
|
|
|
|
} |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
<template> |
|
|
@ -54,7 +72,7 @@ const showResetPluginModal = async (app: any, resetActiveAppMsg = false) => { |
|
|
|
<GeneralIcon |
|
|
|
<GeneralIcon |
|
|
|
v-if="app.active" |
|
|
|
v-if="app.active" |
|
|
|
icon="delete" |
|
|
|
icon="delete" |
|
|
|
class="text-error min-w-6 h-6 bg-white-500 !hidden group-hover:!inline cursor-pointer" |
|
|
|
class="text-error min-w-6 h-6 bg-white-500 !hidden !group-hover:!inline cursor-pointer" |
|
|
|
@click.stop="showResetPluginModal(app)" |
|
|
|
@click.stop="showResetPluginModal(app)" |
|
|
|
/> |
|
|
|
/> |
|
|
|
<GeneralIcon v-if="app.active" icon="circleCheckSolid" class="text-primary min-w-6 h-6 bg-white-500" /> |
|
|
|
<GeneralIcon v-if="app.active" icon="circleCheckSolid" class="text-primary min-w-6 h-6 bg-white-500" /> |
|
|
@ -73,14 +91,15 @@ const showResetPluginModal = async (app: any, resetActiveAppMsg = false) => { |
|
|
|
> |
|
|
|
> |
|
|
|
<div class="flex flex-col h-full"> |
|
|
|
<div class="flex flex-col h-full"> |
|
|
|
<div class="flex flex-row justify-center mt-2 text-center w-full text-base"> |
|
|
|
<div class="flex flex-row justify-center mt-2 text-center w-full text-base"> |
|
|
|
<template v-if="resetActivePlugin">{{ `Click on confirm to reset ${activePlugin && activePlugin.title}` }}</template> |
|
|
|
<template v-if="showResetActiveAppMsg"> |
|
|
|
<template v-else> |
|
|
|
Switching to {{ switchingTo && switchingTo.title }} will reset your {{ activePlugin && activePlugin.title }} |
|
|
|
{{ `Before switching confirm to reset ${activePlugin && activePlugin.title}` }} |
|
|
|
settings. Continue? |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
<template v-else>{{ `Click on confirm to reset ${activePlugin && activePlugin.title}` }}</template> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="flex mt-6 justify-center space-x-2"> |
|
|
|
<div class="flex mt-6 justify-center space-x-2"> |
|
|
|
<NcButton type="secondary" @click="showPluginUninstallModal = false"> {{ $t('general.cancel') }} </NcButton> |
|
|
|
<NcButton type="secondary" @click="closeResetModal"> {{ $t('general.cancel') }}</NcButton> |
|
|
|
<NcButton type="danger" @click="resetPlugin"> {{ $t('general.confirm') }} </NcButton> |
|
|
|
<NcButton type="danger" @click="resetPlugin"> {{ $t('general.confirm') }}</NcButton> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</a-modal> |
|
|
|
</a-modal> |
|
|
@ -92,7 +111,7 @@ const showResetPluginModal = async (app: any, resetActiveAppMsg = false) => { |
|
|
|
@apply p-4 w-950px gap-5 mx-auto my-2 grid grid-cols-3; |
|
|
|
@apply p-4 w-950px gap-5 mx-auto my-2 grid grid-cols-3; |
|
|
|
|
|
|
|
|
|
|
|
.item { |
|
|
|
.item { |
|
|
|
@apply text-base w-296px max-w-296px flex gap-6 border-1 border-gray-100 py-3 px-6 rounded items-center cursor-pointer hover:(shadow bg-gray-50); |
|
|
|
@apply text-base w-296px max-w-296px flex gap-6 border-1 border-gray-200 py-3 px-6 rounded-xl items-center cursor-pointer hover:(shadow bg-gray-50); |
|
|
|
|
|
|
|
|
|
|
|
.icon { |
|
|
|
.icon { |
|
|
|
@apply max-w-32px max-h-32px; |
|
|
|
@apply max-w-32px max-h-32px; |
|
|
|