mirror of
https://github.com/KevinMidboe/infra-map.git
synced 2026-02-12 11:19:20 +00:00
global search component
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import PageHeader from '$lib/components/PageHeader.svelte';
|
||||
import ServerComp from '$lib/components/Server.svelte';
|
||||
import ServerSummary from '$lib/components/ServerSummary.svelte';
|
||||
@@ -7,6 +8,34 @@
|
||||
let { data }: { data: PageData } = $props();
|
||||
|
||||
const { cluster, nodes } = data;
|
||||
const allVms: Array<VM> = nodes.flatMap((n) => n.vms).filter((v) => v.template !== 1);
|
||||
const allLxcs: Array<LXC> = nodes.flatMap((n) => n.lxcs);
|
||||
|
||||
onMount(() => {
|
||||
window.elements = [
|
||||
...allVms
|
||||
.map((vm) => {
|
||||
return {
|
||||
link: `/servers/vm/${vm.name}`,
|
||||
...vm
|
||||
};
|
||||
})
|
||||
.filter((d) => d.name),
|
||||
...nodes.map(node => {
|
||||
return {
|
||||
link: `/servers/node/${node.name}`,
|
||||
...node
|
||||
}
|
||||
}),
|
||||
...allLxcs.map(lxc => {
|
||||
return {
|
||||
link: `/servers/lxc/${lxc.name}`,
|
||||
...lxc
|
||||
}
|
||||
})
|
||||
];
|
||||
});
|
||||
console.log(allLxcs)
|
||||
</script>
|
||||
|
||||
<PageHeader>Servers</PageHeader>
|
||||
|
||||
Reference in New Issue
Block a user