| proxy.type.toUpperCase() |
| 9 | }}</span> |
| 10 | </div> |
| 11 |
| 12 | <div class="card-meta"> |
| 13 | <span v-if="proxy.port" class="meta-item"> |
| 14 | <span class="meta-label">Port:</span> |
| 15 | <span class="meta-value">{{ proxy.port }}</span> |
| 16 | </span> |
| 17 | <span class="meta-item"> |
| 18 | <span class="meta-label">Connections:</span> |
| 19 | <span class="meta-value">{{ proxy.conns }}</span> |
| 20 | </span> |
| 21 | <span class="meta-item" v-if="proxy.clientID"> |
| 22 | <span class="meta-label">Client:</span> |
| 23 | <span class="meta-value">{{ |
| 24 | proxy.user ? `${proxy.user}.${proxy.clientID}` : proxy.clientID |
| 25 | }}</span> |
| 26 | </span> |
| 27 | </div> |
| 28 | </div> |
| 29 |
| 30 | <div class="card-right"> |
| 31 | <div class="traffic-stats"> |
| 32 | <div class="traffic-row"> |
| 33 | <el-icon class="traffic-icon out"><Top /></el-icon> |
| 34 | <span class="traffic-value">{{ |
| 35 | formatFileSize(proxy.trafficOut) |
| 36 | }}</span> |
| 37 | </div> |
| 38 | <div class="traffic-row"> |
| 39 | <el-icon class="traffic-icon in"><Bottom /></el-icon> |
| 40 | <span class="traffic-value">{{ |
| 41 | formatFileSize(proxy.trafficIn) |
| 42 | }}</span> |
| 43 | </div> |
| 44 | </div> |
| 45 |
| 46 | <div class="status-badge" :class="proxy.status"> |
| 47 | {{ proxy.status }} |
| 48 | </div> |
| 49 | </div> |
| 50 | </div> |
| 51 | </router-link> |
| 52 | </template> |
| 53 |
| 54 | <script setup lang="ts"> |
| 55 | import { computed } from 'vue' |
| 56 | import { useRoute } from 'vue-router' |
| 57 | import { Top, Bottom } from '@element-plus/icons-vue' |
| 58 | import { formatFileSize } from '../utils/format' |
| 59 | import type { BaseProxy } from '../utils/proxy' |
| 60 |
| 61 | interface Props { |
| 62 | proxy: BaseProxy |
| 63 | showType?: boolean |
| 64 | } |
| 65 |
| 66 | const props = defineProps<Props>() |
| 67 | const route = useRoute() |
| 68 |
| 69 | const proxyLink = computed(() => { |
| 70 | const base = `/proxy/${props.proxy.name}` |
| 71 | // If we're on a client detail page, pass client info |
| 72 | if (route.name === 'ClientDetail' && route.params.key) { |
| 73 | return `${base}?from=client&client=${route.params.key}` |
| 74 | } |
| 75 | return base |
| 76 | }) |
| 77 | </script> |
| 78 |
| 79 | <style scoped> |
| 80 | .proxy-card { |
| 81 | display: block; |
| 82 | background: var(--el-bg-color); |
| 83 | border: 1px solid var(--el-border-color-lighter); |
| 84 | border-radius: 12px; |
| 85 | transition: all 0.2s ease-in-out; |
| 86 | overflow: hidden; |
| 87 | text-decoration: none; |
| 88 | cursor: pointer; |
| 89 | } |
| 90 |
| 91 | .proxy-card:hover { |
| 92 | border-color: var(--el-border-color-light); |
| 93 | box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04); |
| 94 | } |
| 95 |
| 96 | .card-main { |
| 97 | display: flex; |
| 98 | justify-content: space-between; |
| 99 | align-items: center; |
| 100 | padding: 20px 24px; |
| 101 | gap: 24px; |
| 102 | min-height: 80px; |
| 103 | } |
| 104 |
| 105 | /* Left Section */ |
| 106 | .card-left { |
| 107 | display: flex; |
| 108 | flex-direction: column; |
| 109 | justify-content: center; |
| 110 | gap: 12px; |
| 111 | flex: 1; |
| 112 | min-width: 0; |
| 113 | } |
| 114 |
| 115 | .card-header { |
| 116 | display: flex; |
| 117 | align-items: center; |
| 118 | gap: 8px; |
| 119 | } |
| 120 |
| 121 | .proxy-name { |
| 122 | font-size: 16px; |
| 123 | font-weight: 600; |
| 124 | color: var(--el-text-color-primary); |
| 125 | line-height: 1.4; |
| 126 | } |
| 127 |
| 128 | .type-tag { |
| 129 | font-size: 11px; |
| 130 | font-weight: 500; |
| 131 | padding: 2px 6px; |
| 132 | border-radius: 4px; |
| 133 | background: var(--el-fill-color); |
| 134 | color: var(--el-text-color-secondary); |
| 135 | } |
| 136 |
| 137 | .card-meta { |
| 138 | display: flex; |
| 139 | align-items: center; |
| 140 | gap: 24px; |
| 141 | flex-wrap: wrap; |
| 142 | } |
| 143 |
| 144 | .meta-item { |
| 145 | display: flex; |
| 146 | align-items: baseline; |
| 147 | gap: 6px; |
| 148 | line-height: 1; |
| 149 | } |
| 150 |
| 151 | .meta-label { |
| 152 | color: var(--el-text-color-placeholder); |
| 153 | font-size: 13px; |
| 154 | font-weight: 500; |
| 155 | } |
| 156 |
| 157 | .meta-value { |
| 158 | font-size: 13px; |
| 159 | font-weight: 500; |
| 160 | color: var(--el-text-color-regular); |
| 161 | } |
| 162 |
| 163 | /* Right Section */ |
| 164 | .card-right { |
| 165 | display: flex; |
| 166 | align-items: center; |
| 167 | gap: 24px; |
| 168 | flex-shrink: 0; |
| 169 | } |
| 170 |
| 171 | .traffic-stats { |
| 172 | display: flex; |
| 173 | flex-direction: column; |
| 174 | gap: 4px; |
| 175 | align-items: flex-end; |
| 176 | } |
| 177 |
| 178 | .traffic-row { |
| 179 | display: flex; |
| 180 | align-items: center; |
| 181 | gap: 6px; |
| 182 | line-height: 1; |
| 183 | } |
| 184 |
| 185 | .traffic-icon { |
| 186 | font-size: 12px; |
| 187 | } |
| 188 |
| 189 | .traffic-icon.in { |
| 190 | color: var(--el-color-primary); |
| 191 | } |
| 192 |
| 193 | .traffic-icon.out { |
| 194 | color: var(--el-color-success); |
| 195 | } |
| 196 |
| 197 | .traffic-value { |
| 198 | font-size: 12px; |
| 199 | color: var(--el-text-color-secondary); |
| 200 | font-weight: 500; |
| 201 | text-align: right; |
| 202 | } |
| 203 |
| 204 | .status-badge { |
| 205 | display: inline-flex; |
| 206 | padding: 2px 10px; |
| 207 | border-radius: 10px; |
| 208 | font-size: 12px; |
| 209 | font-weight: 500; |
| 210 | text-transform: capitalize; |
| 211 | } |
| 212 |
| 213 | .status-badge.online { |
| 214 | background: var(--el-color-success-light-9); |
| 215 | color: var(--el-color-success); |
| 216 | } |
| 217 |
| 218 | .status-badge.offline { |
| 219 | background: var(--el-color-danger-light-9); |
| 220 | color: var(--el-color-danger); |
| 221 | } |
| 222 |
| 223 | /* Mobile Responsive */ |
| 224 | @media (max-width: 768px) { |
| 225 | .card-main { |
| 226 | flex-direction: column; |
| 227 | align-items: stretch; |
| 228 | gap: 16px; |
| 229 | padding: 16px; |
| 230 | } |
| 231 |
| 232 | .card-right { |
| 233 | flex-direction: row; |
| 234 | align-items: center; |
| 235 | justify-content: space-between; |
| 236 | border-top: 1px solid var(--el-border-color-lighter); |
| 237 | padding-top: 16px; |
| 238 | } |
| 239 |
| 240 | .traffic-stats { |
| 241 | align-items: flex-start; |
| 242 | } |
| 243 | } |
| 244 | </style> |