From ee2db276bb0bbd522f758e0b66f7e7b2f4afd9d5 Mon Sep 17 00:00:00 2001 From: Sabir Hassan Date: Fri, 2 Sep 2022 23:40:02 +0500 Subject: [PATCH 1/2] feat: add option for program launch in context menu --- web/src/components/tree.tsx | 43 +++++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/web/src/components/tree.tsx b/web/src/components/tree.tsx index a76b4ae2..382cef6c 100644 --- a/web/src/components/tree.tsx +++ b/web/src/components/tree.tsx @@ -63,6 +63,7 @@ const TreeViewNode = ({ rename, defaultExpanded }: Props) => { + // const appContext = useContext(AppContext) const [deleteConfirmationModalOpen, setDeleteConfirmationModalOpen] = useState(false) const [deleteConfirmationModalMessage, setDeleteConfirmationModalMessage] = @@ -78,6 +79,23 @@ const TreeViewNode = ({ mouseY: number } | null>(null) + // const isFileLaunchable = (filename: string) => { + // const availableRuntimes = Object.values(appContext.runTimes) + + // } + + const launchProgram = () => { + const baseUrl = window.location.origin + window.open(`${baseUrl}/SASjsApi/stp/execute?_program=${node.relativePath}`) + } + + const launchProgramWithDebug = () => { + const baseUrl = window.location.origin + window.open( + `${baseUrl}/SASjsApi/stp/execute?_program=${node.relativePath}&_debug=131` + ) + } + const handleContextMenu = (event: React.MouseEvent) => { event.preventDefault() event.stopPropagation() @@ -224,8 +242,8 @@ const TreeViewNode = ({ : undefined } > - {node.isFolder && ( -
+ {node.isFolder ? ( + <> Add Folder Add File -
+ + ) : ( + <> + Launch + + Launch and Debug + + + )} + {!!node.relativePath && ( + <> + Rename + Delete + )} - - Rename - - - Delete - ) From 730c7c52acefd288fc8c80cc916facac5e66f398 Mon Sep 17 00:00:00 2001 From: Sabir Hassan Date: Sat, 3 Sep 2022 00:09:48 +0500 Subject: [PATCH 2/2] chore: remove commented code --- web/src/components/tree.tsx | 6 ------ 1 file changed, 6 deletions(-) diff --git a/web/src/components/tree.tsx b/web/src/components/tree.tsx index 382cef6c..5b06db5b 100644 --- a/web/src/components/tree.tsx +++ b/web/src/components/tree.tsx @@ -63,7 +63,6 @@ const TreeViewNode = ({ rename, defaultExpanded }: Props) => { - // const appContext = useContext(AppContext) const [deleteConfirmationModalOpen, setDeleteConfirmationModalOpen] = useState(false) const [deleteConfirmationModalMessage, setDeleteConfirmationModalMessage] = @@ -79,11 +78,6 @@ const TreeViewNode = ({ mouseY: number } | null>(null) - // const isFileLaunchable = (filename: string) => { - // const availableRuntimes = Object.values(appContext.runTimes) - - // } - const launchProgram = () => { const baseUrl = window.location.origin window.open(`${baseUrl}/SASjsApi/stp/execute?_program=${node.relativePath}`)