forked from baron/baron-sso
orgfront 버그 픽스
This commit is contained in:
@@ -40,6 +40,15 @@ type ViewBox = {
|
||||
height: number;
|
||||
};
|
||||
|
||||
type OrgChartLoadErrorDiagnostics = {
|
||||
cacheMode: "redis" | "public";
|
||||
code: string;
|
||||
message: string;
|
||||
route: string;
|
||||
status: number | null;
|
||||
tenantId: string;
|
||||
};
|
||||
|
||||
type OrgSelectionDescendantOption = {
|
||||
depth: 1 | 2;
|
||||
id: string;
|
||||
@@ -1215,6 +1224,36 @@ function normalizeOrgSlug(value: unknown) {
|
||||
return typeof value === "string" ? value.trim().toLowerCase() : "";
|
||||
}
|
||||
|
||||
function readErrorText(value: unknown): string {
|
||||
return typeof value === "string" ? value : "";
|
||||
}
|
||||
|
||||
function getOrgChartLoadErrorDiagnostics(
|
||||
error: unknown,
|
||||
options: { cacheMode: "redis" | "public"; route: string; tenantId: string },
|
||||
): OrgChartLoadErrorDiagnostics {
|
||||
const maybeError = error as {
|
||||
config?: { url?: string };
|
||||
message?: string;
|
||||
response?: {
|
||||
data?: { code?: unknown; error?: unknown; message?: unknown };
|
||||
status?: number;
|
||||
};
|
||||
};
|
||||
const responseData = maybeError.response?.data;
|
||||
return {
|
||||
cacheMode: options.cacheMode,
|
||||
code: readErrorText(responseData?.code),
|
||||
message:
|
||||
readErrorText(responseData?.error) ||
|
||||
readErrorText(responseData?.message) ||
|
||||
readErrorText(maybeError.message),
|
||||
route: maybeError.config?.url || options.route,
|
||||
status: maybeError.response?.status ?? null,
|
||||
tenantId: options.tenantId,
|
||||
};
|
||||
}
|
||||
|
||||
function getUserOrgAppointmentRefs(user: UserSummary): UserOrgAppointmentRef[] {
|
||||
const rawAppointments = user.metadata?.additionalAppointments;
|
||||
if (!Array.isArray(rawAppointments)) return [];
|
||||
@@ -1443,7 +1482,10 @@ export function TenantOrgChartPage() {
|
||||
}
|
||||
|
||||
const rootNodes = buildTenantFullTree(
|
||||
filterSystemGlobalTenants(orgChartSnapshotQuery.data.tenants, visibilityMode),
|
||||
filterSystemGlobalTenants(
|
||||
orgChartSnapshotQuery.data.tenants,
|
||||
visibilityMode,
|
||||
),
|
||||
).subTree;
|
||||
const membershipRootNodes = buildTenantFullTree(
|
||||
filterOrgChartMembershipTenants(orgChartSnapshotQuery.data.tenants),
|
||||
@@ -1601,6 +1643,24 @@ export function TenantOrgChartPage() {
|
||||
const isError = shareToken
|
||||
? publicQuery.isError
|
||||
: orgChartSnapshotQuery.isError;
|
||||
const currentLoadError = shareToken
|
||||
? publicQuery.error
|
||||
: orgChartSnapshotQuery.error;
|
||||
|
||||
React.useEffect(() => {
|
||||
if (!currentLoadError) return;
|
||||
console.error(
|
||||
"[orgfront] Org chart load failed",
|
||||
getOrgChartLoadErrorDiagnostics(currentLoadError, {
|
||||
cacheMode: shareToken ? "public" : "redis",
|
||||
route: shareToken
|
||||
? "/v1/public/orgchart"
|
||||
: "/v1/admin/orgchart/snapshot",
|
||||
tenantId:
|
||||
tenantId ?? window.localStorage.getItem("dev_tenant_id") ?? "",
|
||||
}),
|
||||
);
|
||||
}, [currentLoadError, shareToken, tenantId]);
|
||||
|
||||
const totalUsers = React.useMemo(() => {
|
||||
const ids = new Set<string>();
|
||||
@@ -1619,9 +1679,12 @@ export function TenantOrgChartPage() {
|
||||
}
|
||||
|
||||
if (isError) {
|
||||
const errorMessage = shareToken
|
||||
? "조직도를 불러올 수 없거나 만료된 링크입니다."
|
||||
: "조직도를 불러올 수 없습니다. 로그인 상태와 조직 권한을 확인해 주세요.";
|
||||
return (
|
||||
<div className="p-8 text-center text-red-500">
|
||||
조직도를 불러올 수 없거나 만료된 링크입니다.
|
||||
{errorMessage}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user