diff --git a/html/template/sync/pool-by-id.html b/html/template/sync/pool-by-id.html index 15c4dc44..3f3ab447 100644 --- a/html/template/sync/pool-by-id.html +++ b/html/template/sync/pool-by-id.html @@ -2,28 +2,28 @@ {{ define "title" }}Pool Upload{{ end }} {{ define "extraheader" }} - {{ end }} {{ define "content" }}
-

Upload Results: pools-data-2023.csv

- - File Parsed Successfully - +

Upload Results: {{ .Upload.Name }}

+ {{ if eq .Upload.Status "parsed" }} + + File Parsed Successfully + + {{ else if eq .Upload.Status "error" }} + + File Has Problems + + {{ else if eq .Upload.Status "uploaded" }} + + File Is Processing + + {{ else }} + + Unknown status + + {{ end }}
diff --git a/platform/pool.go b/platform/pool.go index 84020c84..5c6db680 100644 --- a/platform/pool.go +++ b/platform/pool.go @@ -19,13 +19,14 @@ import ( "github.com/stephenafamo/scan" ) -type PoolDetail struct { - Created time.Time `db:"created"` - ID int32 `db:"id"` - Pools []PoolRow - Status string `db:"status"` +type UploadPoolDetail struct { + Created time.Time + ID int32 + Name string + Pools []UploadPoolRow + Status string } -type PoolRow struct { +type UploadPoolRow struct { Street string City string } @@ -72,10 +73,10 @@ func NewPoolUpload(ctx context.Context, u *models.User, upload userfile.FileUplo ID: file.ID, }, nil } -func GetPoolDetail(ctx context.Context, organization_id int32, file_id int32) (PoolDetail, error) { +func GetUploadPoolDetail(ctx context.Context, organization_id int32, file_id int32) (UploadPoolDetail, error) { file, err := models.FindFileuploadFile(ctx, db.PGInstance.BobDB, file_id) if err != nil { - return PoolDetail{}, fmt.Errorf("Failed to lookup file %d: %w", file_id, err) + return UploadPoolDetail{}, fmt.Errorf("Failed to lookup file %d: %w", file_id, err) } /* csv, err := models.FindFileuploadCSV(ctx, db.PGInstance.BobDB, file_id) @@ -87,16 +88,17 @@ func GetPoolDetail(ctx context.Context, organization_id int32, file_id int32) (P models.SelectWhere.FileuploadPools.CSVFile.EQ(file_id), ).All(ctx, db.PGInstance.BobDB) if err != nil { - return PoolDetail{}, fmt.Errorf("Failed to query pools for %d: %w", file_id, err) + return UploadPoolDetail{}, fmt.Errorf("Failed to query pools for %d: %w", file_id, err) } - pools := make([]PoolRow, 0) + pools := make([]UploadPoolRow, 0) for _, r := range rows { - pools = append(pools, PoolRow{ + pools = append(pools, UploadPoolRow{ Street: r.AddressStreet, City: r.AddressCity, }) } - return PoolDetail{ + return UploadPoolDetail{ + Name: file.Name, Pools: pools, Status: file.Status.String(), }, nil diff --git a/scss/custom.scss b/scss/custom.scss index 96d8dbfd..4231f3e1 100644 --- a/scss/custom.scss +++ b/scss/custom.scss @@ -52,3 +52,4 @@ $theme-colors: map-merge( @import "./rmo/status.scss"; @import "./sync/dashboard.scss"; @import "./sync/pool-csv-upload.scss"; +@import "./sync/pool-by-id.scss"; diff --git a/scss/sync/pool-by-id.scss b/scss/sync/pool-by-id.scss new file mode 100644 index 00000000..1acd725b --- /dev/null +++ b/scss/sync/pool-by-id.scss @@ -0,0 +1,13 @@ + +.summary-card { + transition: transform 0.2s; +} +.summary-card:hover { + transform: translateY(-5px); +} +.warning-row { + background-color: rgba(255, 193, 7, 0.15) !important; +} +.status-badge { + font-size: 0.85rem; +} diff --git a/sync/pool.go b/sync/pool.go index 09a1e966..27e99feb 100644 --- a/sync/pool.go +++ b/sync/pool.go @@ -13,9 +13,9 @@ import ( ) type ContentPoolDetail struct { - Pool platform.PoolDetail - URL ContentURL - User User + Upload platform.UploadPoolDetail + URL ContentURL + User User } type ContentPoolList struct { Uploads []platform.PoolUpload @@ -72,15 +72,15 @@ func getPoolUploadByID(w http.ResponseWriter, r *http.Request, u *models.User) { respondError(w, "Failed to parse file_id", err, http.StatusInternalServerError) return } - detail, err := platform.GetPoolDetail(ctx, u.OrganizationID, int32(file_id)) + detail, err := platform.GetUploadPoolDetail(ctx, u.OrganizationID, int32(file_id)) if err != nil { respondError(w, "Failed to get pool", err, http.StatusInternalServerError) return } data := ContentPoolDetail{ - Pool: detail, - URL: newContentURL(), - User: userContent, + Upload: detail, + URL: newContentURL(), + User: userContent, } html.RenderOrError(w, "sync/pool-by-id.html", data) }