handler

package
v0.0.0-...-e560ebb Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: BSD-3-Clause Imports: 43 Imported by: 0

Documentation

Overview

Package handler implements HTTP server that handles requests to default module.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnrecognizedTree indicates that a request specified an unrecognized tree.
	ErrUnrecognizedTree = fmt.Errorf("unrecognized tree name")
)

Functions

func AnnotationTreeWorker

func AnnotationTreeWorker(ctx *router.Context)

AnnotationTreeWorker attaches trees to annotations after the annotation schema was changed to include trees.

func FlushOldAlertsHandler

func FlushOldAlertsHandler(ctx *router.Context)

FlushOldAlertsHandler deletes old resolved alerts from datastore.

func FlushOldAnnotationsHandler

func FlushOldAnnotationsHandler(ctx *router.Context)

FlushOldAnnotationsHandler culls obsolete annotations from the datastore. TODO (crbug.com/1079068): Perhaps we want to revisit flush annotation logic.

func GetAlerts

func GetAlerts(ctx *router.Context, unresolved bool, resolved bool) *messages.AlertsSummary

GetAlerts handles API requests for alerts.

func GetAlertsHandler

func GetAlertsHandler(ctx *router.Context)

GetAlertsHandler handles API requests for all alerts and revision summaries.

func GetAnalyzeHandler

func GetAnalyzeHandler(ctx *router.Context)

GetAnalyzeHandler enqueues a request to run an analysis on a particular tree. This is usually hit by appengine cron rather than manually.

func GetBQQueryHandler

func GetBQQueryHandler(ctx *router.Context)

GetBQQueryHandler queries BQ sheriffable_failures for a particular project, and caches the result. This is usually hit by appengine cron rather than manually.

func GetLayoutTestsHandler

func GetLayoutTestsHandler(ctx *router.Context)

GetLayoutTestsHandler returns a JSON summary of webkit layout tests and their expected results.

func GetResolvedAlertsHandler

func GetResolvedAlertsHandler(ctx *router.Context)

GetResolvedAlertsHandler handles API requests for resolved alerts.

func GetRevRangeHandler

func GetRevRangeHandler(ctx *router.Context)

GetRevRangeHandler returns a revision range queury for gitiles, given one or two commit positions.

func GetTreeLogoHandler

func GetTreeLogoHandler(ctx *router.Context)

GetTreeLogoHandler returns a signed URL to an image asset hosted on GCS.

func GetTrees

func GetTrees(c context.Context) ([]byte, error)

GetTrees retrieves all trees from the DataStore.

func GetUnresolvedAlertsHandler

func GetUnresolvedAlertsHandler(ctx *router.Context)

GetUnresolvedAlertsHandler handles API requests for unresolved alerts and revision summaries.

func GetUserAutocompleteHandler

func GetUserAutocompleteHandler(ctx *router.Context)

GetUserAutocompleteHandler returns chromium developer email addresses that match the query string.

func PostClientMonHandler

func PostClientMonHandler(ctx *router.Context)

PostClientMonHandler handles uncaught javascript errors reported by the client.

func PostLayoutTestExpectationChangeHandler

func PostLayoutTestExpectationChangeHandler(ctx *router.Context)

PostLayoutTestExpectationChangeHandler enqueues an asynchronous task to create a Gerrit changelist to change test expectations based on the fields POSTed to it.

func WithAnalyzer

func WithAnalyzer(ctx context.Context, a *analyzer.Analyzer) context.Context

WithAnalyzer returns a context with a attached as a context value.

Types

type AnnotationHandler

type AnnotationHandler struct {
	Bqh                 *BugQueueHandler
	MonorailIssueClient AnnotationsIssueClient
}

AnnotationHandler handles annotation-related requests.

func (*AnnotationHandler) FileBugHandler

func (ah *AnnotationHandler) FileBugHandler(ctx *router.Context)

FileBugHandler files a new bug in monorail.

func (*AnnotationHandler) GetAnnotationsHandler

func (ah *AnnotationHandler) GetAnnotationsHandler(ctx *router.Context, activeKeys map[string]interface{})

