mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
db1a0235ed | ||
|
|
2cd6a7cae0 | ||
|
|
bd80fdc960 |
+2
-2
@@ -26,5 +26,5 @@ keywords:
|
||||
- web-ui
|
||||
- agent
|
||||
license: Apache-2.0
|
||||
version: 1.2.4
|
||||
date-released: "2026-01-29"
|
||||
version: 1.2.5-rc.1
|
||||
date-released: "2026-01-31"
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
EDGE_KEY="eyJzZXJ2ZXJVcmwiOiJodHRwOi8vbG9jYWxob3N0Ojg4ODciLCJhZ2VudElkIjoiOWNhODU3MDQtYmM5MC00Mzg3LTgxYzUtYjIyZWI3MTNiMDM3IiwicHVibGljS2V5IjoiLS0tLS1CRUdJTiBSU0EgUFVCTElDIEtFWS0tLS0tXG5NSUlCQ2dLQ0FRRUF5UmhJaXdOTnVFWVhxV1VaQXlVdkZjajl5SDJyWHVJM055ZHVpN0F0NzlIZ1JEV1BFWHVnXG5HMytBNVdtKzZROFE2c1l1YVEzT05tVUw3VzZGZDlvNjYvZ3cxbjBmTHZDMFV2c2JRbHB5L3ZTeGx5eVFreWNoXG5aR3lBY09IcmpMVGhpcmJ0aGQzT1NxR1paYlZrcnFsSnErZytrdksrcU5VV0QvdzU5amZtVmtvU3ByRlVBRi91XG5jUW96aFdFd3hVVjBsYlRHOXhzNnFPdE5pMjlhbklESjI3eTNVNnkrUk95NUNnQVk3MmNwRUdCelhSUzNQY0ZGXG5vMG5iejR2VlN1SHJkZ05tWDZPcjNoSXVEdHJPdnAyMWVXTU5kc05KTDdJQm1BbFFzbGNMdzRNTGluTzg5eUZxXG53bkFSZXJ1Yk1CTlhjM2FEZFo5NG02Z1k4b1BBbERiRHBRSURBUUFCXG4tLS0tLUVORCBSU0EgUFVCTElDIEtFWS0tLS0tXG4ifQ"
|
||||
PROJECT_NAME="my-agent"
|
||||
DB_PG_E009_PORT="63200"
|
||||
DB_PG_E009_DB="pg_a4e81399"
|
||||
DB_PG_E009_USER="admin"
|
||||
DB_PG_E009_PASS="0d147e4485751e80"
|
||||
DB_MARIADB_3896_PORT="63206"
|
||||
DB_MARIADB_3896_DB="mysql_d82be2e8"
|
||||
DB_MARIADB_3896_USER="admin"
|
||||
DB_MARIADB_3896_PASS="5c3c1050728af0ba"
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"databases": [
|
||||
{
|
||||
"name": "pg_a4e81399",
|
||||
"database": "pg_a4e81399",
|
||||
"type": "postgresql",
|
||||
"username": "admin",
|
||||
"password": "0d147e4485751e80",
|
||||
"port": 63200,
|
||||
"host": "localhost",
|
||||
"generated_id": "d79b86c2-6c70-4d44-99cc-22243f36f539"
|
||||
},
|
||||
{
|
||||
"name": "mysql_d82be2e8",
|
||||
"database": "mysql_d82be2e8",
|
||||
"type": "mysql",
|
||||
"username": "admin",
|
||||
"password": "5c3c1050728af0ba",
|
||||
"port": 63206,
|
||||
"host": "localhost",
|
||||
"generated_id": "4beda7df-1370-4613-b98a-4f47fe7132be"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
name: my-agent
|
||||
services:
|
||||
app:
|
||||
container_name: my-agent-app
|
||||
restart: always
|
||||
image: portabase/agent:latest
|
||||
volumes:
|
||||
- ./databases.json:/config/config.json
|
||||
extra_hosts:
|
||||
- "localhost:host-gateway"
|
||||
environment:
|
||||
TZ: "Europe/Paris"
|
||||
EDGE_KEY: "${EDGE_KEY}"
|
||||
LOG: info
|
||||
networks:
|
||||
- portabase
|
||||
|
||||
|
||||
db-pg-e009:
|
||||
container_name: my-agent-db-pg-e009
|
||||
image: postgres:17-alpine
|
||||
networks:
|
||||
- portabase
|
||||
- default
|
||||
ports:
|
||||
- "${DB_PG_E009_PORT}:5432"
|
||||
volumes:
|
||||
- db-pg-e009-data:/var/lib/postgresql/data
|
||||
environment:
|
||||
- POSTGRES_DB=${DB_PG_E009_DB}
|
||||
- POSTGRES_USER=${DB_PG_E009_USER}
|
||||
- POSTGRES_PASSWORD=${DB_PG_E009_PASS}
|
||||
|
||||
db-mariadb-3896:
|
||||
container_name: my-agent-db-mariadb-3896
|
||||
image: mariadb:latest
|
||||
ports:
|
||||
- "${DB_MARIADB_3896_PORT}:3306"
|
||||
environment:
|
||||
- MYSQL_DATABASE=${DB_MARIADB_3896_DB}
|
||||
- MYSQL_USER=${DB_MARIADB_3896_USER}
|
||||
- MYSQL_PASSWORD=${DB_MARIADB_3896_PASS}
|
||||
- MYSQL_RANDOM_ROOT_PASSWORD=yes
|
||||
volumes:
|
||||
- db-mariadb-3896-data:/var/lib/mysql
|
||||
|
||||
|
||||
volumes:
|
||||
db-pg-e009-data:
|
||||
db-mariadb-3896-data:
|
||||
|
||||
|
||||
networks:
|
||||
portabase:
|
||||
name: portabase_network
|
||||
external: true
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "portabase",
|
||||
"version": "1.2.4",
|
||||
"version": "1.2.5-rc.1",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev --turbopack -p 8887",
|
||||
|
||||
@@ -85,7 +85,7 @@ export const LoginForm = (props: loginFormProps) => {
|
||||
<FormItem>
|
||||
<FormLabel>Email Address</FormLabel>
|
||||
<FormControl>
|
||||
<Input autoComplete="email" autoFocus placeholder="exemple@portabase.io" {...field} />
|
||||
<Input autoComplete="email" autoFocus placeholder="example@portabase.io" {...field} />
|
||||
</FormControl>
|
||||
<FormMessage/>
|
||||
</FormItem>
|
||||
|
||||
@@ -88,7 +88,7 @@ export const RegisterForm = (props: registerFormProps) => {
|
||||
<FormItem>
|
||||
<FormLabel>Email</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder="exemple@portabase.io" {...field} />
|
||||
<Input placeholder="example@portabase.io" {...field} />
|
||||
</FormControl>
|
||||
<FormMessage/>
|
||||
</FormItem>
|
||||
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
ChannelOrganisationForm
|
||||
} from "@/components/wrappers/dashboard/admin/channels/organization/channels-organization-form";
|
||||
|
||||
|
||||
type ChannelAddModalProps = {
|
||||
channel?: NotificationChannelWith | StorageChannelWith
|
||||
organization?: OrganizationWithMembers;
|
||||
|
||||
+5
-4
@@ -34,6 +34,7 @@ import {
|
||||
addNotificationChannelAction, updateNotificationChannelAction
|
||||
} from "@/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/notifications/action";
|
||||
|
||||
|
||||
type NotifierFormProps = {
|
||||
onSuccessAction?: () => void;
|
||||
organization?: OrganizationWithMembers;
|
||||
@@ -54,7 +55,7 @@ export const ChannelForm = ({onSuccessAction, organization, defaultValues, kind}
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
form.reset(defaultValues ? {...defaultValues} : {});
|
||||
form.reset(defaultValues ? {...defaultValues} : {enabled: true});
|
||||
}, [defaultValues]);
|
||||
|
||||
const mutationAddNotificationChannel = useMutation({
|
||||
@@ -118,7 +119,7 @@ export const ChannelForm = ({onSuccessAction, organization, defaultValues, kind}
|
||||
}}
|
||||
>
|
||||
|
||||
{type.preview && (
|
||||
{type.preview && (
|
||||
<div
|
||||
className="absolute bottom-0 right-0 overflow-hidden w-20 h-20 pointer-events-none">
|
||||
<div
|
||||
@@ -223,11 +224,11 @@ export const ChannelForm = ({onSuccessAction, organization, defaultValues, kind}
|
||||
|
||||
<div className="flex justify-between mt-4">
|
||||
<div>
|
||||
{defaultValues && (
|
||||
{kind == "storage" && (
|
||||
<ChannelTestButton
|
||||
kind={kind}
|
||||
organizationId={organization?.id}
|
||||
channel={defaultValues}
|
||||
channel={form.getValues()}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
+12
-8
@@ -1,18 +1,21 @@
|
||||
"use client"
|
||||
import {Button} from "@/components/ui/button";
|
||||
import {NotificationChannel} from "@/db/schema/09_notification-channel";
|
||||
|
||||
import {useMutation} from "@tanstack/react-query";
|
||||
import {dispatchNotification} from "@/features/notifications/dispatch";
|
||||
import {EventPayload} from "@/features/notifications/types";
|
||||
import {Send, ShieldCheck} from "lucide-react";
|
||||
import {toast} from "sonner";
|
||||
|
||||
import {Button} from "@/components/ui/button";
|
||||
import {NotificationChannel} from "@/db/schema/09_notification-channel";
|
||||
import {dispatchNotification} from "@/features/notifications/dispatch";
|
||||
import {EventPayload} from "@/features/notifications/types";
|
||||
import {useIsMobile} from "@/hooks/use-mobile";
|
||||
import {cn} from "@/lib/utils";
|
||||
import {StorageChannel} from "@/db/schema/12_storage-channel";
|
||||
import {ChannelKind, getChannelTextBasedOnKind} from "@/components/wrappers/dashboard/admin/channels/helpers/common";
|
||||
import {ChannelKind} from "@/components/wrappers/dashboard/admin/channels/helpers/common";
|
||||
import type {StorageInput} from "@/features/storages/types";
|
||||
import {dispatchStorage} from "@/features/storages/dispatch";
|
||||
|
||||
|
||||
type NotifierTestChannelButtonProps = {
|
||||
channel: NotificationChannel | StorageChannel;
|
||||
organizationId?: string;
|
||||
@@ -20,8 +23,9 @@ type NotifierTestChannelButtonProps = {
|
||||
}
|
||||
|
||||
export const ChannelTestButton = ({channel, organizationId, kind}: NotifierTestChannelButtonProps) => {
|
||||
const channelText = getChannelTextBasedOnKind(kind)
|
||||
|
||||
const isMobile = useIsMobile()
|
||||
|
||||
const mutation = useMutation({
|
||||
mutationFn: async () => {
|
||||
if (kind === "notification") {
|
||||
@@ -30,7 +34,7 @@ export const ChannelTestButton = ({channel, organizationId, kind}: NotifierTestC
|
||||
message: `We are testing channel ${channel.name}`,
|
||||
level: 'info',
|
||||
};
|
||||
const result = await dispatchNotification(payload, undefined, channel.id, organizationId);
|
||||
const result = await dispatchNotification(payload, undefined, channel, organizationId);
|
||||
|
||||
if (result.success) {
|
||||
toast.success(result.message);
|
||||
@@ -41,7 +45,7 @@ export const ChannelTestButton = ({channel, organizationId, kind}: NotifierTestC
|
||||
const input: StorageInput = {
|
||||
action: "ping",
|
||||
};
|
||||
const result = await dispatchStorage(input, undefined, channel.id);
|
||||
const result = await dispatchStorage(input, undefined, undefined, channel);
|
||||
|
||||
if (result.success) {
|
||||
toast.success("Successfully connected to storage channel");
|
||||
|
||||
+2
-2
@@ -47,7 +47,7 @@ export const NotifierSmtpForm = ({form}: NotifierSmtpFormProps) => {
|
||||
<FormItem>
|
||||
<FormLabel>Username</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder="contact@exemple.com" {...field} value={field.value ?? ""}/>
|
||||
<Input placeholder="contact@example.com" {...field} value={field.value ?? ""}/>
|
||||
</FormControl>
|
||||
<FormMessage/>
|
||||
</FormItem>
|
||||
@@ -77,7 +77,7 @@ export const NotifierSmtpForm = ({form}: NotifierSmtpFormProps) => {
|
||||
<FormItem>
|
||||
<FormLabel>From Email</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={`"Portabase" <exemple@portabase.io>`} {...field}
|
||||
<Input placeholder={`"Portabase" <example@portabase.io>`} {...field}
|
||||
value={field.value ?? ""}/>
|
||||
</FormControl>
|
||||
<FormMessage/>
|
||||
|
||||
+15
-2
@@ -19,9 +19,22 @@ export const StorageS3Form = ({form}: StorageS3FormProps) => {
|
||||
name="config.endPointUrl"
|
||||
render={({field}) => (
|
||||
<FormItem>
|
||||
<FormLabel>Endpoind URL</FormLabel>
|
||||
<FormLabel>Endpoint URL</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} placeholder="s3.exemple.com"/>
|
||||
<Input {...field} placeholder="s3.amazonaws.com"/>
|
||||
</FormControl>
|
||||
<FormMessage/>
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="config.region"
|
||||
render={({field}) => (
|
||||
<FormItem>
|
||||
<FormLabel>Region</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} placeholder="us-east-1"/>
|
||||
</FormControl>
|
||||
<FormMessage/>
|
||||
</FormItem>
|
||||
|
||||
@@ -110,7 +110,7 @@ export const EmailForm = (props: EmailFormProps) => {
|
||||
<FormItem>
|
||||
<FormLabel>From Email *</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={"exemple@portabase.com"} {...field} />
|
||||
<Input placeholder={"example@portabase.com"} {...field} />
|
||||
</FormControl>
|
||||
<FormDescription>{"The email from where the email will be send"}</FormDescription>
|
||||
<FormMessage/>
|
||||
@@ -172,7 +172,7 @@ export const EmailForm = (props: EmailFormProps) => {
|
||||
<FormItem>
|
||||
<FormLabel>User Email *</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={"exemple@portabase.com"} {...field} />
|
||||
<Input placeholder={"example@portabase.com"} {...field} />
|
||||
</FormControl>
|
||||
<FormDescription>{"The email server user"}</FormDescription>
|
||||
<FormMessage/>
|
||||
|
||||
@@ -94,7 +94,7 @@ export const AgentForm = (props: agentFormProps) => {
|
||||
<FormItem>
|
||||
<FormLabel>Description</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder="This agent is for the client exemple.com" {...field}
|
||||
<Input placeholder="This agent is for the client example.com" {...field}
|
||||
value={field.value ?? ""}/>
|
||||
</FormControl>
|
||||
<FormDescription>Enter your project agent description</FormDescription>
|
||||
|
||||
@@ -1,17 +1,23 @@
|
||||
"use server";
|
||||
|
||||
import {eq} from 'drizzle-orm';
|
||||
import {Json} from "drizzle-zod";
|
||||
|
||||
import * as drizzleDb from '@/db';
|
||||
import {db} from '@/db';
|
||||
import type {StorageInput, StorageProviderKind, StorageResult,} from './types';
|
||||
import {dispatchViaProvider} from "@/features/storages/providers";
|
||||
import {StorageChannel} from "@/db/schema/12_storage-channel";
|
||||
import {Json} from "drizzle-zod";
|
||||
import {
|
||||
StorageChannelFormType
|
||||
} from "@/components/wrappers/dashboard/admin/channels/channel/channel-form/channel-form.schema";
|
||||
|
||||
|
||||
export async function dispatchStorage(
|
||||
input: StorageInput,
|
||||
policyId?: string,
|
||||
channelId?: string,
|
||||
channelData?: StorageChannelFormType,
|
||||
organizationId?: string
|
||||
): Promise<StorageResult> {
|
||||
try {
|
||||
@@ -68,6 +74,8 @@ export async function dispatchStorage(
|
||||
};
|
||||
}
|
||||
|
||||
if (channelData) channel = {...channelData, config: channelData.config as Json};
|
||||
|
||||
if (!channel) {
|
||||
return {
|
||||
success: false,
|
||||
@@ -90,7 +98,6 @@ export async function dispatchStorage(
|
||||
channel.provider as StorageProviderKind,
|
||||
channel.config,
|
||||
input,
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import {generateFileUrl} from "@/features/storages/helpers";
|
||||
|
||||
type S3Config = {
|
||||
endPointUrl: string;
|
||||
region?: string;
|
||||
accessKey: string;
|
||||
secretKey: string;
|
||||
bucketName: string;
|
||||
@@ -14,6 +15,7 @@ type S3Config = {
|
||||
async function getS3Client(config: S3Config) {
|
||||
return new Minio.Client({
|
||||
endPoint: config.endPointUrl,
|
||||
region: config.region ?? "us-east-1",
|
||||
accessKey: config.accessKey,
|
||||
secretKey: config.secretKey,
|
||||
port: config.port ?? 443,
|
||||
@@ -32,7 +34,7 @@ async function ensureBucket(config: S3Config) {
|
||||
|
||||
export async function uploadS3(
|
||||
config: S3Config,
|
||||
input: { data: StorageUploadInput, metadata?: StorageMetaData }
|
||||
input: { data: StorageUploadInput, metadata?: StorageMetaData }
|
||||
): Promise<StorageResult> {
|
||||
const client = await getS3Client(config);
|
||||
await ensureBucket(config);
|
||||
@@ -72,7 +74,10 @@ export async function uploadS3(
|
||||
|
||||
}
|
||||
|
||||
export async function getS3(config: S3Config, input: { data: StorageGetInput, metadata: StorageMetaData }): Promise<StorageResult> {
|
||||
export async function getS3(config: S3Config, input: {
|
||||
data: StorageGetInput,
|
||||
metadata: StorageMetaData
|
||||
}): Promise<StorageResult> {
|
||||
const client = await getS3Client(config);
|
||||
|
||||
const key = `${BASE_DIR}${input.data.path}`;
|
||||
@@ -97,7 +102,10 @@ export async function getS3(config: S3Config, input: { data: StorageGetInput, me
|
||||
};
|
||||
}
|
||||
|
||||
export async function deleteS3(config: S3Config, input: { data: StorageDeleteInput, metadata?: StorageMetaData }): Promise<StorageResult> {
|
||||
export async function deleteS3(config: S3Config, input: {
|
||||
data: StorageDeleteInput,
|
||||
metadata?: StorageMetaData
|
||||
}): Promise<StorageResult> {
|
||||
const client = await getS3Client(config);
|
||||
const key = `${BASE_DIR}${input.data.path}`;
|
||||
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
EDGE_KEY="eyJzZXJ2ZXJVcmwiOiJodHRwOi8vbG9jYWxob3N0Ojg4ODciLCJhZ2VudElkIjoiZDYxMTBiZjItODQ2OS00MWRlLTkxMDItMzA3NmE4NDlhMmNjIiwicHVibGljS2V5IjoiLS0tLS1CRUdJTiBSU0EgUFVCTElDIEtFWS0tLS0tXG5NSUlCQ2dLQ0FRRUF5UmhJaXdOTnVFWVhxV1VaQXlVdkZjajl5SDJyWHVJM055ZHVpN0F0NzlIZ1JEV1BFWHVnXG5HMytBNVdtKzZROFE2c1l1YVEzT05tVUw3VzZGZDlvNjYvZ3cxbjBmTHZDMFV2c2JRbHB5L3ZTeGx5eVFreWNoXG5aR3lBY09IcmpMVGhpcmJ0aGQzT1NxR1paYlZrcnFsSnErZytrdksrcU5VV0QvdzU5amZtVmtvU3ByRlVBRi91XG5jUW96aFdFd3hVVjBsYlRHOXhzNnFPdE5pMjlhbklESjI3eTNVNnkrUk95NUNnQVk3MmNwRUdCelhSUzNQY0ZGXG5vMG5iejR2VlN1SHJkZ05tWDZPcjNoSXVEdHJPdnAyMWVXTU5kc05KTDdJQm1BbFFzbGNMdzRNTGluTzg5eUZxXG53bkFSZXJ1Yk1CTlhjM2FEZFo5NG02Z1k4b1BBbERiRHBRSURBUUFCXG4tLS0tLUVORCBSU0EgUFVCTElDIEtFWS0tLS0tXG4ifQ"
|
||||
PROJECT_NAME="test-1"
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"databases": [
|
||||
{
|
||||
"name": "Test database 3 - rust",
|
||||
"database": "mariadb",
|
||||
"type": "mysql",
|
||||
"username": "mariadb",
|
||||
"password": "changeme",
|
||||
"port": 3306,
|
||||
"host": "db2",
|
||||
"generated_id": "16678124-ff7e-4c97-8c83-0adeff214681"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
name: test-1
|
||||
services:
|
||||
app:
|
||||
container_name: test-1-app
|
||||
restart: always
|
||||
image: portabase/agent:1.0.1-rc.1
|
||||
volumes:
|
||||
- ./databases.json:/config/config.json
|
||||
extra_hosts:
|
||||
- "localhost:host-gateway"
|
||||
environment:
|
||||
TZ: "Europe/Paris"
|
||||
EDGE_KEY: "${EDGE_KEY}"
|
||||
LOG: info
|
||||
|
||||
db2:
|
||||
image: mariadb:latest
|
||||
environment:
|
||||
- MYSQL_DATABASE=mariadb
|
||||
- MYSQL_USER=mariadb
|
||||
- MYSQL_PASSWORD=changeme
|
||||
- MYSQL_RANDOM_ROOT_PASSWORD=yes
|
||||
volumes:
|
||||
- mariadb-data:/var/lib/mysql
|
||||
|
||||
|
||||
volumes:
|
||||
mariadb-data:
|
||||
Reference in New Issue
Block a user