luci: go.chromium.org/luci/milo/frontend/ui Index | Files

package ui

import "go.chromium.org/luci/milo/frontend/ui"

Index

Package Files

build.go builder.go componenttype_string.go console.go frontpage.go logo.go search.go settings.go verbosity_string.go

Constants

const (
    // TreeMaintenance means the tree is under maintenance and is not open.
    // This has a color of purple.
    TreeMaintenance TreeStatusState = "maintenance"
    // TreeThrottled means the tree is backed up, and commits are throttled
    // to allow the tree to catch up.  This has a color of yellow.
    TreeThrottled = "throttled"
    // TreeClosed means the tree is broken, and commits other than reverts
    // or fixes are not accepted at the time.  This has a color of red.
    TreeClosed = "closed"
    // TreeOpen means the tree is not broken, and commits can happen freely.
    // This has a color of green.
    TreeOpen = "open"
)

Variables

var (
    Windows = LogoBase{
        Img: "windows.svg",
        Alt: "Microsoft Windows",
    }

    OSX = LogoBase{
        Img: "apple.svg",
        Alt: "Apple OSX",
    }

    Ubuntu = LogoBase{
        Img: "ubuntu.svg",
        Alt: "Canonical Ubuntu",
    }

    // These are devices.
    IOS = LogoBase{
        Img: "ios_device.png",
        Alt: "Apple iOS",
    }

    Android = LogoBase{
        Img: "android_device.png",
        Alt: "Google Android",
    }

    ChromeOS = LogoBase{
        Img: "cros_device.png",
        Alt: "Google ChromeOS",
    }
)

Define our known base logos

type Bot Uses

type Bot struct {
    model.Bot
    Status model.BotStatus
}

Bot wraps a model.Bot to provide a UI specific statuses.

func (*Bot) Label Uses

func (b *Bot) Label() *Link

type BuildComponent Uses

type BuildComponent struct {
    // The parent of this component.  For buildbot and swarmbucket builds, this
    // refers to the builder.  For DM, this refers to whatever triggered the Quest.
    ParentLabel *Link `json:",omitempty"`

    // The main label for the component.
    Label *Link

    // Status of the build.
    Status model.Status

    // Banner is a banner of logos that define the OS and devices this
    // component is associated with.
    Banner *LogoBanner `json:",omitempty"`

    // Bot is the machine or execution instance that this component ran on.
    Bot *Link `json:",omitempty"`

    // Recipe is a link to the recipe this component is based on.
    Recipe *Link `json:",omitempty"`

    // Source is a link to the external (buildbot, swarming, dm, etc) data
    // source that this component relates to.
    Source *Link `json:",omitempty"`

    // Links to show adjacent to the main label.
    MainLink LinkSet `json:",omitempty"`

    // Links to show right below the main label. Top-level slice are rows of
    // links, second level shows up as
    SubLink []LinkSet `json:",omitempty"`

    // Designates the progress of the current component. Set null for no progress.
    Progress *BuildProgress `json:",omitempty"`

    // Pending is time interval that this build was pending.
    PendingTime Interval

    // Execution is time interval that this build was executing.
    ExecutionTime Interval

    // The type of component.  This manifests itself as a little label on the
    // top left corner of the component.
    // This is either "RECIPE" or "STEP".  An attempt is considered a recipe.
    Type ComponentType

    // Specifies if this is a top level or a dependency.  Manifests itself as an
    // indentation level.  Valid options are 0 and 1.  Anything more than 1 is
    // automatically truncated to 1.
    LevelsDeep uint32

    // Verbosity indicates how important this step is.
    Verbosity Verbosity

    // Arbitrary text to display below links.  One line per entry,
    // newlines are stripped.
    Text []string
}

BuildComponent represents a single Step, subsetup, attempt, or recipe.

func (*BuildComponent) TextBR Uses

func (bc *BuildComponent) TextBR() []string

TextBR returns Text, but also splits each line by <br>

type BuildProgress Uses

type BuildProgress struct {
    // contains filtered or unexported fields
}

BuildProgress is a way to show progress. Percent should always be specified.

type BuildSummary Uses

type BuildSummary struct {
    // Link to the build.
    Link *Link

    // Status of the build.
    Status model.Status

    // Pending is time interval that this build was pending.
    PendingTime Interval

    // Execution is time interval that this build was executing.
    ExecutionTime Interval

    // Revision is the main revision of the build.
    Revision *Commit

    // Arbitrary text to display below links.  One line per entry,
    // newlines are stripped.
    Text []string

    // Blame is for tracking whose change the build belongs to, if any.
    Blame []*Commit
}

