Skip to content

Commit

Permalink
Merge branch 'main' into 2528-bug-backend-default-to-noauth-while-fro…
Browse files Browse the repository at this point in the history
…ntend-doesnt-default-to-anything
  • Loading branch information
talboren authored Nov 19, 2024
2 parents 0f9bf29 + 892a79e commit 119de69
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion keep-ui/app/alerts/alerts-table-body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function AlertsTableBody({
if (showEmptyState) {
return (
<>
<div className="flex flex-col justify-center items-center h-96 w-full absolute top-1/3">
<div className="flex flex-col justify-center items-center h-96 w-full absolute p-4">
<EmptyStateCard
title="No alerts to display"
description="It is because you have not connected any data source yet or there are no alerts matching the filter."
Expand Down
17 changes: 15 additions & 2 deletions keep/providers/servicenow_provider/servicenow_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,9 @@ def validate_config(self):
def _query(
self,
table_name: str,
get_incidents: bool = False,
incident_id: str = None,
sysparm_limit: int = 100,
sysparm_offset: int = 0,
**kwargs: dict,
):
request_url = f"{self.authentication_config.service_now_base_url}/api/now/table/{table_name}"
Expand All @@ -205,11 +206,23 @@ def _query(
if self._access_token:
headers["Authorization"] = f"Bearer {self._access_token}"

if incident_id:
request_url = f"{request_url}/{incident_id}"

params = {"sysparm_offset": 0, "sysparm_limit": 100}
# Add pagination parameters if not already set
if sysparm_limit:
params["sysparm_limit"] = (
sysparm_limit # Limit number of records per request
)
if sysparm_offset:
params["sysparm_offset"] = 0 # Start from beginning

response = requests.get(
request_url,
headers=headers,
auth=auth,
params=kwargs,
params=params,
verify=False,
timeout=10,
)
Expand Down

0 comments on commit 119de69

Please sign in to comment.