Skip to content

Commit

Permalink
Merge branch 'main' into feat/clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
Matvey-Kuk authored Nov 25, 2024
2 parents f7a1637 + af41180 commit 5a4fb7d
Show file tree
Hide file tree
Showing 25 changed files with 880 additions and 452 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: Test docs
on:
push:
paths:
- 'keep/poviders/**'
- 'keep/providers/**'
- 'docs/**'
pull_request:
paths:
- 'keep/poviders/**'
- 'keep/providers/**'
- 'docs/**'
workflow_dispatch:
concurrency:
Expand Down
6 changes: 3 additions & 3 deletions docs/deployment/authentication/azuread-auth.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This feature is a part of Keep Enterprise.
Talk to us to get access: https://www.keephq.dev/meet-keep
</Tip>

Keep supports enterprise authentication through Azure Active Directory (Azure AD), enabling organizations to use their existing Microsoft identity platform for secure access management.
Keep supports enterprise authentication through Azure Entre ID (formerly known as Azure AD), enabling organizations to use their existing Microsoft identity platform for secure access management.

## When to Use

Expand Down Expand Up @@ -49,9 +49,9 @@ We use "Web" platform instead of "Single Page Application (SPA)" because Keep's
</Info>

<Tip>
For localhost, the redirect would be http://localhost:3000/api/auth/callback/azure-ad
For localhost, the redirect would be http://localhost:3000/api/auth/callback/microsoft-entra-id

For production, it should be something like http://your_keep_frontend_domain/api/auth/callback/azure-ad
For production, it should be something like http://your_keep_frontend_domain/api/auth/callback/microsoft-entra-id

</Tip>

Expand Down
Binary file modified docs/images/azuread_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions docs/providers/documentation/gke-provider.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "GKE"
sidebarTitle: "GKE Provider"
description: "GKE provider allows managing Google Kubernetes Engine clusters and related resources."
title: "Google Kubernetes Engine"
sidebarTitle: "Google Kubernetes Engine Provider"
description: "Google Kubernetes Engine provider allows managing Google Kubernetes Engine clusters and related resources."
---

## Inputs
Expand Down
6 changes: 3 additions & 3 deletions docs/providers/documentation/teams-provider.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "Teams Provider"
sidebarTitle: "Teams Provider"
description: "Teams Provider is a provider that allows to notify alerts to Microsoft Teams chats."
title: "Microsoft Teams Provider"
sidebarTitle: "Microsoft Teams Provider"
description: "Microsoft Teams Provider is a provider that allows to notify alerts to Microsoft Teams chats."
---

## Inputs
Expand Down
4 changes: 2 additions & 2 deletions docs/providers/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ By leveraging Keep Providers, users are able to deeply integrate Keep with the t
/>