BuildSummary is a summary of a build, with just enough information for display on a builder page.

type Builder Uses

type Builder struct {
    // Name of the builder
    Name string

    // Indicates that this Builder should render a blamelist for each build.
    // This is only supported for Buildbot (crbug.com/807846)
    HasBlamelist bool

    // Warning text, if any.
    Warning string

    CurrentBuilds []*BuildSummary
    PendingBuilds []*BuildSummary
    // PendingBuildNum is the number of pending builds, since the slice above
    // may be a snapshot instead of the full set.
    PendingBuildNum int
    FinishedBuilds  []*BuildSummary

    // MachinePool is primarily used by buildbot builders to list the set of
    // machines that can run in a builder.  It has no meaning in buildbucket or dm
    // and is expected to be nil.
    MachinePool *MachinePool

    // Groups is a list of links to builder groups that contain this builder.
    Groups []*Link

    // PrevCursor is a cursor to the previous page.
    PrevCursor string `json:",omitempty"`
    // NextCursor is a cursor to the next page.
    NextCursor string `json:",omitempty"`
}

Builder denotes an ordered list of MiloBuilds

type BuilderGroup Uses

type BuilderGroup struct {
    // Name is the name of the group.
    Name string
    // Builders is a list of links to the builder page for that builder.
    Builders []Link
}

BuilderGroup is a container to describe a named cluster of builders. This takes on other names in each CI services: Buildbot: Master Buildbucket: Bucket Dungeon Master: Bucket

type BuilderRef Uses

type BuilderRef struct {
    // ID is the canonical reference to a specific builder.
    ID  string
    // ShortName is a string of length 1-3 used to label the builder.
    ShortName string
    // The most recent build summaries for this builder.
    Build []*model.BuildSummary
    // The most recent builder summary for this builder.
    Builder *model.BuilderSummary
}

BuilderRef is an unambiguous reference to a builder.

It represents a single column of builds in the console view.

Implements ConsoleElement.

func (*BuilderRef) BuilderName Uses

func (br *BuilderRef) BuilderName() string

BuilderName returns the last component of ID (which is the Builder Name).

func (BuilderRef) NumLeafNodes Uses

func (br BuilderRef) NumLeafNodes() int

NumLeafNodes always returns 1 for BuilderDef since it is a leaf node.

func (BuilderRef) RenderHTML Uses

func (br BuilderRef) RenderHTML(buffer *bytes.Buffer, depth int, maxDepth int)

RenderHTML renders a BuilderRef as HTML with its builds in a column. If maxDepth is negative, render the HTML as flat rather than nested.

type BuilderSummaryGroup Uses

type BuilderSummaryGroup struct {
    // Name is a Link that contains the name of the console as well as a relative URL
    // to the console's page.
    Name *Link

    // Builders contains a list of builders for a given console and some data about
    // the latest state for each builder.
    Builders []*model.BuilderSummary
}

BuilderSummaryGroup represents the summary of a console, including its name and the latest status of each of its builders.

type CIService Uses

type CIService struct {
    // Name is the display name of the service, which could be "Buildbot",
    // "SwarmBucket", or "Dungeon Master"
    Name string

    // Host points to the specific instance of this CI Service.
    Host *Link

    // BuilderGroups lists all of the known named groups of builders within this service.
    BuilderGroups []BuilderGroup
}

CIService is a backing service for a Continuous Integration system, such as "buildbot", "swarmbucket", or "dm".

type Category Uses

type Category struct {
    Name string
    // contains filtered or unexported fields
}

Category represents an interior node in a category tree for builders.

Implements ConsoleElement.

func NewCategory Uses

func NewCategory(name string) *Category

NewCategory allocates a new Category struct with no children.

func (*Category) AddBuilder Uses

func (c *Category) AddBuilder(categories []string, builder *BuilderRef)

AddBuilder inserts the builder into this Category tree.

AddBuilder will create new subcategories as a chain of Category structs as needed until there are no categories remaining. The builder is then made a child of the deepest such Category.

func (*Category) Children Uses

func (c *Category) Children() []ConsoleElement

Children returns a list of child console elements.

func (*Category) NumLeafNodes Uses

func (c *Category) NumLeafNodes() int

NumLeafNodes calculates the number of leaf nodes in Category.

func (Category) RenderHTML Uses

