Allow direct search links into the eventlog

This commit is contained in:
Johannes Zellner
2025-07-16 13:28:30 +02:00
parent 7f0201b552
commit e632f07708
2 changed files with 15 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
<script setup>
import { ref, reactive, onMounted, watch } from 'vue';
import { ref, reactive, onMounted, onUnmounted, watch } from 'vue';
import moment from 'moment';
import { Button, TextInput, MultiSelect } from '@cloudron/pankow';
import { useDebouncedRef, copyToClipboard } from '@cloudron/pankow/utils';
@@ -135,12 +135,22 @@ function onCopySource(eventlog) {
watch(actions, onRefresh);
watch(search, onRefresh);
async function onHashChange() {
const params = new URLSearchParams(window.location.hash.slice(window.location.hash.indexOf('?')));
search.value = params.get('search') || '';
}
onMounted(async () => {
const [error, result] = await appsModel.list();
if (error) console.error(error);
else apps.value = result;
await onRefresh();
window.addEventListener('hashchange', onHashChange);
onHashChange();
});
onUnmounted(() => {
window.removeEventListener('hashchange', onHashChange);
});
</script>