Skip to content

Commit

Permalink
show file system for connected node in settings
Browse files Browse the repository at this point in the history
  • Loading branch information
liamcottle committed Dec 5, 2024
1 parent fa2df3e commit de75c4b
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/components/pages/settings/NodeSettingsList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,27 @@

</div>

<!-- file system -->
<div v-if="nodeId.toString() === GlobalState.myNodeId.toString()" class="flex flex-col divide-y bg-white">
<div class="bg-white p-2 font-semibold">File System</div>
<div v-for="fileInfo of GlobalState.myNodeFiles" class="flex p-2 bg-white">

<!-- leading -->
<div class="my-auto ml-2 mr-4 text-gray-500">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">
<path stroke-linecap="round" stroke-linejoin="round" d="M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z" />
</svg>
</div>

<!-- title -->
<div class="my-auto mr-auto">
<div>{{ fileInfo.fileName }}</div>
<div class="text-sm text-gray-500">{{ fileInfo.sizeBytes }} bytes</div>
</div>

</div>
</div>

</div>

</div>
Expand Down
8 changes: 8 additions & 0 deletions src/js/Connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ class Connection {

// listen for packets from radio
// we use this for some packets that don't have their own event listener
GlobalState.myNodeFiles = [];
connection.events.onFromRadio.subscribe(async (data) => {

await databaseToBeReady;
Expand Down Expand Up @@ -238,6 +239,13 @@ class Connection {
}
}

// handle fileInfo
if(data.payloadVariant.case.toString() === "fileInfo"){
const fileInfo = data.payloadVariant.value;
console.log("fileInfo", fileInfo);
GlobalState.myNodeFiles.push(fileInfo);
}

// handle config complete
if(data.payloadVariant.case.toString() === "configCompleteId"){

Expand Down
1 change: 1 addition & 0 deletions src/js/GlobalState.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const globalState = reactive({
myNodeId: null,
myNodeUser: null,
myNodeDeviceMetrics: null,
myNodeFiles: [],

loraConfig: null,
channelsByIndex: {},
Expand Down

0 comments on commit de75c4b

Please sign in to comment.