@@ -39,13 +39,15 @@ func (i Changes) Render() []*html.Node { div := &html.Node{ Type: html.ElementNode, Data: atom.Div.String(), Attr: []html.Attribute{{Key: atom.Style.String(), Val: "text-align: center; margin-top: 80px; margin-bottom: 80px;"}}, } switch i.Filter { default: div.AppendChild(htmlg.Text(fmt.Sprintf("There are no %s changes.", i.Filter))) case changes.AllStates: case changes.FilterOpen: div.AppendChild(htmlg.Text("There are no open changes.")) case changes.FilterClosedMerged: div.AppendChild(htmlg.Text("There are no closed/merged changes.")) case changes.FilterAll: div.AppendChild(htmlg.Text("There are no changes.")) } ns = append(ns, div) }
@@ -143,15 +143,15 @@ func (cb ChangeBadge) Render() []*html.Node { text string color string ) switch cb.State { case changes.OpenState: icon = octiconssvg.IssueOpened() icon = octiconssvg.GitPullRequest() text = "Open" color = "#6cc644" case changes.ClosedState: icon = octiconssvg.IssueClosed() icon = octiconssvg.GitPullRequest() text = "Closed" color = "#bd2c00" case changes.MergedState: icon = octiconssvg.GitMerge() text = "Merged" @@ -195,18 +195,18 @@ func (ii ChangeIcon) Render() []*html.Node { icon *html.Node color string ) switch ii.State { case changes.OpenState: icon = octiconssvg.IssueOpened() icon = octiconssvg.GitPullRequest() color = "#6cc644" case changes.ClosedState: icon = octiconssvg.IssueClosed() icon = octiconssvg.GitPullRequest() color = "#bd2c00" case changes.MergedState: icon = octiconssvg.GitMerge() color = "#bd2c00" // TODO. color = "#6f42c1" } span := &html.Node{ Type: html.ElementNode, Data: atom.Span.String(), Attr: []html.Attribute{{ Key: atom.Style.String(),
@@ -188,19 +188,19 @@ func (h *handler) ChangesHandler(w http.ResponseWriter, req *http.Request) error } filter, err := stateFilter(req.URL.Query()) if err != nil { return httperror.BadRequest{Err: err} } is, err := h.is.List(req.Context(), state.RepoSpec, changes.ListOptions{State: filter}) is, err := h.is.List(req.Context(), state.RepoSpec, changes.ListOptions{Filter: filter}) if err != nil { return err } openCount, err := h.is.Count(req.Context(), state.RepoSpec, changes.ListOptions{State: changes.StateFilter(changes.OpenState)}) openCount, err := h.is.Count(req.Context(), state.RepoSpec, changes.ListOptions{Filter: changes.FilterOpen}) if err != nil { return fmt.Errorf("changes.Count(open): %v", err) } closedCount, err := h.is.Count(req.Context(), state.RepoSpec, changes.ListOptions{State: changes.StateFilter(changes.ClosedState)}) closedCount, err := h.is.Count(req.Context(), state.RepoSpec, changes.ListOptions{Filter: changes.FilterClosedMerged}) if err != nil { return fmt.Errorf("changes.Count(closed): %v", err) } var es []component.ChangeEntry for _, i := range is { @@ -235,15 +235,15 @@ const ( // returning an error if the value is unsupported. func stateFilter(query url.Values) (changes.StateFilter, error) { selectedTabName := query.Get(stateQueryKey) switch selectedTabName { case "": return changes.StateFilter(changes.OpenState), nil return changes.FilterOpen, nil case "closed": return changes.StateFilter(changes.ClosedState), nil return changes.FilterClosedMerged, nil case "all": return changes.AllStates, nil return changes.FilterAll, nil default: return "", fmt.Errorf("unsupported state filter value: %q", selectedTabName) } }