backups plugin history view back link; seed script docstring

This commit is contained in:
2026-08-07 14:40:47 -04:00
parent 5a0017cd9a
commit 70fa8c6420

View File

@@ -1,7 +1,11 @@
<template>
<div class="bh">
<div class="bh-head">
<router-link :to="`/assets/${assetid}`" class="bh-back">&larr; Back to asset</router-link>
<!-- back(), not a route: this page is reached from an asset panel, and
each asset type has its own detail route keyed by its OWN id
(/machines/:machineid, not the assetid we are given). There is no
generic /assets/:id to link to. -->
<button type="button" class="bh-back" @click="goback">&larr; Back</button>
<h1>Configuration Backups</h1>
<p v-if="assetname" class="bh-sub">{{ assetname }}</p>
</div>
@@ -90,12 +94,18 @@
<script setup>
import { ref, onMounted } from 'vue'
import { useRoute } from 'vue-router'
import { useRoute, useRouter } from 'vue-router'
import api from '@/api'
const route = useRoute()
const router = useRouter()
const assetid = route.params.assetid
function goback() {
if (window.history.length > 1) router.back()
else router.push('/machines')
}
const revisions = ref([])
const diffs = ref({})
const assetname = ref('')
@@ -177,7 +187,10 @@ onMounted(load)
<style scoped>
.bh { padding: 1.5rem; }
.bh-head { margin-bottom: 1rem; }
.bh-back { font-size: 0.85rem; }
.bh-back {
font-size: 0.85rem; background: none; border: none; padding: 0;
color: #0d6efd; cursor: pointer;
}
.bh-sub { color: #666; margin: 0.2rem 0 0; }
.bh-note, .bh-muted { color: #666; }
.bh-error { color: #c00; }