Make server blocks clickable, break out routes into their own file

This commit is contained in:
Dane Everitt 2018-05-28 11:34:24 -07:00
parent 6f2fcabf22
commit 47c1ecc9bc
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
4 changed files with 46 additions and 29 deletions

View file

@ -7,12 +7,7 @@ import VueRouter from 'vue-router';
import { Ziggy } from './helpers/ziggy'; import { Ziggy } from './helpers/ziggy';
import Locales from './../../../resources/lang/locales'; import Locales from './../../../resources/lang/locales';
import { flash } from './mixins/flash'; import { flash } from './mixins/flash';
import { routes } from './routes';
// Base Vuejs Templates
import Login from './components/auth/Login';
import Dashboard from './components/dashboard/Dashboard';
import Account from './components/dashboard/Account';
import ResetPassword from './components/auth/ResetPassword';
window.events = new Vue; window.events = new Vue;
window.Ziggy = Ziggy; window.Ziggy = Ziggy;
@ -33,24 +28,7 @@ Vue.i18n.add('en', Locales.en);
Vue.i18n.set('en'); Vue.i18n.set('en');
const router = new VueRouter({ const router = new VueRouter({
mode: 'history', mode: 'history', routes
routes: [
{ name: 'login', path: '/auth/login', component: Login },
{ name: 'forgot-password', path: '/auth/password', component: Login },
{ name: 'checkpoint', path: '/checkpoint', component: Login },
{
name: 'reset-password',
path: '/auth/password/reset/:token',
component: ResetPassword,
props: function (route) {
return { token: route.params.token, email: route.query.email || '' };
}
},
{ name : 'index', path: '/', component: Dashboard },
{ name : 'account', path: '/account', component: Account },
{ name : 'account-api', path: '/account/api', component: Account },
{ name : 'account-security', path: '/account/security', component: Account },
]
}); });
require('./bootstrap'); require('./bootstrap');

View file

@ -9,12 +9,14 @@
</div> </div>
<transition-group class="w-full m-auto mt-4 animate fadein sm:flex flex-wrap content-start"> <transition-group class="w-full m-auto mt-4 animate fadein sm:flex flex-wrap content-start">
<div class="server-box" :key="index" v-for="(server, index) in servers"> <div class="server-box" :key="index" v-for="(server, index) in servers">
<div class="content"> <router-link :to="{ name: 'server', params: { id: server.uuidShort }}" class="content">
<div class="float-right"> <div class="float-right">
<div class="indicator online"></div> <div class="indicator"></div>
</div> </div>
<div class="mb-4"> <div class="mb-4">
<div class="text-black font-bold text-xl">{{ server.name }}</div> <div class="text-black font-bold text-xl">
{{ server.name }}
</div>
</div> </div>
<div class="mb-0 flex"> <div class="mb-0 flex">
<div class="usage"> <div class="usage">
@ -40,7 +42,7 @@
<p class="text-grey-dark">{{ server.allocation.ip }}:{{ server.allocation.port }}</p> <p class="text-grey-dark">{{ server.allocation.ip }}:{{ server.allocation.port }}</p>
</div> </div>
</div> </div>
</div> </router-link>
</div> </div>
</transition-group> </transition-group>
</div> </div>

View file

@ -0,0 +1,33 @@
// Base Vuejs Templates
import Login from './components/auth/Login';
import Dashboard from './components/dashboard/Dashboard';
import Account from './components/dashboard/Account';
import ResetPassword from './components/auth/ResetPassword';
export const routes = [
{ name: 'login', path: '/auth/login', component: Login },
{ name: 'forgot-password', path: '/auth/password', component: Login },
{ name: 'checkpoint', path: '/checkpoint', component: Login },
{
name: 'reset-password',
path: '/auth/password/reset/:token',
component: ResetPassword,
props: function (route) {
return { token: route.params.token, email: route.query.email || '' };
}
},
{ name : 'index', path: '/', component: Dashboard },
{ name : 'account', path: '/account', component: Account },
{ name : 'account.api', path: '/account/api', component: Account },
{ name : 'account.security', path: '/account/security', component: Account },
{
name: 'server',
path: '/server/:id',
// component: Server,
// children: [
// { path: 'files', component: ServerFileManager }
// ],
}
];

View file

@ -65,7 +65,11 @@ code {
} }
& > .content { & > .content {
@apply .border .border-grey-light .bg-white .rounded .p-4 .justify-between .leading-normal; @apply .border .border-grey-light .bg-white .rounded .p-4 .justify-between .leading-normal .no-underline .block .text-black;
&:visited {
@apply .text-black;
}
} }
} }