Skip to content

Commit

Permalink
fix: Quick action errors and device reloads
Browse files Browse the repository at this point in the history
  • Loading branch information
MikMuellerDev committed Oct 25, 2024
1 parent 8269000 commit d7649ed
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
20 changes: 18 additions & 2 deletions web/src/pages/dash/QuickActions/Action.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,14 @@
hmsExecutionResults = [
...hmsExecutionResults,
{
response: hmsRes,
modeRun: true,
response: {
title: data.data.data.name,
success: hmsRes.success,
output: hmsRes.output,
fileContents: new Map(),
errors: hmsRes.errors,
},
},
]
} catch (err) {
Expand All @@ -88,10 +94,20 @@
{/if}

{#if hmsExecutionResults[0] !== undefined}

<!-- bind:open={errorsOpen} -->
<!-- data={{ -->
<!-- modeRun: true, -->
<!-- response: { -->
<!-- }, -->
<!-- }} -->
<!-- on:close={() => { -->
<!-- // This hack is required so that the window still remains scrollable after removal -->
<!-- }} -->

<ExecutionResultPopup
open={hmsExecutionResults[0] !== undefined}
data={hmsExecutionResults[0]}
scriptId={data.data.data.id}
on:close={() => {
// This hack is required so that the window still remains scrollable after removal
setTimeout(() => (hmsExecutionResults = hmsExecutionResults.slice(1)), 1000)
Expand Down
6 changes: 6 additions & 0 deletions web/src/pages/rooms/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,16 @@
for (const room of rooms) {
room.devices = (res as Room[]).find(r => r.data.id === room.data.id).devices
}
currentRoom = currentRoom
} else {
rooms = res
}
const roomId = window.localStorage.getItem('current_room')
const room = roomId === null ? undefined : rooms.find(r => r.data.id === roomId)
currentRoom = room === undefined ? rooms[0] : room
loadedData = true
refreshCounter++
} catch {
$createSnackbar('Could not load rooms', [
{
Expand Down Expand Up @@ -294,6 +297,8 @@
$requests--
}
let refreshCounter = 0
onMount(async () => {
// This call is non-blocking on purpose.
loadDriverDeviceCapabilities()
Expand Down Expand Up @@ -374,6 +379,7 @@
{#each currentRoom !== undefined ? currentRoom.devices : [] as device, i (device.id)}
<Device
style={''}
{refreshCounter}
capabilities={
capabilities.find(
c => c.modelId === device.modelId
Expand Down
2 changes: 2 additions & 0 deletions web/src/pages/rooms/Device.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
let deviceInfoOpen = false
let deviceEditOpen = false
export let refreshCounter = 0
$: if (refreshCounter) { console.log("RELOAD"); loadExtractions() }
export let style = ''
Expand Down

0 comments on commit d7649ed

Please sign in to comment.