123123
124124 <!-- Remote Configurations -->
125125 <div class =" flex h-full w-full flex-1 flex-col gap-4 overflow-hidden rounded-md shadow-md" >
126+ <div v-if =" initLoading" class =" flex w-full h-full overflow-auto no-scrollbar items-center justify-center" >
127+ <div class =" flex flex-col gap-4 w-full h-full items-center justify-center" >
128+ <div class =" border-3 border-border w-20 h-20 rounded-full border-t-accent border-t-3 animate-spin" ></div >
129+ <div class =" text-main font-semibold" >{{ t('mount.loading') }}</div >
130+ </div >
131+ </div >
126132 <div
127- v-if =" filteredConfigs.length === 0 && !appStore.loading "
133+ v-else- if =" filteredConfigs.length === 0 && !initLoading "
128134 class =" flex w-full h-full overflow-auto items-center justify-center p-2"
129135 >
130136 <div class =" max-w-80 flex flex-col items-center justify-center gap-2" >
133139 <p class =" text-secondary text-sm" >{{ t('mount.empty.description') }}</p >
134140 </div >
135141 </div >
136- <div
137- v-else-if =" appStore.loading"
138- class =" flex w-full h-full overflow-auto no-scrollbar items-center justify-center"
139- >
140- <div class =" flex flex-col gap-4 w-full h-full items-center justify-center" >
141- <div class =" border-3 border-border w-20 h-20 rounded-full border-t-accent border-t-3 animate-spin" ></div >
142- <div class =" text-main font-semibold" >{{ t('mount.loading') }}</div >
143- </div >
144- </div >
145142
146143 <div v-else class =" w-full h-full overflow-auto no-scrollbar items-center justify-center" >
147144 <div class =" w-full h-auto grid grid-cols-[repeat(auto-fill,minmax(300px,1fr))] gap-4 p-4" >
@@ -535,6 +532,7 @@ const searchQuery = ref('')
535532const statusFilter = ref <' all' | ' mounted' | ' unmounted' | ' error' >(' all' )
536533const showFlagSelector = ref (false )
537534const isAddingNew = ref (false )
535+ const initLoading = ref (true )
538536let mountRefreshInterval: NodeJS .Timeout | null = null
539537
540538const configForm = ref ({
@@ -685,7 +683,11 @@ const editConfig = (config: RcloneFormConfig) => {
685683
686684const saveConfig = async () => {
687685 if (! configForm .value .name || ! configForm .value .url || ! configForm .value .user || ! configForm .value .pass ) {
688- console .error (t (' mount.messages.fillRequiredFields' ))
686+ message .error (t (' mount.messages.fillRequiredFields' ))
687+ return
688+ }
689+ if (isConfigMounted (configForm .value )) {
690+ message .error (t (' mount.messages.unmountBeforeEdit' , { name: configForm .value .name }))
689691 return
690692 }
691693
@@ -725,7 +727,7 @@ const saveConfig = async () => {
725727 )
726728 resetForm ()
727729 } catch (error : any ) {
728- console .error (error .message || t (' mount.messages.failedToSave' ))
730+ message .error (error .message || t (' mount.messages.failedToSave' ))
729731 }
730732}
731733
@@ -754,7 +756,7 @@ const mountConfig = async (config: RcloneFormConfig) => {
754756 try {
755757 await appStore .mountRemote (config .name )
756758 } catch (error : any ) {
757- console .error (error .message || t (' mount.messages.failedToMount' ))
759+ message .error (error .message || t (' mount.messages.failedToMount' ))
758760 }
759761}
760762
@@ -763,7 +765,7 @@ const unmountConfig = async (config: RcloneFormConfig) => {
763765 try {
764766 await appStore .unmountRemote (config .name )
765767 } catch (error : any ) {
766- console .error (error .message || t (' mount.messages.failedToUnmount' ))
768+ message .error (error .message || t (' mount.messages.failedToUnmount' ))
767769 }
768770}
769771
@@ -789,7 +791,7 @@ const confirmDelete = async (config: RcloneFormConfig) => {
789791 await appStore .deleteRemoteConfig (config .name )
790792 message .success (t (' mount.messages.deletedSuccessfully' , { name: config .name }))
791793 } catch (error : any ) {
792- console .error (error .message || t (' mount.messages.failedToDelete' ))
794+ message .error (error .message || t (' mount.messages.failedToDelete' ))
793795 }
794796}
795797
@@ -798,13 +800,11 @@ const refreshData = async () => {
798800 await appStore .loadRemoteConfigs ()
799801 await appStore .loadMountInfos ()
800802 } catch (error : any ) {
801- console .error (error .message )
803+ message .error (error .message )
802804 }
803805}
804806
805807const getConfigStatus = (config : RcloneFormConfig ) => {
806- console .log (' Getting status for config:' , config )
807- console .log (' Current mount infos:' , appStore .mountInfos )
808808 const mountInfo = appStore .mountInfos .find (mount => mount .name === config .name )
809809 return mountInfo ?.status || ' unmounted'
810810}
@@ -896,7 +896,7 @@ const getFlagDescription = (flag: { flag: string; value: string; descriptionKey:
896896
897897const openInFileExplorer = async (path ? : string ) => {
898898 if (! path ) {
899- console . warn ( ' Mount point path is not available ' )
899+ message . error ( t ( ' mount.messages.mountPointPathNotAvailable ' ) )
900900 return
901901 }
902902 const normalizedPath = path .trim ()
@@ -943,6 +943,7 @@ const shouldShowWebdavTip = computed(() => {
943943})
944944
945945onMounted (async () => {
946+ initLoading .value = true
946947 appStore .loadRemoteConfigs ()
947948 appStore .loadMountInfos ()
948949 mountRefreshInterval = setInterval (appStore .loadMountInfos , 15 * 1000 )
@@ -952,6 +953,7 @@ onMounted(async () => {
952953 const available = await rcloneStore .checkRcloneAvailable ()
953954 showRcloneTip .value = ! available
954955 }
956+ initLoading .value = false
955957})
956958
957959onUnmounted (() => {
0 commit comments