2021-06-25 21:55:49 +08:00
< template >
2021-08-10 15:02:46 +08:00
< div :class = "classes" >
2021-08-08 07:47:29 +02:00
< div v-if = "! $root.socket.connected && ! $root.socket.firstConnect" class="lost-connection" >
< div class = "container-fluid" >
{ { $root . connectionErrorMsg } }
2022-03-22 23:46:13 +08:00
< div v-if = "$root.showReverseProxyGuide" >
2022-04-29 20:17:15 +08:00
{ { $t ( "Using a Reverse Proxy?" ) } } < a href = "https://github.com/louislam/uptime-kuma/wiki/Reverse-Proxy" target = "_blank" > { { $t ( "Check how to config it for WebSocket" ) } } < / a >
2022-03-22 23:46:13 +08:00
< / div >
2021-08-08 07:47:29 +02:00
< / div >
2021-06-25 21:55:49 +08:00
< / div >
2021-08-08 07:47:29 +02:00
<!-- Desktop header -- >
< header v-if = "! $root.isMobile" class="d-flex flex-wrap justify-content-center py-3 mb-3 border-bottom" >
< router-link to = "/dashboard" class = "d-flex align-items-center mb-3 mb-md-0 me-md-auto text-dark text-decoration-none" >
2021-08-24 23:38:25 +08:00
< object class = "bi me-2 ms-4" width = "40" height = "40" data = "/icon.svg" / >
2021-09-26 18:49:39 +03:30
< span class = "fs-4 title" > { { $t ( "Uptime Kuma" ) } } < / span >
2021-08-08 07:47:29 +02:00
< / router-link >
2021-08-21 19:50:22 +08:00
< a v-if = "hasNewVersion" target="_blank" href="https://github.com/louislam/uptime-kuma/releases" class="btn btn-info me-3" >
2021-08-24 16:44:58 +08:00
< font-awesome-icon icon = "arrow-alt-circle-up" / > { { $t ( "New Update" ) } }
2021-08-21 19:50:22 +08:00
< / a >
2021-08-08 07:47:29 +02:00
< ul class = "nav nav-pills" >
2022-03-18 14:14:22 +08:00
< li v-if = "$root.loggedIn" class="nav-item me-2" >
2022-03-10 21:34:30 +08:00
< router-link to = "/manage-status-page" class = "nav-link" >
< font-awesome-icon icon = "stream" / > { { $t ( "Status Pages" ) } }
< / router-link >
2021-09-11 19:40:03 +08:00
< / li >
2021-10-01 15:12:37 +02:00
< li v-if = "$root.loggedIn" class="nav-item me-2" >
2021-08-08 07:47:29 +02:00
< router-link to = "/dashboard" class = "nav-link" >
2021-08-24 16:44:58 +08:00
< font-awesome-icon icon = "tachometer-alt" / > { { $t ( "Dashboard" ) } }
2021-08-08 07:47:29 +02:00
< / router-link >
< / li >
2021-10-01 15:12:37 +02:00
< li v-if = "$root.loggedIn" class="nav-item" >
2022-04-19 00:39:49 +08:00
< div class = "dropdown dropdown-profile-pic" >
2022-05-06 14:52:09 +08:00
< div class = "nav-link" data -bs -toggle = " dropdown " >
2022-04-19 19:40:28 +08:00
< div class = "profile-pic" > { { $root . usernameFirstChar } } < / div >
2022-04-19 00:39:49 +08:00
< font-awesome-icon icon = "angle-down" / >
< / div >
2022-09-17 22:00:11 +08:00
<!-- Header ' s Dropdown Menu -- >
2022-04-19 00:39:49 +08:00
< ul class = "dropdown-menu" >
2022-09-17 22:00:11 +08:00
<!-- Username -- >
2022-04-20 15:01:13 +08:00
< li >
2022-04-20 15:09:31 +08:00
< i18n-t v-if = "$root.username != null" tag="span" keypath="signedInDisp" class="dropdown-item-text" >
< strong > { { $root . username } } < / strong >
< / i18n-t >
< span v-if = "$root.username == null" class="dropdown-item-text" > {{ $ t ( " signedInDispDisabled " ) }} < / span >
2022-04-20 15:01:13 +08:00
< / li >
2022-09-17 22:00:11 +08:00
2022-04-19 00:39:49 +08:00
< li > < hr class = "dropdown-divider" > < / li >
2022-09-17 22:00:11 +08:00
<!-- Functions -- >
< li >
< router-link to = "/maintenance" class = "dropdown-item" : class = "{ active: $route.path.includes('manage-maintenance') }" >
< font-awesome-icon icon = "wrench" / > { { $t ( "Maintenance" ) } }
< / router-link >
< / li >
2022-04-19 00:39:49 +08:00
< li >
2022-10-11 01:45:30 +08:00
< router-link to = "/settings/general" class = "dropdown-item" : class = "{ active: $route.path.includes('settings') }" >
2022-04-19 00:39:49 +08:00
< font-awesome-icon icon = "cog" / > { { $t ( "Settings" ) } }
< / router-link >
< / li >
2022-09-17 22:00:11 +08:00
2023-01-16 12:39:24 +08:00
< li >
< a href = "https://github.com/louislam/uptime-kuma/wiki" class = "dropdown-item" target = "_blank" >
< font-awesome-icon icon = "info-circle" / > { { $t ( "Help" ) } }
< / a >
< / li >
2022-04-20 22:39:07 +08:00
< li v-if = "$root.loggedIn && $root.socket.token !== 'autoLogin'" >
2022-04-19 00:39:49 +08:00
< button class = "dropdown-item" @click ="$root.logout" >
< font-awesome-icon icon = "sign-out-alt" / >
{ { $t ( "Logout" ) } }
< / button >
< / li >
< / ul >
< / div >
2021-08-08 07:47:29 +02:00
< / li >
< / ul >
< / header >
<!-- Mobile header -- >
< header v -else class = "d-flex flex-wrap justify-content-center pt-2 pb-2 mb-3" >
< router-link to = "/dashboard" class = "d-flex align-items-center text-dark text-decoration-none" >
< object class = "bi" width = "40" height = "40" data = "/icon.svg" / >
< span class = "fs-4 title ms-2" > Uptime Kuma < / span >
< / router-link >
< / header >
< main >
2022-05-01 17:31:58 +08:00
< router-view v-if = "$root.loggedIn" / >
2021-08-08 07:47:29 +02:00
< Login v-if = "! $root.loggedIn && $root.allowLoginDialog" / >
< / main >
<!-- Mobile Only -- >
2023-03-10 17:42:06 +01:00
< div v-if = "$root.isMobile" style="width: 100%; height: calc(60px + env(safe-area-inset-bottom));" / >
2022-09-17 22:00:11 +08:00
< nav v-if = "$root.isMobile && $root.loggedIn" class="bottom-nav" >
2021-08-19 18:12:52 +08:00
< router-link to = "/dashboard" class = "nav-link" >
2021-08-08 07:47:29 +02:00
< div > < font-awesome-icon icon = "tachometer-alt" / > < / div >
2022-12-12 15:54:46 +08:00
{ { $t ( "Home" ) } }
2021-08-08 07:47:29 +02:00
< / router-link >
2021-08-19 18:12:52 +08:00
< router-link to = "/list" class = "nav-link" >
2021-08-08 07:47:29 +02:00
< div > < font-awesome-icon icon = "list" / > < / div >
2021-08-24 18:26:44 +08:00
{ { $t ( "List" ) } }
2021-08-19 18:12:52 +08:00
< / router-link >
2021-08-08 07:47:29 +02:00
2021-08-19 18:12:52 +08:00
< router-link to = "/add" class = "nav-link" >
2021-08-08 07:47:29 +02:00
< div > < font-awesome-icon icon = "plus" / > < / div >
2022-10-11 22:28:00 +08:00
{ { $t ( "Add" ) } }
2022-01-23 15:22:00 +01:00
< / router-link >
2021-08-19 18:12:52 +08:00
< router-link to = "/settings" class = "nav-link" >
2021-08-08 07:47:29 +02:00
< div > < font-awesome-icon icon = "cog" / > < / div >
2021-08-24 16:44:58 +08:00
{ { $t ( "Settings" ) } }
2021-08-08 07:47:29 +02:00
< / router-link >
< / nav >
2023-09-06 19:52:54 +08:00
< button
v - if = "numActiveToasts != 0"
type = "button"
class = "btn btn-normal clear-all-toast-btn"
@ click = "clearToasts"
>
< font-awesome-icon icon = "times" / >
< / button >
2021-08-08 07:47:29 +02:00
< / div >
2021-06-25 21:55:49 +08:00
< / template >
< script >
import Login from "../components/Login.vue" ;
2021-08-21 19:50:22 +08:00
import compareVersions from "compare-versions" ;
2023-09-06 19:52:54 +08:00
import { useToast } from "vue-toastification" ;
const toast = useToast ( ) ;
2021-06-25 21:55:49 +08:00
export default {
2021-08-10 15:02:46 +08:00
2021-06-25 21:55:49 +08:00
components : {
2021-07-27 19:47:13 +02:00
Login ,
2021-07-11 15:23:28 +08:00
} ,
2021-08-10 15:02:46 +08:00
2021-07-11 15:23:28 +08:00
data ( ) {
2023-09-06 19:52:54 +08:00
return {
toastContainer : null ,
numActiveToasts : 0 ,
toastContainerObserver : null ,
} ;
2021-06-25 21:55:49 +08:00
} ,
2021-08-10 15:02:46 +08:00
computed : {
// Theme or Mobile
classes ( ) {
const classes = { } ;
classes [ this . $root . theme ] = true ;
classes [ "mobile" ] = this . $root . isMobile ;
return classes ;
2021-08-21 19:50:22 +08:00
} ,
hasNewVersion ( ) {
if ( this . $root . info . latestVersion && this . $root . info . version ) {
return compareVersions ( this . $root . info . latestVersion , this . $root . info . version ) >= 1 ;
} else {
return false ;
}
} ,
2021-08-10 15:02:46 +08:00
} ,
2021-06-25 21:55:49 +08:00
watch : {
2021-09-23 13:57:24 +08:00
2021-07-27 19:47:13 +02:00
} ,
2021-08-10 15:02:46 +08:00
2021-07-27 19:47:13 +02:00
mounted ( ) {
2023-09-06 19:52:54 +08:00
this . toastContainer = document . querySelector ( ".bottom-right.toast-container" ) ;
// Watch the number of active toasts
this . toastContainerObserver = new MutationObserver ( ( mutations ) => {
for ( const mutation of mutations ) {
if ( mutation . type === "childList" ) {
this . numActiveToasts = mutation . target . children . length ;
}
}
} ) ;
2021-09-23 13:57:24 +08:00
2023-09-06 19:52:54 +08:00
if ( this . toastContainer != null ) {
this . toastContainerObserver . observe ( this . toastContainer , { childList : true } ) ;
}
2021-06-25 21:55:49 +08:00
} ,
2021-08-10 15:02:46 +08:00
2023-09-06 19:52:54 +08:00
beforeUnmount ( ) {
this . toastContainerObserver . disconnect ( ) ;
} ,
2021-09-15 20:40:26 +08:00
2023-09-06 19:52:54 +08:00
methods : {
/ * *
* Clear all toast notifications .
* /
clearToasts ( ) {
toast . clear ( ) ;
}
2021-07-27 19:47:13 +02:00
} ,
2021-08-10 15:02:46 +08:00
2021-09-22 18:05:40 +08:00
} ;
2021-06-25 21:55:49 +08:00
< / script >
2021-08-08 07:47:29 +02:00
< style lang = "scss" scoped >
2021-07-11 15:23:28 +08:00
@ import "../assets/vars.scss" ;
2021-06-25 21:55:49 +08:00
2021-09-11 19:40:03 +08:00
. nav - link {
& . status - page {
background - color : rgba ( 255 , 255 , 255 , 0.1 ) ;
}
}
2021-07-11 15:23:28 +08:00
. bottom - nav {
z - index : 1000 ;
position : fixed ;
bottom : 0 ;
2023-03-10 17:42:06 +01:00
height : calc ( 60 px + env ( safe - area - inset - bottom ) ) ;
2021-07-11 15:23:28 +08:00
width : 100 % ;
left : 0 ;
2021-07-13 12:16:11 +08:00
background - color : # fff ;
2021-07-11 15:23:28 +08:00
box - shadow : 0 15 px 47 px 0 rgba ( 0 , 0 , 0 , 0.05 ) , 0 5 px 14 px 0 rgba ( 0 , 0 , 0 , 0.05 ) ;
text - align : center ;
white - space : nowrap ;
2023-03-10 17:42:06 +01:00
padding : 0 10 px env ( safe - area - inset - bottom ) ;
2021-06-25 21:55:49 +08:00
2021-07-11 15:23:28 +08:00
a {
text - align : center ;
width : 25 % ;
display : inline - block ;
height : 100 % ;
padding : 8 px 10 px 0 ;
font - size : 13 px ;
color : # c1c1c1 ;
overflow : hidden ;
text - decoration : none ;
2021-06-30 21:04:58 +08:00
2022-03-04 23:20:42 +08:00
& . router - link - exact - active , & . active {
2021-07-11 15:23:28 +08:00
color : $primary ;
font - weight : bold ;
}
div {
font - size : 20 px ;
}
2021-06-30 21:04:58 +08:00
}
2021-07-11 15:23:28 +08:00
}
2021-08-09 01:58:56 +08:00
main {
2021-08-24 23:38:25 +08:00
min - height : calc ( 100 vh - 160 px ) ;
2021-08-09 01:58:56 +08:00
}
2021-07-11 15:23:28 +08:00
. title {
font - weight : bold ;
}
. nav {
margin - right : 25 px ;
}
. lost - connection {
padding : 5 px ;
background - color : crimson ;
color : white ;
2022-03-22 23:46:13 +08:00
position : fixed ;
width : 100 % ;
2022-03-31 16:15:34 +08:00
z - index : 99999 ;
2021-07-11 15:23:28 +08:00
}
2022-04-19 00:39:49 +08:00
// Profile Pic Button with Dropdown
. dropdown - profile - pic {
user - select : none ;
. nav - link {
cursor : pointer ;
display : flex ;
gap : 6 px ;
align - items : center ;
background - color : rgba ( 200 , 200 , 200 , 0.2 ) ;
padding : 0.5 rem 0.8 rem ;
& : hover {
background - color : rgba ( 255 , 255 , 255 , 0.2 ) ;
}
}
. dropdown - menu {
transition : all 0.2 s ;
padding - left : 0 ;
2022-04-20 22:39:07 +08:00
padding - bottom : 0 ;
2022-04-19 19:46:21 +08:00
margin - top : 8 px ! important ;
2022-04-20 22:39:07 +08:00
border - radius : 16 px ;
overflow : hidden ;
2022-04-19 00:39:49 +08:00
. dropdown - divider {
margin : 0 ;
border - top : 1 px solid rgba ( 0 , 0 , 0 , 0.4 ) ;
background - color : transparent ;
}
. dropdown - item - text {
font - size : 14 px ;
padding - bottom : 0.7 rem ;
}
. dropdown - item {
padding : 0.7 rem 1 rem ;
}
. dark & {
background - color : $dark - bg ;
color : $dark - font - color ;
border - color : $dark - border - color ;
. dropdown - item {
color : $dark - font - color ;
& . active {
color : $dark - font - color2 ;
background - color : $highlight ! important ;
}
& : hover {
background - color : $dark - bg2 ;
}
}
}
}
. profile - pic {
display : flex ;
align - items : center ;
justify - content : center ;
color : white ;
background - color : $primary ;
width : 24 px ;
height : 24 px ;
margin - right : 5 px ;
border - radius : 50 rem ;
font - weight : bold ;
font - size : 10 px ;
}
2021-07-11 15:23:28 +08:00
}
2021-08-08 07:47:29 +02:00
. dark {
header {
2021-10-20 18:54:20 +08:00
background - color : $dark - header - bg ;
border - bottom - color : $dark - header - bg ! important ;
2021-08-08 07:47:29 +02:00
span {
2021-08-24 23:38:25 +08:00
color : # f0f6fc ;
2021-08-08 07:47:29 +02:00
}
}
. bottom - nav {
background - color : $dark - bg ;
}
}
2023-09-06 19:52:54 +08:00
. clear - all - toast - btn {
position : fixed ;
right : 1 em ;
bottom : 1 em ;
font - size : 1.2 em ;
padding : 9 px 15 px ;
width : 48 px ;
box - shadow : 2 px 2 px 30 px rgba ( 0 , 0 , 0 , 0.2 ) ;
}
@ media ( max - width : 770 px ) {
. clear - all - toast - btn {
bottom : 72 px ;
z - index : 100 ;
}
}
2021-06-25 21:55:49 +08:00
< / style >