diff --git a/docs/configuration.md b/docs/configuration.md index a452a0a..fbd6dcc 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -14,7 +14,7 @@ - [Weather](#weather) - [Monitor](#monitor) - [Releases](#releases) - - [Repository Overview](#repository-overview) + - [Repository](#repository) - [Bookmarks](#bookmarks) - [Calendar](#calendar) - [Stocks](#stocks) @@ -822,13 +822,13 @@ The maximum number of releases to show. #### `collapse-after` How many releases are visible before the "SHOW MORE" button appears. Set to `-1` to never collapse. -### Repository Overview +### Repository Display general information about a repository as well as a list of the latest open pull requests and issues. Example: ```yaml -- type: repository-overview +- type: repository repository: glanceapp/glance pull-requests-limit: 5 issues-limit: 3 @@ -836,7 +836,7 @@ Example: Preview: -![](images/repository-overview-preview.png) +![](images/repository-preview.png) #### Properties diff --git a/docs/images/repository-overview-preview.png b/docs/images/repository-preview.png similarity index 100% rename from docs/images/repository-overview-preview.png rename to docs/images/repository-preview.png diff --git a/internal/assets/templates.go b/internal/assets/templates.go index 0dde279..b8aa6ae 100644 --- a/internal/assets/templates.go +++ b/internal/assets/templates.go @@ -31,7 +31,7 @@ var ( MonitorTemplate = compileTemplate("monitor.html", "widget-base.html") TwitchGamesListTemplate = compileTemplate("twitch-games-list.html", "widget-base.html") TwitchChannelsTemplate = compileTemplate("twitch-channels.html", "widget-base.html") - RepositoryOverviewTemplate = compileTemplate("repository-overview.html", "widget-base.html") + RepositoryTemplate = compileTemplate("repository.html", "widget-base.html") ) var globalTemplateFunctions = template.FuncMap{ diff --git a/internal/assets/templates/repository-overview.html b/internal/assets/templates/repository.html similarity index 100% rename from internal/assets/templates/repository-overview.html rename to internal/assets/templates/repository.html diff --git a/internal/widget/repository-overview.go b/internal/widget/repository-overview.go index 8c50b31..85a896c 100644 --- a/internal/widget/repository-overview.go +++ b/internal/widget/repository-overview.go @@ -9,7 +9,7 @@ import ( "github.com/glanceapp/glance/internal/feed" ) -type RepositoryOverview struct { +type Repository struct { widgetBase `yaml:",inline"` RequestedRepository string `yaml:"repository"` Token OptionalEnvString `yaml:"token"` @@ -18,7 +18,7 @@ type RepositoryOverview struct { RepositoryDetails feed.RepositoryDetails } -func (widget *RepositoryOverview) Initialize() error { +func (widget *Repository) Initialize() error { widget.withTitle("Repository").withCacheDuration(1 * time.Hour) if widget.PullRequestsLimit == 0 || widget.PullRequestsLimit < -1 { @@ -32,7 +32,7 @@ func (widget *RepositoryOverview) Initialize() error { return nil } -func (widget *RepositoryOverview) Update(ctx context.Context) { +func (widget *Repository) Update(ctx context.Context) { details, err := feed.FetchRepositoryDetailsFromGithub( widget.RequestedRepository, string(widget.Token), @@ -47,6 +47,6 @@ func (widget *RepositoryOverview) Update(ctx context.Context) { widget.RepositoryDetails = details } -func (widget *RepositoryOverview) Render() template.HTML { - return widget.render(widget, assets.RepositoryOverviewTemplate) +func (widget *Repository) Render() template.HTML { + return widget.render(widget, assets.RepositoryTemplate) } diff --git a/internal/widget/widget.go b/internal/widget/widget.go index 48ebb4c..3707b7e 100644 --- a/internal/widget/widget.go +++ b/internal/widget/widget.go @@ -43,8 +43,8 @@ func New(widgetType string) (Widget, error) { return &TwitchGames{}, nil case "twitch-channels": return &TwitchChannels{}, nil - case "repository-overview": - return &RepositoryOverview{}, nil + case "repository": + return &Repository{}, nil default: return nil, fmt.Errorf("unknown widget type: %s", widgetType) }