11<script setup lang="ts">
2- import { ref , onMounted , watch } from ' vue'
3- import { useRouter } from ' vue-router'
2+ import { ref , watch } from ' vue'
43
4+ import { openDesktop , openFileExplorer } from ' ../router'
55import { useAuthStore } from ' ../stores/auth'
66import { authService } from ' ../services/authService'
77import type { Organization , Desktop } from ' ../types'
88
99const authStore = useAuthStore ()
10- const router = useRouter ()
11-
12- function openDesktop(realm : string ) {
13- const url = router .resolve (` /desktops/${realm } ` ).href
14-
15- const width = 1000
16- const height = 700
17-
18- const left = window .screenX + (window .outerWidth - width ) / 2
19- const top = window .screenY + (window .outerHeight - height ) / 2
20-
21- window .open (
22- url ,
23- ' _blank' ,
24- ` width=${width },height=${height },left=${left },top=${top },resizable=yes,scrollbars=yes ` ,
25- )
26- }
2710
2811// State
2912const organizations = ref <Organization []>([])
@@ -78,7 +61,6 @@ const fetchDesktops = async () => {
7861 }
7962}
8063
81- // Watch for session changes (e.g., after auto-login)
8264watch (
8365 () => authStore .session ,
8466 (newSession ) => {
@@ -93,18 +75,6 @@ watch(
9375 { immediate: true },
9476)
9577
96- onMounted (() => {
97- // If session is already present, fetch immediately
98- if (authStore .session ) {
99- fetchOrganizations ()
100- fetchDesktops ()
101- } else {
102- // If not, the watcher will handle it, but let's make sure we don't hang forever
103- // if auto-login is not even running or fails.
104- // authStore.autoLogin is called in App.vue, so we wait for its result indirectly.
105- }
106- })
107-
10878const handleOpenModal = () => {
10979 showModal .value = true
11080}
@@ -181,7 +151,10 @@ const handleCreateOrg = async () => {
181151
182152 <div v-else class =" row g-4" >
183153 <div v-for =" desktop in desktops" :key =" desktop.realm" class =" col-md-4" >
184- <div class =" card h-100 border-0 shadow-sm" >
154+ <div
155+ class =" card h-100 border-0 shadow-sm card-hover desktop-card"
156+ @click =" openFileExplorer(desktop.realm, desktop.name)"
157+ >
185158 <div class =" card-body p-4 d-flex flex-column" >
186159 <div class =" d-flex align-items-center mb-3" >
187160 <span class =" fs-2 me-3" >{{ desktop.icon }}</span >
@@ -191,23 +164,22 @@ const handleCreateOrg = async () => {
191164 </div >
192165
193166 <div class =" mt-auto d-flex justify-content-between align-items-center" >
194- <span class =" badge bg-light text-secondary rounded-pill" > Desktop </span >
167+ <span class =" badge bg-light text-secondary rounded-pill" > Open Explorer </span >
195168 <button
196169 class =" btn btn-sm btn-outline-primary"
197- @click =" openDesktop(desktop.realm)"
170+ @click.stop =" openDesktop(desktop.realm)"
198171 title =" Open Terminal" >
199172 <i class =" bi bi-terminal" ></i >
200173 </button >
201174 </div >
202175 </div >
203176 </div >
177+ </div >
178+ </div >
204179
205- <!-- Empty State -->
206- <div v-if =" desktops.length === 0" class =" col-12" >
207- <div class =" card border-dashed p-5 text-center bg-transparent" >
208- <p class =" text-muted mb-0" >No desktops found</p >
209- </div >
210- </div >
180+ <div v-if =" desktops.length === 0" class =" col-12" >
181+ <div class =" card border-dashed p-5 text-center bg-transparent" >
182+ <p class =" text-muted mb-0" >No desktops found</p >
211183 </div >
212184 </div >
213185 </div >
@@ -327,6 +299,10 @@ const handleCreateOrg = async () => {
327299 box-shadow : 0 10px 20px rgba (0 , 0 , 0 , 0.1 ) !important ;
328300}
329301
302+ .desktop-card {
303+ cursor : pointer ;
304+ }
305+
330306/* Theme Primary Button Override for consistency */
331307.btn-theme-primary {
332308 background-color : var (--theme-yellow ) !important ;
0 commit comments