Skip to content

Implement 'New Threshold' creation#58966

Merged
nhsiehgit merged 7 commits into
masterfrom
new_threshold_btn
Oct 30, 2023
Merged

Implement 'New Threshold' creation#58966
nhsiehgit merged 7 commits into
masterfrom
new_threshold_btn

Conversation

@nhsiehgit

@nhsiehgit nhsiehgit commented Oct 27, 2023

Copy link
Copy Markdown
Contributor

Implements ability to create new thresholds without an existing threshold

Oct-27-2023.14-29-34.mp4

@nhsiehgit nhsiehgit requested a review from a team October 27, 2023 21:05
@nhsiehgit nhsiehgit requested a review from a team as a code owner October 27, 2023 21:05
@github-actions github-actions Bot added Scope: Frontend Automatically applied to PRs that change frontend components Scope: Backend Automatically applied to PRs that change backend components labels Oct 27, 2023
@nhsiehgit nhsiehgit marked this pull request as draft October 27, 2023 21:06
@nhsiehgit nhsiehgit marked this pull request as ready for review October 27, 2023 21:30

@schew2381 schew2381 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not great at frontend, so prob want some more 👀 on this. Also I noticed that thresholds can have multiple conditions and we can add to existing ones on the page. Should we also allow that when creating new ones?

Comment thread static/app/views/releases/components/header.tsx Outdated
Comment on lines 79 to 83

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would it be better to put these into constants? It's a little difficult to tell what's what, even with the comment explanation above

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

hmmm i'm not sure if sticking these into a constant would make it anymore clear either :/

@schew2381 schew2381 Oct 27, 2023

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

When you fetch all environments, would you want to exclude environments that already have a threshold?

In the example video, we show the production env but there's an existing threshold on the page for it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Nah - it's fine if they want to select an env with existing thresholds still. It'll still work as expected

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Product question, can you select multiple projects? The selector is multi-select and selecting just one makes it confusing.

Edit: I saw lower down in the code that it's actually multi select. Where does this tooltip show up?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yup - this tooltip shows up on the "create threshold" button.
I added a video to the description so you can see it there

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Localize?

Comment thread static/app/views/releases/thresholdsList/index.tsx Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

'' is not really being used. How about to turn this into a one liner?
return threshold.environment?.name ? selection.environments.indexOf(envName) > -1 : !selection.environments.length

My point is envName could just be threshold.environment?.name this if is not doing much.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah that's a good callout 👍

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could this be empty at this point?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, if this is empty then we won't render anything

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I mean newThresholdGroup[0]. If it can be empty maybe newThresholdGroup && newThresholdGroup[0]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh - so it'll always be an array (never falsey)
If it's an empty array, then we want this to be false, so no need to check for existence of newThresholdGroup

@nhsiehgit nhsiehgit requested review from a team, schew2381 and sentaur-athena October 30, 2023 16:24
@getsentry getsentry deleted a comment from github-actions Bot Oct 30, 2023
@schew2381 schew2381 removed the Scope: Backend Automatically applied to PRs that change backend components label Oct 30, 2023
@nhsiehgit nhsiehgit merged commit 2709d9a into master Oct 30, 2023
@nhsiehgit nhsiehgit deleted the new_threshold_btn branch October 30, 2023 18:44
Comment on lines +87 to +89
disabled={newThresholdDisabled}
>
<IconAdd isCircled /> &nbsp; {t('New Threshold')}

@scttcper scttcper Oct 30, 2023

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

button takes an icon

Suggested change
disabled={newThresholdDisabled}
>
<IconAdd isCircled /> &nbsp; {t('New Threshold')}
disabled={newThresholdDisabled}
icon={<IconAdd isCircled />}
>
{t('New Threshold')}

setNewThresholdGroup([
...newThresholdGroup,
{
id: `${NEW_GROUP_PREFIX}-${newGroupIterator}`,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

you might be able to just add a unique id instead of tracking how many there have been https://github.com/getsentry/sentry/blob/master/static/app/utils/guid.tsx#L6

Suggested change
id: `${NEW_GROUP_PREFIX}-${newGroupIterator}`,
id: `${NEW_GROUP_PREFIX}-${newGroupIterator}`,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah yea - this isn't really to track how many, but just an easy way to ensure separate keys.
def could generate unique id's but didn't wnat to bother importing another another package for something that's not even going to be utilized.
The ID here isn't going to be saved at all. This is purely just for rendering

nhsiehgit added a commit that referenced this pull request Oct 31, 2023
small nit fixes

- update button with icon
- disable new threshold button when all projects is selected

quick follow up from #58966
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants