@@ -353,37 +353,6 @@ func (s *Server) getImagesJSON(version version.Version, w http.ResponseWriter, r
353353 return err
354354 }
355355
356- // For version >= 1.19 the Created filed of image will change
357- // from int64 to time.Time.
358- // This is for legacy data format.
359- if version .LessThan ("1.19" ) {
360- type legacyImage struct {
361- ID string `json:"Id"`
362- ParentId string
363- RepoTags []string
364- RepoDigests []string
365- Created int64
366- Size int
367- VirtualSize int
368- Labels map [string ]string
369- }
370-
371- legacy := []* legacyImage {}
372- for _ , img := range images {
373- l := & legacyImage {
374- ID : img .ID ,
375- ParentId : img .ParentId ,
376- RepoTags : img .RepoTags ,
377- RepoDigests : img .RepoDigests ,
378- Created : img .Created .Unix (),
379- Size : img .Size ,
380- VirtualSize : img .VirtualSize ,
381- Labels : img .Labels ,
382- }
383- legacy = append (legacy , l )
384- }
385- return writeJSON (w , http .StatusOK , legacy )
386- }
387356 return writeJSON (w , http .StatusOK , images )
388357}
389358
@@ -513,34 +482,6 @@ func (s *Server) getImagesHistory(version version.Version, w http.ResponseWriter
513482 return err
514483 }
515484
516- // For version >= 1.19 the Created filed of image will change
517- // from int64 to time.Time.
518- // This is for legacy data format.
519- if version .LessThan ("1.19" ) {
520- type legacyImageHistory struct {
521- ID string `json:"Id"`
522- Created int64
523- CreatedBy string
524- Tags []string
525- Size int64
526- Comment string
527- }
528-
529- legacy := []* legacyImageHistory {}
530- for _ , img := range history {
531- l := & legacyImageHistory {
532- ID : img .ID ,
533- Created : img .Created .Unix (),
534- CreatedBy : img .CreatedBy ,
535- Tags : img .Tags ,
536- Size : img .Size ,
537- Comment : img .Comment ,
538- }
539- legacy = append (legacy , l )
540- }
541- return writeJSON (w , http .StatusOK , legacy )
542- }
543-
544485 return writeJSON (w , http .StatusOK , history )
545486}
546487
@@ -600,42 +541,6 @@ func (s *Server) getContainersJSON(version version.Version, w http.ResponseWrite
600541 return err
601542 }
602543
603- // For version >= 1.19 the Created filed of container will change
604- // from int64 to time.Time.
605- // This is for legacy data format.
606- if version .LessThan ("1.19" ) {
607- type legacyContainer struct {
608- ID string `json:"Id"`
609- Names []string `json:",omitempty"`
610- Image string `json:",omitempty"`
611- Command string `json:",omitempty"`
612- Created int64 `json:",omitempty"`
613- Ports []types.Port `json:",omitempty"`
614- SizeRw int `json:",omitempty"`
615- SizeRootFs int `json:",omitempty"`
616- Labels map [string ]string `json:",omitempty"`
617- Status string `json:",omitempty"`
618- }
619-
620- legacyContainers := []* legacyContainer {}
621- for _ , c := range containers {
622- lc := & legacyContainer {
623- ID : c .ID ,
624- Names : c .Names ,
625- Image : c .Image ,
626- Command : c .Command ,
627- Created : c .Created .Unix (),
628- Ports : c .Ports ,
629- SizeRw : c .SizeRw ,
630- SizeRootFs : c .SizeRootFs ,
631- Labels : c .Labels ,
632- Status : c .Status ,
633- }
634- legacyContainers = append (legacyContainers , lc )
635- }
636- return writeJSON (w , http .StatusOK , legacyContainers )
637- }
638-
639544 return writeJSON (w , http .StatusOK , containers )
640545}
641546
0 commit comments