# Pool Refresh Fix

## Issue
UI tidak terupdate setelah klik tombol "Refresh Pools", meskipun pool ada di database dan sistem.

## Root Cause
Masalahnya ada di backend - field `created_by` di database bisa null, tapi di struct `ZFSPool` adalah `string` (bukan pointer atau `sql.NullString`). Saat scan, jika `created_by` null, scan akan gagal dan pool di-skip.

## Solution
Menggunakan `sql.NullString` untuk scan `created_by`, lalu assign ke string jika valid.

## Changes Made

### Updated `backend/internal/storage/zfs.go`
**File**: `backend/internal/storage/zfs.go` (line 425-442)

**Before:**
```go
var pool ZFSPool
var description sql.NullString
err := rows.Scan(
    &pool.ID, &pool.Name, &description, &pool.RaidLevel, pq.Array(&pool.Disks),
    &pool.SizeBytes, &pool.UsedBytes, &pool.Compression, &pool.Deduplication,
    &pool.AutoExpand, &pool.ScrubInterval, &pool.IsActive, &pool.HealthStatus,
    &pool.CreatedAt, &pool.UpdatedAt, &pool.CreatedBy, // Direct scan to string
)
```

**After:**
```go
var pool ZFSPool
var description sql.NullString
var createdBy sql.NullString
err := rows.Scan(
    &pool.ID, &pool.Name, &description, &pool.RaidLevel, pq.Array(&pool.Disks),
    &pool.SizeBytes, &pool.UsedBytes, &pool.Compression, &pool.Deduplication,
    &pool.AutoExpand, &pool.ScrubInterval, &pool.IsActive, &pool.HealthStatus,
    &pool.CreatedAt, &pool.UpdatedAt, &createdBy, // Scan to NullString
)
if err != nil {
    s.logger.Error("Failed to scan pool row", "error", err, "error_type", fmt.Sprintf("%T", err))
    continue
}
if createdBy.Valid {
    pool.CreatedBy = createdBy.String
}
```

## Testing
1. Pool ada di database: `default-pool`
2. Pool ada di sistem ZFS: `zpool list` shows `default-pool`
3. API sekarang mengembalikan pool dengan benar
4. Frontend sudah di-deploy

## Status
✅ **FIXED** - Backend sekarang mengembalikan pools dengan benar

## Next Steps
- Refresh browser untuk melihat perubahan
- Klik tombol "Refresh Pools" untuk manual refresh
- Pool seharusnya muncul di UI sekarang

## Date
2026-01-09
