1
0
forked from baron/baron-sso

린트 적용

This commit is contained in:
2026-03-05 17:50:34 +09:00
parent c2b55081a6
commit 45ae1bb1c0
21 changed files with 1114 additions and 810 deletions

View File

@@ -3,6 +3,7 @@ import type { AxiosError } from "axios";
import { CornerDownRight, Pencil, Plus, RefreshCw, Trash2 } from "lucide-react";
import * as React from "react";
import { Link, useNavigate } from "react-router-dom";
import { RoleGuard } from "../../../components/auth/RoleGuard";
import { Badge } from "../../../components/ui/badge";
import { Button } from "../../../components/ui/button";
import {
@@ -27,7 +28,6 @@ import {
fetchTenants,
} from "../../../lib/adminApi";
import { t } from "../../../lib/i18n";
import { RoleGuard } from "../../../components/auth/RoleGuard";
function TenantListPage() {
const navigate = useNavigate();
@@ -41,7 +41,10 @@ function TenantListPage() {
if (profile?.role === "tenant_admin") {
const manageableCount = profile.manageableTenants?.length ?? 0;
// If only 1 in array, OR array is empty but we have a primary tenantId
if ((manageableCount === 1 || manageableCount === 0) && profile.tenantId) {
if (
(manageableCount === 1 || manageableCount === 0) &&
profile.tenantId
) {
navigate(`/tenants/${profile.tenantId}`, { replace: true });
}
}
@@ -50,7 +53,10 @@ function TenantListPage() {
const query = useQuery({
queryKey: ["tenants", { limit: 1000, offset: 0 }],
queryFn: () => fetchTenants(1000, 0),
enabled: profile?.role === "super_admin" || (profile?.role === "tenant_admin" && (profile.manageableTenants?.length ?? 0) > 1),
enabled:
profile?.role === "super_admin" ||
(profile?.role === "tenant_admin" &&
(profile.manageableTenants?.length ?? 0) > 1),
});
const deleteMutation = useMutation({
@@ -60,17 +66,28 @@ function TenantListPage() {
},
});
if (profile && profile.role !== "super_admin" && profile.role !== "tenant_admin") {
if (
profile &&
profile.role !== "super_admin" &&
profile.role !== "tenant_admin"
) {
return (
<div className="flex h-[50vh] flex-col items-center justify-center space-y-4">
<h3 className="text-xl font-bold">{t("msg.admin.common.forbidden", "접근 권한이 없습니다.")}</h3>
<Button onClick={() => navigate("/")}>{t("ui.common.go_home", "홈으로 이동")}</Button>
<h3 className="text-xl font-bold">
{t("msg.admin.common.forbidden", "접근 권한이 없습니다.")}
</h3>
<Button onClick={() => navigate("/")}>
{t("ui.common.go_home", "홈으로 이동")}
</Button>
</div>
);
}
// While redirecting (only if exactly one manageable tenant)
if (profile?.role === "tenant_admin" && (profile.manageableTenants?.length ?? 0) <= 1) {
if (
profile?.role === "tenant_admin" &&
(profile.manageableTenants?.length ?? 0) <= 1
) {
return null;
}

View File

@@ -71,7 +71,8 @@ export function TenantSchemaPage() {
: "text",
required: Boolean(field?.required),
adminOnly: Boolean(field?.adminOnly),
validation: typeof field?.validation === "string" ? field.validation : "",
validation:
typeof field?.validation === "string" ? field.validation : "",
})),
);
}
@@ -170,7 +171,9 @@ export function TenantSchemaPage() {
</Label>
<Input
value={field.key}
onChange={(e) => updateField(index, { key: e.target.value })}
onChange={(e) =>
updateField(index, { key: e.target.value })
}
placeholder={t(
"ui.admin.tenants.schema.field.key_placeholder",
"예: employee_id",
@@ -315,4 +318,3 @@ export function TenantSchemaPage() {
</div>
);
}