Skip to content

Commit 8fd0e5f

Browse files
committed
Fix flexbox view when there are three items
1 parent aee42df commit 8fd0e5f

File tree

5 files changed

+61
-41
lines changed

5 files changed

+61
-41
lines changed

resources/assets/scripts/components/dashboard/Dashboard.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
import ServerBox from './ServerBox';
3434
import Navigation from '../core/Navigation';
3535
import isObject from 'lodash/isObject';
36-
import {mapState} from 'vuex';
36+
import { mapState } from 'vuex';
3737
3838
export default {
3939
name: 'dashboard',
@@ -72,8 +72,8 @@
7272
},
7373
set: function (value) {
7474
this.$store.dispatch('dashboard/setSearchTerm', value);
75-
}
76-
}
75+
},
76+
},
7777
},
7878
7979
methods: {
@@ -112,6 +112,6 @@
112112
onChange: debounce(function () {
113113
this.loadServers();
114114
}, 500),
115-
}
115+
},
116116
};
117117
</script>

resources/assets/scripts/components/dashboard/ServerBox.vue

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,35 @@
11
<template>
2-
<div class="server-card animated-fade-in hover:shadow-md">
3-
<div class="content h-32 relative">
4-
<router-link :to="link">
5-
<h2 class="text-xl flex flex-row items-center mb-2">
6-
<div class="identifier-icon select-none" :class="{
2+
<div class="server-card-container">
3+
<div class="server-card animated-fade-in hover:shadow-md">
4+
<div class="content h-32 relative">
5+
<router-link :to="link">
6+
<h2 class="text-xl flex flex-row items-center mb-2">
7+
<div class="identifier-icon select-none" :class="{
78
'bg-grey': status === '',
89
'bg-red': status === 'offline',
910
'bg-green': status === 'online'
1011
}">
11-
{{ server.name[0] }}
12+
{{ server.name[0] }}
13+
</div>
14+
{{ server.name }}
15+
</h2>
16+
</router-link>
17+
<div class="text-grey-darker font-normal text-sm">
18+
<p v-if="server.description.length" class="pb-1">{{ server.description }}</p>
19+
20+
<div class="absolute pin-b pin-l p-4 w-full">
21+
<span class="font-semibold text-indigo">{{ server.node }}</span>
22+
<span class="float-right text-grey-dark font-light">{{ server.allocation.ip }}:{{ server.allocation.port }}</span>
1223
</div>
13-
{{ server.name }}
14-
</h2>
15-
</router-link>
16-
<div class="text-grey-darker font-normal text-sm">
17-
<p v-if="server.description.length" class="pb-1">{{ server.description }}</p>
18-
19-
<div class="absolute pin-b pin-l p-4 w-full">
20-
<span class="font-semibold text-indigo">{{ server.node }}</span>
21-
<span class="float-right text-grey-dark font-light">{{ server.allocation.ip }}:{{ server.allocation.port }}</span>
2224
</div>
2325
</div>
24-
</div>
25-
<div class="footer p-4 text-sm">
26-
<div class="inline-block pr-2">
27-
<div class="pillbox bg-green"><span class="select-none">MEM:</span> {{ memory }} Mb</div>
28-
</div>
29-
<div class="inline-block">
30-
<div class="pillbox bg-blue"><span class="select-none">CPU:</span> {{ cpu }} %</div>
26+
<div class="footer p-4 text-sm">
27+
<div class="inline-block pr-2">
28+
<div class="pillbox bg-green"><span class="select-none">MEM:</span> {{ memory }} Mb</div>
29+
</div>
30+
<div class="inline-block">
31+
<div class="pillbox bg-blue"><span class="select-none">CPU:</span> {{ cpu }} %</div>
32+
</div>
3133
</div>
3234
</div>
3335
</div>
@@ -122,7 +124,6 @@
122124
throw new Error('Received an invalid response object back from status endpoint.');
123125
}
124126
125-
126127
this.resources = response.data.attributes;
127128
this.status = this.getServerStatus();
128129
@@ -150,14 +151,14 @@
150151
}
151152
152153
switch (this.resources.state) {
153-
case 'off':
154-
return 'offline';
155-
case 'on':
156-
case 'starting':
157-
case 'stopping':
158-
return 'online';
159-
default:
160-
return '';
154+
case 'off':
155+
return 'offline';
156+
case 'on':
157+
case 'starting':
158+
case 'stopping':
159+
return 'online';
160+
default:
161+
return '';
161162
}
162163
},
163164
@@ -189,6 +190,6 @@
189190
this.backgroundedAt = new Date();
190191
}
191192
},
192-
}
193+
},
193194
};
194195
</script>

resources/assets/scripts/helpers/ziggy.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/assets/styles/components/miscellaneous.css

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,36 @@ code {
5252
/**
5353
* Flex boxes for server listing on user dashboard.
5454
*/
55-
.server-card {
56-
@apply .block .no-underline .shadow;
55+
.server-card-container {
56+
@apply .mb-4;
5757

5858
@screen smx {
5959
@apply .w-full;
6060
}
6161

6262
@screen md {
63-
@apply .w-1/3 .mr-4;
63+
@apply .w-1/2 .pr-4;
64+
65+
&:nth-of-type(2n) {
66+
@apply .pr-0;
67+
}
68+
}
69+
70+
@screen lg {
71+
@apply .w-1/3 .pr-4;
72+
73+
&:nth-of-type(2n) {
74+
@apply .pr-4;
75+
}
6476

6577
&:nth-of-type(3n) {
66-
@apply .mr-0;
78+
@apply .pr-0;
6779
}
6880
}
81+
}
82+
83+
.server-card {
84+
@apply .block .no-underline .shadow;
6985

7086
& .identifier-icon {
7187
@apply .inline-block .rounded-full .text-white .text-center .leading-none .justify-center .w-8 .h-8 .mr-2 .flex .flex-row .items-center;

routes/server.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@
1313
->name('server.files')
1414
->where('directory', '.*');
1515
});
16+
17+
Route::get('/')->name('server.index');
18+
Route::get('/console')->name('server.console');

0 commit comments

Comments
 (0)