Make it clear alert groups can't be searched (#4713)
# What this PR does * Make the filter input say `Filter results...` instead of `Search or filter results...` on the alert group page; disallow custom input there so it's only possible to choose among existing filters * Remove outdated `<page>/filters?search=` functionality from internal API ## Which issue(s) this PR closes Related to https://github.com/grafana/oncall-private/issues/2679 <!-- *Note*: If you want the issue to be auto-closed once the PR is merged, change "Related to" to "Closes" in the line above. If you have more than one GitHub issue that this PR closes, be sure to preface each issue link with a [closing keyword](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests#linking-a-pull-request-to-an-issue). This ensures that the issue(s) are auto-closed once the PR has been merged. --> ## Checklist - [x] 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.
This commit is contained in:
parent
ec360f08dd
commit
696aca2d80
9 changed files with 10 additions and 24 deletions
|
|
@ -747,7 +747,6 @@ class AlertGroupView(
|
|||
"href": api_root + "teams/",
|
||||
"global": True,
|
||||
},
|
||||
{"name": "search", "type": "search"},
|
||||
{"name": "integration", "type": "options", "href": api_root + "alert_receive_channels/?filters=true"},
|
||||
{"name": "escalation_chain", "type": "options", "href": api_root + "escalation_chains/?filters=true"},
|
||||
{
|
||||
|
|
@ -811,6 +810,9 @@ class AlertGroupView(
|
|||
},
|
||||
]
|
||||
|
||||
if settings.FEATURE_ALERT_GROUP_SEARCH_ENABLED:
|
||||
filter_options = [{"name": "search", "type": "search"}] + filter_options
|
||||
|
||||
if is_labels_feature_enabled(self.request.auth.organization):
|
||||
filter_options.append(
|
||||
{
|
||||
|
|
|
|||
|
|
@ -474,6 +474,7 @@ class AlertReceiveChannelView(
|
|||
api_root = "/api/internal/v1/"
|
||||
|
||||
filter_options = [
|
||||
{"name": "search", "type": "search"},
|
||||
{
|
||||
"name": "team",
|
||||
"type": "team_select",
|
||||
|
|
|
|||
|
|
@ -183,10 +183,10 @@ class EscalationChainViewSet(
|
|||
|
||||
@action(methods=["get"], detail=False)
|
||||
def filters(self, request):
|
||||
filter_name = request.query_params.get("search", None)
|
||||
api_root = "/api/internal/v1/"
|
||||
|
||||
filter_options = [
|
||||
{"name": "search", "type": "search"},
|
||||
{
|
||||
"name": "team",
|
||||
"type": "team_select",
|
||||
|
|
@ -195,7 +195,4 @@ class EscalationChainViewSet(
|
|||
},
|
||||
]
|
||||
|
||||
if filter_name is not None:
|
||||
filter_options = list(filter(lambda f: filter_name in f["name"], filter_options))
|
||||
|
||||
return Response(filter_options)
|
||||
|
|
|
|||
|
|
@ -577,10 +577,10 @@ class ScheduleView(
|
|||
|
||||
@action(methods=["get"], detail=False)
|
||||
def filters(self, request):
|
||||
filter_name = request.query_params.get("search", None)
|
||||
api_root = "/api/internal/v1/"
|
||||
|
||||
filter_options = [
|
||||
{"name": "search", "type": "search"},
|
||||
{
|
||||
"name": "team",
|
||||
"type": "team_select",
|
||||
|
|
@ -610,7 +610,4 @@ class ScheduleView(
|
|||
},
|
||||
]
|
||||
|
||||
if filter_name is not None:
|
||||
filter_options = list(filter(lambda f: filter_name in f["name"], filter_options))
|
||||
|
||||
return Response(filter_options)
|
||||
|
|
|
|||
|
|
@ -870,10 +870,10 @@ class UserView(
|
|||
)
|
||||
@action(methods=["get"], detail=False)
|
||||
def filters(self, request):
|
||||
filter_name = request.query_params.get("search", None)
|
||||
api_root = "/api/internal/v1/"
|
||||
|
||||
filter_options = [
|
||||
{"name": "search", "type": "search"},
|
||||
{
|
||||
"name": "team",
|
||||
"type": "team_select",
|
||||
|
|
@ -882,9 +882,6 @@ class UserView(
|
|||
},
|
||||
]
|
||||
|
||||
if filter_name is not None:
|
||||
filter_options = list(filter(lambda f: filter_name in f["name"], filter_options))
|
||||
|
||||
return Response(filter_options)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -140,10 +140,10 @@ class WebhooksView(TeamFilteringMixin, PublicPrimaryKeyMixin[Webhook], ModelView
|
|||
|
||||
@action(methods=["get"], detail=False)
|
||||
def filters(self, request):
|
||||
filter_name = request.query_params.get("search", None)
|
||||
api_root = "/api/internal/v1/"
|
||||
|
||||
filter_options = [
|
||||
{"name": "search", "type": "search"},
|
||||
{
|
||||
"name": "team",
|
||||
"type": "team_select",
|
||||
|
|
@ -161,9 +161,6 @@ class WebhooksView(TeamFilteringMixin, PublicPrimaryKeyMixin[Webhook], ModelView
|
|||
}
|
||||
)
|
||||
|
||||
if filter_name is not None:
|
||||
filter_options = list(filter(lambda f: filter_name in f["name"], filter_options))
|
||||
|
||||
return Response(filter_options)
|
||||
|
||||
@action(methods=["get"], detail=True)
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ export const filterAlertGroupsTableByIntegrationAndGoToDetailPage = async (
|
|||
const selectElement = await selectDropdownValue({
|
||||
page,
|
||||
selectType: 'grafanaSelect',
|
||||
placeholderText: 'Search or filter results...',
|
||||
placeholderText: 'Filter results...',
|
||||
value: 'Integration',
|
||||
});
|
||||
await selectElement.type(integrationName);
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ class _RemoteFilters extends Component<RemoteFiltersProps, RemoteFiltersState> {
|
|||
<Select
|
||||
menuShouldPortal
|
||||
key={filters.length}
|
||||
placeholder="Search or filter results..."
|
||||
placeholder={allowFreeSearch ? 'Search or filter results...' : 'Filter results...'}
|
||||
value={undefined}
|
||||
onChange={this.handleAddFilter}
|
||||
getOptionLabel={(item: SelectableValue) => capitalCase(item.label)}
|
||||
|
|
|
|||
|
|
@ -58,11 +58,6 @@ export class FiltersStore extends BaseStore {
|
|||
public async updateOptionsForPage(page: string) {
|
||||
const result = await makeRequest(`/${getApiPathByPage(page)}/filters/`, {});
|
||||
|
||||
const allowFreeSearch = result.some((filter: FilterOption) => filter.name === 'search');
|
||||
if (!allowFreeSearch) {
|
||||
result.unshift({ name: 'search', type: 'search' });
|
||||
}
|
||||
|
||||
runInAction(() => {
|
||||
this.options = {
|
||||
...this.options,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue