forked from baron/baron-sso
kratos SSOT 재설계
This commit is contained in:
@@ -6,6 +6,14 @@ export type WorksmobileComparisonFilter =
|
||||
| "needs_update"
|
||||
| "matched";
|
||||
|
||||
export type WorksmobileAccountStatusFilter =
|
||||
| "all"
|
||||
| "active"
|
||||
| "invited"
|
||||
| "suspended"
|
||||
| "inactive"
|
||||
| "deleted";
|
||||
|
||||
export type WorksmobileComparisonSummary = {
|
||||
total: number;
|
||||
matched: number;
|
||||
@@ -204,6 +212,22 @@ export function getWorksmobileSelectedUpdateUserIds(
|
||||
.filter((id): id is string => Boolean(id));
|
||||
}
|
||||
|
||||
export function formatWorksmobileSelectionFailureDescription(
|
||||
successCount: number,
|
||||
failures: string[],
|
||||
) {
|
||||
const summary = `성공 ${successCount}건, 실패 ${failures.length}건`;
|
||||
const visibleFailures = failures.slice(0, 3);
|
||||
if (failures.length <= visibleFailures.length) {
|
||||
return [summary, ...visibleFailures].join("\n");
|
||||
}
|
||||
return [
|
||||
summary,
|
||||
...visibleFailures,
|
||||
`외 ${failures.length - visibleFailures.length}건 실패`,
|
||||
].join("\n");
|
||||
}
|
||||
|
||||
export function getWorksmobileSelectedMissingExternalKeyOrgUnitIds(
|
||||
rows: WorksmobileComparisonItem[],
|
||||
selectedKeys: string[],
|
||||
@@ -251,6 +275,7 @@ const worksmobileComparisonSearchFields: Array<
|
||||
"externalKey",
|
||||
"worksmobileName",
|
||||
"worksmobileEmail",
|
||||
"worksmobileAccountStatus",
|
||||
"worksmobileLevelId",
|
||||
"worksmobileLevelName",
|
||||
"worksmobileTask",
|
||||
@@ -292,6 +317,7 @@ export function filterWorksmobileComparisonRows(
|
||||
rows: WorksmobileComparisonItem[],
|
||||
filters: WorksmobileComparisonFilter[],
|
||||
onlyMissingExternalKey = false,
|
||||
accountStatus: WorksmobileAccountStatusFilter = "all",
|
||||
) {
|
||||
const allowedStatuses = new Set(
|
||||
filters.flatMap((filter) => worksmobileFilterStatuses[filter]),
|
||||
@@ -302,7 +328,15 @@ export function filterWorksmobileComparisonRows(
|
||||
}
|
||||
allowedStatuses.add("missing_external_key");
|
||||
}
|
||||
return rows.filter((row) => allowedStatuses.has(row.status));
|
||||
return rows.filter((row) => {
|
||||
if (accountStatus !== "all") {
|
||||
return row.worksmobileAccountStatus === accountStatus;
|
||||
}
|
||||
if (!allowedStatuses.has(row.status)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
export function formatWorksmobilePersonName(row: WorksmobileComparisonItem) {
|
||||
@@ -358,6 +392,22 @@ export function formatWorksmobileUpdateDetails(row: WorksmobileComparisonItem) {
|
||||
if (expectedEmail && actualEmail && expectedEmail !== actualEmail) {
|
||||
details.push(`이메일: ${actualEmail} -> ${expectedEmail}`);
|
||||
}
|
||||
const expectedPhone = row.baronPhone?.trim() ?? "";
|
||||
const actualPhone = row.worksmobilePhone?.trim() ?? "";
|
||||
if (expectedPhone && actualPhone && expectedPhone !== actualPhone) {
|
||||
details.push(`전화번호: ${actualPhone} -> ${expectedPhone}`);
|
||||
}
|
||||
const expectedEmployeeNumber = row.baronEmployeeNumber?.trim() ?? "";
|
||||
const actualEmployeeNumber = row.worksmobileEmployeeNumber?.trim() ?? "";
|
||||
if (
|
||||
expectedEmployeeNumber &&
|
||||
actualEmployeeNumber &&
|
||||
expectedEmployeeNumber !== actualEmployeeNumber
|
||||
) {
|
||||
details.push(
|
||||
`사번: ${actualEmployeeNumber} -> ${expectedEmployeeNumber}`,
|
||||
);
|
||||
}
|
||||
return details;
|
||||
}
|
||||
|
||||
@@ -445,6 +495,18 @@ export const comparisonFilterOptions: Array<{
|
||||
|
||||
export const userFilterOptions = comparisonFilterOptions;
|
||||
|
||||
export const worksmobileAccountStatusFilterOptions: Array<{
|
||||
value: WorksmobileAccountStatusFilter;
|
||||
label: string;
|
||||
}> = [
|
||||
{ value: "all", label: "WORKS 전체" },
|
||||
{ value: "active", label: "active" },
|
||||
{ value: "invited", label: "invited" },
|
||||
{ value: "suspended", label: "suspended" },
|
||||
{ value: "inactive", label: "inactive" },
|
||||
{ value: "deleted", label: "deleted" },
|
||||
];
|
||||
|
||||
export function getDefaultUserComparisonFilters(): WorksmobileComparisonFilter[] {
|
||||
return ["baron_only", "needs_update", "works_only"];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user