chore: Port huge amount of code to OliveTin 3k

This commit is contained in:
jamesread
2025-08-20 00:05:40 +01:00
parent 17c716c599
commit 6b342cbedb
59 changed files with 3973 additions and 3290 deletions

View File

@@ -1,94 +1,51 @@
<template>
<div class="diagnostics-view">
<div class="diagnostics-content">
<p class="note">
<strong>Note:</strong> Diagnostics are only generated on OliveTin startup - they are not updated in real-time or
when you refresh this page.
They are intended as a "quick reference" to help you.
</p>
<p class="note">
If you are having problems with OliveTin and want to raise a support request, please don't take a screenshot or
copy text from this page,
but instead it is highly recommended to include a
<a href="https://docs.olivetin.app/sosreport.html" target="_blank">sosreport</a>
which is more detailed, and makes it easier to help you.
</p>
<div class="diagnostics-section">
<h3>SSH</h3>
<table class="diagnostics-table">
<tbody>
<tr>
<td width="10%">Found Key</td>
<td>{{ diagnostics.sshFoundKey || '?' }}</td>
</tr>
<tr>
<td>Found Config</td>
<td>{{ diagnostics.sshFoundConfig || '?' }}</td>
</tr>
</tbody>
</table>
</div>
<div v-if="diagnostics.system" class="diagnostics-section">
<h3>System</h3>
<table class="diagnostics-table">
<tbody>
<tr v-for="(value, key) in diagnostics.system" :key="key">
<td width="10%">{{ formatKey(key) }}</td>
<td>{{ value }}</td>
</tr>
</tbody>
</table>
</div>
<div v-if="diagnostics.network" class="diagnostics-section">
<h3>Network</h3>
<table class="diagnostics-table">
<tbody>
<tr v-for="(value, key) in diagnostics.network" :key="key">
<td width="10%">{{ formatKey(key) }}</td>
<td>{{ value }}</td>
</tr>
</tbody>
</table>
</div>
<div v-if="diagnostics.storage" class="diagnostics-section">
<h3>Storage</h3>
<table class="diagnostics-table">
<tbody>
<tr v-for="(value, key) in diagnostics.storage" :key="key">
<td width="10%">{{ formatKey(key) }}</td>
<td>{{ value }}</td>
</tr>
</tbody>
</table>
</div>
<div v-if="diagnostics.services" class="diagnostics-section">
<h3>Services</h3>
<table class="diagnostics-table">
<tbody>
<tr v-for="(value, key) in diagnostics.services" :key="key">
<td width="10%">{{ formatKey(key) }}</td>
<td>{{ value }}</td>
</tr>
</tbody>
</table>
</div>
<div v-if="diagnostics.errors && diagnostics.errors.length > 0" class="diagnostics-section">
<h3>Errors</h3>
<div class="error-list">
<div v-for="(error, index) in diagnostics.errors" :key="index" class="error-item">
{{ error }}
</div>
</div>
</div>
<section>
<div class="section-header">
<h2>Get support</h2>
</div>
</div>
<div class="section-content">
<p>If you are having problems with OliveTin and want to raise a support request, it would be very helpful to include a sosreport from this page.
</p>
<ul>
<li>
<a href="https://docs.olivetin.app/sosreport.html" target="_blank">sosreport Documentation</a>
</li>
<li>
<a href = "https://docs.olivetin.app/troubleshooting/wheretofindhelp.html" target="_blank">Where to find help</a>
</li>
</ul>
</div>
</section>
<section>
<div class="section-header">
<h2>SSH</h2>
</div>
<div class="section-content">
<dl>
<dt>Found Key</dt>
<dd>{{ diagnostics.sshFoundKey || '?' }}</dd>
<dt>Found Config</dt>
<dd>{{ diagnostics.sshFoundConfig || '?' }}</dd>
</dl>
</div>
</section>
<section>
<div class="section-header">
<h2>SOS Report</h2>
</div>
<div class="section-content">
<p>This section allows you to generate a detailed report of your configuration and environment. It is a good idea to include this when raising a support request.</p>
<div role="toolbar">
<button @click="generateSosReport" :disabled="loading" class = "good">Generate SOS Report</button>
</div>
<textarea v-model="sosReport" readonly style="flex: 1; min-height: 200px; resize: vertical;"></textarea>
</div>
</section>
</template>
<script setup>
@@ -96,6 +53,7 @@ import { ref, onMounted } from 'vue'
const diagnostics = ref({})
const loading = ref(false)
const sosReport = ref('Waiting to start...')
async function fetchDiagnostics() {
loading.value = true
@@ -103,8 +61,8 @@ async function fetchDiagnostics() {
try {
const response = await window.client.getDiagnostics();
diagnostics.value = {
sshFoundKey: response.sshFoundKey,
sshFoundConfig: response.sshFoundConfig
sshFoundKey: response.SshFoundKey,
sshFoundConfig: response.SshFoundConfig
};
} catch (err) {
console.error('Failed to fetch diagnostics:', err);
@@ -123,6 +81,12 @@ function formatKey(key) {
.trim()
}
async function generateSosReport() {
const response = await window.client.sosReport()
console.log("response", response)
sosReport.value = response.alert
}
onMounted(() => {
fetchDiagnostics()
})
@@ -157,23 +121,6 @@ onMounted(() => {
text-decoration: underline;
}
.diagnostics-section {
margin-bottom: 2rem;
background: #fff;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
overflow: hidden;
}
.diagnostics-section h3 {
margin: 0;
padding: 1rem;
background: #f8f9fa;
border-bottom: 1px solid #dee2e6;
font-size: 1.1rem;
font-weight: 600;
}
.diagnostics-table {
width: 100%;
border-collapse: collapse;
@@ -212,4 +159,15 @@ onMounted(() => {
.error-item:last-child {
margin-bottom: 0;
}
.flex-col {
display: flex;
flex-direction: column;
}
.section-content {
display: flex;
flex-direction: column;
gap: 1em;
}
</style>