store: add image size to compose status response
All composes now include the image size in their status response. The image size will be 0 except for finished composes where it will be the file length in bytes.
This commit is contained in:
parent
4d94207488
commit
4366e390cf
2 changed files with 20 additions and 2 deletions
|
|
@ -201,6 +201,7 @@ type ComposeEntry struct {
|
|||
Blueprint string `json:"blueprint"`
|
||||
Version string `json:"version"`
|
||||
ComposeType string `json:"compose_type"`
|
||||
ImageSize int64 `json:"image_size"`
|
||||
QueueStatus string `json:"queue_status"`
|
||||
JobCreated float64 `json:"job_created"`
|
||||
JobStarted float64 `json:"job_started,omitempty"`
|
||||
|
|
@ -232,7 +233,24 @@ func (s *Store) ListQueue(uuids []uuid.UUID) []*ComposeEntry {
|
|||
JobCreated: float64(compose.JobCreated.UnixNano()) / 1000000000,
|
||||
JobStarted: float64(compose.JobStarted.UnixNano()) / 1000000000,
|
||||
}
|
||||
case "FAILED", "FINISHED":
|
||||
case "FINISHED":
|
||||
image, err := s.GetImage(id)
|
||||
imageSize := int64(0)
|
||||
if err == nil {
|
||||
imageSize = image.Size
|
||||
}
|
||||
return &ComposeEntry{
|
||||
ID: id,
|
||||
Blueprint: compose.Blueprint.Name,
|
||||
Version: compose.Blueprint.Version,
|
||||
ComposeType: compose.OutputType,
|
||||
ImageSize: imageSize,
|
||||
QueueStatus: compose.QueueStatus,
|
||||
JobCreated: float64(compose.JobCreated.UnixNano()) / 1000000000,
|
||||
JobStarted: float64(compose.JobStarted.UnixNano()) / 1000000000,
|
||||
JobFinished: float64(compose.JobFinished.UnixNano()) / 1000000000,
|
||||
}
|
||||
case "FAILED":
|
||||
return &ComposeEntry{
|
||||
ID: id,
|
||||
Blueprint: compose.Blueprint.Name,
|
||||
|
|
|
|||
|
|
@ -299,7 +299,7 @@ func (api *API) modulesListHandler(writer http.ResponseWriter, request *http.Req
|
|||
if total > offset && total < end {
|
||||
modules = append(modules, modulesListModule{pkg.Name, "rpm"})
|
||||
// this removes names that have been found from the list of names
|
||||
if len(names) < i - 1 {
|
||||
if len(names) < i-1 {
|
||||
names = append(names[:i], names[i+1:]...)
|
||||
} else {
|
||||
names = names[:i]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue