Skip to content

Shreeya Onboarding#18

Open
shreeyadc wants to merge 4 commits intoUWOrbital:mainfrom
shreeyadc:main
Open

Shreeya Onboarding#18
shreeyadc wants to merge 4 commits intoUWOrbital:mainfrom
shreeyadc:main

Conversation

@shreeyadc
Copy link

Purpose

Completed the GS on-boarding task. Include a screenshot of the front-end of the application.
Screen Shot 2025-03-29 at 7 44 18 PM

New Changes

Backend:

  • Implemented data validation for commands (validate_params_format in data_models.py).
  • Created POST endpoint for creating commands (create_command in command.py).
  • Created DELETE endpoint for removing commands (delete_command in command.py).
  • Added logger middleware to track API requests (logger_middleware.py).

Frontend:

  • Implemented delete command API function in command_api.ts using Axios.
  • Updated command table UI to allow deletion of commands (table.tsx).
  • Modified command input form to dynamically display commands from the backend (command_input.tsx).

Testing

Explain tests that you ran to verify code functionality.
Any functions that can be unit-tested should include a unit test in the PR. Otherwise, explain why it cannot be unit-tested.

Backend:

  • Ran pytest to check that all backend tests passed (13/13).

Frontend:

  • Verified that commands appear in the dropdown and update dynamically.
  • Checked error handling by attempting to submit without selecting a command or entering any parameters.
  • No unit tests for frontend because UI interactions were validated through manual testing.

Outstanding Changes

  • If there are non-critical changes (i.e. additional features) that can be made to this feature in the future, indicate them here.

@shreeyadc shreeyadc changed the title Backend and frontend for onboarding assignment Shreeya Onboarding Mar 31, 2025
Copy link
Contributor

@Yarik-Popov Yarik-Popov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall good. Some minor changes are needed for the backend. I will review the frontend after work today

@Yarik-Popov
Copy link
Contributor

The frontend build is failing

@Yarik-Popov
Copy link
Contributor

Congrats on finishing the backend portion if the gs onboarding, if you want you can dm me your email so i can add you to the notion

Copy link
Contributor

@Yarik-Popov Yarik-Popov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good step in the right direction. In the command_input.tsx file you need to fetch the MainCommands instead of Commands.

For fixing the build error, just remove all the new files you created and see the other comments in the files that were changes that aren't in the frontend/src/display or frontend/src/input directories. For running the frontend, you need to change into the frontend directory before running npm ci and npm run dev

"react": "^18.3.1",
"react-dom": "^18.3.1"
"react-dom": "^18.3.1",
"react-scripts": "^3.0.1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason why the frontend build pipeline is failing due to you add something to the frontend/package.json but not running npm i in that directory

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file isnt needed. See my comment on the frontend/package.json

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file isnt needed. See my comment on the frontend/package.json

Comment on lines +23 to +25
await deleteCommand(id); // Call deleteCommand function to delete the command on the backend
// Remove the deleted command from the local state
setCommands(prevCommands => prevCommands.filter(command => command.id !== id));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the data that was returned instead of filtering out on the frontend

run: |
cd frontend
npm ci
npm ci --legacy-peer-deps
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This command is generally not recommended as it can causes issues

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file isn't needed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file isn't needed

const [commands, setCommands] = useState<CommandResponse[]>([]);
const [selectedCommand, setSelectedCommand] = useState<string>("");
const [params, setParams] = useState<string[]>([]);
const [error, setError] = useState<string | null>(null); // Error state for feedback
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this

useEffect(() => {
const fetchCommands = async () => {
try {
const data = await getCommands();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be fetching the main commands here and you don't need to fetch the regular commands in this component. Use the getMainCommands endpoint function

Comment on lines +35 to +42
export const createCommand = async (commandType: string, params: string): Promise<void> => {
try {
await axios.post(`${API_URL}/commands/`, { command_type: commandType, params });
} catch (error) {
console.error("Error creating command:", error);
throw error;
}
}; No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't needed here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants