1
0
forked from baron/baron-sso

린트 적용3

This commit is contained in:
2026-03-17 09:48:00 +09:00
parent 45ae1bb1c0
commit f239ac984f
6 changed files with 73 additions and 31 deletions

View File

@@ -477,7 +477,8 @@ function UserCreatePage() {
/>
{errors.metadata?.[field.key] && (
<p className="text-xs text-destructive">
{(errors.metadata[field.key] as any).message}
{(errors.metadata[field.key] as { message?: string })
?.message}
</p>
)}
</div>

View File

@@ -9,7 +9,11 @@ import {
Users,
} from "lucide-react";
import * as React from "react";
import { useForm } from "react-hook-form";
import {
type FieldErrors,
type UseFormRegister,
useForm,
} from "react-hook-form";
import { Link, useNavigate, useParams } from "react-router-dom";
import { Button } from "../../components/ui/button";
import {
@@ -22,6 +26,7 @@ import {
import { Input } from "../../components/ui/input";
import { Label } from "../../components/ui/label";
import {
type TenantSummary,
type UserUpdateRequest,
fetchMe,
fetchTenant,
@@ -40,7 +45,7 @@ type UserSchemaField = {
validation?: string;
};
type UserFormValues = UserUpdateRequest & { metadata: Record<string, unknown> };
type UserFormValues = UserUpdateRequest & { metadata: Record<string, Record<string, unknown>> };
// [New] Component for per-tenant profile/schema management
function TenantProfileCard({
@@ -49,9 +54,9 @@ function TenantProfileCard({
errors,
isAdmin,
}: {
tenant: any;
register: any;
errors: any;
tenant: TenantSummary;
register: UseFormRegister<UserFormValues>;
errors: FieldErrors<UserFormValues>;
isAdmin: boolean;
}) {
const { data: detail, isLoading } = useQuery({

View File

@@ -1,4 +1,5 @@
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import type { AxiosError } from "axios";
import { FolderTree, Loader2, Search } from "lucide-react";
import * as React from "react";
import { toast } from "sonner";
@@ -70,7 +71,7 @@ export function UserBulkMoveGroupModal({
setOpen(false);
onSuccess?.();
},
onError: (error: any) => {
onError: (error: AxiosError<{ error?: string }>) => {
toast.error(t("msg.admin.users.bulk.move_error", "부서 이동 실패"), {
description: error.response?.data?.error || error.message,
});

View File

@@ -195,8 +195,8 @@ ${example}`,
</tr>
</thead>
<tbody>
{previewData.slice(0, 10).map((u, i) => (
<tr key={i} className="border-t">
{previewData.slice(0, 10).map((u) => (
<tr key={u.email} className="border-t">
<td className="p-2">{u.email}</td>
<td className="p-2">{u.name}</td>
<td className="p-2">{u.companyCode || "-"}</td>
@@ -241,9 +241,9 @@ ${example}`,
<ScrollArea className="h-[250px] rounded-md border">
<div className="p-2 space-y-2">
{results.map((r, i) => (
{results.map((r) => (
<div
key={i}
key={r.email}
className="flex items-start gap-3 p-2 rounded border bg-card text-sm"
>
{r.success ? (

View File

@@ -13,11 +13,12 @@ export function parseUserCSV(text: string): BulkUserItem[] {
if (!lines[i].trim()) continue;
const values = lines[i].split(",").map((v) => v.trim());
const item: any = { metadata: {} };
const item: Record<string, any> = { metadata: {} };
headers.forEach((header, index) => {
for (let index = 0; index < headers.length; index++) {
const header = headers[index];
const value = values[index];
if (value === undefined || value === "") return;
if (value === undefined || value === "") continue;
if (
[
@@ -34,7 +35,7 @@ export function parseUserCSV(text: string): BulkUserItem[] {
} else {
item.metadata[header] = value;
}
});
}
if (item.email && item.name) {
data.push(item as BulkUserItem);