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

Fix setting team feature status in Stern/backoffice #1146

Merged
merged 5 commits into from
Jun 30, 2020

Conversation

mheinzel
Copy link
Contributor

@mheinzel mheinzel force-pushed the mheinzel/fix-stern-set-team-feature branch from 797c8f8 to a741174 Compare June 24, 2020 12:25
Copy link
Member

@akshaymankar akshaymankar left a comment

Choose a reason for hiding this comment

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

Looks good!
Have you run this locally? If you have, let's document how to do that.

@mheinzel
Copy link
Contributor Author

It worked as expected when I curled it, but I'm still trying to run the backoffice Swagger app.

I'll keep at it, might just fix https://github.com/zinfra/backend-issues/issues/1496 and https://github.com/wireapp/wire-server/tree/develop/tools/stern#how-to-run-stern-together-with-the-rest-of-wire-server as well. 🤷

@mheinzel
Copy link
Contributor Author

Umhh, so I managed to get this working locally with some trickery, but there is a bit of a usability issue:

Screenshot from 2020-06-24 16-51-53

Normally, we want JSON requests and responses to be objects, but for the backoffice this doesn't really make sense, as it's much more cumbersome now to send requests.

So I guess we should accept a plain JSON string instead (only in Stern)? To do that, we will need to split out a separate type again...

@akshaymankar
Copy link
Member

Yeah, it will be nicer to accept a plain string in the body, that way we get the dropdown. But this is also fine as few other endpoints in the same swagger-ui require much more complex JSONs and so the users clearly understand this.
So, what I want to say is that it is upto you if you want to make it nicer or avoid spending time on this.

@fisx
Copy link
Contributor

fisx commented Jun 25, 2020

i'm in favor of making this more usable, if it's not more than 3 hours (i don't think it should be.)

@fisx
Copy link
Contributor

fisx commented Jun 25, 2020

all we need to do is move the type which was there before from the body to the query, right?

@mheinzel
Copy link
Contributor Author

mheinzel commented Jun 25, 2020

all we need to do is move the type which was there before from the body to the query, right?

That's actually a good idea, requiring fewer changes. Unfortunately, I already started doing this by splitting the type into one with is just a JSON string and one with the object wrapper around it. Almost done with that...

Might be slightly nicer to have that separation, because then also the types defined for the interface correspond more closely to their JSON structure (which will also be helpful if we want to start automatically deriving JSON stuff). I'll push the update soon, so you can have a look and shout if you think the query parameter is the better solution.

@mheinzel mheinzel force-pushed the mheinzel/fix-stern-set-team-feature branch 2 times, most recently from e95f1d9 to 28c81bf Compare June 25, 2020 15:22
@mheinzel
Copy link
Contributor Author

mheinzel commented Jun 25, 2020

@fisx @akshaymankar This should work now.

(and I verified it's a dropdown in the backoffice again)

@mheinzel
Copy link
Contributor Author

Have you run this locally? If you have, let's document how to do that.

I'll do that as part of #1148.

Where do you think would be the best place to document it? I was first thinking about the stern README, but now I'm not sure anymore.

@akshaymankar
Copy link
Member

Where do you think would be the best place to document it? I was first thinking about the stern README, but now I'm not sure anymore.

It would be nice if it started when I run services/start-services-only.sh and then we probably don't even need to document it like rest of the services.

@mheinzel
Copy link
Contributor Author

Okay, I'll look into it as part of the other PR. This one should be ready to be merged, though. Do you think the approach with splitting into TeamFeatureStatus and TeamFeatureStatusValue makes sense?

@mheinzel mheinzel mentioned this pull request Jun 26, 2020
4 tasks
deriving stock (Eq, Show, Generic)
deriving (Arbitrary) via (GenericUniform TeamFeatureStatus)
newtype TeamFeatureStatus = TeamFeatureStatus
{teamFeatureStatusValue :: TeamFeatureStatusValue}
Copy link
Contributor

Choose a reason for hiding this comment

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

sigh

This is rolling back the change we did in tag image/2.83.22 (#1122). The reason we changed it was that it made the code simpler all over the backend, as you can tell from all the awkwardness you had to add. :-P

So, good thing you asked for a second review!

Copy link
Contributor

Choose a reason for hiding this comment

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

we discussed this, and came to the conclusion that this code is more beaurocratic, but less surprising. so we'll keep it.

@fisx fisx force-pushed the mheinzel/fix-stern-set-team-feature branch from 3442980 to 887e47a Compare June 30, 2020 14:07
Copy link
Contributor

@fisx fisx left a comment

Choose a reason for hiding this comment

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

as discussed: all good! pleas take a look at my commit and merge if you agree.

tools/stern/src/Stern/API.hs Show resolved Hide resolved
Using FromJSON here would have required quotes around the value,
so I instead added a FromByteString instance.
@mheinzel mheinzel force-pushed the mheinzel/fix-stern-set-team-feature branch from 887e47a to 40b3fd2 Compare June 30, 2020 14:43
@mheinzel
Copy link
Contributor Author

I rebase this and tested the backoffice. Ran into an issue with the query param deserialization, which I fixed now.

I will merge once CI passed.

@fisx fisx merged commit 8710776 into develop Jun 30, 2020
@fisx fisx deleted the mheinzel/fix-stern-set-team-feature branch June 30, 2020 17:54
@fisx fisx mentioned this pull request Jul 13, 2020
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.

None yet

3 participants