@@ -2,27 +2,35 @@ import BugApiButton from "@core/BugApiButton";
22import BugToolbarWrapper from "@core/BugToolbarWrapper" ;
33import LaunchIcon from "@mui/icons-material/Launch" ;
44import SaveIcon from "@mui/icons-material/Save" ;
5+ import TerminalIcon from "@mui/icons-material/Terminal" ;
56import Divider from "@mui/material/Divider" ;
67import ListItemIcon from "@mui/material/ListItemIcon" ;
78import ListItemText from "@mui/material/ListItemText" ;
89import MenuItem from "@mui/material/MenuItem" ;
910import AxiosCommand from "@utils/AxiosCommand" ;
1011import { useAlert } from "@utils/Snackbar" ;
11- import React from "react" ;
1212import { useSelector } from "react-redux" ;
1313
1414export default function Toolbar ( { panelId, ...props } ) {
1515 const sendAlert = useAlert ( ) ;
1616 const panelConfig = useSelector ( ( state ) => state . panelConfig ) ;
1717
18- const handleLaunchClicked = async ( event , item ) => {
18+ const handleUILaunchClicked = async ( event , item ) => {
1919 if ( panelConfig ?. data ?. address ) {
2020 const url = `http://${ panelConfig . data . address } ` ;
2121 const newWindow = window . open ( url , "_blank" , "noopener,noreferrer" ) ;
2222 if ( newWindow ) newWindow . opener = null ;
2323 }
2424 } ;
2525
26+ const handleTerminalLaunchClicked = async ( event , item ) => {
27+ if ( panelConfig ?. data ?. address ) {
28+ const url = `http://${ panelConfig . data . address } :8081` ;
29+ const newWindow = window . open ( url , "_blank" , "noopener,noreferrer" ) ;
30+ if ( newWindow ) newWindow . opener = null ;
31+ }
32+ } ;
33+
2634 const handleSave = async ( event , item ) => {
2735 sendAlert ( "Saving device config ... please wait" , {
2836 variant : "info" ,
@@ -58,11 +66,17 @@ export default function Toolbar({ panelId, ...props }) {
5866 < ListItemText primary = "Save Changes" />
5967 </ MenuItem > ,
6068 < Divider key = "divider" /> ,
61- < MenuItem key = "launch" onClick = { handleLaunchClicked } >
69+ < MenuItem key = "launch" onClick = { handleUILaunchClicked } >
6270 < ListItemIcon >
6371 < LaunchIcon fontSize = "small" />
6472 </ ListItemIcon >
65- < ListItemText primary = "Launch device webpage" />
73+ < ListItemText primary = "Launch device UI" />
74+ </ MenuItem > ,
75+ < MenuItem key = "launch" onClick = { handleTerminalLaunchClicked } >
76+ < ListItemIcon >
77+ < TerminalIcon fontSize = "small" />
78+ </ ListItemIcon >
79+ < ListItemText primary = "Launch device terminal" />
6680 </ MenuItem > ,
6781 ] ;
6882 } ;
0 commit comments