feat: Working on storage modal in database page in order to add multiple backend storages. Adding a system to manage independently channels from organizations and from system admin.

This commit is contained in:
charlesgauthereau
2026-01-14 21:54:13 +01:00
parent d8e9e2dac3
commit 91f25bc25d
32 changed files with 7663 additions and 461 deletions
@@ -0,0 +1,60 @@
import {OrganizationWithMembers} from "@/db/schema/03_organization";
import {CardsWithPagination} from "@/components/wrappers/common/cards-with-pagination";
import {EmptyStatePlaceholder} from "@/components/wrappers/common/empty-state-placeholder";
import {useState} from "react";
import {cn} from "@/lib/utils";
import {ChannelAddEditModal} from "@/components/wrappers/dashboard/admin/channels/channel/channel-add-edit-modal";
import {ChannelCard} from "@/components/wrappers/dashboard/admin/channels/channel/channel-card/channel-card";
import {StorageChannel} from "@/db/schema/12_storage-channel";
export type OrganizationNotifiersTabProps = {
organization: OrganizationWithMembers;
storageChannels: StorageChannel[];
};
export const OrganizationStoragesTab = ({
organization,
storageChannels,
}: OrganizationNotifiersTabProps) => {
const [isAddModalOpen, setIsAddModalOpen] = useState(false);
const hasNotifiers = storageChannels.length > 0;
const kind = "storage"
return (
<div className="flex flex-col gap-y-6 h-full py-4">
<div className="h-full flex flex-col gap-y-6">
<div className={cn("hidden flex-row justify-between items-start", hasNotifiers && "flex")}>
<div className="max-w-2xl ">
<h3 className="text-xl font-semibold text-balance mb-1">
Notification Settings
</h3>
</div>
<ChannelAddEditModal
kind={kind}
organization={organization}
open={isAddModalOpen}
onOpenChangeAction={setIsAddModalOpen}
/>
</div>
{hasNotifiers ? (
<div className="h-full">
<CardsWithPagination
data={storageChannels}
cardItem={ChannelCard}
cardsPerPage={8}
numberOfColumns={2}
organization={organization}
kind={kind}
/>
</div>
) : (
<EmptyStatePlaceholder
text="No storage channels configured yet"
onClick={() => setIsAddModalOpen(true)}
className="h-full"
/>
)}
</div>
</div>
);
};
@@ -12,14 +12,19 @@ import {
} from "@/components/wrappers/dashboard/organization/tabs/organization-notifiers-tab/organization-notifiers-tab";
import {NotificationChannel} from "@/db/schema/09_notification-channel";
import {useOrganizationPermissions} from "@/hooks/use-organization-permissions";
import {
OrganizationStoragesTab
} from "@/components/wrappers/dashboard/organization/tabs/organization-notifiers-tab/organization-storages-tab";
import {StorageChannel} from "@/db/schema/12_storage-channel";
export type OrganizationTabsProps = {
organization: OrganizationWithMembers;
notificationChannels: NotificationChannel[];
storageChannels: StorageChannel[];
activeMember: MemberWithUser
};
export const OrganizationTabs = ({activeMember, organization, notificationChannels}: OrganizationTabsProps) => {
export const OrganizationTabs = ({activeMember, organization, notificationChannels, storageChannels}: OrganizationTabsProps) => {
const router = useRouter();
const searchParams = useSearchParams();
@@ -28,6 +33,7 @@ export const OrganizationTabs = ({activeMember, organization, notificationChanne
const {
canManageUsers,
canManageNotifications,
canManageStorages
} = useOrganizationPermissions(activeMember);
@@ -43,7 +49,7 @@ export const OrganizationTabs = ({activeMember, organization, notificationChanne
return (
<div className="h-full">
{canManageNotifications ?
{(canManageNotifications && canManageStorages) ?
<Tabs className="h-full" value={tab} onValueChange={handleChangeTab}>
<TabsList className="w-full">
<TabsTrigger
@@ -59,6 +65,12 @@ export const OrganizationTabs = ({activeMember, organization, notificationChanne
>
Notifiers
</TabsTrigger>
<TabsTrigger
className="w-full"
value="storages"
>
Storages
</TabsTrigger>
</TabsList>
<TabsContent className="h-full" value="users">
<SettingsOrganizationMembersTable organization={organization}/>
@@ -69,6 +81,12 @@ export const OrganizationTabs = ({activeMember, organization, notificationChanne
notificationChannels={notificationChannels}
/>
</TabsContent>
<TabsContent className="h-full" value="storages">
<OrganizationStoragesTab
organization={organization}
storageChannels={storageChannels}
/>
</TabsContent>
</Tabs>
:
<SettingsOrganizationMembersTable organization={organization}/>