Skip to content

Commit

Permalink
fix: errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Kiryous committed Nov 26, 2024
1 parent 8314292 commit 8524c23
Show file tree
Hide file tree
Showing 32 changed files with 27 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import IncidentCard from "./alert-create-incident-ai-card";
import { useIncidents } from "utils/hooks/useIncidents";
import { useRouter } from "next/navigation";
import { useApi } from "@/shared/lib/hooks/useApi";
import { KeepApiError } from "@/shared/api/KeepApiError";
import { KeepApiError } from "@/shared/api";

interface CreateIncidentWithAIModalProps {
isOpen: boolean;
Expand Down
1 change: 0 additions & 1 deletion keep-ui/app/(keep)/alerts/alert-dismiss-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ const ReactQuill =
typeof window === "object" ? require("react-quill") : () => false;
import "./alert-dismiss-modal.css";
import { useApi } from "@/shared/lib/hooks/useApi";
import { KeepApiError } from "@/shared/api/KeepApiError";
import { showErrorToast } from "@/shared/ui/utils/showErrorToast";

interface Props {
Expand Down
1 change: 0 additions & 1 deletion keep-ui/app/(keep)/alerts/alert-method-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { useRouter, useSearchParams } from "next/navigation";
import { useProviders } from "utils/hooks/useProviders";
import Modal from "@/components/ui/Modal";
import { useApi } from "@/shared/lib/hooks/useApi";
import { KeepApiError } from "@/shared/api/KeepApiError";
import { showErrorToast } from "@/shared/ui/utils/showErrorToast";

const supportedParamTypes = ["datetime", "literal", "str"];
Expand Down
2 changes: 0 additions & 2 deletions keep-ui/app/(keep)/alerts/alert-note-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import { Button } from "@tremor/react";
import { AlertDto } from "./models";
import Modal from "@/components/ui/Modal";
import { useApi } from "@/shared/lib/hooks/useApi";
import { KeepApiError } from "@/shared/api/KeepApiError";
import { toast } from "react-toastify";
import { showErrorToast } from "@/shared/ui/utils/showErrorToast";

interface AlertNoteModalProps {
Expand Down
1 change: 0 additions & 1 deletion keep-ui/app/(keep)/alerts/alert-presets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { Table } from "@tanstack/react-table";
import { AlertsRulesBuilder } from "./alerts-rules-builder";
import { formatQuery, parseCEL, RuleGroupType } from "react-querybuilder";
import { useApi } from "@/shared/lib/hooks/useApi";
import { KeepApiError } from "@/shared/api/KeepApiError";
import CreatableMultiSelect from "@/components/ui/CreatableMultiSelect";
import { MultiValue } from "react-select";
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { useAlerts } from "utils/hooks/useAlerts";
import { usePresets } from "utils/hooks/usePresets";
import Select from "@/components/ui/Select";
import { useApi } from "@/shared/lib/hooks/useApi";
import { KeepApiError } from "@/shared/api/KeepApiError";
import { KeepApiError } from "@/shared/api";

interface PushAlertToServerModalProps {
handleClose: () => void;
Expand Down
2 changes: 1 addition & 1 deletion keep-ui/app/(keep)/alerts/alert-tab-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Modal from "@/components/ui/Modal";
import { Button, TextInput } from "@tremor/react";
import { AlertsRulesBuilder } from "@/app/(keep)/alerts/alerts-rules-builder";
import { useApi } from "@/shared/lib/hooks/useApi";
import { KeepApiError } from "@/shared/api/KeepApiError";
import { KeepApiError } from "@/shared/api";

interface AlertTabModalProps {
presetId: string;
Expand Down
4 changes: 0 additions & 4 deletions keep-ui/app/(keep)/alerts/alert-tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ import { AlertDto } from "./models";
import AlertTabModal from "./alert-tab-modal";
import { evalWithContext } from "./alerts-rules-builder";
import { XMarkIcon } from "@heroicons/react/24/outline";
import { useApiUrl } from "utils/hooks/useConfig";
import { useHydratedSession as useSession } from "@/shared/lib/hooks/useHydratedSession";
import { useApi } from "@/shared/lib/hooks/useApi";
import { KeepApiError } from "@/shared/api/KeepApiError";
import { toast } from "react-toastify";
import { showErrorToast } from "@/shared/ui/utils/showErrorToast";
interface Tab {
id?: string;
Expand Down
2 changes: 1 addition & 1 deletion keep-ui/app/(keep)/deduplication/DeduplicationSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
} from "@heroicons/react/24/outline";
import { KeyedMutator } from "swr";
import { useApi } from "@/shared/lib/hooks/useApi";
import { KeepApiError } from "@/shared/api/KeepApiError";
import { KeepApiError } from "@/shared/api";
import { Providers } from "@/app/(keep)/providers/providers";
import SidePanel from "@/components/SidePanel";

Expand Down
2 changes: 1 addition & 1 deletion keep-ui/app/(keep)/error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import "./error.css";
import { useEffect } from "react";
import { Title, Subtitle } from "@tremor/react";
import { Button, Text } from "@tremor/react";
import { KeepApiError } from "@/shared/api/KeepApiError";
import { KeepApiError } from "@/shared/api";
import * as Sentry from "@sentry/nextjs";
import { useSignOut } from "@/shared/lib/hooks/useSignOut";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getIncident } from "@/entities/incidents/api/incidents";
import { createServerApiClient } from "@/shared/api/createServerApiClient";
import { createServerApiClient } from "@/shared/api/server";
import { notFound } from "next/navigation";
import { KeepApiError } from "@/shared/api/KeepApiError";
import { KeepApiError } from "@/shared/api";
import { IncidentDto } from "@/entities/incidents/model";

export async function getIncidentWithErrorHandling(
Expand Down
2 changes: 1 addition & 1 deletion keep-ui/app/(keep)/incidents/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
GetIncidentsParams,
} from "@/entities/incidents/api/incidents";
import { PaginatedIncidentsDto } from "@/entities/incidents/model";
import { createServerApiClient } from "@/shared/api/createServerApiClient";
import { createServerApiClient } from "@/shared/api/server";

const defaultIncidentsParams: GetIncidentsParams = {
confirmed: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { redirect } from "next/navigation";
import { cookies } from "next/headers";
import { createServerApiClient } from "@/shared/api/createServerApiClient";
import { createServerApiClient } from "@/shared/api/server";

export default async function InstallFromOAuth({
params,
Expand Down
2 changes: 1 addition & 1 deletion keep-ui/app/(keep)/providers/provider-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import { useProviders } from "@/utils/hooks/useProviders";
import TimeAgo from "react-timeago";
import { toast } from "react-toastify";
import { useApi } from "@/shared/lib/hooks/useApi";
import { KeepApiError, KeepApiReadOnlyError } from "@/shared/api/KeepApiError";
import { KeepApiError, KeepApiReadOnlyError } from "@/shared/api";
import { showErrorToast } from "@/shared/ui/utils/showErrorToast";

type ProviderFormProps = {
Expand Down
2 changes: 1 addition & 1 deletion keep-ui/app/(keep)/settings/auth/groups-sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { useRoles } from "utils/hooks/useRoles";
import { useUsers } from "@/entities/users/model/useUsers";
import "./multiselect.css";
import { useApi } from "@/shared/lib/hooks/useApi";
import { KeepApiError } from "@/shared/api/KeepApiError";
import { KeepApiError } from "@/shared/api";

interface GroupSidebarProps {
isOpen: boolean;
Expand Down
2 changes: 1 addition & 1 deletion keep-ui/app/(keep)/settings/auth/roles-sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
import { Text, Button, TextInput, Callout, Badge } from "@tremor/react";
import { IoMdClose } from "react-icons/io";
import { Role } from "@/app/(keep)/settings/models";
import { KeepApiError } from "@/shared/api/KeepApiError";
import { KeepApiError } from "@/shared/api";
import { useApi } from "@/shared/lib/hooks/useApi";

interface RoleSidebarProps {
Expand Down
2 changes: 1 addition & 1 deletion keep-ui/app/(keep)/settings/auth/users-sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { User, Group } from "@/app/(keep)/settings/models";
import { AuthType } from "utils/authenticationType";
import { useConfig } from "utils/hooks/useConfig";
import Select from "@/components/ui/Select";
import { KeepApiError } from "@/shared/api/KeepApiError";
import { KeepApiError } from "@/shared/api";
import { useApi } from "@/shared/lib/hooks/useApi";

interface UserSidebarProps {
Expand Down
2 changes: 1 addition & 1 deletion keep-ui/app/(keep)/settings/create-api-key-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { Role } from "@/app/(keep)/settings/models";
import Modal from "@/components/ui/Modal";
import Select from "@/components/ui/Select";
import { useApi } from "@/shared/lib/hooks/useApi";
import { KeepApiError } from "@/shared/api/KeepApiError";
import { KeepApiError } from "@/shared/api";

interface CreateApiKeyModalProps {
isOpen: boolean;
Expand Down
2 changes: 1 addition & 1 deletion keep-ui/app/(keep)/settings/smtp-settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Card, Button, Title, Subtitle, TextInput } from "@tremor/react";
import useSWR from "swr";
import Loading from "@/app/(keep)/loading";
import { useApi } from "@/shared/lib/hooks/useApi";
import { KeepApiError } from "@/shared/api/KeepApiError";
import { KeepApiError } from "@/shared/api";

interface SMTPSettings {
host: string;
Expand Down
2 changes: 1 addition & 1 deletion keep-ui/app/(keep)/topology/api/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { TopologyApplication, TopologyService } from "../model/models";
import { ApiClient } from "@/shared/lib/api/ApiClient";
import { ApiClient } from "@/shared/api";

export function buildTopologyUrl({
providerIds,
Expand Down
1 change: 0 additions & 1 deletion keep-ui/app/(keep)/topology/model/useTopology.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import useSWR, { SWRConfiguration } from "swr";
import { useEffect } from "react";
import { buildTopologyUrl } from "@/app/(keep)/topology/api";
import { useTopologyPollingContext } from "@/app/(keep)/topology/model/TopologyPollingContext";
import { useApiUrl } from "utils/hooks/useConfig";
import { useApi } from "@/shared/lib/hooks/useApi";

export const TOPOLOGY_URL = `/topology`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useCallback, useMemo } from "react";
import { useTopology } from "./useTopology";
import { useRevalidateMultiple } from "@/utils/state";
import { TOPOLOGY_URL } from "./useTopology";
import { KeepApiError } from "@/shared/api/KeepApiError";
import { KeepApiError } from "@/shared/api";
import { useApi } from "@/shared/lib/hooks/useApi";

type UseTopologyApplicationsOptions = {
Expand Down
2 changes: 1 addition & 1 deletion keep-ui/app/(keep)/topology/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";
import { getApplications, getTopology } from "./api";
import { TopologyPageClient } from "./topology-client";
import { Subtitle, Title } from "@tremor/react";
import { createServerApiClient } from "@/shared/api/createServerApiClient";
import { createServerApiClient } from "@/shared/api/server";
import { TopologyApplication, TopologyService } from "./model";

export const metadata = {
Expand Down
2 changes: 1 addition & 1 deletion keep-ui/app/(keep)/workflows/builder/[workflowId]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PageClient from "../page.client";
import { createServerApiClient } from "@/shared/api/createServerApiClient";
import { createServerApiClient } from "@/shared/api/server";

type WorkflowRawResponse = {
workflow_raw: string;
Expand Down
2 changes: 1 addition & 1 deletion keep-ui/app/(keep)/workflows/builder/builder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import useStore, {
} from "./builder-store";
import { toast } from "react-toastify";
import { useApi } from "@/shared/lib/hooks/useApi";
import { KeepApiError } from "@/shared/api/KeepApiError";
import { KeepApiError } from "@/shared/api";
import { showErrorToast } from "@/shared/ui/utils/showErrorToast";
import "./page.css";

Expand Down
2 changes: 1 addition & 1 deletion keep-ui/app/(keep)/workflows/dragndrop.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useRef, useState } from "react";
import { useApi } from "@/shared/lib/hooks/useApi";
import { KeepApiError } from "@/shared/api/KeepApiError";
import { KeepApiError } from "@/shared/api";

const FileUpload: React.FC = () => {
const api = useApi();
Expand Down
2 changes: 1 addition & 1 deletion keep-ui/app/(keep)/workflows/workflows.client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { useRouter } from "next/navigation";
import Modal from "@/components/ui/Modal";
import MockWorkflowCardSection from "./mockworkflows";
import { useApi } from "@/shared/lib/hooks/useApi";
import { KeepApiError } from "@/shared/api/KeepApiError";
import { KeepApiError } from "@/shared/api";

export default function WorkflowsPage() {
const api = useApi();
Expand Down
2 changes: 1 addition & 1 deletion keep-ui/entities/incidents/api/incidents.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { IncidentDto, PaginatedIncidentsDto } from "@/entities/incidents/model";
import { ApiClient } from "@/shared/lib/api/ApiClient";
import { ApiClient } from "@/shared/api";

interface Filters {
status: string[];
Expand Down
3 changes: 1 addition & 2 deletions keep-ui/shared/api/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export { KeepApiError } from "./KeepApiError";
export { KeepApiError, KeepApiReadOnlyError } from "./KeepApiError";
export { ApiClient } from "./ApiClient";
export { createServerApiClient } from "./createServerApiClient";
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { auth } from "@/auth";
import { getConfig } from "@/shared/lib/server/getConfig";
import { ApiClient } from "./ApiClient";
import { ApiClient } from "../ApiClient";

/**
* Creates an API client configured for server-side usage
Expand Down
1 change: 1 addition & 0 deletions keep-ui/shared/api/server/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { createServerApiClient } from "./createServerApiClient";
2 changes: 1 addition & 1 deletion keep-ui/shared/ui/utils/showErrorToast.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Link } from "@/components/ui";
import { KeepApiError, KeepApiReadOnlyError } from "@/shared/api/KeepApiError";
import { KeepApiError, KeepApiReadOnlyError } from "@/shared/api";
import { toast, ToastOptions } from "react-toastify";

export function showErrorToast(
Expand Down

0 comments on commit 8524c23

Please sign in to comment.