Implement 'New Threshold' creation#58966
Conversation
5ae49b6 to
5eb195f
Compare
There was a problem hiding this comment.
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
There was a problem hiding this comment.
hmmm i'm not sure if sticking these into a constant would make it anymore clear either :/
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Nah - it's fine if they want to select an env with existing thresholds still. It'll still work as expected
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Yup - this tooltip shows up on the "create threshold" button.
I added a video to the description so you can see it there
There was a problem hiding this comment.
'' 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.
There was a problem hiding this comment.
Ah that's a good callout 👍
There was a problem hiding this comment.
Could this be empty at this point?
There was a problem hiding this comment.
Yes, if this is empty then we won't render anything
There was a problem hiding this comment.
I mean newThresholdGroup[0]. If it can be empty maybe newThresholdGroup && newThresholdGroup[0]
There was a problem hiding this comment.
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
69ca027 to
3331f03
Compare
| disabled={newThresholdDisabled} | ||
| > | ||
| <IconAdd isCircled /> {t('New Threshold')} |
There was a problem hiding this comment.
button takes an icon
| disabled={newThresholdDisabled} | |
| > | |
| <IconAdd isCircled /> {t('New Threshold')} | |
| disabled={newThresholdDisabled} | |
| icon={<IconAdd isCircled />} | |
| > | |
| {t('New Threshold')} |
| setNewThresholdGroup([ | ||
| ...newThresholdGroup, | ||
| { | ||
| id: `${NEW_GROUP_PREFIX}-${newGroupIterator}`, |
There was a problem hiding this comment.
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
| id: `${NEW_GROUP_PREFIX}-${newGroupIterator}`, | |
| id: `${NEW_GROUP_PREFIX}-${newGroupIterator}`, |
There was a problem hiding this comment.
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
small nit fixes - update button with icon - disable new threshold button when all projects is selected quick follow up from #58966
Implements ability to create new thresholds without an existing threshold
Oct-27-2023.14-29-34.mp4