func (c Category) RenderHTML(buffer *bytes.Buffer, depth int, maxDepth int)

RenderHTML renders the Category struct and its children as HTML into a buffer. If maxDepth is negative, skip the labels to render the HTML as flat rather than nested.

type Choices Uses

type Choices struct {
    // A list of all possible choices.
    Choices []string

    // The selected choice.
    Selected string
}

Choices - A dropdown menu showing all possible choices.

type Commit Uses

type Commit struct {
    // Who made the commit?
    AuthorName string
    // Email of the committer.
    AuthorEmail string
    // Time of the commit.
    CommitTime time.Time
    // Full URL of the main source repository.
    Repo string
    // Branch of the repo.
    Branch string
    // Requested revision of the commit or base commit.
    RequestRevision *Link
    // Revision of the commit or base commit.
    Revision *Link
    // The commit message.
    Description string
    // Rietveld or Gerrit URL if the commit is a patch.
    Changelist *Link
    // Browsable URL of the commit.
    CommitURL string
    // List of changed filenames.
    File []string
}

Commit represents a single commit to a repository, rendered as part of a blamelist.

func (*Commit) DescLines Uses

func (c *Commit) DescLines() []string

DescLines returns the description as a slice, one line per item.

func (*Commit) RevisionHTML Uses

func (c *Commit) RevisionHTML() template.HTML

RevisionHTML returns a single rendered link for the revision, prioritizing Revision over RequestRevision.

func (*Commit) Title Uses

func (c *Commit) Title() string

Title is the first line of the commit message (Description).

type ComponentType Uses

type ComponentType int

ComponentType is the type of build component.

const (
    // Recipe corresponds to a full recipe run.  Dependencies are recipes.
    Recipe ComponentType = iota

    // Step is a single step of a recipe.
    Step

    // Summary denotes that this does not pretain to any particular step.
    Summary
)

func (ComponentType) MarshalJSON Uses

func (c ComponentType) MarshalJSON() ([]byte, error)

MarshalJSON renders enums into String rather than an int when marshalling.

func (ComponentType) String Uses

func (i ComponentType) String() string

type Console Uses

type Console struct {
    Name string

    // Project is the LUCI project for which this console is defined.
    Project string

    // Header is an optional header for the console which contains links, oncall info,
    // and summaries of other, presumably related consoles.
    //
    // This field may be nil, which simply indicates to the renderer to not render a
    // header.
    Header *ConsoleHeader

    // Commit is a list of commits representing the list of commits to the left of the
    // console.
    Commit []Commit

    // Table is a tree of builder categories used to generate the console's main table.
    //
    // Leaf nodes must always be of concrete type BuilderRef, interior nodes must
    // always be of type Category. The root node is a dummy node without a name
    // to simplify the implementation.
    Table Category

    // MaxDepth represents the maximum tree depth of Table.
    MaxDepth int

    // FaviconURL is the URL to the favicon for this console.
    FaviconURL string
}

Console represents a console view. Commit contains a list of commits to be displayed in this console. Table contains a tree of categories whose leaves are builders. The builders maintain information regarding the builds for the corresponding commits in Commit. MaxDepth is a useful piece of metadata for adding in empty rows in the console's header.

type ConsoleElement Uses

type ConsoleElement interface {
    // Writes HTML into the given byte buffer.
    //
    // The two integer parameters represent useful pieces of metadata in
    // rendering: current depth, and maximum depth.
    RenderHTML(*bytes.Buffer, int, int)

    // Returns number of leaf nodes in this console element.
    NumLeafNodes() int
}

ConsoleElement represents a single renderable console element.

type ConsoleGroup Uses

type ConsoleGroup struct {
    // Title is the title for this group of consoles and may link to anywhere.
    Title *Link

    // Consoles is the list of console summaries contained without this group.
    Consoles []*BuilderSummaryGroup
}

ConsoleGroup represents a group of console summaries which may optionally be titled. Logically, it represents a group of consoles with some shared quality (e.g. tree closers).

type ConsoleHeader Uses

type ConsoleHeader struct {
    // Oncalls is a list of oncall roles and the current people who fill that role
    // that will be displayed in the header..
    Oncalls []Oncall

    // Links is a list of link groups to be displayed in the header.
    Links []LinkGroup

    // ConsoleGroups is a list of groups of console summaries to be displayed in
    // the header.
    //
    // A console group without a title will have all of its console summaries
    // appear "ungrouped" when rendered.
    ConsoleGroups []ConsoleGroup

    // TreeStatus indicates the status of the tree if it is not nil.
    TreeStatus *TreeStatus
}

