mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
refactor(channel): reorganize into components/schemas, nest notifications+storages under components
This commit is contained in:
@@ -4,8 +4,8 @@ import {Metadata} from "next";
|
|||||||
import {db} from "@/db";
|
import {db} from "@/db";
|
||||||
import {notificationChannel, NotificationChannelWith} from "@/db/schema/09_notification-channel";
|
import {notificationChannel, NotificationChannelWith} from "@/db/schema/09_notification-channel";
|
||||||
import {desc, isNull} from "drizzle-orm";
|
import {desc, isNull} from "drizzle-orm";
|
||||||
import {ChannelsSection} from "@/features/channel/channels-section";
|
import {ChannelsSection} from "@/features/channel/components/channels-section";
|
||||||
import {ChannelAddEditModal} from "@/features/channel/channel-add-edit-modal";
|
import {ChannelAddEditModal} from "@/features/channel/components/channel-add-edit-modal";
|
||||||
import * as drizzleDb from "@/db";
|
import * as drizzleDb from "@/db";
|
||||||
|
|
||||||
export const metadata: Metadata = {
|
export const metadata: Metadata = {
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import {PageParams} from "@/types/next";
|
import {PageParams} from "@/types/next";
|
||||||
import {Page, PageActions, PageContent, PageHeader, PageTitle} from "@/features/layout/page";
|
import {Page, PageActions, PageContent, PageHeader, PageTitle} from "@/features/layout/page";
|
||||||
import {Metadata} from "next";
|
import {Metadata} from "next";
|
||||||
import {ChannelsSection} from "@/features/channel/channels-section";
|
import {ChannelsSection} from "@/features/channel/components/channels-section";
|
||||||
import {db} from "@/db";
|
import {db} from "@/db";
|
||||||
import {desc, eq, isNull} from "drizzle-orm";
|
import {desc, eq, isNull} from "drizzle-orm";
|
||||||
import * as drizzleDb from "@/db";
|
import * as drizzleDb from "@/db";
|
||||||
import {StorageChannelWith} from "@/db/schema/12_storage-channel";
|
import {StorageChannelWith} from "@/db/schema/12_storage-channel";
|
||||||
import {ChannelAddEditModal} from "@/features/channel/channel-add-edit-modal";
|
import {ChannelAddEditModal} from "@/features/channel/components/channel-add-edit-modal";
|
||||||
|
|
||||||
export const metadata: Metadata = {
|
export const metadata: Metadata = {
|
||||||
title: "Storage Channels",
|
title: "Storage Channels",
|
||||||
|
|||||||
+2
-2
@@ -12,8 +12,8 @@ import {useIsMobile} from "@/hooks/use-mobile";
|
|||||||
import {useEffect, useState} from "react";
|
import {useEffect, useState} from "react";
|
||||||
import {Tabs, TabsContent, TabsList, TabsTrigger} from "@/components/ui/tabs";
|
import {Tabs, TabsContent, TabsList, TabsTrigger} from "@/components/ui/tabs";
|
||||||
import {StorageChannelWith} from "@/db/schema/12_storage-channel";
|
import {StorageChannelWith} from "@/db/schema/12_storage-channel";
|
||||||
import {ChannelForm} from "@/features/channel/channel-form";
|
import {ChannelForm} from "@/features/channel/components/channel-form";
|
||||||
import {ChannelKind, getChannelTextBasedOnKind} from "@/features/channel/channels-helpers";
|
import {ChannelKind, getChannelTextBasedOnKind} from "@/features/channel/components/channels-helpers";
|
||||||
import {
|
import {
|
||||||
ChannelOrganisationForm
|
ChannelOrganisationForm
|
||||||
} from "@/features/organizations/channels-organization-form";
|
} from "@/features/organizations/channels-organization-form";
|
||||||
+3
-3
@@ -9,11 +9,11 @@ import {useIsMobile} from "@/hooks/use-mobile";
|
|||||||
import {StorageChannelWith} from "@/db/schema/12_storage-channel";
|
import {StorageChannelWith} from "@/db/schema/12_storage-channel";
|
||||||
import {
|
import {
|
||||||
EditChannelButton
|
EditChannelButton
|
||||||
} from "@/features/channel/channel-edit-button";
|
} from "@/features/channel/components/channel-edit-button";
|
||||||
import {ChannelKind, getChannelIcon} from "@/features/channel/channels-helpers";
|
import {ChannelKind, getChannelIcon} from "@/features/channel/components/channels-helpers";
|
||||||
import {
|
import {
|
||||||
DeleteChannelButton
|
DeleteChannelButton
|
||||||
} from "@/features/channel/channel-delete-button";
|
} from "@/features/channel/components/channel-delete-button";
|
||||||
|
|
||||||
export type ChannelCardProps = {
|
export type ChannelCardProps = {
|
||||||
data: NotificationChannelWith | StorageChannelWith;
|
data: NotificationChannelWith | StorageChannelWith;
|
||||||
+3
-3
@@ -5,12 +5,12 @@ import {useRouter} from "next/navigation";
|
|||||||
import {Trash2} from "lucide-react";
|
import {Trash2} from "lucide-react";
|
||||||
import {
|
import {
|
||||||
removeNotificationChannelAction,
|
removeNotificationChannelAction,
|
||||||
} from "@/features/channel/notifications/channel.action";
|
} from "@/features/channel/components/notifications/channel.action";
|
||||||
import {toast} from "sonner";
|
import {toast} from "sonner";
|
||||||
import {ChannelKind, getChannelTextBasedOnKind} from "@/features/channel/channels-helpers";
|
import {ChannelKind, getChannelTextBasedOnKind} from "@/features/channel/components/channels-helpers";
|
||||||
import {
|
import {
|
||||||
removeStorageChannelAction
|
removeStorageChannelAction
|
||||||
} from "@/features/channel/storages/channel.action";
|
} from "@/features/channel/components/storages/channel.action";
|
||||||
|
|
||||||
export type DeleteChannelButtonProps = {
|
export type DeleteChannelButtonProps = {
|
||||||
channelId: string;
|
channelId: string;
|
||||||
+4
-4
@@ -7,14 +7,14 @@ import {toast} from "sonner";
|
|||||||
import {useState} from "react";
|
import {useState} from "react";
|
||||||
import {OrganizationWithMembers} from "@/db/schema/03_organization";
|
import {OrganizationWithMembers} from "@/db/schema/03_organization";
|
||||||
import {StorageChannelWith} from "@/db/schema/12_storage-channel";
|
import {StorageChannelWith} from "@/db/schema/12_storage-channel";
|
||||||
import {ChannelKind} from "@/features/channel/channels-helpers";
|
import {ChannelKind} from "@/features/channel/components/channels-helpers";
|
||||||
import {
|
import {
|
||||||
updateNotificationChannelAction
|
updateNotificationChannelAction
|
||||||
} from "@/features/channel/notifications/channel.action";
|
} from "@/features/channel/components/notifications/channel.action";
|
||||||
import {ChannelAddEditModal} from "@/features/channel/channel-add-edit-modal";
|
import {ChannelAddEditModal} from "@/features/channel/components/channel-add-edit-modal";
|
||||||
import {
|
import {
|
||||||
updateStorageChannelAction
|
updateStorageChannelAction
|
||||||
} from "@/features/channel/storages/channel.action";
|
} from "@/features/channel/components/storages/channel.action";
|
||||||
|
|
||||||
export type EditChannelButtonProps = {
|
export type EditChannelButtonProps = {
|
||||||
channel: NotificationChannelWith | StorageChannelWith;
|
channel: NotificationChannelWith | StorageChannelWith;
|
||||||
+7
-7
@@ -8,7 +8,7 @@ import {Input} from "@/components/ui/input";
|
|||||||
|
|
||||||
import {
|
import {
|
||||||
addStorageChannelAction, updateStorageChannelAction
|
addStorageChannelAction, updateStorageChannelAction
|
||||||
} from "@/features/channel/storages/channel.action";
|
} from "@/features/channel/components/storages/channel.action";
|
||||||
import {toast} from "sonner";
|
import {toast} from "sonner";
|
||||||
import {OrganizationWithMembers} from "@/db/schema/03_organization";
|
import {OrganizationWithMembers} from "@/db/schema/03_organization";
|
||||||
import {Button} from "@/components/ui/button";
|
import {Button} from "@/components/ui/button";
|
||||||
@@ -20,19 +20,19 @@ import {ArrowLeft} from "lucide-react";
|
|||||||
import {StorageChannelWith} from "@/db/schema/12_storage-channel";
|
import {StorageChannelWith} from "@/db/schema/12_storage-channel";
|
||||||
import {
|
import {
|
||||||
NotificationChannelFormSchema, NotificationChannelFormType, StorageChannelFormSchema, StorageChannelFormType
|
NotificationChannelFormSchema, NotificationChannelFormType, StorageChannelFormSchema, StorageChannelFormType
|
||||||
} from "@/features/channel/channel-form.schema";
|
} from "@/features/channel/schemas/channel-form.schema";
|
||||||
import {
|
import {
|
||||||
ChannelKind,
|
ChannelKind,
|
||||||
renderChannelForm
|
renderChannelForm
|
||||||
} from "@/features/channel/channels-helpers";
|
} from "@/features/channel/components/channels-helpers";
|
||||||
import {storageProviders} from "@/features/channel/channels-storage-helper";
|
import {storageProviders} from "@/features/channel/components/channels-storage-helper";
|
||||||
import {notificationProviders} from "@/features/channel/channels-notification-helper";
|
import {notificationProviders} from "@/features/channel/components/channels-notification-helper";
|
||||||
import {
|
import {
|
||||||
ChannelTestButton
|
ChannelTestButton
|
||||||
} from "@/features/channel/channel-test-button";
|
} from "@/features/channel/components/channel-test-button";
|
||||||
import {
|
import {
|
||||||
addNotificationChannelAction, updateNotificationChannelAction
|
addNotificationChannelAction, updateNotificationChannelAction
|
||||||
} from "@/features/channel/notifications/channel.action";
|
} from "@/features/channel/components/notifications/channel.action";
|
||||||
|
|
||||||
|
|
||||||
type NotifierFormProps = {
|
type NotifierFormProps = {
|
||||||
+1
-1
@@ -11,7 +11,7 @@ import {EventPayload} from "@/features/notifications/notifications.types";
|
|||||||
import {useIsMobile} from "@/hooks/use-mobile";
|
import {useIsMobile} from "@/hooks/use-mobile";
|
||||||
import {cn} from "@/lib/utils";
|
import {cn} from "@/lib/utils";
|
||||||
import {StorageChannel} from "@/db/schema/12_storage-channel";
|
import {StorageChannel} from "@/db/schema/12_storage-channel";
|
||||||
import {ChannelKind} from "@/features/channel/channels-helpers";
|
import {ChannelKind} from "@/features/channel/components/channels-helpers";
|
||||||
import type {StorageInput} from "@/features/storages/storages.types";
|
import type {StorageInput} from "@/features/storages/storages.types";
|
||||||
import {dispatchStorage} from "@/features/storages/storages.dispatch";
|
import {dispatchStorage} from "@/features/storages/storages.dispatch";
|
||||||
|
|
||||||
+15
-15
@@ -1,49 +1,49 @@
|
|||||||
import {UseFormReturn} from "react-hook-form";
|
import {UseFormReturn} from "react-hook-form";
|
||||||
import {
|
import {
|
||||||
NotifierSmtpForm
|
NotifierSmtpForm
|
||||||
} from "@/features/channel/notifications/smtp.form";
|
} from "@/features/channel/components/notifications/smtp.form";
|
||||||
import {
|
import {
|
||||||
NotifierSlackForm
|
NotifierSlackForm
|
||||||
} from "@/features/channel/notifications/slack.form";
|
} from "@/features/channel/components/notifications/slack.form";
|
||||||
import {
|
import {
|
||||||
NotifierDiscordForm
|
NotifierDiscordForm
|
||||||
} from "@/features/channel/notifications/discord.form";
|
} from "@/features/channel/components/notifications/discord.form";
|
||||||
import {
|
import {
|
||||||
NotifierTelegramForm
|
NotifierTelegramForm
|
||||||
} from "@/features/channel/notifications/telegram.form";
|
} from "@/features/channel/components/notifications/telegram.form";
|
||||||
import {
|
import {
|
||||||
NotifierGotifyForm
|
NotifierGotifyForm
|
||||||
} from "@/features/channel/notifications/gotify.form";
|
} from "@/features/channel/components/notifications/gotify.form";
|
||||||
import {
|
import {
|
||||||
NotifierNtfyForm
|
NotifierNtfyForm
|
||||||
} from "@/features/channel/notifications/ntfy.form";
|
} from "@/features/channel/components/notifications/ntfy.form";
|
||||||
import {
|
import {
|
||||||
NotifierWebhookForm
|
NotifierWebhookForm
|
||||||
} from "@/features/channel/notifications/webhook.form";
|
} from "@/features/channel/components/notifications/webhook.form";
|
||||||
import {
|
import {
|
||||||
NotifierNextcloudForm
|
NotifierNextcloudForm
|
||||||
} from "@/features/channel/notifications/nextcloud.form";
|
} from "@/features/channel/components/notifications/nextcloud.form";
|
||||||
import {
|
import {
|
||||||
NotifierPushoverForm
|
NotifierPushoverForm
|
||||||
} from "@/features/channel/notifications/pushover.form";
|
} from "@/features/channel/components/notifications/pushover.form";
|
||||||
import {
|
import {
|
||||||
notificationProviders,
|
notificationProviders,
|
||||||
} from "@/features/channel/channels-notification-helper";
|
} from "@/features/channel/components/channels-notification-helper";
|
||||||
import {
|
import {
|
||||||
NotifierTeamsForm
|
NotifierTeamsForm
|
||||||
} from "@/features/channel/notifications/teams.form";
|
} from "@/features/channel/components/notifications/teams.form";
|
||||||
import {storageProviders} from "@/features/channel/channels-storage-helper";
|
import {storageProviders} from "@/features/channel/components/channels-storage-helper";
|
||||||
import {ForwardRefExoticComponent, JSX, RefAttributes, SVGProps} from "react";
|
import {ForwardRefExoticComponent, JSX, RefAttributes, SVGProps} from "react";
|
||||||
import {LucideProps} from "lucide-react";
|
import {LucideProps} from "lucide-react";
|
||||||
import {
|
import {
|
||||||
StorageS3Form
|
StorageS3Form
|
||||||
} from "@/features/channel/storages/s3.form";
|
} from "@/features/channel/components/storages/s3.form";
|
||||||
import {
|
import {
|
||||||
StorageGoogleDriveForm
|
StorageGoogleDriveForm
|
||||||
} from "@/features/channel/storages/google-drive/google-drive.form";
|
} from "@/features/channel/components/storages/google-drive/google-drive.form";
|
||||||
import {
|
import {
|
||||||
StorageBlobForm
|
StorageBlobForm
|
||||||
} from "@/features/channel/storages/az-blob.form";
|
} from "@/features/channel/components/storages/az-blob.form";
|
||||||
|
|
||||||
export type ChannelKind = "notification" | "storage";
|
export type ChannelKind = "notification" | "storage";
|
||||||
|
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
import {Mail} from "lucide-react";
|
import {Mail} from "lucide-react";
|
||||||
import type { SVGProps } from 'react';
|
import type { SVGProps } from 'react';
|
||||||
import {ProviderIconTypes} from "@/features/channel/channels-helpers";
|
import {ProviderIconTypes} from "@/features/channel/components/channels-helpers";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+3
-3
@@ -5,12 +5,12 @@ import { useState } from "react";
|
|||||||
import { EmptyStatePlaceholder } from "@/components/common/empty-state-placeholder";
|
import { EmptyStatePlaceholder } from "@/components/common/empty-state-placeholder";
|
||||||
import { OrganizationWithMembers } from "@/db/schema/03_organization";
|
import { OrganizationWithMembers } from "@/db/schema/03_organization";
|
||||||
import { StorageChannelWith } from "@/db/schema/12_storage-channel";
|
import { StorageChannelWith } from "@/db/schema/12_storage-channel";
|
||||||
import { ChannelCard } from "@/features/channel/channel-card";
|
import { ChannelCard } from "@/features/channel/components/channel-card";
|
||||||
import { ChannelAddEditModal } from "@/features/channel/channel-add-edit-modal";
|
import { ChannelAddEditModal } from "@/features/channel/components/channel-add-edit-modal";
|
||||||
import {
|
import {
|
||||||
ChannelKind,
|
ChannelKind,
|
||||||
getChannelTextBasedOnKind,
|
getChannelTextBasedOnKind,
|
||||||
} from "@/features/channel/channels-helpers";
|
} from "@/features/channel/components/channels-helpers";
|
||||||
|
|
||||||
type ChannelsSectionProps = {
|
type ChannelsSectionProps = {
|
||||||
channels: NotificationChannelWith[] | StorageChannelWith[];
|
channels: NotificationChannelWith[] | StorageChannelWith[];
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
import {Server} from "lucide-react";
|
import {Server} from "lucide-react";
|
||||||
import type {SVGProps} from "react";
|
import type {SVGProps} from "react";
|
||||||
import {ProviderIconTypes} from "@/features/channel/channels-helpers";
|
import {ProviderIconTypes} from "@/features/channel/components/channels-helpers";
|
||||||
|
|
||||||
export const storageProviders: ProviderIconTypes[] = [
|
export const storageProviders: ProviderIconTypes[] = [
|
||||||
{value: "local", label: "Local", icon: Server},
|
{value: "local", label: "Local", icon: Server},
|
||||||
+1
-1
@@ -10,7 +10,7 @@ import {and, eq} from "drizzle-orm";
|
|||||||
import {withUpdatedAt} from "@/db/utils";
|
import {withUpdatedAt} from "@/db/utils";
|
||||||
import {
|
import {
|
||||||
NotificationChannelFormSchema
|
NotificationChannelFormSchema
|
||||||
} from "@/features/channel/channel-form.schema";
|
} from "@/features/channel/schemas/channel-form.schema";
|
||||||
|
|
||||||
|
|
||||||
export const addNotificationChannelAction = userAction.schema(
|
export const addNotificationChannelAction = userAction.schema(
|
||||||
+8
-8
@@ -2,14 +2,14 @@
|
|||||||
import type {ProviderKind, EventPayload, DispatchResult} from '@/features/notifications/notifications.types';
|
import type {ProviderKind, EventPayload, DispatchResult} from '@/features/notifications/notifications.types';
|
||||||
import {sendSlack} from './slack';
|
import {sendSlack} from './slack';
|
||||||
import {sendSmtp} from './smtp';
|
import {sendSmtp} from './smtp';
|
||||||
import {sendDiscord} from "@/features/channel/notifications/discord";
|
import {sendDiscord} from "@/features/channel/components/notifications/discord";
|
||||||
import {sendTelegram} from "@/features/channel/notifications/telegram";
|
import {sendTelegram} from "@/features/channel/components/notifications/telegram";
|
||||||
import {sendGotify} from "@/features/channel/notifications/gotify";
|
import {sendGotify} from "@/features/channel/components/notifications/gotify";
|
||||||
import {sendNtfy} from "@/features/channel/notifications/ntfy";
|
import {sendNtfy} from "@/features/channel/components/notifications/ntfy";
|
||||||
import {sendWebhook} from "@/features/channel/notifications/webhook";
|
import {sendWebhook} from "@/features/channel/components/notifications/webhook";
|
||||||
import {sendNextcloud} from "@/features/channel/notifications/nextcloud";
|
import {sendNextcloud} from "@/features/channel/components/notifications/nextcloud";
|
||||||
import {sendPushover} from "@/features/channel/notifications/pushover";
|
import {sendPushover} from "@/features/channel/components/notifications/pushover";
|
||||||
import {sendTeams} from "@/features/channel/notifications/teams"
|
import {sendTeams} from "@/features/channel/components/notifications/teams"
|
||||||
|
|
||||||
const handlers: Record<
|
const handlers: Record<
|
||||||
ProviderKind,
|
ProviderKind,
|
||||||
+1
-1
@@ -4,7 +4,7 @@ import {Input} from "@/components/ui/input";
|
|||||||
import {Separator} from "@/components/ui/separator";
|
import {Separator} from "@/components/ui/separator";
|
||||||
import {PasswordInput} from "@/components/ui/password-input";
|
import {PasswordInput} from "@/components/ui/password-input";
|
||||||
import {Select, SelectContent, SelectItem, SelectTrigger, SelectValue} from "@/components/ui/select";
|
import {Select, SelectContent, SelectItem, SelectTrigger, SelectValue} from "@/components/ui/select";
|
||||||
import {PUSHOVER_PRIORITIES} from "@/features/channel/notifications/pushover.schema";
|
import {PUSHOVER_PRIORITIES} from "@/features/channel/components/notifications/pushover.schema";
|
||||||
|
|
||||||
type NotifierPushoverFormProps = {
|
type NotifierPushoverFormProps = {
|
||||||
form: UseFormReturn<any, any, any>;
|
form: UseFormReturn<any, any, any>;
|
||||||
+1
-1
@@ -9,7 +9,7 @@ import {and, eq} from "drizzle-orm";
|
|||||||
import {withUpdatedAt} from "@/db/utils";
|
import {withUpdatedAt} from "@/db/utils";
|
||||||
import {
|
import {
|
||||||
StorageChannelFormSchema
|
StorageChannelFormSchema
|
||||||
} from "@/features/channel/channel-form.schema";
|
} from "@/features/channel/schemas/channel-form.schema";
|
||||||
import {StorageChannel} from "@/db/schema/12_storage-channel";
|
import {StorageChannel} from "@/db/schema/12_storage-channel";
|
||||||
|
|
||||||
|
|
||||||
+1
-1
@@ -8,7 +8,7 @@ import {Button} from "@/components/ui/button";
|
|||||||
import {PasswordInput} from "@/components/ui/password-input";
|
import {PasswordInput} from "@/components/ui/password-input";
|
||||||
import {
|
import {
|
||||||
googleDriveRefreshTokenAction
|
googleDriveRefreshTokenAction
|
||||||
} from "@/features/channel/storages/google-drive/google-drive-refresh.action";
|
} from "@/features/channel/components/storages/google-drive/google-drive-refresh.action";
|
||||||
import {toast} from "sonner";
|
import {toast} from "sonner";
|
||||||
|
|
||||||
type StorageGoogleDriveFormProps = {
|
type StorageGoogleDriveFormProps = {
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
import {drive_v3, google} from "googleapis";
|
import {drive_v3, google} from "googleapis";
|
||||||
import {GoogleDriveConfig} from "@/features/channel/storages/google-drive/types";
|
import {GoogleDriveConfig} from "@/features/channel/components/storages/google-drive/types";
|
||||||
import Drive = drive_v3.Drive;
|
import Drive = drive_v3.Drive;
|
||||||
import {getServerUrl} from "@/utils/get-server-url";
|
import {getServerUrl} from "@/utils/get-server-url";
|
||||||
|
|
||||||
+2
-2
@@ -7,12 +7,12 @@ import {
|
|||||||
StorageResult,
|
StorageResult,
|
||||||
StorageUploadInput
|
StorageUploadInput
|
||||||
} from '@/features/storages/storages.types';
|
} from '@/features/storages/storages.types';
|
||||||
import {GoogleDriveConfig} from "@/features/channel/storages/google-drive/types";
|
import {GoogleDriveConfig} from "@/features/channel/components/storages/google-drive/types";
|
||||||
import {
|
import {
|
||||||
ensureFolderPath,
|
ensureFolderPath,
|
||||||
findFileByName,
|
findFileByName,
|
||||||
getGoogleDriveClient, resolveFilePath
|
getGoogleDriveClient, resolveFilePath
|
||||||
} from "@/features/channel/storages/google-drive/helpers";
|
} from "@/features/channel/components/storages/google-drive/helpers";
|
||||||
import {Readable} from "node:stream";
|
import {Readable} from "node:stream";
|
||||||
import {generateFileUrl} from "@/features/storages/storages.helpers";
|
import {generateFileUrl} from "@/features/storages/storages.helpers";
|
||||||
|
|
||||||
+3
-3
@@ -5,15 +5,15 @@ import {
|
|||||||
} from '@/features/storages/storages.types';
|
} from '@/features/storages/storages.types';
|
||||||
|
|
||||||
import {uploadLocal, getLocal, deleteLocal, pingLocal, copyLocal} from './local';
|
import {uploadLocal, getLocal, deleteLocal, pingLocal, copyLocal} from './local';
|
||||||
import {copyS3, deleteS3, getS3, pingS3, uploadS3} from "@/features/channel/storages/s3";
|
import {copyS3, deleteS3, getS3, pingS3, uploadS3} from "@/features/channel/components/storages/s3";
|
||||||
import {copyBlob, deleteBlob, getBlob, pingBlob, uploadBlob} from "@/features/channel/storages/az-blob";
|
import {copyBlob, deleteBlob, getBlob, pingBlob, uploadBlob} from "@/features/channel/components/storages/az-blob";
|
||||||
import {
|
import {
|
||||||
copyGoogleDrive,
|
copyGoogleDrive,
|
||||||
deleteGoogleDrive,
|
deleteGoogleDrive,
|
||||||
getGoogleDrive,
|
getGoogleDrive,
|
||||||
pingGoogleDrive,
|
pingGoogleDrive,
|
||||||
uploadGoogleDrive
|
uploadGoogleDrive
|
||||||
} from "@/features/channel/storages/google-drive";
|
} from "@/features/channel/components/storages/google-drive";
|
||||||
|
|
||||||
type ProviderHandler = {
|
type ProviderHandler = {
|
||||||
upload: (config: any, input: StorageInput & { action: 'upload' }) => Promise<StorageResult>;
|
upload: (config: any, input: StorageInput & { action: 'upload' }) => Promise<StorageResult>;
|
||||||
+14
-14
@@ -1,18 +1,18 @@
|
|||||||
import {z} from "zod";
|
import {z} from "zod";
|
||||||
import {SlackChannelConfigSchema} from "@/features/channel/notifications/slack.schema";
|
import {SlackChannelConfigSchema} from "@/features/channel/components/notifications/slack.schema";
|
||||||
import {SmtpChannelConfigSchema} from "@/features/channel/notifications/smtp.schema";
|
import {SmtpChannelConfigSchema} from "@/features/channel/components/notifications/smtp.schema";
|
||||||
import {DiscordChannelConfigSchema} from "@/features/channel/notifications/discord.schema";
|
import {DiscordChannelConfigSchema} from "@/features/channel/components/notifications/discord.schema";
|
||||||
import {TelegramChannelConfigSchema} from "@/features/channel/notifications/telegram.schema";
|
import {TelegramChannelConfigSchema} from "@/features/channel/components/notifications/telegram.schema";
|
||||||
import {GotifyChannelConfigSchema} from "@/features/channel/notifications/gotify.schema";
|
import {GotifyChannelConfigSchema} from "@/features/channel/components/notifications/gotify.schema";
|
||||||
import {NtfyChannelConfigSchema} from "@/features/channel/notifications/ntfy.schema";
|
import {NtfyChannelConfigSchema} from "@/features/channel/components/notifications/ntfy.schema";
|
||||||
import {WebhookChannelConfigSchema} from "@/features/channel/notifications/webhook.schema";
|
import {WebhookChannelConfigSchema} from "@/features/channel/components/notifications/webhook.schema";
|
||||||
import {NextcloudChannelConfigSchema} from "@/features/channel/notifications/nextcloud.schema";
|
import {NextcloudChannelConfigSchema} from "@/features/channel/components/notifications/nextcloud.schema";
|
||||||
import {PushoverChannelConfigSchema} from "@/features/channel/notifications/pushover.schema";
|
import {PushoverChannelConfigSchema} from "@/features/channel/components/notifications/pushover.schema";
|
||||||
import {S3ChannelConfigSchema} from "@/features/channel/storages/s3.schema";
|
import {S3ChannelConfigSchema} from "@/features/channel/components/storages/s3.schema";
|
||||||
import {GoogleDriveChannelConfigSchema} from "@/features/channel/storages/google-drive/google-drive.schema";
|
import {GoogleDriveChannelConfigSchema} from "@/features/channel/components/storages/google-drive/google-drive.schema";
|
||||||
import {LocalChannelConfigSchema} from "@/features/channel/storages/local.schema";
|
import {LocalChannelConfigSchema} from "@/features/channel/components/storages/local.schema";
|
||||||
import {TeamsChannelConfigSchema} from "@/features/channel/notifications/teams.schema";
|
import {TeamsChannelConfigSchema} from "@/features/channel/components/notifications/teams.schema";
|
||||||
import {BlobChannelConfigSchema} from "@/features/channel/storages/az-blob.schema";
|
import {BlobChannelConfigSchema} from "@/features/channel/components/storages/az-blob.schema";
|
||||||
|
|
||||||
|
|
||||||
const BaseChannelFormSchema = z.object({
|
const BaseChannelFormSchema = z.object({
|
||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
} from "@/components/ui/form";
|
} from "@/components/ui/form";
|
||||||
import { TooltipProvider } from "@/components/ui/tooltip";
|
import { TooltipProvider } from "@/components/ui/tooltip";
|
||||||
import { ButtonWithLoading } from "@/components/common/button-with-loading";
|
import { ButtonWithLoading } from "@/components/common/button-with-loading";
|
||||||
import { getChannelIcon } from "@/features/channel/channels-helpers";
|
import { getChannelIcon } from "@/features/channel/components/channels-helpers";
|
||||||
import {
|
import {
|
||||||
getStatusColor,
|
getStatusColor,
|
||||||
getStatusIcon,
|
getStatusIcon,
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { MultiSelect } from "@/components/common/multi-select";
|
|||||||
import { Switch } from "@/components/ui/switch";
|
import { Switch } from "@/components/ui/switch";
|
||||||
import { Card } from "@/components/ui/card";
|
import { Card } from "@/components/ui/card";
|
||||||
import { useIsMobile } from "@/hooks/use-mobile";
|
import { useIsMobile } from "@/hooks/use-mobile";
|
||||||
import { ChannelKind, getChannelIcon, getChannelTextBasedOnKind } from "@/features/channel/channels-helpers";
|
import { ChannelKind, getChannelIcon, getChannelTextBasedOnKind } from "@/features/channel/components/channels-helpers";
|
||||||
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage, useZodForm } from "@/components/ui/form";
|
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage, useZodForm } from "@/components/ui/form";
|
||||||
import {
|
import {
|
||||||
EVENT_KIND_BACKUP_ONLY_OPTIONS,
|
EVENT_KIND_BACKUP_ONLY_OPTIONS,
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import Link from "next/link";
|
|||||||
import { DatabaseWith } from "@/db/schema/07_database";
|
import { DatabaseWith } from "@/db/schema/07_database";
|
||||||
import { NotificationChannel } from "@/db/schema/09_notification-channel";
|
import { NotificationChannel } from "@/db/schema/09_notification-channel";
|
||||||
import { StorageChannel } from "@/db/schema/12_storage-channel";
|
import { StorageChannel } from "@/db/schema/12_storage-channel";
|
||||||
import { ChannelKind, getChannelTextBasedOnKind } from "@/features/channel/channels-helpers";
|
import { ChannelKind, getChannelTextBasedOnKind } from "@/features/channel/components/channels-helpers";
|
||||||
import { ChannelPoliciesForm } from "@/features/database/channels-policy-form";
|
import { ChannelPoliciesForm } from "@/features/database/channels-policy-form";
|
||||||
import { PolicyType } from "@/features/database/channels-policy.schema";
|
import { PolicyType } from "@/features/database/channels-policy.schema";
|
||||||
import {
|
import {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import {humanReadableDate} from "@/utils/date-formatting";
|
|||||||
import {CheckCircle2, XCircle} from "lucide-react";
|
import {CheckCircle2, XCircle} from "lucide-react";
|
||||||
import {Badge} from "@/components/ui/badge";
|
import {Badge} from "@/components/ui/badge";
|
||||||
import {NotificationLogModal} from "@/features/notifications/notification-log-modal";
|
import {NotificationLogModal} from "@/features/notifications/notification-log-modal";
|
||||||
import {getChannelIcon} from "@/features/channel/channels-helpers";
|
import {getChannelIcon} from "@/features/channel/components/channels-helpers";
|
||||||
|
|
||||||
|
|
||||||
export function notificationLogsColumns(): ColumnDef<NotificationLogWithRelations>[] {
|
export function notificationLogsColumns(): ColumnDef<NotificationLogWithRelations>[] {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import { useMutation } from "@tanstack/react-query";
|
import { useMutation } from "@tanstack/react-query";
|
||||||
import { useOnboarding } from "@onboardjs/react";
|
import { useOnboarding } from "@onboardjs/react";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
import { addNotificationChannelAction } from "@/features/channel/notifications/channel.action";
|
import { addNotificationChannelAction } from "@/features/channel/components/notifications/channel.action";
|
||||||
import type { OnboardingChannel } from "@/features/onboarding/types";
|
import type { OnboardingChannel } from "@/features/onboarding/types";
|
||||||
|
|
||||||
type NotifierInput = {
|
type NotifierInput = {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import { useMutation } from "@tanstack/react-query";
|
import { useMutation } from "@tanstack/react-query";
|
||||||
import { useOnboarding } from "@onboardjs/react";
|
import { useOnboarding } from "@onboardjs/react";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
import { addStorageChannelAction } from "@/features/channel/storages/channel.action";
|
import { addStorageChannelAction } from "@/features/channel/components/storages/channel.action";
|
||||||
import type { OnboardingChannel } from "@/features/onboarding/types";
|
import type { OnboardingChannel } from "@/features/onboarding/types";
|
||||||
|
|
||||||
type StorageInput = {
|
type StorageInput = {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import { useMutation } from "@tanstack/react-query";
|
import { useMutation } from "@tanstack/react-query";
|
||||||
import { useOnboarding } from "@onboardjs/react";
|
import { useOnboarding } from "@onboardjs/react";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
import { removeNotificationChannelAction } from "@/features/channel/notifications/channel.action";
|
import { removeNotificationChannelAction } from "@/features/channel/components/notifications/channel.action";
|
||||||
import type { OnboardingChannel } from "@/features/onboarding/types";
|
import type { OnboardingChannel } from "@/features/onboarding/types";
|
||||||
|
|
||||||
export const useRemoveNotifier = () => {
|
export const useRemoveNotifier = () => {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import { useMutation } from "@tanstack/react-query";
|
import { useMutation } from "@tanstack/react-query";
|
||||||
import { useOnboarding } from "@onboardjs/react";
|
import { useOnboarding } from "@onboardjs/react";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
import { removeStorageChannelAction } from "@/features/channel/storages/channel.action";
|
import { removeStorageChannelAction } from "@/features/channel/components/storages/channel.action";
|
||||||
import type { OnboardingChannel } from "@/features/onboarding/types";
|
import type { OnboardingChannel } from "@/features/onboarding/types";
|
||||||
|
|
||||||
export const useRemoveStorage = () => {
|
export const useRemoveStorage = () => {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import type {
|
|||||||
OnboardingChannel,
|
OnboardingChannel,
|
||||||
OnboardingDefaultsData,
|
OnboardingDefaultsData,
|
||||||
} from "@/features/onboarding/types";
|
} from "@/features/onboarding/types";
|
||||||
import { getChannelIcon } from "@/features/channel/channels-helpers";
|
import { getChannelIcon } from "@/features/channel/components/channels-helpers";
|
||||||
import { updateNotificationSettingsAction } from "@/features/settings/notification.action";
|
import { updateNotificationSettingsAction } from "@/features/settings/notification.action";
|
||||||
import { updateStorageSettingsAction } from "@/features/settings/storage.action";
|
import { updateStorageSettingsAction } from "@/features/settings/storage.action";
|
||||||
import { updateAvatarModeAction } from "@/features/settings/avatar.action";
|
import { updateAvatarModeAction } from "@/features/settings/avatar.action";
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ import {
|
|||||||
FormControl,
|
FormControl,
|
||||||
FormMessage,
|
FormMessage,
|
||||||
} from "@/components/ui/form";
|
} from "@/components/ui/form";
|
||||||
import { notificationProviders } from "@/features/channel/channels-notification-helper";
|
import { notificationProviders } from "@/features/channel/components/channels-notification-helper";
|
||||||
import { renderChannelForm } from "@/features/channel/channels-helpers";
|
import { renderChannelForm } from "@/features/channel/components/channels-helpers";
|
||||||
import { NotificationChannelFormSchema } from "@/features/channel/channel-form.schema";
|
import { NotificationChannelFormSchema } from "@/features/channel/schemas/channel-form.schema";
|
||||||
import { useAddNotifier } from "@/features/onboarding/hooks/use-add-notifier";
|
import { useAddNotifier } from "@/features/onboarding/hooks/use-add-notifier";
|
||||||
import { useRemoveNotifier } from "@/features/onboarding/hooks/use-remove-notifier";
|
import { useRemoveNotifier } from "@/features/onboarding/hooks/use-remove-notifier";
|
||||||
import type { OnboardingChannel } from "@/features/onboarding/types";
|
import type { OnboardingChannel } from "@/features/onboarding/types";
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ import {
|
|||||||
FormControl,
|
FormControl,
|
||||||
FormMessage,
|
FormMessage,
|
||||||
} from "@/components/ui/form";
|
} from "@/components/ui/form";
|
||||||
import { storageProviders } from "@/features/channel/channels-storage-helper";
|
import { storageProviders } from "@/features/channel/components/channels-storage-helper";
|
||||||
import { renderChannelForm } from "@/features/channel/channels-helpers";
|
import { renderChannelForm } from "@/features/channel/components/channels-helpers";
|
||||||
import { StorageChannelFormSchema } from "@/features/channel/channel-form.schema";
|
import { StorageChannelFormSchema } from "@/features/channel/schemas/channel-form.schema";
|
||||||
import { useAddStorage } from "@/features/onboarding/hooks/use-add-storage";
|
import { useAddStorage } from "@/features/onboarding/hooks/use-add-storage";
|
||||||
import { useRemoveStorage } from "@/features/onboarding/hooks/use-remove-storage";
|
import { useRemoveStorage } from "@/features/onboarding/hooks/use-remove-storage";
|
||||||
import type { OnboardingChannel } from "@/features/onboarding/types";
|
import type { OnboardingChannel } from "@/features/onboarding/types";
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import {
|
|||||||
import {
|
import {
|
||||||
updateNotificationChannelsOrganizationAction, updateStorageChannelsOrganizationAction
|
updateNotificationChannelsOrganizationAction, updateStorageChannelsOrganizationAction
|
||||||
} from "@/features/organizations/channels-organization.action";
|
} from "@/features/organizations/channels-organization.action";
|
||||||
import {ChannelKind} from "@/features/channel/channels-helpers";
|
import {ChannelKind} from "@/features/channel/components/channels-helpers";
|
||||||
|
|
||||||
|
|
||||||
type ChannelOrganisationFormProps = {
|
type ChannelOrganisationFormProps = {
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import {CardsWithPagination} from "@/components/common/cards-with-pagination";
|
|||||||
import {EmptyStatePlaceholder} from "@/components/common/empty-state-placeholder";
|
import {EmptyStatePlaceholder} from "@/components/common/empty-state-placeholder";
|
||||||
import {useState} from "react";
|
import {useState} from "react";
|
||||||
import {cn} from "@/lib/utils";
|
import {cn} from "@/lib/utils";
|
||||||
import {ChannelAddEditModal} from "@/features/channel/channel-add-edit-modal";
|
import {ChannelAddEditModal} from "@/features/channel/components/channel-add-edit-modal";
|
||||||
import {ChannelCard} from "@/features/channel/channel-card";
|
import {ChannelCard} from "@/features/channel/components/channel-card";
|
||||||
|
|
||||||
export type OrganizationNotifiersTabProps = {
|
export type OrganizationNotifiersTabProps = {
|
||||||
organization: OrganizationWithMembers;
|
organization: OrganizationWithMembers;
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ import {CardsWithPagination} from "@/components/common/cards-with-pagination";
|
|||||||
import {EmptyStatePlaceholder} from "@/components/common/empty-state-placeholder";
|
import {EmptyStatePlaceholder} from "@/components/common/empty-state-placeholder";
|
||||||
import {useState} from "react";
|
import {useState} from "react";
|
||||||
import {cn} from "@/lib/utils";
|
import {cn} from "@/lib/utils";
|
||||||
import {ChannelAddEditModal} from "@/features/channel/channel-add-edit-modal";
|
import {ChannelAddEditModal} from "@/features/channel/components/channel-add-edit-modal";
|
||||||
import {ChannelCard} from "@/features/channel/channel-card";
|
import {ChannelCard} from "@/features/channel/components/channel-card";
|
||||||
import {StorageChannel} from "@/db/schema/12_storage-channel";
|
import {StorageChannel} from "@/db/schema/12_storage-channel";
|
||||||
|
|
||||||
export type OrganizationNotifiersTabProps = {
|
export type OrganizationNotifiersTabProps = {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import {
|
|||||||
} from "@/components/ui/form";
|
} from "@/components/ui/form";
|
||||||
import {Select, SelectContent, SelectItem, SelectTrigger, SelectValue} from "@/components/ui/select";
|
import {Select, SelectContent, SelectItem, SelectTrigger, SelectValue} from "@/components/ui/select";
|
||||||
import {useMutation} from "@tanstack/react-query";
|
import {useMutation} from "@tanstack/react-query";
|
||||||
import {getChannelIcon} from "@/features/channel/channels-helpers";
|
import {getChannelIcon} from "@/features/channel/components/channels-helpers";
|
||||||
import {NotificationChannelWith} from "@/db/schema/09_notification-channel";
|
import {NotificationChannelWith} from "@/db/schema/09_notification-channel";
|
||||||
import {
|
import {
|
||||||
DefaultNotificationSchema, DefaultNotificationType
|
DefaultNotificationSchema, DefaultNotificationType
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import {
|
|||||||
DefaultStorageSchema,
|
DefaultStorageSchema,
|
||||||
DefaultStorageType
|
DefaultStorageType
|
||||||
} from "@/features/settings/storage.schema";
|
} from "@/features/settings/storage.schema";
|
||||||
import {getChannelIcon} from "@/features/channel/channels-helpers";
|
import {getChannelIcon} from "@/features/channel/components/channels-helpers";
|
||||||
import {
|
import {
|
||||||
updateStorageSettingsAction
|
updateStorageSettingsAction
|
||||||
} from "@/features/settings/storage.action";
|
} from "@/features/settings/storage.action";
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import {dispatchViaProvider} from "@/features/channel/storages";
|
|||||||
import {StorageChannel} from "@/db/schema/12_storage-channel";
|
import {StorageChannel} from "@/db/schema/12_storage-channel";
|
||||||
import {
|
import {
|
||||||
StorageChannelFormType
|
StorageChannelFormType
|
||||||
} from "@/features/channel/channel-form.schema";
|
} from "@/features/channel/schemas/channel-form.schema";
|
||||||
import { logger } from "@/lib/logger";
|
import { logger } from "@/lib/logger";
|
||||||
|
|
||||||
const log = logger.child({ module: "features/storages/dispatch" });
|
const log = logger.child({ module: "features/storages/dispatch" });
|
||||||
|
|||||||
Reference in New Issue
Block a user