|
1 | 1 | <template> |
2 | | - <div class="server-box animate fadein"> |
3 | | - <router-link :to="{ name: 'server', params: { id: server.identifier }}" class="content"> |
4 | | - <div class="float-right"> |
5 | | - <div class="indicator" :class="status"></div> |
6 | | - </div> |
7 | | - <div class="mb-4"> |
8 | | - <div class="text-black font-bold text-xl"> |
| 2 | + <div class="server-card animated-fade-in hover:shadow-md"> |
| 3 | + <div class="content h-32 relative" :class="{ |
| 4 | + 'is-online': status === 'online', |
| 5 | + 'is-offline': status === 'offline' |
| 6 | + }"> |
| 7 | + <router-link :to="link"> |
| 8 | + <h2 class="text-xl flex flex-row items-center mb-2"> |
| 9 | + <div class="identifier-icon select-none" :class="{ |
| 10 | + 'bg-grey': status === '', |
| 11 | + 'bg-red': status === 'offline', |
| 12 | + 'bg-green': status === 'online' |
| 13 | + }"> |
| 14 | + {{ server.name[0] }} |
| 15 | + </div> |
9 | 16 | {{ server.name }} |
| 17 | + </h2> |
| 18 | + </router-link> |
| 19 | + <div class="text-grey-darker font-normal text-sm"> |
| 20 | + <p v-if="server.description.length" class="pb-1">{{ server.description }}</p> |
| 21 | + |
| 22 | + <div class="absolute pin-b pin-l p-4 w-full"> |
| 23 | + <span class="font-semibold text-indigo">{{ server.node }}</span> |
| 24 | + <span class="float-right text-grey-dark font-light">{{ server.allocation.ip }}:{{ server.allocation.port }}</span> |
10 | 25 | </div> |
11 | 26 | </div> |
12 | | - <div class="mb-0 flex"> |
13 | | - <div class="usage"> |
14 | | - <div class="indicator-title">{{ $t('dashboard.index.cpu_title') }}</div> |
15 | | - </div> |
16 | | - <div class="usage"> |
17 | | - <div class="indicator-title">{{ $t('dashboard.index.memory_title') }}</div> |
18 | | - </div> |
| 27 | + </div> |
| 28 | + <div class="footer p-4 text-sm"> |
| 29 | + <div class="inline-block pr-2"> |
| 30 | + <div class="pillbox bg-green"><span class="select-none">MEM:</span> {{ memory }} Mb</div> |
19 | 31 | </div> |
20 | | - <div class="mb-4 flex text-center"> |
21 | | - <div class="inline-block border border-grey-lighter border-l-0 p-4 flex-1"> |
22 | | - <span class="font-bold text-xl">{{ cpu > 0 ? cpu : '—' }}</span> |
23 | | - <span class="font-light text-sm">%</span> |
24 | | - </div> |
25 | | - <div class="inline-block border border-grey-lighter border-l-0 border-r-0 p-4 flex-1"> |
26 | | - <span class="font-bold text-xl">{{ memory > 0 ? memory : '—' }}</span> |
27 | | - <span class="font-light text-sm">MB</span> |
28 | | - </div> |
29 | | - </div> |
30 | | - <div class="flex items-center"> |
31 | | - <div class="text-sm"> |
32 | | - <p class="text-grey">{{ server.node }}</p> |
33 | | - <p class="text-grey-dark">{{ server.allocation.ip }}:{{ server.allocation.port }}</p> |
34 | | - </div> |
| 32 | + <div class="inline-block"> |
| 33 | + <div class="pillbox bg-blue"><span class="select-none">CPU:</span> {{ cpu }} %</div> |
35 | 34 | </div> |
36 | | - </router-link> |
| 35 | + </div> |
37 | 36 | </div> |
38 | 37 | </template> |
39 | 38 |
|
|
57 | 56 | cpu: 0, |
58 | 57 | memory: 0, |
59 | 58 | status: '', |
| 59 | + link: { name: 'server', params: { id: this.server.identifier }}, |
60 | 60 | }; |
61 | 61 | }, |
62 | 62 |
|
|
101 | 101 | * Poll the API for changes every 10 seconds when the component is mounted. |
102 | 102 | */ |
103 | 103 | mounted: function () { |
| 104 | + console.log(this.server); |
104 | 105 | this.$options.dataGetTimeout = window.setInterval(() => { |
105 | 106 | this.getResourceUse(); |
106 | 107 | }, 10000); |
|
0 commit comments