feat: enhance mapping dialog UI with team filtering and improved styling#139
feat: enhance mapping dialog UI with team filtering and improved styling#139pdt-rmunoz wants to merge 2 commits intoservice_mappigns_featurefrom
Conversation
This commit adds comprehensive improvements to the mapping dialog: Backend changes: - Add getAllTeams endpoint to fetch all PagerDuty teams - Add getFilteredServices endpoint with team_id and query filters - Add PagerDutyTeam type to common types Frontend changes: - Add team filtering dropdown to filter services by PagerDuty team - Add service search with debounced input (500ms) - Replace read-only text displays with TextField components for visual consistency - Add border container styling to RadioGroup matching TextField appearance - Add enhanced radio button styling with interactive states Radio button improvements: - Individual padding on each option (12px all sides) - Bottom border dividers between options - Hover effect with gray background - Selected state with blue background, bold text, and 3px left accent bar 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
sandornagy517
left a comment
There was a problem hiding this comment.
great job! just left some small comments
| Object.keys(EndpointConfig).map(async account => { | ||
| try { | ||
| // reset offset value | ||
| offset = 0; |
There was a problem hiding this comment.
these comments are a bit redundant, could you please remove them?
| let params = `time_zone=UTC&limit=${limit}`; | ||
|
|
||
| // Add team_ids filter if provided | ||
| if (teamIds && teamIds.length > 0) { |
There was a problem hiding this comment.
same for the comments here
| const [searchQuery, setSearchQuery] = useState<string>(''); | ||
| const [debouncedSearchQuery, setDebouncedSearchQuery] = useState<string>(''); | ||
|
|
||
| // Debounce search query (wait 500ms after user stops typing) |
There was a problem hiding this comment.
same for the comments
| <Flex> | ||
| <Text variant="body-medium" weight="regular"> | ||
| Name: | ||
| <style> |
There was a problem hiding this comment.
we should use makeStyles and useStyles for these
There was a problem hiding this comment.
Added import { makeStyles } from '@material-ui/core'
Created useStyles hook with nested selectors
| <> | ||
| <Box | ||
| className="radio-list-container" | ||
| style={{ |
There was a problem hiding this comment.
same for styles like above
- Remove redundant comments from pagerduty.ts functions (getAllTeams, getFilteredServices) - Remove redundant comments from MappingsDialog.tsx - Refactor inline <style> tag to use makeStyles from @material-ui/core - Refactor inline Box styles to use makeStyles pattern - Follow established codebase pattern for styling (StatusCell, AutoMappingsButton) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
Is it me, or the first option is smaller than the others, @pdt-rmunoz?
|
jhfgloria
left a comment
There was a problem hiding this comment.
Left some questions and comments. Overall really nice PR.
| // GET /filtered-services?team_id=:teamId&query=:query&limit=:limit | ||
| router.get('/filtered-services', async (request, response) => { | ||
| try { | ||
| const teamId = request.query.team_id as string | undefined; | ||
| const query = request.query.query as string | undefined; | ||
| const limit = request.query.limit | ||
| ? parseInt(request.query.limit as string, 10) | ||
| : 100; | ||
|
|
||
| const teamIdsArray: string[] | undefined = teamId ? [teamId] : undefined; | ||
|
|
||
| const services = await getFilteredServices(teamIdsArray, query, limit); | ||
|
|
||
| response.json(services); | ||
| } catch (error) { | ||
| if (error instanceof HttpError) { | ||
| response.status(error.status).json({ | ||
| errors: [`${error.message}`], | ||
| }); | ||
| } | ||
| } | ||
| }); |
There was a problem hiding this comment.
I don't think we should have an extra method here. I think this method is just a specialisation of the next method /services. You should merge them together, and have a different execution path for either a team_id search, or a integration_key search. Otherwise we will end up with a multitude of controller methods for every different query string someone decides to introduce.
| const res = await getTeams(offset, limit, account); | ||
|
|
||
| res[1].forEach(team => { | ||
| team.account = account; |
There was a problem hiding this comment.
We need to be careful about this one. Is this setting it as default? I think I mentioned this to @sandornagy517 before, that we should avoid using the default value, which I believe is the case here.
| useEffect(() => { | ||
| const timer = setTimeout(() => { | ||
| setDebouncedSearchQuery(searchQuery); | ||
| }, 500); | ||
|
|
||
| return () => clearTimeout(timer); | ||
| }, [searchQuery]); |
There was a problem hiding this comment.
I think @sandornagy517 created a new useDebounce hook that abstracts this login.
| useEffect(() => { | |
| const timer = setTimeout(() => { | |
| setDebouncedSearchQuery(searchQuery); | |
| }, 500); | |
| return () => clearTimeout(timer); | |
| }, [searchQuery]); | |
| const debouncedSearchQuery = useDebounced(searchQuery); |
| createMapping({ | ||
| serviceId: currentServiceId, | ||
| integrationKey: currentIntegrationKey, | ||
| entityRef: '', | ||
| account: account, | ||
| }); |
There was a problem hiding this comment.
I'm wondering if we shouldn't remove the mapping entirely... 🤔
| value={selectedTeamIds[0] || ''} | ||
| onChange={value => { | ||
| const teamId = String(value || ''); | ||
| setSelectedTeamIds(teamId ? [teamId] : []); |
There was a problem hiding this comment.
Why do we store the team ids as an array. Seems like I can only select one at a time...


Description
This commit adds comprehensive improvements to the mapping dialog:
Backend changes:
Frontend changes:
Issue number:
https://pagerduty.atlassian.net/browse/DEVECO-527
Affected plugin
Type of change
Checklist
If this is a breaking change 👇
Acknowledgement
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.