Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui): styling in alert table when empty #2531

Merged
merged 4 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading