web

package
v0.0.0-...-52c43cf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 17, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseDescription

func ParseDescription(text string) (title, subtitle, description string)

Parses the repo description format, a markdown with optional `# Title` and `## Subtitle` at the start of the file.

func ServeErrorTemplate

func ServeErrorTemplate(err error, code int, w http.ResponseWriter)

func ServeStyleSheet

func ServeStyleSheet(w http.ResponseWriter, r *http.Request)

func ServeTemplate

func ServeTemplate(v interface{}, p Paths, w io.Writer, name string, templ string) error

func WriteStyleSheet

func WriteStyleSheet(w io.Writer) error

Types

type BranchDetails

type BranchDetails struct {
	Ref               string
	Title             string
	Subtitle          string
	Description       string
	OpenReviewCount   int
	OpenReviews       []review.Summary
	ClosedReviewCount int
	ClosedReviews     []review.Summary
}

type BranchList

type BranchList []*BranchDetails

func (BranchList) Len

func (list BranchList) Len() int

func (BranchList) Less

func (list BranchList) Less(i, j int) bool

func (BranchList) Swap

func (list BranchList) Swap(i, j int)

type Paths

type Paths interface {
	Css() string
	Repo() string
	Branch(branch uint64) string
	Review(review string) string
}

type RepoDetails

type RepoDetails struct {
	Path             string
	Repo             repository.Repo
	RepoHash         string
	Title            string
	Subtitle         string
	Description      string
	Branches         BranchList
	AbandonedReviews []review.Summary
	ReviewMap        map[string]ReviewIndex
}

func NewRepoDetails

func NewRepoDetails(repo repository.Repo) (*RepoDetails, error)

NewRepoDetails constructs a RepoDetails instance from the given Repo instance.

func (*RepoDetails) GetBranchDetails

func (repoDetails *RepoDetails) GetBranchDetails(branch string) *BranchDetails

GetBranchDetails constructs a concise summary of the branch.

func (*RepoDetails) ServeBranchTemplate

func (repoDetails *RepoDetails) ServeBranchTemplate(w http.ResponseWriter, r *http.Request)

Shows reviews for a given branch The branch to summarize is given by the 'repo' URL parameter.

func (*RepoDetails) ServeBranchTemplateWith

func (repoDetails *RepoDetails) ServeBranchTemplateWith(p Paths, w http.ResponseWriter, r *http.Request)

func (*RepoDetails) ServeEntryPointRedirect

func (repoDetails *RepoDetails) ServeEntryPointRedirect(w http.ResponseWriter, r *http.Request)

ServeEntryPointRedirect writes the main redirect response to the given writer.

func (*RepoDetails) ServeRepoTemplate

func (repoDetails *RepoDetails) ServeRepoTemplate(w http.ResponseWriter, r *http.Request)

Lists branches

func (*RepoDetails) ServeRepoTemplateWith

func (repoDetails *RepoDetails) ServeRepoTemplateWith(p Paths, w http.ResponseWriter, r *http.Request)

func (*RepoDetails) ServeReviewTemplate

func (repoDetails *RepoDetails) ServeReviewTemplate(w http.ResponseWriter, r *http.Request)

Show a review with inline diff The enclosing repository is given by the 'repo' URL parameter. The review to write is given by the 'review' URL parameter.

func (*RepoDetails) ServeReviewTemplateWith

func (repoDetails *RepoDetails) ServeReviewTemplateWith(p Paths, w http.ResponseWriter, r *http.Request)

func (*RepoDetails) Update

func (repoDetails *RepoDetails) Update() error

func (*RepoDetails) UpdateRepoDescription

func (repoDetails *RepoDetails) UpdateRepoDescription()

func (*RepoDetails) WriteBranchTemplate

func (repoDetails *RepoDetails) WriteBranchTemplate(branch uint64, p Paths, w io.Writer) error

func (*RepoDetails) WriteRepoTemplate

func (repoDetails *RepoDetails) WriteRepoTemplate(p Paths, w io.Writer) error

func (*RepoDetails) WriteReviewTemplate

func (repoDetails *RepoDetails) WriteReviewTemplate(reviewRev string, p Paths, w io.Writer) error

type ReviewIndex

type ReviewIndex struct {
	Type ReviewType
	// Index into RepoDetails.Branches[...] for Open/ClosedReview
	Branch int
	// Index into RepoDetails.{Branches[...].{OpenReviews,ClosedReviews},.AbandonedReviews}
	Index int
}

func (*ReviewIndex) GetBranchTitle

func (reviewIndex *ReviewIndex) GetBranchTitle(repoDetails *RepoDetails) string

func (*ReviewIndex) GetNext

func (reviewIndex *ReviewIndex) GetNext(repoDetails *RepoDetails) *ReviewIndex

func (*ReviewIndex) GetPrevious

func (reviewIndex *ReviewIndex) GetPrevious(repoDetails *RepoDetails) *ReviewIndex

func (*ReviewIndex) GetSummaries

func (reviewIndex *ReviewIndex) GetSummaries(repoDetails *RepoDetails) []review.Summary

func (*ReviewIndex) GetSummary

func (reviewIndex *ReviewIndex) GetSummary(repoDetails *RepoDetails) *review.Summary

type ReviewType

type ReviewType int
const (
	OpenReview ReviewType = iota
	ClosedReview
	AbandonedReview
)

type ServePaths

type ServePaths struct{}

func (ServePaths) Branch

func (ServePaths) Branch(branch uint64) string

func (ServePaths) Css

func (ServePaths) Css() string

func (ServePaths) Repo

func (ServePaths) Repo() string

func (ServePaths) Review

func (ServePaths) Review(review string) string

type StaticPaths

type StaticPaths struct{}

func (StaticPaths) Branch

func (StaticPaths) Branch(branch uint64) string

func (StaticPaths) Css

func (StaticPaths) Css() string

func (StaticPaths) Repo

func (StaticPaths) Repo() string

func (StaticPaths) Review

func (StaticPaths) Review(review string) string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL