File tree Expand file tree Collapse file tree
routes/(authenticated)/hubs Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import type { HubConnection } from '@microsoft/signalr' ;
2+
3+ export async function serializeEmergencyStopMessage ( connection : HubConnection | null , deviceId : string ) {
4+ if ( connection === null ) return ;
5+ await connection . send ( 'EmergencyStop' , deviceId ) ;
6+ }
Original file line number Diff line number Diff line change 1+ import type { HubConnection } from '@microsoft/signalr' ;
2+
3+ export async function serializeRebootMessage ( connection : HubConnection | null , deviceId : string ) {
4+ if ( connection === null ) return ;
5+ await connection . send ( 'Reboot' , deviceId ) ;
6+ }
Original file line number Diff line number Diff line change 33 import { goto } from ' $app/navigation' ;
44 import { Button } from ' $lib/components/ui/button' ;
55 import * as DropdownMenu from ' $lib/components/ui/dropdown-menu' ;
6+ import { SignalR_Connection } from ' $lib/signalr' ;
7+ import { serializeEmergencyStopMessage } from ' $lib/signalr/serializers/EmergencyStop' ;
8+ import { serializeRebootMessage } from ' $lib/signalr/serializers/Reboot' ;
69 import { toast } from ' svelte-sonner' ;
10+ import { get } from ' svelte/store' ;
711 import type { Hub } from ' ./columns' ;
812 import HubDeleteDialog from ' ./dialog-hub-delete.svelte' ;
913 import HubEditDialog from ' ./dialog-hub-edit.svelte' ;
4145 <DropdownMenu .Content >
4246 <DropdownMenu .Item onclick ={copyId }>Copy ID</DropdownMenu .Item >
4347 <DropdownMenu .Item onclick ={() => goto (` /hubs/${hub .id }/update ` )}>Update</DropdownMenu .Item >
48+ <DropdownMenu .Item onclick ={() => serializeRebootMessage (get (SignalR_Connection ), hub .id )}>
49+ Reboot
50+ </DropdownMenu .Item >
51+ <DropdownMenu .Item
52+ class =" text-red-500"
53+ onclick ={() => serializeEmergencyStopMessage (get (SignalR_Connection ), hub .id )}
54+ >
55+ Emergency Stop
56+ </DropdownMenu .Item >
4457 <DropdownMenu .Item onclick ={() => (regenerateTokenDialogOpen = true )}>
4558 Regenerate Token
4659 </DropdownMenu .Item >
You can’t perform that action at this time.
0 commit comments