update lisensi prosess
tests / ci (push) Has been cancelled

This commit is contained in:
Wian Drs
2026-08-25 13:43:55 +07:00
parent 1e80be180e
commit 60946ddf37
58 changed files with 2903 additions and 165 deletions
+91 -30
View File
@@ -48,11 +48,14 @@ export default function DeviceSettings({
const [revealing, setRevealing] = useState(false);
const hideTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
useEffect(() => () => {
if (hideTimer.current) {
clearTimeout(hideTimer.current);
}
}, []);
useEffect(
() => () => {
if (hideTimer.current) {
clearTimeout(hideTimer.current);
}
},
[],
);
const revealBasePassword = async () => {
setRevealing(true);
@@ -60,29 +63,47 @@ clearTimeout(hideTimer.current);
setRevealedPassword('');
try {
const csrf = document.querySelector<HTMLMetaElement>('meta[name="csrf-token"]')?.content ?? '';
const csrf =
document.querySelector<HTMLMetaElement>(
'meta[name="csrf-token"]',
)?.content ?? '';
const response = await fetch('/device-settings/reveal-password', {
method: 'POST',
credentials: 'same-origin',
headers: { 'Content-Type': 'application/json', Accept: 'application/json', 'X-CSRF-TOKEN': csrf },
headers: {
'Content-Type': 'application/json',
Accept: 'application/json',
'X-CSRF-TOKEN': csrf,
},
body: JSON.stringify({ current_password: loginPassword }),
});
const result = await response.json();
if (!response.ok) {
throw new Error(result.errors?.current_password?.[0] ?? result.message ?? 'Password tidak dapat ditampilkan.');
throw new Error(
result.errors?.current_password?.[0] ??
result.message ??
'Password tidak dapat ditampilkan.',
);
}
setRevealedPassword(result.password);
setLoginPassword('');
if (hideTimer.current) {
clearTimeout(hideTimer.current);
}
clearTimeout(hideTimer.current);
}
hideTimer.current = setTimeout(() => setRevealedPassword(''), 30000);
hideTimer.current = setTimeout(
() => setRevealedPassword(''),
30000,
);
} catch (error) {
setRevealError(error instanceof Error ? error.message : 'Password tidak dapat ditampilkan.');
setRevealError(
error instanceof Error
? error.message
: 'Password tidak dapat ditampilkan.',
);
} finally {
setRevealing(false);
}
@@ -106,9 +127,7 @@ clearTimeout(hideTimer.current);
{({ processing, errors }) => (
<Card>
<CardHeader>
<CardTitle>
Template Base User Tenant
</CardTitle>
<CardTitle>Template Base User Tenant</CardTitle>
<CardDescription>
Password disimpan terenkripsi dan tidak
pernah ditampilkan kembali.
@@ -200,31 +219,58 @@ clearTimeout(hideTimer.current);
<div className="rounded-lg border bg-muted/40 p-4 text-sm md:col-span-2">
<strong>Group yang dibuat:</strong>{' '}
RADIQ-READ, RADIQ-WRITE, dan RADIQ-NOC tanpa
permission <code>policy</code>, serta
group bawaan full untuk akun provisioning
permission <code>policy</code>, serta group
bawaan full untuk akun provisioning
terpusat.
</div>
{hasPassword && (
<div className="grid gap-3 rounded-lg border border-amber-200 bg-amber-50 p-4 text-sm text-amber-950 md:col-span-2">
<div>
<strong>Lihat Base Password</strong>
<p>Masukkan password login Tenant Admin. Password perangkat akan disembunyikan otomatis setelah 30 detik.</p>
<p>
Masukkan password login Tenant
Admin. Password perangkat akan
disembunyikan otomatis setelah
30 detik.
</p>
</div>
<div className="flex flex-col gap-2 md:flex-row">
<Input
type="password"
value={loginPassword}
onChange={(event) => setLoginPassword(event.target.value)}
onChange={(event) =>
setLoginPassword(
event.target.value,
)
}
placeholder="Password login Tenant Admin"
autoComplete="current-password"
/>
<Button type="button" variant="outline" disabled={revealing || !loginPassword} onClick={revealBasePassword}>
{revealing ? 'Memverifikasi...' : 'Lihat Password'}
<Button
type="button"
variant="outline"
disabled={
revealing || !loginPassword
}
onClick={revealBasePassword}
>
{revealing
? 'Memverifikasi...'
: 'Lihat Password'}
</Button>
</div>
{revealError && <p className="text-destructive">{revealError}</p>}
{revealError && (
<p className="text-destructive">
{revealError}
</p>
)}
{revealedPassword && (
<Input value={revealedPassword} readOnly className="font-mono" aria-label="Base Password" />
<Input
value={revealedPassword}
readOnly
className="font-mono"
aria-label="Base Password"
/>
)}
</div>
)}
@@ -241,21 +287,36 @@ clearTimeout(hideTimer.current);
<CardHeader>
<CardTitle>Status Rotasi Base User</CardTitle>
<CardDescription>
Perangkat offline akan dicoba kembali oleh scheduler.
Vendor tanpa driver ditandai unsupported.
Perangkat offline akan dicoba kembali oleh
scheduler. Vendor tanpa driver ditandai unsupported.
</CardDescription>
</CardHeader>
<CardContent className="space-y-2">
{devices.map((device) => (
<div key={device.id} className="flex flex-wrap items-center justify-between gap-3 rounded-lg border p-3 text-sm">
<div
key={device.id}
className="flex flex-wrap items-center justify-between gap-3 rounded-lg border p-3 text-sm"
>
<div>
<div className="font-medium">{device.name}</div>
<div className="text-xs text-muted-foreground">{device.vendor.name} · {device.base_sync_message ?? 'Belum pernah disinkronkan'}</div>
<div className="font-medium">
{device.name}
</div>
<div className="text-xs text-muted-foreground">
{device.vendor.name} ·{' '}
{device.base_sync_message ??
'Belum pernah disinkronkan'}
</div>
</div>
<span className="rounded-full bg-muted px-2 py-1 text-xs uppercase">{device.base_sync_status}</span>
<span className="rounded-full bg-muted px-2 py-1 text-xs uppercase">
{device.base_sync_status}
</span>
</div>
))}
{devices.length === 0 && <p className="py-4 text-center text-sm text-muted-foreground">Belum ada perangkat.</p>}
{devices.length === 0 && (
<p className="py-4 text-center text-sm text-muted-foreground">
Belum ada perangkat.
</p>
)}
</CardContent>
</Card>
<Form