blob: 47604b82b1ca3c7493eedc055fa9efe39e3dcce4 [file] [log] [blame]
// Copyright 2016 The LUCI Authors.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// See the License for the specific language governing permissions and
// limitations under the License.
package ui
import (
// Collection of structs to describe how to lay out the overview pages of Milo.
// There is an implicit hierarchy of Builder Group -> Builder.
type Search struct {
// CIServices is a backing service for a Continuous Integration system,
// such as "buildbot", "swarmbucket", or "dm".
CIServices []CIService
// CIService is a backing service for a Continuous Integration system,
// such as "buildbot", "swarmbucket", or "dm".
type CIService struct {
// Name is the display name of the service, which could be "Buildbot",
// or "SwarmBucket"
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
// Sort sorts builder groups by their Name.
func (c *CIService) Sort() {
sort.Slice(c.BuilderGroups, func(i, j int) bool {
return c.BuilderGroups[i].Name < c.BuilderGroups[j].Name
// BuilderGroup is a container to describe a named cluster of builders.
// In buildbucket CI system, it refers to a Bucket
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
// Sort sorts Builders by the lowercase of their name.
func (g *BuilderGroup) Sort() {
sort.Slice(g.Builders, func(i, j int) bool {
return strings.ToLower(g.Builders[i].Label) < strings.ToLower(g.Builders[j].Label)