mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
feat: store graph in session manager
This commit is contained in:
1 parent
1c017c98c7
commit
3dae9e8552
4 files changed
+32
-26
No files matched your search
@@ -1,36 +1,16 @@
|
||||
<script setup>
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { FileGraph } from '@linux-odyssey/file-graph'
|
||||
import { ref } from 'vue'
|
||||
import FileNode from './FileNode.vue'
|
||||
import socket from '../utils/socket.js'
|
||||
import sessionManager from '../utils/session.js'
|
||||
|
||||
const pwd = ref('/home/rudeus')
|
||||
|
||||
const graph = ref(
|
||||
new FileGraph({
|
||||
path: '/',
|
||||
name: '/',
|
||||
type: 'folder',
|
||||
discovered: false,
|
||||
})
|
||||
)
|
||||
|
||||
onMounted(() => {
|
||||
socket.on('graph', (event) => {
|
||||
// TODO: update graph
|
||||
console.log(event)
|
||||
if (event.discover) {
|
||||
graph.value.discover(event.discover)
|
||||
}
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="tree w-max h-max">
|
||||
<ul>
|
||||
<li>
|
||||
<FileNode :node="graph" :pwd="pwd" />
|
||||
<FileNode :node="sessionManager.graph.value" :pwd="pwd" />
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user