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)
}