Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions monitor-web/index.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
<!doctype html>
<html lang="en">
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="//lib.baomitu.com/element-plus/2.2.32/index.css" />
<link rel="stylesheet" href="//lib.baomitu.com/font-awesome/6.4.2/css/all.min.css" />
<title>Vite App</title>
<style>
body {
margin: 0;
}
</style>
<meta name="theme-color" content="#061b38" />
<meta name="description" content="flying monitor 服务器监控控制台" />
<title>flying monitor</title>
</head>
<body>
<div id="app"></div>
Expand Down
6 changes: 5 additions & 1 deletion monitor-web/public/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 15 additions & 29 deletions monitor-web/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,22 +1,9 @@
<script setup>
import { onErrorCaptured, ref } from 'vue'
import { useDark, useToggle } from '@vueuse/core'
import { useDark } from '@vueuse/core'

/**
* 初始化主题切换能力,保持现有明暗主题行为。
*/
const isDark = useDark({
selector: 'html',
attribute: 'class',
valueDark: 'dark',
valueLight: 'light'
})
const toggleDark = useToggle(isDark)
useDark({
onChanged(dark) {
toggleDark(dark)
}
})
// 在应用根同步持久化主题,确保公开状态页等无主题控件路由也能恢复明暗模式。
useDark()

const hasError = ref(false)
const errorMessage = ref('')
Expand All @@ -40,29 +27,28 @@ function resetErrorState() {
</script>

<template>
<div v-if="hasError" class="error-boundary">
<el-result icon="error" title="页面发生错误" :sub-title="errorMessage">
<template #extra>
<el-button type="primary" @click="resetErrorState">重试</el-button>
</template>
</el-result>
</div>
<header v-else>
<div class="wrapper">
<router-view />
<div class="app-root">
<div v-if="hasError" class="error-boundary">
<el-result icon="error" title="页面发生错误" :sub-title="errorMessage">
<template #extra>
<el-button type="primary" @click="resetErrorState">重试</el-button>
</template>
</el-result>
</div>
</header>
<router-view v-else />
</div>
</template>

<style scoped>
header {
line-height: 1.5;
.app-root {
min-height: 100vh;
}

.error-boundary {
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background: var(--app-canvas);
}
</style>
167 changes: 150 additions & 17 deletions monitor-web/src/assert/css/element.less
Original file line number Diff line number Diff line change
@@ -1,53 +1,186 @@
:root {
color-scheme: light;
--app-shell: #061b38;
--app-shell-hover: rgba(255, 255, 255, 0.08);
--app-shell-active: #0b6bee;
--app-shell-text: #cbd9eb;
--app-canvas: #f5f7fb;
--app-surface: #ffffff;
--app-surface-soft: #f8faff;
--app-text: #10233f;
--app-text-secondary: #64748b;
--app-border: #dce4ee;
--app-primary: #0b6bee;
--app-primary-soft: #eaf3ff;
--app-success: #16a34a;
--app-warning: #f97316;
--app-danger: #dc2626;
--app-muted: #94a3b8;
--app-shadow-sm: 0 1px 2px rgba(15, 35, 63, 0.04), 0 4px 16px rgba(15, 35, 63, 0.05);
--app-shadow-md: 0 12px 32px rgba(15, 35, 63, 0.12);
--app-radius-sm: 8px;
--app-radius-md: 12px;
--app-radius-lg: 16px;
--app-transition: 180ms ease-out;
--el-color-primary: #0b6bee;
--el-color-success: #16a34a;
--el-color-warning: #f97316;
--el-color-danger: #dc2626;
--el-border-radius-base: 8px;
}

html.dark {
color-scheme: dark;
--app-shell: #050f20;
--app-shell-hover: rgba(255, 255, 255, 0.1);
--app-shell-active: #1677ff;
--app-shell-text: #d8e4f3;
--app-canvas: #0f1726;
--app-surface: #162033;
--app-surface-soft: #19263a;
--app-text: #f1f5f9;
--app-text-secondary: #9dacbf;
--app-border: #2b3a50;
--app-primary: #5aa2ff;
--app-primary-soft: rgba(74, 144, 245, 0.16);
--app-success: #4ade80;
--app-warning: #fb923c;
--app-danger: #f87171;
--app-muted: #718096;
--app-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.18), 0 8px 22px rgba(0, 0, 0, 0.18);
--app-shadow-md: 0 16px 38px rgba(0, 0, 0, 0.34);
}

*,
*::before,
*::after {
box-sizing: border-box;
}

html,
body,
#app {
min-width: 320px;
min-height: 100%;
margin: 0;
}

body {
background: var(--app-canvas);
color: var(--app-text);
font-family:
Inter,
ui-sans-serif,
-apple-system,
BlinkMacSystemFont,
'Segoe UI',
'PingFang SC',
'Microsoft YaHei',
sans-serif;
font-size: 14px;
-webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility;
}

button,
input,
textarea,
select {
font: inherit;
}

::selection {
background: var(--app-primary-soft);
color: var(--app-text);
}

:focus-visible {
outline: 2px solid var(--app-primary);
outline-offset: 2px;
}

.el-button {
min-height: 36px;
border-radius: var(--app-radius-sm);
font-weight: 600;
}

.el-button.is-circle {
min-width: 36px;
}

.el-input__wrapper,
.el-select__wrapper,
.el-textarea__inner {
border-radius: var(--app-radius-sm);
}

.el-drawer {
background: var(--app-surface);
color: var(--app-text);
}

.el-overlay {
background: rgba(4, 15, 32, 0.48);
}

.is-success {
.el-progress-bar__outer {
background-color: #18cb1822 !important;
background-color: rgba(22, 163, 74, 0.14) !important;
}

.el-progress-bar__inner {
background-color: #18cb18 !important;
background-color: var(--app-success) !important;
}

.el-progress-circle__track {
stroke: #18cb1822;
stroke: rgba(22, 163, 74, 0.14);
}

.el-progress-circle__path {
stroke: #18cb18 !important;
stroke: var(--app-success) !important;
}
}

.is-warning {
.el-progress-bar__outer {
background-color: #ffa04622;
background-color: rgba(249, 115, 22, 0.14);
}

.el-progress-circle__track {
stroke: #ffa04622;
}

.el-progress-circle__path {
stroke: #ffa046 !important;
stroke: rgba(249, 115, 22, 0.14);
}

.el-progress-circle__path,
.el-progress-bar__inner {
background-color: #ffa046 !important;
stroke: var(--app-warning) !important;
background-color: var(--app-warning) !important;
}
}

.is-exception {
.el-progress-bar__outer {
background-color: #ef4e4e22;
background-color: rgba(220, 38, 38, 0.14);
}

.el-progress-circle__track {
stroke: #ef4e4e22;
stroke: rgba(220, 38, 38, 0.14);
}

.el-progress-circle__path {
stroke: #ef4e4e !important;
.el-progress-circle__path,
.el-progress-bar__inner {
stroke: var(--app-danger) !important;
background-color: var(--app-danger) !important;
}
}

.el-progress-bar__inner {
background-color: #ef4e4e !important;
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
scroll-behavior: auto !important;
transition-duration: 0.01ms !important;
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
}
}
2 changes: 1 addition & 1 deletion monitor-web/src/component/NotificationBell.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ onMounted(() => {
>
<template #reference>
<el-badge :value="unread" :hidden="unread === 0" :max="99" class="bell-badge">
<el-button :icon="Bell" circle text />
<el-button :icon="Bell" circle text aria-label="打开通知中心" />
</el-badge>
</template>
<div class="bell-panel">
Expand Down
Loading
Loading