Skip to content

Commit 7888e43

Browse files
committed
feat: 完成服务器页面和配置编辑页
1 parent 651e517 commit 7888e43

31 files changed

Lines changed: 1250 additions & 100 deletions

LICENSE.old

Lines changed: 0 additions & 21 deletions
This file was deleted.

global.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
declare const GIT_BRANCH: string;
2+
declare const GIT_COMMITHASH: string;
3+
declare const GIT_VERSION: string;
4+
declare const GIT_LASTCOMMITDATETIME: string;

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
},
1111
"dependencies": {
1212
"@mdi/js": "^7.4.47",
13+
"ansi_up": "^6.0.2",
1314
"axios": "^1.7.9",
1415
"chart.js": "^4.4.7",
1516
"numeral": "^2.0.6",
@@ -24,6 +25,7 @@
2425
"@vue/eslint-config-prettier": "^8.0.0",
2526
"autoprefixer": "^10.4.20",
2627
"eslint-plugin-vue": "^9.32.0",
28+
"git-revision-vite-plugin": "^0.0.11",
2729
"postcss": "^8.4.49",
2830
"postcss-import": "^15.1.0",
2931
"prettier": "^3.4.2",

pnpm-lock.yaml

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/App.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<script setup lang="ts">
22
import { RouterView } from 'vue-router';
3+
import NotificationContainer from './components/NotificationContainer.vue';
34
</script>
45

56
<template>
67
<RouterView />
8+
<NotificationContainer />
79
</template>
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
<script setup lang="ts">
2+
defineProps(['message']);
3+
</script>
4+
15
<template>
26
<div class="text-center py-24 text-gray-500 dark:text-slate-400">
3-
<p>Nothing's here…</p>
7+
<p v-if="message">{{ message }}</p>
8+
<p v-else>Nothing's here…</p>
49
</div>
510
</template>

src/components/CardBoxComponentHeader.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const buttonClick = (event) => {
2828
<div class="flex items-center py-3 grow font-bold" :class="[icon ? 'px-4' : 'px-6']">
2929
<BaseIcon v-if="icon" :path="icon" class="mr-3" />
3030
{{ title }}
31+
<slot />
3132
</div>
3233
<button
3334
v-if="buttonIcon"

src/components/CardBoxModal.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ window.addEventListener('keydown', (e) => {
7575
<template #footer>
7676
<BaseButtons>
7777
<BaseButton :label="buttonLabel" :color="button" @click="confirm" />
78-
<BaseButton v-if="hasCancel" label="Cancel" :color="button" outline @click="cancel" />
78+
<BaseButton v-if="hasCancel" label="取消" :color="button" outline @click="cancel" />
7979
</BaseButtons>
8080
</template>
8181
</CardBox>

src/components/Console.vue

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<script setup lang="ts">
2+
import { AnsiUp } from 'ansi_up';
3+
import { computed, nextTick, onMounted, ref, watch } from 'vue';
4+
5+
const props = defineProps({
6+
datas: {
7+
type: Array,
8+
require: true,
9+
default: [],
10+
},
11+
});
12+
13+
const scrollToBottom = () =>
14+
(consoleRef.value.scrollTop = consoleRef.value.scrollHeight ?? 0);
15+
16+
const consoleRef = ref();
17+
const length = computed(() => props.datas.length);
18+
const ansiUp = new AnsiUp();
19+
ansiUp.use_classes = true;
20+
21+
watch(length, () => nextTick(scrollToBottom));
22+
onMounted(scrollToBottom);
23+
</script>
24+
25+
<template>
26+
<div id="console" ref="consoleRef" class="py-1 overflow-y-scroll">
27+
<div
28+
class="whitespace-pre-wrap break-all hover:bg-[#8881] px-3 transition-colors"
29+
v-for="line in datas"
30+
>
31+
<span v-html="ansiUp.ansi_to_html(line as string)"></span>
32+
</div>
33+
</div>
34+
</template>
35+
36+
<style>
37+
div#console {
38+
font-family: Consolas, 'Courier New', Courier, '微软雅黑';
39+
height: 50vh;
40+
min-height: 500px;
41+
scrollbar-width: thin;
42+
scrollbar-color: rgb(156, 163, 175) rgb(249, 250, 251);
43+
}
44+
45+
div#console::-webkit-scrollbar {
46+
width: 8px;
47+
height: 8px;
48+
}
49+
50+
.dark div#console {
51+
color-scheme: dark;
52+
scrollbar-color: rgb(71, 85, 105) rgb(30, 41, 59);
53+
}
54+
</style>

src/components/FooterBar.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script setup lang="ts">
22
import { containerMaxW } from '@/config.js';
33
import BaseLevel from '@/components/BaseLevel.vue';
4+
import { gitInfo } from '@/utils/constants';
45
</script>
56

67
<template>
@@ -13,8 +14,9 @@ import BaseLevel from '@/components/BaseLevel.vue';
1314
href="https://sereindev.github.io/"
1415
target="_blank"
1516
class="text-blue-600"
16-
>Serein</a
17-
>.
17+
>Serein
18+
</a>
19+
<code :title="gitInfo.sha"> @ {{ gitInfo.shortSha }} </code>
1820
</div>
1921
</BaseLevel>
2022
</footer>

0 commit comments

Comments
 (0)