Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
prasunanand committed Dec 21, 2024
1 parent 833ec64 commit b9b9436
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 13 deletions.
8 changes: 5 additions & 3 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func main() {
zerolog.TimeFieldFormat = zerolog.TimeFormatUnix
debug := flag.Bool("debug", false, "sets log level to debug")
cwd := flag.String("cwd", ".", "base directory of project")
port := flag.String("port", ":8888", "port to start the server on")
port := flag.String("port", ":8048", "port to start the server on")

flag.Parse()

Expand Down Expand Up @@ -112,8 +112,6 @@ func main() {
apiRouter.HandleFunc("/kernels/{kernelId}/channels", websocket.HandleWebSocket)
apiRouter.HandleFunc("/terminals/{terminalId}", websocket.HandleTerminalWebSocket)

glog.Print("Zasper Server started! Listening on port", *port)

//cors optionsGoes Below
corsOpts := cors.New(cors.Options{
AllowedOrigins: []string{"*"}, //you service is available and allowed for this base url
Expand Down Expand Up @@ -147,6 +145,10 @@ func main() {
╚══════╝╚═╝ ╚═╝╚══════╝╚═╝ ╚══════╝╚═╝ ╚═╝
`)

glog.Println("Zasper Server started! Listening on port", *port)
url := "http://localhost" + *port
glog.Printf("Visit Zasper webapp on %s", url)

go func() {
if err := http.ListenAndServe(*port, corsOpts.Handler(router)); err != nil && err != http.ErrServerClosed {
fmt.Printf("ListenAndServe(): %s\n", err)
Expand Down
3 changes: 1 addition & 2 deletions ui/public/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const http = require("http");

var log = require("electron-log");

const apiPort = 8048;
var apiProcess;
var mainWindow;
var welcomeScreen;
Expand Down Expand Up @@ -51,7 +52,6 @@ const startApiServer = (directory) => {
};

const startApp = () => {
const apiPort = 8888;
welcomeScreen = new BrowserWindow({
width: 1050,
height: 700,
Expand Down Expand Up @@ -118,7 +118,6 @@ ipcMain.handle("dialog:openDirectory", async () => {
});

ipcMain.handle("runCommand", async (event, directory) => {
const apiPort = 8888;
if (apiProcess) {
apiProcess.kill();
mainWindow.close();
Expand Down
1 change: 1 addition & 0 deletions ui/public/images/editor/jupyter-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion ui/src/ide/NavigationPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ const NavigationPanel: React.FC<NavigationPanelProps> = ({ handleNavigationPanel

const menuItems = [
{ label: 'Open Project', action: handleSelectDirectory },
{ label: 'Edit', action: () => alert('Edit') }
];

// Handle the right-click event to show context menu
Expand Down
8 changes: 5 additions & 3 deletions ui/src/ide/config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export const BaseApiUrl = 'http://localhost:8888'
export const BaseWebSocketUrl = 'ws://localhost:8888'
export const WsBaseUrl = 'ws://localhost:8888/api/kernels/'
const port = 8048

export const BaseApiUrl = `http://localhost:${port}`
export const BaseWebSocketUrl = `ws://localhost:${port}`
export const WsBaseUrl = `ws://localhost:${port}/api/kernels/`
2 changes: 1 addition & 1 deletion ui/src/ide/sidebar/FileBrowser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ const FileItem = (
mod: './images/editor/go-icon.svg',
sum: './images/editor/go-icon.svg',
py: './images/editor/py-icon.svg',
ipynb: './images/editor/py-icon.svg',
ipynb: './images/editor/jupyter-icon.svg',
java: './images/editor/java-icon.svg',
class: './images/editor/java-icon.svg',
js: './images/editor/js-icon.svg',
Expand Down
6 changes: 3 additions & 3 deletions ui/src/ide/sidebar/GitPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ export default function GitPanel({ sendDataToParent, display }) {
<div className='content-head'>
<div>SOURCE CONTROL</div>
</div>
<GitCommit />
<GitCommit display={display}/>
<CommitGraphContainer />
</div>
</div>
)
}

function GitCommit() {
function GitCommit( {display} ) {
const [files, setFiles] = useState<string[]>([]);
const [selectedFiles, setSelectedFiles] = useState<string[]>([]);
const [commitMessage, setCommitMessage] = useState<string>('');
Expand All @@ -40,7 +40,7 @@ function GitCommit() {
useEffect(() => {
// Initial fetch when component mounts
fetchFiles();
}, []);
}, [display]);

const handleCheckboxChange = (file: string) => {
setSelectedFiles((prevSelectedFiles) => {
Expand Down

0 comments on commit b9b9436

Please sign in to comment.