ConsoleHeader represents the header of a console view, containing a set of links, oncall details, as well as a set of console summaries for other, relevant consoles.

type Frontpage Uses

type Frontpage struct {
    Projects []common.Project
}

type Interval Uses

type Interval struct {
    // Started denotes the start time of this interval.
    Started time.Time
    // Finished denotest the end time of this interval.
    Finished time.Time
    // Duration is the length of the interval.
    Duration time.Duration
}

Interval is a time interval which has a start, an end and a duration.

func NewInterval Uses

func NewInterval(c context.Context, start, end time.Time) Interval

NewInterval returns a new interval struct. If end time is empty (eg. Not completed) set end time to empty but set duration to the difference between start and now. Getting called with an empty start time and non-empty end time is undefined.

type Link struct {
    model.Link

    // AriaLabel is a spoken label for the link.  Used as aria-label under the anchor tag.
    AriaLabel string `json:",omitempty"`

    // Img is an icon for the link.  Not compatible with label.  Rendered as <img>
    Img string `json:",omitempty"`

    // Alt text for the image, or title text with text link.
    Alt string `json:",omitempty"`

    // Alias, if true, means that this link is an [alias link].
    Alias bool `json:",omitempty"`
}

Link denotes a single labeled link.

JSON tags here are for test expectations.

func NewEmptyLink(label string) *Link

NewEmptyLink creates a Link struct acting as a pure text label.

func NewLink(label, url, ariaLabel string) *Link

NewLink does just about what you'd expect.

func NewPatchLink(cl buildbucketpb.BuildSet) *Link

NewPatchLink is the right way (TM) to generate links to Rietveld/Gerrit CLs.

Returns nil if provided buildset is not Rietveld or Gerrit CL.

func (*Link) HTML Uses

func (l *Link) HTML() template.HTML

HTML renders this Link as HTML.

func (*Link) String Uses

func (l *Link) String() string

String renders this Link's Label as a string.

type LinkGroup Uses

type LinkGroup struct {
    // Name is the name of the category this group of links belongs to.
    Name *Link

    // Links is a list of links in this link group.
    Links []*Link
}

LinkGroup represents a set of links grouped together by some category.

type LinkSet Uses

type LinkSet []*Link

LinkSet is an ordered collection of Link objects that will be rendered on the same line.

func (LinkSet) HTML Uses

func (l LinkSet) HTML() template.HTML

HTML renders this LinkSet as HTML.

type Logo struct {
    LogoBase
    // Subtitle is text that goes under the logo.  This is most commonly used
    // to specify the version of the OS or type of device.
    Subtitle string
    // Count specifies how many of the OS or device there are.
    Count int
}

type LogoBanner Uses

type LogoBanner struct {
    OS     []Logo
    Device []Logo
}

LogoBanner is a banner of logos that define the OS and devices that a component is associated with.

type LogoBase Uses

type LogoBase struct {
    Img string
    Alt string
}

type MachinePool Uses

type MachinePool struct {
    Total   int
    Offline int
    Idle    int
    Busy    int
    Bots    []Bot
}

MachinePool represents the capacity and availability of a builder.

func NewMachinePool Uses

func NewMachinePool(c context.Context, bots []model.Bot) *MachinePool

NewMachinePool calculates stats from a model.Bot and generates a MachinePool. This requires a context because setting the UI Status field requires the current time.

type MiloBuild Uses

type MiloBuild struct {
    // Summary is a top level summary of the page.
    Summary BuildComponent

    // Trigger gives information about how and with what information
    // the build was triggered.
    Trigger *Trigger

    // Components is a detailed list of components and subcomponents of the page.
    // This is most often used for steps (buildbot/luci) or deps (luci).
    Components []*BuildComponent

    // PropertyGroup is a list of input and output property of this page.
    // This is used for build and emitted properties (buildbot) and quest
    // information (luci).  This is also grouped by the "type" of property
    // so different categories of properties can be separated and sorted.
    //
    // This is not a map so code that constructs MiloBuild can control the
    // order of property groups, for example show important properties
    // first.
    PropertyGroup []*PropertyGroup

    // Blame is a list of people and commits that is likely to be in relation to
    // the thing displayed on this page.
    Blame []*Commit
}

MiloBuild denotes a full renderable Milo build page.

func (*MiloBuild) BuildSummary Uses

