Skip to content

Commit

Permalink
Fix Slack User Group search in Escalation Steps (#4332)
Browse files Browse the repository at this point in the history
# What this PR does
Fix Slack User Group search in Escalation Steps

## Which issue(s) this PR closes
Closes grafana/support-escalations#10488

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
  • Loading branch information
brojd authored May 10, 2024
1 parent d4ba57b commit 4340781
Show file tree
Hide file tree
Showing 14 changed files with 2 additions and 23 deletions.
5 changes: 1 addition & 4 deletions grafana-plugin/src/components/Policy/EscalationPolicy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ class _EscalationPolicy extends React.Component<EscalationPolicyProps, any> {
<WithPermissionControlTooltip key="users-multiple" userAction={UserActions.EscalationChainsWrite}>
<GSelect<ApiSchemas['User']>
isMulti
showSearch
allowClear
disabled={isDisabled}
displayField="username"
Expand Down Expand Up @@ -348,7 +347,6 @@ class _EscalationPolicy extends React.Component<EscalationPolicyProps, any> {
return (
<WithPermissionControlTooltip key="notify_schedule" userAction={UserActions.EscalationChainsWrite}>
<GSelect<Schedule>
showSearch
allowClear
disabled={isDisabled}
items={scheduleStore.items}
Expand Down Expand Up @@ -386,6 +384,7 @@ class _EscalationPolicy extends React.Component<EscalationPolicyProps, any> {
return (
<WithPermissionControlTooltip key="notify_to_group" userAction={UserActions.EscalationChainsWrite}>
<GSelect<UserGroup[]>
allowClear
disabled={isDisabled}
items={userGroupStore.items}
fetchItemsFn={userGroupStore.updateItems}
Expand Down Expand Up @@ -415,7 +414,6 @@ class _EscalationPolicy extends React.Component<EscalationPolicyProps, any> {
return (
<WithPermissionControlTooltip key="custom-webhook" userAction={UserActions.EscalationChainsWrite}>
<GSelect<ApiSchemas['Webhook']>
showSearch
disabled={isDisabled}
items={outgoingWebhookStore.items}
fetchItemsFn={outgoingWebhookStore.updateItems}
Expand Down Expand Up @@ -457,7 +455,6 @@ class _EscalationPolicy extends React.Component<EscalationPolicyProps, any> {
return (
<WithPermissionControlTooltip key="notify_to_team_members" userAction={UserActions.EscalationChainsWrite}>
<GSelect<GrafanaTeam>
showSearch
disabled={isDisabled}
items={grafanaTeamStore.items}
fetchItemsFn={grafanaTeamStore.updateItems}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ export const MSTeamsConnector = (props: MSTeamsConnectorProps) => {
Post to Microsoft Teams channel
<WithPermissionControlTooltip userAction={UserActions.IntegrationsWrite}>
<GSelect<MSTeamsChannel>
showSearch
allowClear
className={cx('select', 'control')}
items={msteamsChannelStore.items}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ export const SlackConnector = (props: SlackConnectorProps) => {
Slack Channel
<WithPermissionControlTooltip userAction={UserActions.IntegrationsWrite}>
<GSelect<SlackChannel>
showSearch
allowClear
className={cx('select', 'control')}
items={slackChannelStore.items}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export const TelegramConnector = ({ channelFilterId }: TelegramConnectorProps) =
Post to telegram channel
<WithPermissionControlTooltip userAction={UserActions.IntegrationsWrite}>
<GSelect<TelegramChannel>
showSearch
allowClear
className={cx('select', 'control')}
items={telegramChannelStore.items}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ export const AttachIncidentForm = observer(({ id, onUpdate, onHide }: AttachInci
>
<WithPermissionControlTooltip userAction={UserActions.AlertGroupsWrite}>
<GSelect<ApiSchemas['AlertGroup']>
showSearch
items={Object.fromEntries(alertGroupStore.alerts)}
fetchItemsFn={async (query: string) => {
await alertGroupStore.fetchAlertGroups(false, query);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ export const EscalationChainForm: FC<EscalationChainFormProps> = (props) => {
getSearchResult={grafanaTeamStore.getSearchResult}
displayField="name"
valueField="id"
showSearch
allowClear
placeholder="Select a team"
className={cx('team-select')}
Expand Down
4 changes: 1 addition & 3 deletions grafana-plugin/src/containers/GSelect/GSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ interface GSelectProps<Item> {
className?: string;
displayField?: string;
valueField?: string;
showSearch?: boolean;
allowClear?: boolean;
isMulti?: boolean;
showWarningIfEmptyValue?: boolean;
Expand All @@ -49,7 +48,6 @@ interface GSelectProps<Item> {
export const GSelect = observer(<Item,>(props: GSelectProps<Item>) => {
const {
autoFocus,
showSearch = false,
allowClear = false,
isLoading,
defaultOpen,
Expand Down Expand Up @@ -156,7 +154,7 @@ export const GSelect = observer(<Item,>(props: GSelectProps<Item>) => {
<div className={cx('root', className)}>
<Tag
autoFocus={autoFocus}
isSearchable={showSearch}
isSearchable
isClearable={allowClear}
placeholder={placeholder}
openMenuOnFocus={defaultOpen}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ export const GrafanaTeamSelect = observer(

const select = (
<GSelect<GrafanaTeam>
showSearch
items={grafanaTeamStore.items}
fetchItemsFn={grafanaTeamStore.updateItems}
fetchItemFn={grafanaTeamStore.fetchItemById}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ export const IntegrationForm = observer(
getSearchResult: grafanaTeamStore.getSearchResult,
displayField: 'name',
valueField: 'id',
showSearch: true,
allowClear: true,
}}
onChange={(value) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ export const MaintenanceForm = observer((props: MaintenanceFormProps) => {
>
<GSelect<ApiSchemas['AlertReceiveChannel']>
disabled
showSearch
items={alertReceiveChannelStore.items}
fetchItemsFn={alertReceiveChannelStore.fetchItems}
fetchItemFn={alertReceiveChannelStore.fetchItemById}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ export const OutgoingWebhookFormFields = ({
error={errors.team?.message}
>
<GSelect<GrafanaTeam>
showSearch
allowClear
items={grafanaTeamStore.items}
fetchItemsFn={grafanaTeamStore.updateItems}
Expand Down Expand Up @@ -147,7 +146,6 @@ export const OutgoingWebhookFormFields = ({
>
<GSelect<ApiSchemas['AlertReceiveChannel']>
isMulti
showSearch
placeholder="Choose (Optional)"
items={alertReceiveChannelStore.items}
fetchItemsFn={alertReceiveChannelStore.fetchItems}
Expand Down
3 changes: 0 additions & 3 deletions grafana-plugin/src/containers/ScheduleForm/ScheduleForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ const ScheduleCommonFields = () => {
render={({ field }) => (
<Field label="Assign to team" invalid={!!errors.team} error={errors.team?.message}>
<GSelect<GrafanaTeam>
showSearch
items={grafanaTeamStore.items}
fetchItemsFn={grafanaTeamStore.updateItems}
fetchItemFn={grafanaTeamStore.fetchItemById}
Expand Down Expand Up @@ -265,7 +264,6 @@ const ScheduleNotificationSettingsFields = () => {
error={errors.slack_channel_id?.message}
>
<GSelect<SlackChannel>
showSearch
allowClear
items={slackChannelStore.items}
fetchItemsFn={slackChannelStore.updateItems}
Expand All @@ -292,7 +290,6 @@ const ScheduleNotificationSettingsFields = () => {
error={errors.user_group?.message}
>
<GSelect<UserGroup[]>
showSearch
allowClear
items={userGroupStore.items}
fetchItemsFn={userGroupStore.updateItems}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ const GoogleCalendar: React.FC<{ id: ApiSchemas['User']['pk'] }> = observer(({ i
<WithPermissionControlTooltip userAction={UserActions.UserSettingsWrite}>
<GSelect<Schedule>
isMulti
showSearch
allowClear
disabled={false}
items={scheduleStore.items}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ class _SlackSettings extends Component<SlackProps, SlackState> {
>
<WithPermissionControlTooltip userAction={UserActions.ChatOpsUpdateSettings}>
<GSelect<SlackChannel>
showSearch
items={slackChannelStore.items}
fetchItemsFn={slackChannelStore.updateItems}
fetchItemFn={slackChannelStore.updateItem}
Expand Down Expand Up @@ -216,7 +215,6 @@ class _SlackSettings extends Component<SlackProps, SlackState> {
return (
<WithPermissionControlTooltip userAction={UserActions.ChatOpsUpdateSettings}>
<GSelect<SlackChannel>
showSearch
className={cx('select', 'control')}
items={slackChannelStore.items}
fetchItemsFn={slackChannelStore.updateItems}
Expand Down

0 comments on commit 4340781

Please sign in to comment.