func newInitManifestPage( docPage docPage, cpiRef bhrelui.ReleaseRef, releasesRepo bhrelsrepo.ReleasesRepository, releaseVersionsRepo bhrelsrepo.ReleaseVersionsRepository, ) (initManifestPage, error) { page := initManifestPage{docPage: docPage} sources := []bhrelui.Source{bhrelui.BOSH.Source, cpiRef.Source} for _, source := range sources { relVerRec, err := releasesRepo.FindLatest(source.Full()) if err != nil { return page, err } rel, err := releaseVersionsRepo.Find(relVerRec) if err != nil { return page, err } page.Releases = append(page.Releases, bhrelui.NewRelease(relVerRec, rel)) } return page, nil }
func (c JobsController) Show(req *http.Request, r martrend.Render, params mart.Params) { relSource, relVersion, jobName, err := c.extractShowParams(req, params) if err != nil { r.HTML(500, c.errorTmpl, err) return } c.logger.Debug(c.logTag, "Release source '%s'", relSource) var relVerRec bhrelsrepo.ReleaseVersionRec if len(relVersion) > 0 { relVerRec, err = c.releasesRepo.Find(relSource, relVersion) if err != nil { r.HTML(500, c.errorTmpl, err) return } } else { relVerRec, err = c.releasesRepo.FindLatest(relSource) if err != nil { r.HTML(500, c.errorTmpl, err) return } } rel, err := c.releaseVersionsRepo.Find(relVerRec) if err != nil { r.HTML(500, c.errorTmpl, err) return } relJobs, err := c.jobsRepo.FindAll(relVerRec) if err != nil { r.HTML(500, c.errorTmpl, err) return } viewRel := bhrelui.NewRelease(relVerRec, rel) for _, relJob := range relJobs { if relJob.Name == jobName { r.HTML(200, c.showTmpl, bhjobui.NewJob(relJob, viewRel)) return } } err = bosherr.New("Release job '%s' is not found", jobName) r.HTML(404, c.errorTmpl, err) }
func (c ReleasesController) showSingleRelease(r martrend.Render, relSource, relVersion, tmpl string) { var err error var relVerRec bhrelsrepo.ReleaseVersionRec if len(relVersion) > 0 { relVerRec, err = c.releasesRepo.Find(relSource, relVersion) if err != nil { r.HTML(500, c.errorTmpl, err) return } } else { relVerRec, err = c.releasesRepo.FindLatest(relSource) if err != nil { r.HTML(500, c.errorTmpl, err) return } } rel, err := c.releaseVersionsRepo.Find(relVerRec) if err != nil { r.HTML(500, c.errorTmpl, err) return } relJobs, err := c.jobsRepo.FindAll(relVerRec) if err != nil { r.HTML(500, c.errorTmpl, err) return } viewRel := bhrelui.NewRelease(relVerRec, rel) viewJobs := []bhjobui.Job{} for _, relJob := range relJobs { viewJobs = append(viewJobs, bhjobui.NewJob(relJob, viewRel)) } viewRel.Graph = bhmiscui.NewReleaseGraph(viewRel.Packages, viewJobs, c.runner, c.logger) r.HTML(200, tmpl, &viewRel) }
func (c PackagesController) Show(req *http.Request, r martrend.Render, params mart.Params) { relSource, relVersion, pkgName, err := c.extractShowParams(req, params) if err != nil { r.HTML(500, c.errorTmpl, err) return } c.logger.Debug(c.logTag, "Release source '%s'", relSource) var relVerRec bhrelsrepo.ReleaseVersionRec if len(relVersion) > 0 { relVerRec, err = c.releasesRepo.Find(relSource, relVersion) if err != nil { r.HTML(500, c.errorTmpl, err) return } } else { relVerRec, err = c.releasesRepo.FindLatest(relSource) if err != nil { r.HTML(500, c.errorTmpl, err) return } } rel, err := c.releaseVersionsRepo.Find(relVerRec) if err != nil { r.HTML(500, c.errorTmpl, err) return } viewRel := bhrelui.NewRelease(relVerRec, rel) for _, viewPkg := range viewRel.Packages { if viewPkg.Name == pkgName { r.HTML(200, c.showTmpl, viewPkg) return } } err = bosherr.New("Release package '%s' is not found", pkgName) r.HTML(404, c.errorTmpl, err) }