controller

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2019 License: Apache-2.0 Imports: 8 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Build

type Build struct {
	ID        string
	Version   string
	State     State
	EventType string
	Started   time.Time
	Ended     time.Time
}

Build is a project build.

type BuildJobListPageContext

type BuildJobListPageContext struct {
	BuildInfo *Build
	Jobs      []*Job
	Error     error
}

BuildJobListPageContext has the required information to render a build job list page.

type Controller

type Controller interface {
	// ProjectListPageContext returns the projectListPage context.
	ProjectListPageContext() *ProjectListPageContext
	// ProjectBuildListContext returns the projectBuildListPage context.
	ProjectBuildListPageContext(projectID string) *ProjectBuildListPageContext
	// BuildJobListPageContext returns the BuildJobListPage context.
	BuildJobListPageContext(buildID string) *BuildJobListPageContext
	// JobLogPageContext returns the JobLogPage context.
	JobLogPageContext(jobID string) *JobLogPageContext
	// JobRunning returns if the job is running or finished.
	JobRunning(jobID string) bool
	// RerunBuild will create a new build based on the build ID.
	RerunBuild(buildID string) error
}

Controller knows what to how to handle the different ui views data using the required services and having the logic of each part.

func NewController

func NewController(brigade brigade.Service) Controller

NewController returns a new controller.

func NewFakeController

func NewFakeController() Controller

NewFakeController returns a new faked controller.

type Job

type Job struct {
	ID      string
	Name    string
	Image   string
	State   State
	Started time.Time
	Ended   time.Time
}

Job is a build job.

type JobLogPageContext

type JobLogPageContext struct {
	Job   *Job
	Log   io.ReadCloser
	Error error
}

JobLogPageContext has the required information to render a job log page.

type Project

type Project struct {
	Name       string
	ID         string
	LastBuilds []*Build
}

Project represents a Brigade project.

type ProjectBuildListPageContext

type ProjectBuildListPageContext struct {
	ProjectName string
	ProjectURL  string
	ProjectNS   string

	Builds []*Build
	Error  error
}

ProjectBuildListPageContext has the required information to render a project build list page.

type ProjectListPageContext

type ProjectListPageContext struct {
	Projects []*Project
	Error    error
}

ProjectListPageContext has the required information to render a project list page.

type State added in v0.2.0

type State int

State is the state a build, project or job could be.

const (
	// UnknownState is in unknown state.
	UnknownState State = iota
	// PendingState is pending, didn't start.
	PendingState
	// RunningState has started and is running.
	RunningState
	// FailedState has finished and has failed.
	FailedState
	// SuccessedState has finished and has completed successfuly.
	SuccessedState
)

Jump to

Keyboard shortcuts

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