|
|
|
@ -3,14 +3,16 @@ const props = defineProps<{
|
|
|
|
|
category: string |
|
|
|
|
}>() |
|
|
|
|
|
|
|
|
|
const { categorizeApps, resetPlugin, showPluginUninstallModal, activePlugin } = useAccountSetupStoreOrThrow() |
|
|
|
|
const { categorizeApps, resetPlugin: _resetPlugin, showPluginUninstallModal, activePlugin } = useAccountSetupStoreOrThrow() |
|
|
|
|
|
|
|
|
|
const apps = computed(() => categorizeApps.value?.[props.category?.toLowerCase()] || []) |
|
|
|
|
const showResetActiveAppMsg = ref(false) |
|
|
|
|
const switchingTo = ref(null) |
|
|
|
|
|
|
|
|
|
const selectApp = (app: any) => { |
|
|
|
|
const activeApp = !app.active && apps.value.find((a: any) => a.active) |
|
|
|
|
if (activeApp) { |
|
|
|
|
switchingTo.value = app |
|
|
|
|
return showResetPluginModal(activeApp, true) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -22,6 +24,22 @@ const showResetPluginModal = async (app: any, resetActiveAppMsg = false) => {
|
|
|
|
|
showPluginUninstallModal.value = true |
|
|
|
|
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> |
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
@ -54,7 +72,7 @@ const showResetPluginModal = async (app: any, resetActiveAppMsg = false) => {
|
|
|
|
|
<GeneralIcon |
|
|
|
|
v-if="app.active" |
|
|
|
|
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)" |
|
|
|
|
/> |
|
|
|
|
<GeneralIcon v-if="app.active" icon="circleCheckSolid" class="text-primary min-w-6 h-6 bg-white-500" /> |
|
|
|
@ -73,13 +91,14 @@ const showResetPluginModal = async (app: any, resetActiveAppMsg = false) => {
|
|
|
|
|
> |
|
|
|
|
<div class="flex flex-col h-full"> |
|
|
|
|
<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-else> |
|
|
|
|
{{ `Before switching confirm to reset ${activePlugin && activePlugin.title}` }} |
|
|
|
|
<template v-if="showResetActiveAppMsg"> |
|
|
|
|
Switching to {{ switchingTo && switchingTo.title }} will reset your {{ activePlugin && activePlugin.title }} |
|
|
|
|
settings. Continue? |
|
|
|
|
</template> |
|
|
|
|
<template v-else>{{ `Click on confirm to reset ${activePlugin && activePlugin.title}` }}</template> |
|
|
|
|
</div> |
|
|
|
|
<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> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
@ -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; |
|
|
|
|
|
|
|
|
|
.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 { |
|
|
|
|
@apply max-w-32px max-h-32px; |
|
|
|
|