func (b *MiloBuild) BuildSummary() *BuildSummary

BuildSummary returns the BuildSummary representation of the MiloBuild. This is the subset of fields that is interesting to the builder view.

func (*MiloBuild) Fix Uses

func (b *MiloBuild) Fix()

Fix fixes various inconsistencies that users expect to see as part of the Build, but didn't make sense as part of the individual components, including: * If the build is complete, all open steps should be closed.

type Navigation struct {
    // Title of the site, is generally consistent throughout the whole site.
    SiteTitle *Link

    // Title of the page, usually talks about what's currently here
    PageTitle *Link

    // List of clickable thing to navigate down the hierarchy.
    Breadcrumbs []*Link

    // List of (smaller) clickable things to display on the right side.
    Right []*Link
}

Navigation is the top bar of the page, used for navigating out of the page.

type Oncall Uses

type Oncall struct {
    // Name is the name of the oncall role.  This is set by Milo.
    Name string `json:"-"`

    // Primary is the username of the primary oncall.  This is used in lieu of emails.
    // This is filled in from the remote JSON.
    Primary string

    // Secondaries are the usernames of the secondary oncalls.  This is used in lieu of emails.
    // This is filled in from the remote JSON.
    Secondaries []string

    // Emails is a list of email addresses for the individuals who are currently in
    // that role.  This is loaded from the sheriffing json.
    Emails []string
}

Oncall represents an oncall role with the current individuals in that role, represented by their email addresses.

type Property Uses

type Property struct {
    Key   string
    Value string
}

Property specifies k/v pair representing some sort of property, such as buildbot property, quest property, etc.

type PropertyGroup Uses

type PropertyGroup struct {
    GroupName string
    Property  []*Property
}

PropertyGroup is a cluster of similar properties. In buildbot land this would be the "source". This is a way to segregate different types of properties such as Quest properties, swarming properties, emitted properties, revision properties, etc.

func (PropertyGroup) Len Uses

func (p PropertyGroup) Len() int

func (PropertyGroup) Less Uses

func (p PropertyGroup) Less(i, j int) bool

func (PropertyGroup) Swap Uses

func (p PropertyGroup) Swap(i, j int)
type Search struct {
    // CIServices is a backing service for a Continuous Integration system,
    // such as "buildbot", "swarmbucket", or "dm".
    CIServices []CIService
}

type Settings Uses

type Settings struct {
    // Where the form should go.
    ActionURL string

    // Themes is a list of usable themes for Milo
    Theme *Choices
}

Settings denotes a full renderable Milo settings page.

type TreeStatus Uses

type TreeStatus struct {
    // Username is the name of the user who changed the status last.
    Username        string `json:"username"`
    CanCommitFreely bool   `json:"can_commit_freely"`
    // GeneralState is the general state of the tree, which also indicates
    // the color of the tree.
    GeneralState TreeStatusState `json:"general_state"`
    Key          int64           `json:"key"`
    // Date is when the tree was last updated.  The format is YYYY-mm-DD HH:MM:SS.ssssss
    // and implicitly UTC.  eg. "2017-11-10 14:29:21.804080"
    Date string `json:"date"`
    // Message is a human readable description of the tree.
    Message string `json:"message"`
    // URL is a link to the root status page.  This is generated on the Milo side,
    // not provided by the status app.
    URL *url.URL
}

TreeStatus represents the very top bar of the console, above the header.

type TreeStatusState Uses

type TreeStatusState string

TreeStatusState indicates the status of a tree.

type Trigger Uses

type Trigger struct {
    Commit
    // Source is the trigger source.  In buildbot, this would be the "Reason".
    // This has no meaning in SwarmBucket and DM yet.
    Source string
    // Project is the name of the LUCI project responsible for
    // triggering the build.
    Project string
}

Trigger is the combination of pointing to a single commit, with information about where that commit came from (e.g. the repository), and the project that triggered it.

type Verbosity Uses

type Verbosity int

Verbosity can be tagged onto a BuildComponent to indicate whether it should be hidden or annuciated.

const (
    // Normal items are displayed as usual.  This is the default.
    Normal Verbosity = iota

    // Hidden items are by default not displayed.
    Hidden

    // Interesting items are a signal that they should be annuciated, or
    // pre-fetched.
    Interesting
)

func (Verbosity) String Uses

func (i Verbosity) String() string

Package ui imports 14 packages (graph) and is imported by 14 packages. Updated 2018-08-20. Refresh now. Tools for package owners.