uptime-kuma/src/layouts/Layout.vue

168 lines
4.5 KiB
Vue
Raw Normal View History

2021-06-25 09:55:49 -04:00
<template>
2021-07-27 13:47:13 -04:00
<div v-if="! $root.socket.connected && ! $root.socket.firstConnect" class="lost-connection">
2021-06-25 09:55:49 -04:00
<div class="container-fluid">
Lost connection to the socket server. Reconnecting...
</div>
</div>
2021-07-11 03:23:28 -04:00
<!-- Desktop header -->
2021-07-27 13:47:13 -04:00
<header v-if="! $root.isMobile" class="d-flex flex-wrap justify-content-center py-3 mb-3 border-bottom">
2021-07-13 00:16:11 -04:00
<router-link to="/dashboard" class="d-flex align-items-center mb-3 mb-md-0 me-md-auto text-dark text-decoration-none">
2021-07-27 13:47:13 -04:00
<object class="bi me-2 ms-4" width="40" height="40" data="/icon.svg" alt="Logo" />
2021-06-25 09:55:49 -04:00
<span class="fs-4 title">Uptime Kuma</span>
</router-link>
2021-07-27 13:47:13 -04:00
<ul class="nav nav-pills">
<li class="nav-item">
<router-link to="/dashboard" class="nav-link">
<font-awesome-icon icon="tachometer-alt" /> Dashboard
</router-link>
</li>
<li class="nav-item">
<router-link to="/settings" class="nav-link">
<font-awesome-icon icon="cog" /> Settings
</router-link>
</li>
2021-06-25 09:55:49 -04:00
</ul>
2021-07-11 03:23:28 -04:00
</header>
2021-06-25 09:55:49 -04:00
2021-07-11 03:23:28 -04:00
<!-- Mobile header -->
2021-07-27 13:47:13 -04:00
<header v-else class="d-flex flex-wrap justify-content-center mt-3 mb-3">
2021-07-13 00:16:11 -04:00
<router-link to="/dashboard" class="d-flex align-items-center text-dark text-decoration-none">
2021-07-27 13:47:13 -04:00
<object class="bi" width="40" height="40" data="/icon.svg" />
2021-07-11 03:23:28 -04:00
<span class="fs-4 title ms-2">Uptime Kuma</span>
</router-link>
2021-06-25 09:55:49 -04:00
</header>
<main>
2021-06-30 09:04:58 -04:00
<!-- Add :key to disable vue router re-use the same component -->
<router-view v-if="$root.loggedIn" :key="$route.fullPath" />
2021-06-25 09:55:49 -04:00
<Login v-if="! $root.loggedIn && $root.allowLoginDialog" />
</main>
2021-07-13 06:08:12 -04:00
<footer>
<div class="container-fluid">
Uptime Kuma -
Version: {{ $root.info.version }} -
2021-07-17 16:55:53 -04:00
<a href="https://github.com/louislam/uptime-kuma/releases" target="_blank" rel="noopener">Check Update On GitHub</a>
2021-07-13 06:08:12 -04:00
</div>
</footer>
2021-07-11 03:23:28 -04:00
<!-- Mobile Only -->
2021-07-27 13:47:13 -04:00
<div v-if="$root.isMobile" style="width: 100%;height: 60px;" />
<nav v-if="$root.isMobile" class="bottom-nav">
2021-07-27 04:52:44 -04:00
<router-link to="/dashboard" class="nav-link" @click="$root.cancelActiveList">
<div><font-awesome-icon icon="tachometer-alt" /></div>
Dashboard
</router-link>
<a href="#" :class=" { 'router-link-exact-active' : $root.showListMobile } " @click="$root.showListMobile = ! $root.showListMobile">
<div><font-awesome-icon icon="list" /></div>
List
</a>
<router-link to="/add" class="nav-link" @click="$root.cancelActiveList">
<div><font-awesome-icon icon="plus" /></div>
Add
</router-link>
<router-link to="/settings" class="nav-link" @click="$root.cancelActiveList">
<div><font-awesome-icon icon="cog" /></div>
Settings
</router-link>
2021-07-11 03:23:28 -04:00
</nav>
2021-06-25 09:55:49 -04:00
</template>
<script>
import Login from "../components/Login.vue";
export default {
components: {
2021-07-27 13:47:13 -04:00
Login,
2021-07-11 03:23:28 -04:00
},
data() {
2021-07-27 13:47:13 -04:00
return {}
2021-06-25 09:55:49 -04:00
},
2021-07-27 13:47:13 -04:00
computed: {},
2021-06-25 09:55:49 -04:00
watch: {
$route (to, from) {
this.init();
2021-07-27 13:47:13 -04:00
},
},
mounted() {
this.init();
2021-06-25 09:55:49 -04:00
},
methods: {
init() {
if (this.$route.name === "root") {
this.$router.push("/dashboard")
}
2021-07-11 03:23:28 -04:00
},
2021-07-27 13:47:13 -04:00
},
2021-06-25 09:55:49 -04:00
}
</script>
2021-07-11 03:23:28 -04:00
<style scoped lang="scss">
@import "../assets/vars.scss";
2021-06-25 09:55:49 -04:00
2021-07-11 03:23:28 -04:00
.bottom-nav {
z-index: 1000;
position: fixed;
bottom: 0;
height: 60px;
width: 100%;
left: 0;
2021-07-13 00:16:11 -04:00
background-color: #fff;
2021-07-11 03:23:28 -04:00
box-shadow: 0 15px 47px 0 rgba(0, 0, 0, 0.05), 0 5px 14px 0 rgba(0, 0, 0, 0.05);
text-align: center;
white-space: nowrap;
2021-07-27 04:52:44 -04:00
padding: 0 10px;
2021-06-25 09:55:49 -04:00
2021-07-11 03:23:28 -04:00
a {
text-align: center;
width: 25%;
display: inline-block;
height: 100%;
padding: 8px 10px 0;
font-size: 13px;
color: #c1c1c1;
overflow: hidden;
text-decoration: none;
2021-06-30 09:04:58 -04:00
2021-07-11 03:23:28 -04:00
&.router-link-exact-active {
color: $primary;
font-weight: bold;
}
div {
font-size: 20px;
}
2021-06-30 09:04:58 -04:00
}
2021-07-11 03:23:28 -04:00
}
.title {
font-weight: bold;
}
.nav {
margin-right: 25px;
}
.lost-connection {
padding: 5px;
background-color: crimson;
color: white;
}
2021-07-13 06:08:12 -04:00
footer {
color: #AAA;
font-size: 13px;
2021-07-27 04:52:44 -04:00
margin-top: 10px;
2021-07-11 03:23:28 -04:00
margin-bottom: 30px;
2021-07-13 06:08:12 -04:00
margin-left: 10px;
2021-07-17 04:12:05 -04:00
text-align: center;
2021-07-11 03:23:28 -04:00
}
2021-07-13 06:08:12 -04:00
2021-06-25 09:55:49 -04:00
</style>