Skip to content

Commit

Permalink
feat(frontend): add buildit-monitor page
Browse files Browse the repository at this point in the history
  • Loading branch information
eatradish committed Jun 19, 2024
1 parent caeb8d8 commit e8ab25e
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
},
"dependencies": {
"@mdi/font": "7.0.96",
"@xterm/xterm": "^5.5.0",
"ansi_up": "^6.0.2",
"axios": "^1.6.7",
"core-js": "^3.34.0",
Expand Down
37 changes: 37 additions & 0 deletions frontend/src/pages/monitor/[hostname].vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<template>
<v-container style="height: 100%; font-family: monospace">
<v-row v-if="loading">
<v-spacer></v-spacer>
<v-progress-circular indeterminate></v-progress-circular>
<v-spacer></v-spacer>
</v-row>
<div id="terminal"></div>
</v-container>
</template>

<script lang="ts">
import { Terminal } from "@xterm/xterm";
export default {
mounted() {
this.fetchData();
},
data: () => ({
loading: true,
}),
methods: {
fetchData() {
const term = new Terminal();
let name = (this.$route.params as { hostname: string }).hostname;
const socket = new WebSocket(
`wss://buildit.aosc.io/api/ws/viewer/${name}`
);
this.loading = false;
term.open(document.getElementById('terminal'));
socket.onmessage = (event) => {
const data = event.data;
term.write(data);
};
},
},
};
</script>
5 changes: 5 additions & 0 deletions frontend/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,11 @@
dependencies:
upath "^2.0.1"

"@xterm/xterm@^5.5.0":
version "5.5.0"
resolved "https://registry.yarnpkg.com/@xterm/xterm/-/xterm-5.5.0.tgz#275fb8f6e14afa6e8a0c05d4ebc94523ff775396"
integrity sha512-hqJHYaQb5OptNunnyAnkHyM8aCjZ1MEIDTQu1iIbbTD/xops91NB5yq1ZK/dC2JDbVWtF23zUtl9JE2NqwT87A==

acorn-jsx@^5.3.2:
version "5.3.2"
resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937"
Expand Down

0 comments on commit e8ab25e

Please sign in to comment.