Skip to content

Commit ca47831

Browse files
committed
feat: add catalog tab
1 parent fd7cef7 commit ca47831

File tree

5 files changed

+43
-1
lines changed

5 files changed

+43
-1
lines changed

options/locale/locale_en-US.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,6 +1024,7 @@ visibility.private = Private
10241024
visibility.private_tooltip = Visible only to members of organizations you have joined
10251025

10261026
[repo]
1027+
catalog = Catalog
10271028
new_repo_helper = A repository contains all project files, including revision history. Already hosting one elsewhere? <a href="%s">Migrate repository.</a>
10281029
owner = Owner
10291030
owner_helper = Some organizations may not show up in the dropdown due to a maximum repository count limit.

routers/web/repo/view.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ const (
5555
tplWatchers templates.TplName = "repo/watchers"
5656
tplForks templates.TplName = "repo/forks"
5757
tplMigrating templates.TplName = "repo/migrate/migrating"
58+
tplCatalog templates.TplName = "repo/catalog"
5859
)
5960

6061
type fileInfo struct {
@@ -387,3 +388,9 @@ func Forks(ctx *context.Context) {
387388

388389
ctx.HTML(http.StatusOK, tplForks)
389390
}
391+
392+
// CatalogHome renders the repository catalog home/overview page
393+
func CatalogHome(ctx *context.Context) {
394+
ctx.Data["PageIsCatalog"] = true
395+
ctx.HTML(http.StatusOK, tplCatalog)
396+
}

routers/web/web.go

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1497,7 +1497,26 @@ func registerRoutes(m *web.Router) {
14971497
context.RequireUnitReader(unit.TypeCode, unit.TypeIssues, unit.TypePullRequests, unit.TypeReleases),
14981498
)
14991499
// end "/{username}/{reponame}/activity"
1500-
1500+
// "/{username}/{reponame}/catalog": repo data catalog
1501+
m.Group("/{username}/{reponame}/catalog", func() {
1502+
// Example routes for a data catalog:
1503+
m.Get("", repo.CatalogHome) // Landing page showing catalog overview
1504+
// m.Get("/datasets", repo.ListDatasets) // List all datasets
1505+
// m.Get("/datasets/{name}", repo.ViewDataset) // View single dataset details
1506+
// m.Get("/datasets/{name}/schema", repo.ViewDatasetSchema) // View dataset schema
1507+
// m.Get("/datasets/{name}/lineage", repo.ViewDatasetLineage) // View dataset lineage
1508+
// m.Get("/datasets/{name}/quality", repo.ViewDatasetQuality) // View dataset quality metrics
1509+
// m.Get("/tags", repo.ListTags) // List all dataset tags
1510+
// m.Get("/search", repo.SearchCatalog) // Search datasets and metadata
1511+
// m.Group("/datasets/{name}", func() {
1512+
// m.Post("", web.Bind(forms.DatasetForm{}), repo.CreateDataset) // Create new dataset
1513+
// m.Put("", web.Bind(forms.DatasetForm{}), repo.UpdateDataset) // Update dataset
1514+
// m.Delete("", repo.DeleteDataset) // Delete dataset
1515+
// m.Post("/tags", web.Bind(forms.TagForm{}), repo.AddDatasetTags) // Add tags
1516+
// }, reqSignIn, reqDataCatalogWriter)
1517+
}, optSignIn, context.RepoAssignment, repo.MustBeNotEmpty, reqUnitCodeReader)
1518+
1519+
// end "/{username}/{reponame}/catalog"
15011520
m.Group("/{username}/{reponame}", func() {
15021521
m.Get("/{type:pulls}", repo.Issues)
15031522
m.Group("/{type:pulls}/{index}", func() {

templates/repo/catalog.tmpl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{{template "base/head" .}}
2+
<div class="page-content repository catalog">
3+
{{template "repo/header" .}}
4+
<div class="ui container">
5+
<h2>Repository Catalog</h2>
6+
<!-- Your catalog content here -->
7+
</div>
8+
</div>
9+
{{template "base/footer" .}}

templates/repo/header.tmpl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,12 @@
138138
</a>
139139
{{end}}
140140

141+
{{if .Repository.CanEnableEditor}}
142+
<a href="{{.RepoLink}}/catalog" class="{{if .PageIsCatalog}}active {{end}}item">
143+
{{svg "octicon-book"}} {{ctx.Locale.Tr "repo.catalog"}}
144+
</a>
145+
{{end}}
146+
141147
{{if .Permission.CanRead ctx.Consts.RepoUnitTypeIssues}}
142148
<a class="{{if .PageIsIssueList}}active {{end}}item" href="{{.RepoLink}}/issues">
143149
{{svg "octicon-issue-opened"}} {{ctx.Locale.Tr "repo.issues"}}

0 commit comments

Comments
 (0)