This commit is contained in:
@@ -136,6 +136,7 @@ export function OrganizationsPage() {
|
||||
},
|
||||
{ key: 'type', header: '유형', className: 'w-32 px-5 py-3', cell: (row) => <StatusBadge status={organizationTypeLabel(row.type)} tone="blue" /> },
|
||||
{ key: 'license', header: '라이센스', className: 'w-36 px-5 py-3', cell: (row) => row.defaultLicenseCode ? <StatusBadge status={row.defaultLicenseName ?? row.defaultLicenseCode} tone="green" /> : <span className="text-xs text-muted-foreground">-</span> },
|
||||
{ key: 'instructorInviteCode', header: '강사 가입 코드', className: 'w-40 px-5 py-3', cell: (row) => <span className="font-mono text-sm font-semibold tracking-[0.08em] text-foreground">{row.instructorInviteCode}</span> },
|
||||
{ key: 'domain', header: '도메인', className: 'w-56 px-5 py-3', cell: (row) => <span className="font-mono text-xs text-muted-foreground">{row.domain || '-'}</span> },
|
||||
{ key: 'createdAt', header: '생성', className: 'w-48 px-5 py-3', cell: (row) => <OrganizationCreator organization={row} /> },
|
||||
{
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
lockUser,
|
||||
terminateUserSession,
|
||||
unlockUser,
|
||||
updateLmsInstructor,
|
||||
type LicensePlan,
|
||||
type Organization,
|
||||
type UserSession
|
||||
@@ -45,6 +46,7 @@ export function UserSessionsPage() {
|
||||
const [createSaving, setCreateSaving] = useState(false);
|
||||
const [menuSession, setMenuSession] = useState<{ id: string; x: number; y: number } | null>(null);
|
||||
const [detailSession, setDetailSession] = useState<UserSession | null>(null);
|
||||
const [lmsRoleSaving, setLmsRoleSaving] = useState(false);
|
||||
const loadingVisible = useMinimumLoading(loading);
|
||||
|
||||
const refresh = () => {
|
||||
@@ -183,6 +185,24 @@ export function UserSessionsPage() {
|
||||
.finally(() => setCreateSaving(false));
|
||||
};
|
||||
|
||||
const setLmsInstructor = (isInstructor: boolean) => {
|
||||
if (!detailSession) return;
|
||||
|
||||
setLmsRoleSaving(true);
|
||||
updateLmsInstructor(detailSession.userId, isInstructor)
|
||||
.then(() => {
|
||||
setDetailSession((current) => current ? { ...current, isLmsInstructor: isInstructor } : current);
|
||||
setSessions((current) => current.map((session) => (
|
||||
session.userId === detailSession.userId ? { ...session, isLmsInstructor: isInstructor } : session
|
||||
)));
|
||||
toast({ type: 'success', title: 'LMS 역할 변경', message: isInstructor ? '강사 권한을 부여했습니다.' : '강사 권한을 해제했습니다.' });
|
||||
})
|
||||
.catch((error: Error) => {
|
||||
toast({ type: 'error', title: 'LMS 역할 변경 실패', message: error.message });
|
||||
})
|
||||
.finally(() => setLmsRoleSaving(false));
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<PageTitle
|
||||
@@ -289,8 +309,20 @@ export function UserSessionsPage() {
|
||||
</div>
|
||||
<StatusBadge status={detailSession.state} />
|
||||
</div>
|
||||
<div className="grid gap-3 text-sm">
|
||||
<div className="grid gap-3 text-sm sm:grid-cols-2">
|
||||
<DetailItem label="사용자 ID" value={detailSession.userId} mono />
|
||||
<label className="block min-w-0">
|
||||
<span className="text-xs font-medium text-muted-foreground">LMS</span>
|
||||
<select
|
||||
className="mt-2 h-9 w-full rounded-md border border-input bg-background px-3 text-sm font-medium text-foreground outline-none focus:ring-2 focus:ring-ring"
|
||||
value={detailSession.isLmsInstructor ? 'INSTRUCTOR' : 'STUDENT'}
|
||||
disabled={lmsRoleSaving}
|
||||
onChange={(event) => setLmsInstructor(event.target.value === 'INSTRUCTOR')}
|
||||
>
|
||||
<option value="STUDENT">수강생</option>
|
||||
<option value="INSTRUCTOR">강사</option>
|
||||
</select>
|
||||
</label>
|
||||
<DetailItem label="조직" value={detailSession.primaryAffiliation?.organizationName ?? '-'} />
|
||||
<DetailItem label="조직 유형" value={organizationTypeLabel(detailSession.primaryAffiliation?.organizationType)} />
|
||||
<DetailItem label="부서" value={detailSession.primaryAffiliation?.department ?? '-'} />
|
||||
|
||||
@@ -70,6 +70,7 @@ export type UserSession = {
|
||||
expiresAt?: string | null;
|
||||
lastSeen?: string | null;
|
||||
state: string;
|
||||
isLmsInstructor?: boolean;
|
||||
primaryAffiliation?: {
|
||||
id: string;
|
||||
organizationId: string;
|
||||
@@ -90,6 +91,7 @@ export type Organization = {
|
||||
domain?: string | null;
|
||||
defaultLicenseCode?: string | null;
|
||||
defaultLicenseName?: string | null;
|
||||
instructorInviteCode: string;
|
||||
createdById?: string | null;
|
||||
createdByName?: string | null;
|
||||
createdByEmail?: string | null;
|
||||
@@ -257,6 +259,13 @@ export function unlockUser(userId: string) {
|
||||
});
|
||||
}
|
||||
|
||||
export function updateLmsInstructor(userId: string, isInstructor: boolean) {
|
||||
return apiRequest<{ userId: string; isInstructor: boolean }>(`/users/${userId}/lms-instructor`, {
|
||||
method: 'PATCH',
|
||||
body: JSON.stringify({ isInstructor })
|
||||
});
|
||||
}
|
||||
|
||||
export function terminateUserSession(sessionId: string) {
|
||||
return apiRequest(`/users/sessions/${sessionId}`, {
|
||||
method: 'DELETE'
|
||||
|
||||
@@ -21,6 +21,7 @@ export type BuildJob = {
|
||||
branch: string;
|
||||
commitSha?: string | null;
|
||||
artifact?: string | null;
|
||||
artifactSha256?: string | null;
|
||||
image?: string | null;
|
||||
status: JobStatus;
|
||||
logs?: string | null;
|
||||
|
||||
Reference in New Issue
Block a user