-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(frontend): add buildit-monitor page
- Loading branch information
Showing
3 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters