Skip to content

Commit 47c1ecc

Browse files
committed
Make server blocks clickable, break out routes into their own file
1 parent 6f2fcab commit 47c1ecc

File tree

4 files changed

+46
-29
lines changed

4 files changed

+46
-29
lines changed

resources/assets/scripts/app.js

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,7 @@ import VueRouter from 'vue-router';
77
import { Ziggy } from './helpers/ziggy';
88
import Locales from './../../../resources/lang/locales';
99
import { flash } from './mixins/flash';
10-
11-
// Base Vuejs Templates
12-
import Login from './components/auth/Login';
13-
import Dashboard from './components/dashboard/Dashboard';
14-
import Account from './components/dashboard/Account';
15-
import ResetPassword from './components/auth/ResetPassword';
10+
import { routes } from './routes';
1611

1712
window.events = new Vue;
1813
window.Ziggy = Ziggy;
@@ -33,24 +28,7 @@ Vue.i18n.add('en', Locales.en);
3328
Vue.i18n.set('en');
3429

3530
const router = new VueRouter({
36-
mode: 'history',
37-
routes: [
38-
{ name: 'login', path: '/auth/login', component: Login },
39-
{ name: 'forgot-password', path: '/auth/password', component: Login },
40-
{ name: 'checkpoint', path: '/checkpoint', component: Login },
41-
{
42-
name: 'reset-password',
43-
path: '/auth/password/reset/:token',
44-
component: ResetPassword,
45-
props: function (route) {
46-
return { token: route.params.token, email: route.query.email || '' };
47-
}
48-
},
49-
{ name : 'index', path: '/', component: Dashboard },
50-
{ name : 'account', path: '/account', component: Account },
51-
{ name : 'account-api', path: '/account/api', component: Account },
52-
{ name : 'account-security', path: '/account/security', component: Account },
53-
]
31+
mode: 'history', routes
5432
});
5533

5634
require('./bootstrap');

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@
99
</div>
1010
<transition-group class="w-full m-auto mt-4 animate fadein sm:flex flex-wrap content-start">
1111
<div class="server-box" :key="index" v-for="(server, index) in servers">
12-
<div class="content">
12+
<router-link :to="{ name: 'server', params: { id: server.uuidShort }}" class="content">
1313
<div class="float-right">
14-
<div class="indicator online"></div>
14+
<div class="indicator"></div>
1515
</div>
1616
<div class="mb-4">
17-
<div class="text-black font-bold text-xl">{{ server.name }}</div>
17+
<div class="text-black font-bold text-xl">
18+
{{ server.name }}
19+
</div>
1820
</div>
1921
<div class="mb-0 flex">
2022
<div class="usage">
@@ -40,7 +42,7 @@
4042
<p class="text-grey-dark">{{ server.allocation.ip }}:{{ server.allocation.port }}</p>
4143
</div>
4244
</div>
43-
</div>
45+
</router-link>
4446
</div>
4547
</transition-group>
4648
</div>

resources/assets/scripts/routes.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Base Vuejs Templates
2+
import Login from './components/auth/Login';
3+
import Dashboard from './components/dashboard/Dashboard';
4+
import Account from './components/dashboard/Account';
5+
import ResetPassword from './components/auth/ResetPassword';
6+
7+
export const routes = [
8+
{ name: 'login', path: '/auth/login', component: Login },
9+
{ name: 'forgot-password', path: '/auth/password', component: Login },
10+
{ name: 'checkpoint', path: '/checkpoint', component: Login },
11+
{
12+
name: 'reset-password',
13+
path: '/auth/password/reset/:token',
14+
component: ResetPassword,
15+
props: function (route) {
16+
return { token: route.params.token, email: route.query.email || '' };
17+
}
18+
},
19+
20+
{ name : 'index', path: '/', component: Dashboard },
21+
{ name : 'account', path: '/account', component: Account },
22+
{ name : 'account.api', path: '/account/api', component: Account },
23+
{ name : 'account.security', path: '/account/security', component: Account },
24+
25+
{
26+
name: 'server',
27+
path: '/server/:id',
28+
// component: Server,
29+
// children: [
30+
// { path: 'files', component: ServerFileManager }
31+
// ],
32+
}
33+
];

resources/assets/styles/components/miscellaneous.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ code {
6565
}
6666

6767
& > .content {
68-
@apply .border .border-grey-light .bg-white .rounded .p-4 .justify-between .leading-normal;
68+
@apply .border .border-grey-light .bg-white .rounded .p-4 .justify-between .leading-normal .no-underline .block .text-black;
69+
70+
&:visited {
71+
@apply .text-black;
72+
}
6973
}
7074
}
7175

0 commit comments

Comments
 (0)