Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak logic for register new deployment #230

Merged
merged 5 commits into from
Sep 13, 2023
Merged

Conversation

annavik
Copy link
Member

@annavik annavik commented Sep 7, 2023

Show "Register new deployment" if logged in user has create permissions.

@annavik annavik requested a review from mihow September 7, 2023 11:13
@netlify
Copy link

netlify bot commented Sep 7, 2023

Deploy Preview for ami-storybook canceled.

Name Link
🔨 Latest commit 33f1be3
🔍 Latest deploy log https://app.netlify.com/sites/ami-storybook/deploys/65016e66938d500008c26c18

@netlify
Copy link

netlify bot commented Sep 7, 2023

Deploy Preview for ami-web canceled.

Name Link
🔨 Latest commit 33f1be3
🔍 Latest deploy log https://app.netlify.com/sites/ami-web/deploys/65016e66f8f4580008fd2498

@mihow
Copy link
Collaborator

mihow commented Sep 8, 2023

It works! I believe the only thing missing is the project assignment. When you create a deployment it "disappears" because it is not assigned to a project. Can you pass the current project ID to the POST request when creating a Deployment? (the property is just called project and accepts a project ID). You can test that in the API test page as well: https://api.dev.insectai.org/api/v2/deployments/

Copy link
Collaborator

@mihow mihow left a comment

Choose a reason for hiding this comment

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

It works! I believe the only thing missing is the project assignment. When you create a deployment it "disappears" because it is not assigned to a project. Can you pass the current project ID to the POST request when creating a Deployment? (the property is just called project and accepts a project ID). You can test that in the API test page as well: https://api.dev.insectai.org/api/v2/deployments/

@annavik
Copy link
Member Author

annavik commented Sep 12, 2023

It works! I believe the only thing missing is the project assignment. When you create a deployment it "disappears" because it is not assigned to a project. Can you pass the current project ID to the POST request when creating a Deployment? (the property is just called project and accepts a project ID). You can test that in the API test page as well: https://api.dev.insectai.org/api/v2/deployments/

Ah yes, sorry, forgot about that. Code is updated!

I believe the project param expects a full url, would it be possible to just pass the id here?

@@ -14,7 +13,7 @@ const convertToServerFieldValues = (fieldValues: DeploymentFieldValues) => ({
latitude: fieldValues.latitude,
longitude: fieldValues.longitude,
occurrences: [],
project: null,
project: `http://api.dev.insectai.org/api/v2/projects/${fieldValues.projectId}/`, // TODO: Can we pass just id here?
Copy link
Member Author

@annavik annavik Sep 12, 2023

Choose a reason for hiding this comment

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

I'm getting 400 if I just pass the id here @mihow

Copy link
Collaborator

@mihow mihow Sep 13, 2023

Choose a reason for hiding this comment

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

I just fixed this! The deployments endpoint now accepts a project id for the project field (for POST & PUT requests), and it returns a nested representation of the project instead of just the details URL.

image

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you! Just pushed a FE fix

@annavik annavik requested a review from mihow September 12, 2023 09:24
Copy link
Collaborator

@mihow mihow left a comment

Choose a reason for hiding this comment

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

Works!

@annavik annavik merged commit 8927bee into main Sep 13, 2023
6 checks passed
@annavik annavik deleted the fix-create-deployments branch October 11, 2023 06:21
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