fix no client showed up but says pending in purgatory
This commit is contained in:
@@ -55,6 +55,9 @@ try {
|
|||||||
try {
|
try {
|
||||||
db.run(`ALTER TABLE clients ADD COLUMN enrollment_status TEXT NOT NULL DEFAULT 'pending'`);
|
db.run(`ALTER TABLE clients ADD COLUMN enrollment_status TEXT NOT NULL DEFAULT 'pending'`);
|
||||||
} catch {}
|
} catch {}
|
||||||
|
try {
|
||||||
|
db.run(`UPDATE clients SET enrollment_status='pending' WHERE enrollment_status IS NULL`);
|
||||||
|
} catch {}
|
||||||
try {
|
try {
|
||||||
db.run(`ALTER TABLE clients ADD COLUMN public_key TEXT`);
|
db.run(`ALTER TABLE clients ADD COLUMN public_key TEXT`);
|
||||||
} catch {}
|
} catch {}
|
||||||
@@ -469,8 +472,12 @@ export function listClients(filters: ListFilters): ListResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (enrollmentFilter && enrollmentFilter !== "all") {
|
if (enrollmentFilter && enrollmentFilter !== "all") {
|
||||||
where.push("enrollment_status=?");
|
if (enrollmentFilter === "pending") {
|
||||||
params.push(enrollmentFilter);
|
where.push("(enrollment_status='pending' OR enrollment_status IS NULL)");
|
||||||
|
} else {
|
||||||
|
where.push("enrollment_status=?");
|
||||||
|
params.push(enrollmentFilter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (osFilter && osFilter !== "all") {
|
if (osFilter && osFilter !== "all") {
|
||||||
@@ -1089,7 +1096,7 @@ export function getPendingClients(): {
|
|||||||
return db
|
return db
|
||||||
.query<any>(
|
.query<any>(
|
||||||
`SELECT id, host, os, user, ip, country, public_key as publicKey, key_fingerprint as keyFingerprint, last_seen as lastSeen
|
`SELECT id, host, os, user, ip, country, public_key as publicKey, key_fingerprint as keyFingerprint, last_seen as lastSeen
|
||||||
FROM clients WHERE enrollment_status='pending' ORDER BY last_seen DESC`,
|
FROM clients WHERE enrollment_status='pending' OR enrollment_status IS NULL ORDER BY last_seen DESC`,
|
||||||
)
|
)
|
||||||
.all()
|
.all()
|
||||||
.map((r: any) => ({
|
.map((r: any) => ({
|
||||||
|
|||||||
Reference in New Issue
Block a user