fetchImportsDetails now returns imports for a package from the
database. imports.tmpl is also updated to display the name and path of
imports, grouped by whether or not they are in the standard library.
A bug is fixed where the insert for to_name and to_path were
swapped.
Fixes b/124308480
Change-Id: Ic325aee1ee9be37aad7f13948d68ea85461dc92b
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/450576
Reviewed-by: Robert Findley <rfindley@google.com>
Add content to the licenses page, along with anchored links to specific
licenses that apply to the package, as well as a disclaimer.
Updates b/124309095
Change-Id: Id394c8acd2ca60cf711f64bc15541429e77715d1
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/450766
Reviewed-by: Julie Qiu <julieqiu@google.com>
Search results now show the number of packages that a given result is
imported by.
Updates b/130797141
Change-Id: I64dbaf66f7cbb09971c533ad72e77fc94aac6394
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/450855
Reviewed-by: Robert Findley <rfindley@google.com>
frontend.Package now has the fields:
* Name: displays the package suffix as the name is main
* IsCommand: returns true if the package name is main.
* Title: displays Name, prefixed by "Command" or "Package"
These are generated inside createPackageHeader.
seriesPathForModule is deprecated in favor of module.SplitSemverPathVersion.
The content for helpers/_mod_header.tmpl and helpers/_modules_nav.tmpl
are moved to pages/details.tmpl. The package header now displays:
* "Command <name>" instead of "Package <name>" if IsCommand is true
* import "<path>" only if IsCommand is false
The links are versions.tmpl fixed to use the new v query param.
Fixes b/130320811
Change-Id: Ib4bb25ad54ff454e3b6b0a837f77a86dbfb60ccb
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/450575
Reviewed-by: Robert Findley <rfindley@google.com>
At least during the development phase, this will make it easier to
implement consistent styling across the site. If needed, we can later
either revert to constant values, or use a preprocessor.
Change-Id: I94d5987d69f2e251304c9c2907b0892c82c6ac76
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/450849
Reviewed-by: Julie Qiu <julieqiu@google.com>
frontend.Package now has the methods:
* Name() string: displays the package suffix as the name is main
* IsCommand() bool: returns true if the package name is main.
* Title() string: displays Name(), prefixed by "Command" or "Package"
seriesPathForModule is deprecated in favor of module.SplitSemverPathVersion.
content/static/html/helpers/_mod_header.tmpl now displays:
* Package name using the Name() method
* "Command <name>" instead of "Package <name>" if IsCommand() is true
* import "<path>" only if IsCommand() is false
The links are versions.tmpl fixed to use the new v query param.
Fixes b/130320811
Change-Id: I32160d80df6312292c78007a84ac98867e9e7bf8
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/445774
Reviewed-by: Robert Findley <rfindley@google.com>
All of the handlers named fetch*Page (now renamed to fetch*Details)
return a PackageHeader and other details. They now all return a *DetailsPage,
with their corresponding details embedded, instead of different types.
The search handler logic is also moved to its own file at
internal/frontend/search.go
Fixes b/130721889
Change-Id: I5eca8cdda8fa658ec935f06521da2c8fe179b8d1
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/450569
Reviewed-by: Robert Findley <rfindley@google.com>
The templates for the package details pages are refactored so that they
use a shared base layout.
Skeleton templates are also added for the imports and importers page.
Fixes b/130638124
Change-Id: I0e4072e91cd53ee61ff1a108592bcc2c4ed74235
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/450209
Reviewed-by: Robert Findley <rfindley@google.com>
The route /favicon.ico is added, which returns a gopher as a favicon.
This also fixes a bug where each request to /<import-path> resulted in
two requests, since /favicon.io matches the syntax for /<import-path>.
Fixes b/130659698
Change-Id: I5aac0bea89832abfb57e70b3dd67441289e75d6b
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/450210
Reviewed-by: Robert Findley <rfindley@google.com>
This CL changes our data model so that licenses are associated with
packages rather than module versions, and adds multiple license
detection. As a result, given following file layout
my.mod/LICENSE
my.mod/pkgfoo/COPYING
my.mod/pkgbar/LICENSE.md
both LICENSE and COPYING (but not LICENSE.md) will be associated with
the package my.mod/pkgfoo.
Additionally make some minimal UI changes to support the new data model,
though a proper implementation of the licenses tab is deferred to a
later CL.
Fixes b/130372424
Updates b/129371814
Updates b/129372226
Fixes b/129000846
Fixes b/129372204
Change-Id: Ife58498914fea75e4c58e7c713a8071887f87000
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/447910
Reviewed-by: Julie Qiu <julieqiu@google.com>
There's no godoc content yet, that will follow in future CLs.
Change the tab name from "docs" to just "doc". This is simpler and more
consistent with "godoc", etc. The current future plan is to make this
the default tab, so it won't have a name then. But it'll continue to be
"doc" while the page is in development.
Change-Id: If4ec229a6b7f49aee216f6ea845bcf3d1e2fa356
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/449355
Reviewed-by: Julie Qiu <julieqiu@google.com>
Additionally passes the template context to the nav template
on all pages with some other small updates.
Fixes b/130230126
Change-Id: I10114822382c6fc6c0a9f547749aa4faa433a851
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/449352
Reviewed-by: Julie Qiu <julieqiu@google.com>
+ Disable autocomplete, spellcheck, autocorrect, etc. in the search
input
+ Remove redundant "equal" template function in favor of the built-in
"eq"
+ Populate the search input with the current query
+ Show the query first in the title since tabs are typically not
wide enough to show everything
+ Redirect to the homepage if the q param is empty
+ Other very small cleanup changes
Change-Id: Ib9baa41c336088cb3e9555ddaf527545292bb118
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/449351
Reviewed-by: Julie Qiu <julieqiu@google.com>
The module page is added, which displays the directory and synopsis
of all packages in the module and the README.
This change includes the following additions:
* frontend.fetchModulePage: returns data needed to populate module.tmpl
* postgres.GetVersionForPackage: returns the version for a given
package_path and version, along with all of the packages for that
version.
Note: At the moment, both the overview page and the module page display
the README. Once a decision is made on where the README will be displayed,
these pages will be updated.
Fixes b/130112117
Fixes b/130111944
Change-Id: Ib240b1744cf66be72a63683804b521beaec62307
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/444468
Reviewed-by: Andrew Bonventre <andybons@google.com>
This CL implements a pattern similar to that used in
github.com/golang/gddo to implement an active tab selector for the nav.
Along the way, refactor a bit so that the frontend package is fully
responsible for templates.
Also replace the pattern of Make*HandlerFunc with handler methods.
Also fix a minor typo in all.bash that was causing misspell not to be
installed.
Updates b/124309095
Change-Id: I802ba69b91b81be13c6314140326fe8783608a0c
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/445973
Reviewed-by: Julie Qiu <julieqiu@google.com>
The links in versions.tmpl now route to the default tab instead of the
versions tabs.
An error with using the wrong type to format an arg for the
createPackageHeader error message is also fixed.
Change-Id: I5479895e13e04867aa00153e4276e0e6fc4aee43
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/444466
Reviewed-by: Robert Findley <rfindley@google.com>
The following endpoints now have handler funcs HTML/CSS:
- "/" directs the user to the home page which contains just a search bar.
This endpoint is handled by MakeDetailsHandlerFunc.
- "/search?q=<query>" directs the user to a list of search results for the
specified query. This endpint is handled by MakeSearchHandlerFunc.
Fixes b/125408009.
Change-Id: I2d919e35b8d5d8d5f76a6895d47f99897b4f32ff
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/444660
Reviewed-by: Julie Qiu <julieqiu@google.com>
fetchVersionsTabPage takes in a package path and a version and then returns
all of the data needed to display the packages that have the same series and
package suffix to make the versions tab content. The data is displayed in a
hierarchical list of major (i.e. "v1") then major and minor (i.e. "1.2") and
lastly the entirety of the version (i.e. "1.2.3" or "1.2.2-alpha.1").
verisons.tmpl is the template that displays all of the data in the
VersionsTabPage struct.
The routing was changed so that MakeFrontendHandlerFunc handles both
/<import path>@<version> which brings up the overview page and
/<import path>@<version>?tab=versions which brings up the versions
tab.
Fixes b/124308701
Change-Id: I92bd86d050ab6e7e669c07a750b325b3e026d052
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/443954
Reviewed-by: Julie Qiu <julieqiu@google.com>
The module overview page is being updated to be a package
overview page instead. The package header information
has been pulled out into its own struct because that information
will need to be used across various tabs and GetPackage was
updated to also return the module path and readme from the
database.
Fixes b/129020591
Change-Id: I09174c68077b3dc9c27da608b219cabf610639ee
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/441334
Reviewed-by: Julie Qiu <julieqiu@google.com>
READMEs written in markdown will be displayed as HTML.
internal.Version.ReadMe is changed from type string to []byte.
Minor changes are made to the Overview page to reflect changes for
package discovery.
Change-Id: I52e5ae091cf8069154415e02c7d88c7911f3a205
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/437553
Reviewed-by: Andrew Bonventre <andybons@google.com>
A bug introduced in commit cdaa29e is fixed. The bug was due to
Module.Name being renamed to Module.Path throughout the codebase, but
not in the templates inside content/.
Change-Id: Iadf2d85e0f33c2dfb57c2ff1f88e7914d9d6e5d7
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/437549
Reviewed-by: Channing Kimble-Brown <ckimblebrown@google.com>
There is now a frontend binary that accepts HTTP requests for:
GET /name?v=<version>
This route renders an overview page, which displays the name, version
publish date and readme for a specified module. The readme has not yet
been rendered into HTML.
Also note that the tabs are not fully functional or accessible and
these issues will be thoroughly addressed in a future CL.
Fixes b/124438879
Fixes b/124438779
Fixes b/124438684
Change-Id: I569dd3549bdea781183e2d7d29be375141fb5c3d
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/425454
Reviewed-by: Andrew Bonventre <andybons@google.com>