Skip to content

(Post feedback version) GS Onboarding#22

Closed
GabrielGuirguis wants to merge 7 commits intoUWOrbital:mainfrom
GabrielGuirguis:main
Closed

(Post feedback version) GS Onboarding#22
GabrielGuirguis wants to merge 7 commits intoUWOrbital:mainfrom
GabrielGuirguis:main

Conversation

@GabrielGuirguis
Copy link

Purpose

Completed the GS on-boarding task. Include a screenshot of the front-end of the application.

New Changes

  • Explain new changes

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.

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.

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.

For the frontend, its a good start. My requested changes are to due to error handling. You will also need to add data validation for user input related to a command

deleteCommand(id)
} catch (error) {
console.error(error)
throw error
Copy link
Contributor

Choose a reason for hiding this comment

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

We shouldnt be throwing inside the component. Instead, display an error popup that we couldnt successfully delete the command

// TODO:(Member) Submit to your post endpoint
}
const [selectedCommandId, setSelectedCommandId] = useState<string>(
mainCommands[0].id.toString()
Copy link
Contributor

Choose a reason for hiding this comment

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

Main commands will be empty on first load thus, the 0th element will be undefined, resulting in an underfined reference error

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.

Have you tested your frontend locally when building it? None of the functionality works properly

params: commandParams,
};

createCommand(command);
Copy link
Contributor

Choose a reason for hiding this comment

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

When creating a command, the page doesn't display the command after submitting. The workaround is to refresh the page

</div>
<input /> {/* TODO: (Member) Add input handling here if the selected command has a param input*/}
<button onClick={handleSubmit}>Submit</button>
<input onChange={(e) => setCommandParams(e.target.value)} />{" "}
Copy link
Contributor

Choose a reason for hiding this comment

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

Each command can have different types and number of arguments and the frontend should be able to handle that. They are encoded in the mainCommands

const handleDelete = (id: number) => {
return () => {
try {
deleteCommand(id)
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't properly delete a command

*/
export const deleteCommand = async (id: number): Promise<CommandListResponse> => {
try {
const { data } = await axios.delete(`${API_URL}/${id}`)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is wrong. You need to delete at the commands route

Copy link

@kepler452b123 kepler452b123 left a comment

Choose a reason for hiding this comment

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

some small changes

response = await call_next(request)

duration = perf_counter() - start
logger.info(f"Response sent in {duration} seconds to Request params: {request.path_params}")

Choose a reason for hiding this comment

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

need to print the datetime of request

Comment on lines 36 to 39
if self.params is None and self.format is None:
return self
elif isinstance(self.params, str) and isinstance(self.format, str) and self.params.count(",", 0, -1) == self.format.count(",", 0, -1):
return self

Choose a reason for hiding this comment

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

you are missing a case here

Comment on lines 23 to 30
const handleDelete = (id: number) => {
return () => {
try {
deleteCommand(id);
window.location.reload();
} catch (error) {
alert(`Failed to delete command with id ${id}`);
}

Choose a reason for hiding this comment

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

make this async

Copy link

@kepler452b123 kepler452b123 left a comment

Choose a reason for hiding this comment

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

LGTM, send email to be added to Notion/Github

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.

3 participants