<Card
title="GKE"
title="Google Kubernetes Engine"
href="/providers/documentation/gke-provider"
icon={
<img src="https://img.logo.dev/gke.com?token=pk_dfXfZBoKQMGDTIgqu7LvYg" />
Expand Down Expand Up @@ -653,7 +653,7 @@ By leveraging Keep Providers, users are able to deeply integrate Keep with the t
></Card>

<Card
title="Teams"
title="Microsoft Teams"
href="/providers/documentation/teams-provider"
icon={
<img src="https://img.logo.dev/teams.com?token=pk_dfXfZBoKQMGDTIgqu7LvYg" />
Expand Down
133 changes: 77 additions & 56 deletions keep-ui/app/(keep)/alerts/alert-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -264,15 +264,20 @@ export function AlertTable({
};

return (
<div className="flex flex-col gap-4 h-full">
<TitleAndFilters
table={table}
alerts={alerts}
presetName={presetName}
onThemeChange={handleThemeChange}
/>
<div className="min-h-10">
{/* Setting min-h-10 to avoid jumping when actions are shown */}
// Add h-screen to make it full height and remove the default flex-col gap
<div className="h-screen flex flex-col">
{/* Add padding to account for any top nav/header */}
<div className="pt-4 px-4 flex-none">
<TitleAndFilters
table={table}
alerts={alerts}
presetName={presetName}
onThemeChange={handleThemeChange}
/>
</div>

{/* Make actions/presets section fixed height */}
<div className="h-12 px-4 flex-none">
{selectedRowIds.length ? (
<AlertActions
selectedRowIds={selectedRowIds}
Expand All @@ -291,61 +296,77 @@ export function AlertTable({
/>
)}
</div>
<div className="flex gap-6">
<div className="w-32 min-w-[12rem]">
<AlertFacets
className="sticky top-0"
alerts={alerts}
facetFilters={facetFilters}
setFacetFilters={setFacetFilters}
dynamicFacets={dynamicFacets}
setDynamicFacets={setDynamicFacets}
onDelete={handleFacetDelete}
table={table}
showSkeleton={showSkeleton}
/>
</div>
<div className="flex flex-col gap-4 min-w-0">
<Card className="flex-grow h-full flex flex-col p-0">
<div className="flex-grow">
{/* For dynamic preset, add alert tabs*/}
{!presetStatic && (
<AlertTabs
presetId={presetId}
tabs={tabs}
setTabs={setTabs}
selectedTab={selectedTab}
setSelectedTab={setSelectedTab}
/>
)}
<div ref={a11yContainerRef} className="sr-only" />
<Table className="[&>table]:table-fixed [&>table]:w-full">
<AlertsTableHeaders
columns={columns}
table={table}
presetName={presetName}
a11yContainerRef={a11yContainerRef}
/>
<AlertsTableBody
table={table}
showSkeleton={showSkeleton}
showEmptyState={showEmptyState}
theme={theme}
onRowClick={handleRowClick}
presetName={presetName}
/>
</Table>
</div>
</Card>

{/* Main content area - uses flex-grow to fill remaining space */}
<div className="flex-grow overflow-hidden px-4 pb-4">
<div className="h-full flex gap-6">
{/* Facets sidebar */}
<div className="w-32 min-w-[12rem] overflow-y-auto">
<AlertFacets
className="sticky top-0"
alerts={alerts}
facetFilters={facetFilters}
setFacetFilters={setFacetFilters}
dynamicFacets={dynamicFacets}
setDynamicFacets={setDynamicFacets}
onDelete={handleFacetDelete}
table={table}
showSkeleton={showSkeleton}
/>
</div>

{/* Table section */}
<div className="flex-1 flex flex-col min-w-0">
<Card className="h-full flex flex-col p-0">
<div className="flex-grow flex flex-col overflow-hidden">
{!presetStatic && (
<div className="flex-none">
<AlertTabs
presetId={presetId}
tabs={tabs}
setTabs={setTabs}
selectedTab={selectedTab}
setSelectedTab={setSelectedTab}
/>
</div>
)}

<div ref={a11yContainerRef} className="sr-only" />

{/* Make table wrapper scrollable */}
<div className="flex-grow overflow-auto">
<Table className="[&>table]:table-fixed [&>table]:w-full">
<AlertsTableHeaders
columns={columns}
table={table}
presetName={presetName}
a11yContainerRef={a11yContainerRef}
/>
<AlertsTableBody
table={table}
showSkeleton={showSkeleton}
showEmptyState={showEmptyState}
theme={theme}
onRowClick={handleRowClick}
presetName={presetName}
/>
</Table>
</div>
</div>
</Card>
</div>
</div>
</div>
<div className="mt-2 mb-8 pl-[14rem]">

{/* Pagination footer - fixed height */}
<div className="h-16 px-4 flex-none pl-[14rem]">
<AlertPagination
table={table}
presetName={presetName}
isRefreshAllowed={isRefreshAllowed}
/>
</div>

<AlertSidebar
isOpen={isSidebarOpen}
toggle={() => setIsSidebarOpen(false)}
Expand Down
16 changes: 9 additions & 7 deletions keep-ui/app/(keep)/alerts/alerts-table-body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@ export function AlertsTableBody({
if (showEmptyState) {
return (
<>
<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."
buttonText="Add Alert"
onClick={handleModalOpen}
/>
<div className="flex items-center h-full w-full absolute -mt-20">
<div className="flex flex-col justify-center items-center w-full 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."
buttonText="Add Alert"
onClick={handleModalOpen}
/>
</div>
</div>
{modalOpen && (
<PushAlertToServerModal
Expand Down
10 changes: 3 additions & 7 deletions keep-ui/app/(signin)/signin/SignInForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export interface Providers {
auth0?: Provider;
credentials?: Provider;
keycloak?: Provider;
"azure-ad"?: Provider;
"microsoft-entra-id"?: Provider;
}

interface SignInFormInputs {
Expand All @@ -42,15 +42,11 @@ export default function SignInForm({ params }: { params?: { amt: string } }) {
} = useForm<SignInFormInputs>();

useEffect(() => {
console.log("Fetching providers");
async function fetchProviders() {
console.log("Fetching providers 2");
const response = await getProviders();
setProviders(response as Providers);
}
console.log("Fetching providers 3");
fetchProviders();
console.log("Fetching providers 4");
}, []);

useEffect(() => {
Expand All @@ -69,9 +65,9 @@ export default function SignInForm({ params }: { params?: { amt: string } }) {
} else if (providers.keycloak) {
console.log("Signing in with keycloak provider");
signIn("keycloak", { callbackUrl: "/" });
} else if (providers["azure-ad"]) {
} else if (providers["microsoft-entra-id"]) {
console.log("Signing in with Azure AD provider");
signIn("azure-ad", { callbackUrl: "/" });
signIn("microsoft-entra-id", { callbackUrl: "/" });
} else if (
providers.credentials &&
providers.credentials.name == "NoAuth"
Expand Down
23 changes: 22 additions & 1 deletion keep-ui/app/api/auth/[...nextauth]/route.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,23 @@
import { handlers } from "@/auth";
export const { GET, POST } = handlers;
import { NextRequest } from "next/server";

const reqWithTrustedOrigin = (req: NextRequest): NextRequest => {
if (process.env.AUTH_TRUST_HOST !== "true") return req;
const proto = req.headers.get("x-forwarded-proto");
const host = req.headers.get("x-forwarded-host");
if (!proto || !host) {
console.warn("Missing x-forwarded-proto or x-forwarded-host headers.");
return req;
}
const envOrigin = `${proto}://${host}`;
const { href, origin } = req.nextUrl;
return new NextRequest(href.replace(origin, envOrigin), req);
};

export const GET = (req: NextRequest) => {
return handlers.GET(reqWithTrustedOrigin(req));
};

export const POST = (req: NextRequest) => {
return handlers.POST(reqWithTrustedOrigin(req));
};
Loading

0 comments on commit 5a4fb7d

Please sign in to comment.