GetAnnotationsHandler retrieves a set of annotations.

func (*AnnotationHandler) PostAnnotationsHandler

func (ah *AnnotationHandler) PostAnnotationsHandler(ctx *router.Context)

PostAnnotationsHandler handles updates to annotations.

func (*AnnotationHandler) RefreshAnnotationsHandler

func (ah *AnnotationHandler) RefreshAnnotationsHandler(ctx *router.Context)

RefreshAnnotationsHandler refreshes the set of annotations.

type AnnotationResponse

type AnnotationResponse struct {
	model.Annotation
	BugData map[string]MonorailBugData `json:"bug_data"`
}

AnnotationResponse ... The Annotation object extended with cached bug data.

type AnnotationsIssueClient

type AnnotationsIssueClient interface {
	SearchIssues(context.Context, *monorailv3.SearchIssuesRequest, ...grpc.CallOption) (*monorailv3.SearchIssuesResponse, error)
	MakeIssue(ctx context.Context, in *monorailv3.MakeIssueRequest, opts ...grpc.CallOption) (*monorailv3.Issue, error)
}

AnnotationsIssueClient is for testing purpose

type BugQueueHandler

type BugQueueHandler struct {
	Monorail               monorail.MonorailClient
	MonorailIssueClient    IssueClient
	DefaultMonorailProject string
}

BugQueueHandler handles bug queue-related requests.

func (*BugQueueHandler) GetBugQueueHandler

func (bqh *BugQueueHandler) GetBugQueueHandler(ctx *router.Context)

GetBugQueueHandler returns a set of bugs for the current user and tree.

func (*BugQueueHandler) GetMonorailProjectNameFromLabel

func (bqh *BugQueueHandler) GetMonorailProjectNameFromLabel(c context.Context, label string) string

GetMonorailProjectNameFromLabel returns the default monorail project name configured in project settings by comparing the bugqueue label.

func (*BugQueueHandler) GetUncachedBugsHandler

func (bqh *BugQueueHandler) GetUncachedBugsHandler(ctx *router.Context)

GetUncachedBugsHandler bypasses the cache to return the bug queue for current user and tree. TODO (nqmtuan): This is not used. We should remove it.

func (*BugQueueHandler) RefreshBugQueueHandler

func (bqh *BugQueueHandler) RefreshBugQueueHandler(ctx *router.Context)

RefreshBugQueueHandler updates the cached bug queue for current tree.

type IssueClient

type IssueClient interface {
	SearchIssues(context.Context, *monorailv3.SearchIssuesRequest, ...grpc.CallOption) (*monorailv3.SearchIssuesResponse, error)
}

IssueClient is for testing purpose

type MonorailBugData

type MonorailBugData struct {
	BugID     string `json:"id,omitempty"`
	ProjectID string `json:"projectId,omitempty"`
	Summary   string `json:"summary,omitempty"`
	Status    string `json:"status,omitempty"`
}

MonorailBugData wrap around monorailv3.Issue to send to frontend.

type SearchIssueResponseExtras

type SearchIssueResponseExtras struct {
	*monorailv3.SearchIssuesResponse
	Extras map[string]interface{} `json:"extras,omitempty"`
}

SearchIssueResponseExtras wraps around SearchIssuesResponse but adds some information

type SettingsPage

type SettingsPage struct {
	portal.BasePage
}

SettingsPage is the SoM admin settings page.

func (SettingsPage) Fields

func (SettingsPage) Fields(c context.Context) ([]portal.Field, error)

Fields returns a list of settings fields.

func (SettingsPage) ReadSettings

func (SettingsPage) ReadSettings(c context.Context) (map[string]string, error)

ReadSettings converts query parameters and POST body into settings values.

func (SettingsPage) Title

func (SettingsPage) Title(c context.Context) (string, error)

Title returns the settings page title.

func (SettingsPage) WriteSettings

func (SettingsPage) WriteSettings(c context.Context, values map[string]string, who, why string) error

WriteSettings persists the settings values.

Jump to

Keyboard shortcuts

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