|
1 | 1 | <script setup lang="ts"> |
2 | 2 | import { ref, onMounted, watch } from 'vue' |
| 3 | +import { useRouter } from 'vue-router' |
| 4 | +
|
3 | 5 | import { useAuthStore } from '../stores/auth' |
4 | 6 | import { authService } from '../services/authService' |
5 | 7 | import type { Organization, Desktop } from '../types' |
6 | 8 |
|
7 | 9 | const 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 | +} |
8 | 27 |
|
9 | 28 | // State |
10 | 29 | const organizations = ref<Organization[]>([]) |
@@ -162,28 +181,32 @@ const handleCreateOrg = async () => { |
162 | 181 |
|
163 | 182 | <div v-else class="row g-4"> |
164 | 183 | <div v-for="desktop in desktops" :key="desktop.realm" class="col-md-4"> |
165 | | - <router-link :to="'/desktops/' + desktop.realm" class="text-decoration-none"> |
166 | | - <div class="card h-100 border-0 shadow-sm card-hover"> |
167 | | - <div class="card-body p-4"> |
168 | | - <div class="d-flex align-items-center mb-3"> |
169 | | - <span class="fs-2 me-3">{{ desktop.icon }}</span> |
170 | | - <div> |
171 | | - <h5 class="card-title mb-0 text-dark">{{ desktop.name }}</h5> |
172 | | - </div> |
173 | | - </div> |
174 | | - <div class="mt-auto d-flex justify-content-between align-items-center"> |
175 | | - <span class="badge bg-light text-primary rounded-pill">View Details</span> |
176 | | - <i class="bi bi-chevron-right text-muted"></i> |
| 184 | + <div class="card h-100 border-0 shadow-sm"> |
| 185 | + <div class="card-body p-4 d-flex flex-column"> |
| 186 | + <div class="d-flex align-items-center mb-3"> |
| 187 | + <span class="fs-2 me-3">{{ desktop.icon }}</span> |
| 188 | + <div> |
| 189 | + <h5 class="card-title mb-0 text-dark">{{ desktop.name }}</h5> |
177 | 190 | </div> |
178 | 191 | </div> |
| 192 | + |
| 193 | + <div class="mt-auto d-flex justify-content-between align-items-center"> |
| 194 | + <span class="badge bg-light text-secondary rounded-pill"> Desktop </span> |
| 195 | + <button |
| 196 | + class="btn btn-sm btn-outline-primary" |
| 197 | + @click="openDesktop(desktop.realm)" |
| 198 | + title="Open Terminal"> |
| 199 | + <i class="bi bi-terminal"></i> |
| 200 | + </button> |
| 201 | + </div> |
179 | 202 | </div> |
180 | | - </router-link> |
181 | | - </div> |
| 203 | + </div> |
182 | 204 |
|
183 | | - <!-- Empty State --> |
184 | | - <div v-if="desktops.length === 0" class="col-12"> |
185 | | - <div class="card border-dashed p-5 text-center bg-transparent"> |
186 | | - <p class="text-muted mb-0">No desktops found</p> |
| 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> |
187 | 210 | </div> |
188 | 211 | </div> |
189 | 212 | </div> |
|
0 commit comments