Drop all empty sections. Use airplane gopher image with a empty
message for packages without documentation.
Change-Id: I35e8d074b96b9b218799f4e4139ea3662a73eb62
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/257975
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Updates the copy in the back link on metadata pages.
Change-Id: I6e938e88f440f39261fdb3b6c240648d7988329d
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/257970
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
Adds jump to identifier element to the right sidebar.
Focusing on the element will open the jump to modal.
Change-Id: I0dc49d0d5fd93b7f1e4c85f0960cffe03fbb1df8
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/257661
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
Updates the class selector in jump.js to use a js specific class.
Classes used in js to select elements should have the js prefix.
Change-Id: I6481b29c14fa9da11ccdaa76842919283a25fe39
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/257657
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
Adds a navigation element to return to
the unit page from package data pages.
Change-Id: I704e60e37ae587365c3713b448260944c384f34b
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/257140
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
Adds package details data to unit struct and
render pages for versions, licenses, imports
and imported by tabs.
Change-Id: I38ce022bd7ea4a2df53310f3d2dd631fcca020ce
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/256879
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
Gather information about the current cgroup, which
is the implementation of a docker container.
Move all the memory functions to a separate file.
Reduce the display values to the ones that seem to be the most
meaningful.
Change-Id: Ifad13d96750356b6343a65d4945314029e092567
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/256519
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
Creates new files for unit fixed header ui
in preparation for future changes that diverge
from the existing fixed nav. Contains no code changes
outside of renamed css classes.
Change-Id: I450565deea86d88bb10c580f840d0cdd59c5c683
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/256540
Reviewed-by: Julie Qiu <julie@golang.org>
Trust: Jamal Carvalho <jamal@golang.org>
Adds css to unhide the doc index on the unit page and
an index link in the sidenav that is hidden on the
package details page.
Change-Id: Ieffe1368aaa1fc7cfcd4250359279b94d18a500b
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/256537
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
Adds the seperated sidenav and mobile nav to unit page.
Change-Id: Iae960e4ff103591d101b6300ccdf70a05d575fe5
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/256039
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
If the experiments come from a config file, they can't be dynamically
updated. So remove the update form on the worker home page.
Change-Id: I1a6dda10570aa7e08b0392af593dfcc6b44cfa91
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/256517
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Instead of using globals, put all loadshedding state
into a struct.
Also, generalize the names so they're not zip-specific.
This CL address Rob's comments on https://golang.org/cl/c/pkgsite/+/255759/6.
Change-Id: I2200ec45bfc9b2d3dc82aa62b4eb211849d9d9ca
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/255979
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Keep track of load-shedding statistics.
Display them on the worker home page, along
with various memory statistics that help
to understand the worker's memory usage.
Change-Id: I6582ffbd2be5c0f4c6c6d1750f489a77922b0ffb
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/255977
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
Update comment that points to an incorrect path to the correct one.
Change-Id: Ie7c923cec5afe9c195b71ff8a33c542e1d2816da
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/255962
Reviewed-by: Julie Qiu <julie@golang.org>
Trust: Julie Qiu <julie@golang.org>
Trust: Miguel Acero <acero@google.com>
Run-TryBot: Miguel Acero <acero@google.com>
Adds the initial unit page port of the fixed nav and restructures
the unit page template to match design requirements.
Change-Id: I49eac0bb3fe5809a5e755b8c7ee925dafdfeb2e0
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/255598
Trust: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
Creates the html template for the directories section of the unit page.
Change-Id: Ie52a432096d0b7eec9ff6a6b06581954cce92485
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/255041
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
Creates the html template for the documentation section of the unit page.
Change-Id: I2d87a1d577b785829441f9e3621a021c442fd01a
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/255022
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
Creates the html template for the new readme. Part of a series of
changes related to the new unit page.
Change-Id: Idbddcd00837aaa399d64aff4ef897d8dd75d0136
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/254842
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
In addition to providing a frontend fetch button, link to the manual
way to add a package.
Fixesgolang/go#41347
Change-Id: Iaf767e0cff773ddb9f099067d6bc11e2d6fd25e7
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/255097
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
This reverts commit dd6f8882c0.
Reason for revert: these classes are still being used
Change-Id: I996d02b1f4c318f4eb2e1b1710e3492314196eda
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/255024
Trust: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Previously, requests to pkg.go.dev/<path> were redirected to
pkg.go.dev/<path>?tab=doc.
The behavior is now the opposite: requests to pkg.go.dev/<path>?tab=doc
will redirect to pkg.go.dev/<path>. Requests to pkg.go.dev/<path>
will stay there.
Additionally, requests to pkg.go.dev/<path> will always show the
documentation tab, regardless of whether the package is redistributable.
Previously, users were shown the overview tab when a package is not
redistributable.
Fixesgolang/go#37351
Change-Id: Ic7ccbbb840cf04511d419f06eb7fb40ac57f68be
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/254745
Trust: Julie Qiu <julie@golang.org>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
This is partial implementation of the site redesign. Implements
the new header behind the "unit-page" feature.
Change-Id: I5fdd5c55bb9a9257311f9fd35bafbfab1ea7b7f0
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/253738
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Trust: Jamal Carvalho <jamal@golang.org>
This change adds the HTML and CSS changes for the subdirectories
template to include nested modules in the table with a modules badge.
This includes adding a --light-blue CSS variable to reflect the blue
background of the modules badge.
This change also deletes the _directories.tmpl helper template so that
iterating through the packages and nested modules in the HTML table is a
lot clearer.
before/after images: https://photos.app.goo.gl/2reDtNHxThVnDMiL9
Updates golang/go#38596
Change-Id: Id1dad1ba3a28881a203bf90afe1d5372ede2317c
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/254019
Reviewed-by: Julie Qiu <julie@golang.org>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
content/static/css is moved to devtools/cmd/css (pure code in motion).
Change-Id: I7b48bf017edffb1b4c3c571ed44bac7e09e37918
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/253608
Reviewed-by: Jamal Carvalho <jamal@golang.org>
This change replaces display: none; with display: flex; to enable
executable examples in in the documentation page. The HTML changes used
for this CSS change requires the executable-examples feature flag.
Updates golang/go#36865
Change-Id: I2cb62438663ecbfbccfe1f5b4b6b1e2dbe3e3916
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/253599
Reviewed-by: Julie Qiu <julie@golang.org>
Adds a handler to capture rejected promises and
report them to Google Analytics.
For golang/go#40958
Change-Id: Ic0a48d03acbe238bedb2b4eeac7dfb31a8e26d25
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/253597
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
Adds a handler to catch unhandled exceptions and report them to
Google Analytics.
Updates golang/go#40958
Change-Id: I9d9a501da4fea2e95a36809535b234a7d2537f02
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/251918
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Adds the web vitals script built from source to track web vitals metrics
with Google Tag Manager. This will give us more insight into how pkgsite
is performing in the wild and allow us to track changes in performance
before and after the redesign.
Updates golang/go#40958
Change-Id: Ieba237150b6a7056b5dee57911432678bb914b19
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/251537
Reviewed-by: Andrew Bonventre <andybons@golang.org>
VersionStats is a relatively costly query, and can cause it the worker
homepage to take a long time to load. This data is moved to the
/versions page instead to reduce latency on the main worker page.
Change-Id: I7273d8244185a2df94b101d2f48174102f2d23de
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/252357
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
With the inclusion of the latest major version function, this commit
changes current "latestversion" naming to "latestminorversion" in the
latestversion middleware to specify the difference between both
functions.
Updates golang/go#37765
Change-Id: I1c4d8edf6ac30431ef1278abaa334d96cd459258
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/251083
Reviewed-by: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
This change includes auto expand functionality for examples in
playground.js which is included with the executable-examples feature
flag. This includes:
When users click on an example href that links to an example, the
example will be auto expanded as such:
before example link: https://i.imgur.com/7fSa3E9.gif
after example link: https://i.imgur.com/4dQ4UWO.gif
When a user navigates to a pkg.go.dev url with an example hash (i.e:
?tab=doc#example-AtomicLevel), the example is auto exapnded.
before hash change: https://i.imgur.com/luKw5uo.gif
after hash change: https://i.imgur.com/mzUl33F.gif
Updates golang/go#37520
Change-Id: I6cba5ea979ed516bcdb753eee92eecec7839c2f4
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/250467
Reviewed-by: Julie Qiu <julie@golang.org>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
- Fix link to task queue: the URL now includes a location ID
- Remove reference to "etl"
Change-Id: Iaa95e1821afde929e93202dc667fd54b5fd27b54
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/250097
Reviewed-by: Julie Qiu <julie@golang.org>
Add the iframe that loads Google Tag Manager when JS is disabled.
It doesn't need a nonce.
Fixesgolang/go#40321.
Change-Id: I93871833c55aa41185cf5d1c2d5a759937fe79b7
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/245557
Reviewed-by: Andrew Bonventre <andybons@golang.org>
This change places the side navigation flush left and allows the
documentation to expand to fill the rest of the page. The
documentation container has a maximum width of 60rem (960px)
and is flush left in the main container when it can no longer
expand.
Also moves tab name strings into constants and documents the
fields on the basePage struct.
Updates golang/go#40612Fixesgolang/go#40557
Change-Id: Ia1be6ffb04d6c8819371ad12f56e133e2167d2fd
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/248857
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
The address bar URL will be updated to be the canonical url of package.
Canonical url includes the module version in address bar.
Fixesgolang/go#36807
Change-Id: I4a6f9737ff7e112ebf1d093b2eebe2af311fb0c6
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/239179
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
+ Add blank alt text to decorative images (including the main image)
+ Preserve the main image ratio when sizing using CSS
+ Reduce the intrinsic size of the main image since we were displaying
a much smaller version on the page
+ Adjust CSS for smaller viewports. Specifically, reduce top margins
at smaller viewports
+ Update CSS to be mobile by default, with media queries covering
wider viewports (to be in line with the other CSS across the site)
+ Update the background color of one of the footers to ensure we have
satisfactory contrast ratio as reported by Lighthouse
+ Use smart quotes around sample searches
+ Transform the label text for example searches using CSS instead
of directly typing in all caps
Updates golang/go#40504
Change-Id: I55d2823094d9968d00c6d48e64b10af5abd965f6
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/248185
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
We’ve received feedback that a fully-collapsed side nav prevents users
from being able to see package structure at a glance. Expand all
functions and types by default.
Also updates CSS for the side nav to not show a scroll bar if the
content doesn’t overflow.
Updates golang/go#40612Fixesgolang/go#40715
Change-Id: I22049e394b8705316e1ebe1cb9691c6317c61c5b
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/248183
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
The Worker homepage is split into two pages, since there were latency
issues with rendering the homepage. The content on the homepage is split
into the following:
"/": shows the worker homepage and high-level stats
"/versions": shows information about recent versions that were processed
The CSS and JS are moved into files in content/static/css/worker.css and
content/static/js/worker.js, respectively.
Change-Id: Iad713d7b3c98bf8f8ef4e5522c1d7e2377a766a6
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/247178
Reviewed-by: Jonathan Amsterdam <jba@google.com>
This change fixes an issue where tabs on details pages were not
properly disabled. In the case where a tab should be disabled,
the href tag is omitted from the link to take it out of the tab
order and the text is properly styled (grayed out with no hover
styling).
In the case of the overflow menu, an additional attribute
data-always-disabled is set for items that should remain disabled
regardless of whether they are shown in the tab list or not.
Fixesgolang/go#40571
Change-Id: I2faeb5413493d38737c2c7fadd6f0b9a224c5e7d
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/246760
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Add a check for HTML ids that could be valid Go identifiers or dotted
expressions. Such ids are reserved for rendered documentation, which
must use them so people can jump directly to the documentation for a
symbol by typing it as a fragment.
Change-Id: I646449906a845d17ce9d3740ad13d0e0ae514b8d
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/242498
Reviewed-by: Julie Qiu <julie@golang.org>
Now that the new homepage is launched removing the legacy homepage
code and references to the new-homepage experiment.
Change-Id: I94bd2c0cf5f1069c86343cc8972f91ded8600553
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/246440
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Since the search input is collapsed when not in focus on small
viewports, the text should not be shown.
Updates golang/go#40504
Change-Id: Ie4ea3e37a3c22ab7e9cb3198ec3c50108978547d
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/246580
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
This change updates the styled :target pseudo-element to restrict
it to details pages since a fixed header is not present on others.
Updates golang/go#40504
Change-Id: Ifc528eb2ef6a10526615f29002f27abdb698605e
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/246577
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
overflow: auto was fixing an issue relating to the overflow menu
in the fixed header on iOS, but was causing a bunch of other issues.
Notably, the scrollbar was underneath the fixed header and anchor
links did not behave as expected. Only set this on mobile Safari
(where these issues don’t present themselves; I’m sure others will
pop up but they’re at least restricted to mobile Safari).
Updates golang/go#40504Fixesgolang/go#40552Fixesgolang/go#40556
Change-Id: Ib7e108672d6897421faefa3a0b45cc6d7835bb15
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/246478
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
The searches listed on the homepage are example searches, not
necessarily the most popular. The caption is changed accordingly.
Change-Id: Ife71e2b8856b45526a5cd88c2214c0bd06dbf6af
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/246439
Reviewed-by: Jamal Carvalho <jamal@golang.org>
A section for package files containing links to the source code
files was added in CL 240007.
These will now be displayed on pkg.go.dev.
For golang/go#37863
Change-Id: I35a7e74f631aa1f8c0a9775b0d721e7646843291
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/246437
Reviewed-by: Jonathan Amsterdam <jba@google.com>
This change specifies more granular page types primarily for use
by the details pages to differentiate between the type of page
(module, package, etc.) and the name of the item being viewed.
This change also hides the type of the item in the fixed header
when it is not wide enough to show other information.
Change-Id: I1e25e75dbdbac01b5d54ea96224f3464cf9fa9f9
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/245487
Reviewed-by: Julie Qiu <julie@golang.org>
This change implements the latest designs for the site header,
adds a new fixed header to details pages, and updates to the
latest Closure Compiler Docker image tag to support an API used
by the new fixed header implementation (ResizeObserver).
The global header is no longer sticky, but on the details page
a hybrid header that shows a combination of the header content
and details tabs is displayed when the inline tab list goes out
of view.
Both the inline and fixed tab lists are responsive in that the
elements are pushed to an overflow container when they can no
longer fit on screen. A native <select> tag is used for this to
avoid implementing a popup menu (perhaps that can be done in a
future change).
The mechanism used to copy the current path to the clipboard has
also been updated to avoid hacks that didn’t play well with
screen readers. This method does not work on iOS, but a message
is displayed to the user in that case.
Fixesgolang/go#37110
Change-Id: I2b8b73d7e85c122992b106e9b89d7e207be9f099
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/245400
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Adds the ability to update existing experiment rollouts to the worker
page giving team members without db access the ability to rollback
experiments when performing on-call duty.
Change-Id: If35304cb4add31a44d5f54bd634dafa7a838e616
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/245900
Reviewed-by: Julie Qiu <julie@golang.org>
The text in fetch.tmpl is updated to provide clearer instructions.
Corresponding CSS is also adjusted for these text changes.
For golang/go#37002
Change-Id: Iae8b641eb2471172eb4465493fe83a4005bce6fc
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/245880
Run-TryBot: Julie Qiu <julie@golang.org>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
This reverts commit 369bd985a3.
Reason for revert: I forgot I marked CL 245646 as WIP because
I had to fix a test.
Change-Id: Ic2f7edf97733630f39d8a730829abcd2a306a0e6
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/245879
Reviewed-by: Jamal Carvalho <jamal@golang.org>
This change updates the side navigation component to be in line
with the product spec. Notably, scrolling will no longer affect
the currently selected navigation item.
A mobile view is also implemented.
This change also implements some changes needed to ensure the tree
remains accessible, with much of the keyboard navigation code
heavily influenced by Katie Hockman’s work.
Change-Id: Iab0fee771a2d335d4bcbca8ea01ea1ddb2d8b6bd
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/244546
Reviewed-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
fetchPlayUrl creates a request to golang.org/share during the fetch process which we do not want since it would make too many requests. We no longer need this code since we are generating the playUrl in the client side through a button in the frontend. The current implementation has tests for modules with examples and replaces the playlinks.
This commit also updates the tests to reflect the current playground implementation.
For golang/go#36865
Change-Id: Ie590538db2dcdb94d5aa2cdac9c72c3522b7a565
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/241259
Reviewed-by: Julie Qiu <julie@golang.org>
This CL reverts the change for a "HideButtons" field in a package
example struct. Instead of using a feature flag that we turn off and on
for displaying the new Playground buttons, we will just replace the
`display: none;` property back to `display: flex` in a future commit.
For golang/go#36865
Change-Id: Iee29c431c22dc263bda8a812dfc148fd62d77f84
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/244763
Reviewed-by: Miguel Acero <acero@google.com>
This CL adds the HTML changes for the new play button, and error message for the playground integration. Corresponding experiment/feature flag is included.
This change also adds example_test testdata for tests that verify executable and non executable examples.
For golang/go#36865
Change-Id: I3b0339f61c2e46881681cc271252499142785000
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/243222
Reviewed-by: Julie Qiu <julie@golang.org>
Previously, loadScript in base.tmpl was referring to gtmID.dataset.path,
which doesn't exist. It now refers to the correct data attribute
gtmID.dataset.gtmID.
Change-Id: I532b3f8a7f13ac3d1cd962ba45274bc730b77ac7
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/243899
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
Add a button to the worker status page that hits the /clear-cache
endpoint.
Change-Id: Ia7cbd5a4861dac2a275c81ef193d22f16a0049ae
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/243857
Reviewed-by: Julie Qiu <julie@golang.org>
There was an attempt to create a noscript tag, which only runs when JS
is disabled, using JS.
Remove it.
For golang/go#40321.
Change-Id: I99c02810ed7c299fb606259823ef9b764c525bb6
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/243858
Reviewed-by: Julie Qiu <julie@golang.org>
When there are no results, the search page now provides instructions on
how to use the frontend fetch feature when that experiment is on.
For golang/go#37002
Change-Id: I28939ca0a871defb42c43bbce3dae14b657c75c1
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/242922
Reviewed-by: Jonathan Amsterdam <jba@google.com>
After a badge is created when a user makes changes to the url
input field, the urls will dynamically update with JS enabled.
This change fixes the dynamically updated URLs.
Fixesgolang/go#40216
Change-Id: I6a484d3daf7e7e6b09b8a110339b505031b8fada
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/242737
Reviewed-by: Julie Qiu <julie@golang.org>
Examples are collapsed by default, and if one clicks on the header, they
are expanded.
However, that's not terribly obvious to a new user, since the cursor
when hovering over those collapsed example headers is the default for a
text element, the "text selection" cursor.
Fix that, keeping the list sorted.
Change-Id: Idfb7baae1dfc3ae3b6800d58e0d95de49eabf1b7
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/241017
Reviewed-by: Julie Qiu <julie@golang.org>
This change fixes the urls for the markdown snippet
on the badge generation tool. The image and documentation
urls were switched.
Fixesgolang/go#40216
Change-Id: I8bfa409019f00c79116875da1ee9755b2238250e
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/242641
Reviewed-by: Julie Qiu <julie@golang.org>
The canonical feedback link is changed to golang.org/s/pkgsite-feedback,
instead of golang.org/s/discovery-feedback, for consistency with the
project name. Both links will continue to work and redirect to the same
location.
Change-Id: I73fe7018c9d9935dcc584c4f90a82f6c07633787
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/242557
Reviewed-by: Jonathan Amsterdam <jba@google.com>
This change creates a badge generation tool page for package authors. A future change will add
documenation of this feature and a link to the about page.
Fixesgolang/go#36982
Change-Id: Ia64ba9db73ed92b853f1f955330caf93d996da91
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/241273
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Rather than displaying a truncated version on the versions tab,
display the full semantic version.
For golang/go#38542
Change-Id: I7bb6ee3e90f4ffe406cfea99996145f0d9e36f6b
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/242363
Reviewed-by: Jonathan Amsterdam <jba@google.com>
The Google Tag Manager ID is now set using an environment variable,
instead of hardcoding in our templates. This prevent users from sending
traffic data. to the GTM for pkg.go.dev by default, when they fork the
repository.
Change-Id: I5a1f985db20fd19378612593bde3f640b2b40d09
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/241742
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
The frontend now accepts POST requests, which is used for the /fetch
endpoint. The /fetch endpoint will return the standard 404 page when a
GET request is made. When a POST request is made, it will return a
plain text response.
serveDetails and serveSearch now check the request method to ensure
a GET request is being made.
Fixesgolang/go#39979.
Change-Id: Icc4d7f6ab7ebdbabdae43eab5a1c29a6446651bb
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/241378
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Begin using github.com/google/safehtml for frontend templates.
The safehtml module replaces html/template to provide more secure
template execution.
- Templates must come from constant strings or trusted sources.
This CL constructs TrustedSource values from the filesystem
paths that we use.
- Injected HTML must be constructed from known safe values. This CL
does this in some places. In others, notably the documentation, it
uses an escape hatch that we will close in a future CL.
- Identifiers must be constructed safely. We temporarily use an
escape hatch for license identifiers.
- There is a gotcha when using safehtml types: values that
resolve to the empty string do not evaluate to false in the
context of an `if`. We have to replace `.X` inside an `if`
with `.X.String` when `.X` is a `safehtml.HTML` or the like.
Still to be done:
- Remove all `legacyconversions.RiskilyXXX` calls (https://golang.org/issue/39960).
- Remove `template.HTML` from internal/fetch/dochtml (https://golang.org/issue/39959).
Change-Id: Icf4793d70cb2441ba30abd4e7394c4696be64a7b
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/240499
Reviewed-by: Julie Qiu <julie@golang.org>
This change ensures that the topmost element in view has its
corresponding navigation element selected. This is done via
two IntersectionObservers: one to handle the target element and
one to handle all the rest. This is due to the increased size of
the target element to ensure it displays properly under the
sticky header.
Various optimizations are in place to ensure that the
IntsersectionObserver callback does minimal querying of the DOM.
An up front cost of an initial indexing operation in the navigation
controller is a candidate for optimization in future work.
Change-Id: I339085e03efb4708e2739488a36cfab9cd8f1821
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/240689
Reviewed-by: Alexander Rakoczy <alex@golang.org>
Add a new section for package files containing links to the source code
files. These file links are displayed in at most 3 columns for easier
readability.
Fixesgolang/go#37863
Change-Id: Ia70b891a49fc3e27ece655bf895eb18e4c8b2373
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/240007
Reviewed-by: Julie Qiu <julie@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
The frontend fetch UI is updated with a styled button, and loading dots
to indicate that a fetch request is in progress.
The Fetch API is now used instead of AJAX to make requests.
Updates golang/go#36811
Updates golang/go#37002
Change-Id: Ia37113dd9976f8e147875371c099f7b2bfd4bd85
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/240459
Reviewed-by: Andrew Bonventre <andybons@golang.org>
This change allows a user to press the '/' key to focus the search
box, but only in the documentation view.
Fixesgolang/go#36805
Change-Id: I59af717438729e4411c5bc06fd614940475b3796
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/240297
Reviewed-by: Andrew Bonventre <andybons@golang.org>
This change updates the “sidenav” experimental navigation with the
following changes:
+ If a type has methods or functions associated with it, it is
collapsible
+ The gray “gutter” only present in the third level of nesting
+ The build footer properly spans both columns
+ The CSS is cleaned up a bit
Change-Id: I945ccb18c91107e3384c59ffa6ead93ba158db35
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/238021
Reviewed-by: Julie Qiu <julie@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
Change our content security policy (CSP) for scripts.
Instead of using a nonce, which lends itself poorly to caching, use
hashes. See https://csp.withgoogle.com/docs/faq.html, search for "CSP
hashes".
To make hashes work, the hash of every inline script must appear in
our Content-Security-Policy header.
Also, not all browsers support hashing with scripts loaded from files,
so we must dynamically load the files by using an inline script that
builds a script tag with a src attribute. (We need to do this anyway
for the Google Tag Manager script.) See the link above for a
description of the technique. It works because the CSP header mentions
'strict-dynamic', which trusts everything loaded from a trusted
script.
Ideally, we would both generate all these hashes automatically,
and check that they are all correct. This CL doesn't do that.
A followup CL will.
List of changes:
- Replace script tags with scr attributes with inline scripts that
load from the files.
- In internal/middleware/secureheaders.go, add the list of script
hashes to the CSP header.
- Remove all references to nonces.
Updates b/159711607.
Change-Id: Ia9b78ecd85e24619e758f2580a370778708b9e71
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/239897
Reviewed-by: Roberto Clapis <robclap8@gmail.com>
Reviewed-by: Julie Qiu <julie@golang.org>
Instead of generating the entire breadcrumb HTML in code, put the
static bits in details.tmpl and build the dynamic data in code.
This is not only easier to read and maintain, but it also removes
some uses of template.HTML, which we're trying to eliminate.
Change-Id: Ic2868b88d15496bbe4bccff6abb82481e7358b7d
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/240437
Reviewed-by: Julie Qiu <julie@golang.org>
Add a /poll endpoint that polls the index, but just writes
to module_version_states without enqueuing.
Add an /enqueue endpoint that is identical to /requeue. The name more
accurately reflects that it is for new modules as well as
reprocessing.
Update the worker status page to use the new endpoints.
We'll delete the old endpoints after deploying and changing the
scheduler jobs.
Updates b/158866584.
Change-Id: Id116bf9fd99fa55aaacd71bb4ca6b60770ca8812
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/239480
Reviewed-by: Julie Qiu <julie@golang.org>
Information about experiments and excluded prefixes are added to the
worker homepage.
Change-Id: I7bb7fd1eece434bd4da12e1af384b141c8a0ed41
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/239181
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Escape any strings that may come from outside the program and will
be rendered as HTML.
Also, fix some typos.
Also, put args to a cmp.Diff call in the right order.
Change-Id: I1fc6013e200326af8719b14c28a607fc7936e20a
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/239478
Reviewed-by: Julie Qiu <julie@golang.org>
This is CL finishes removing TODOs that are outdated, and
replacing internal issue links with GitHub issue links.
Fixesgolang/go#39621
Change-Id: I09e820b26864ce15404989f5c7683a71e6ed9660
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/238577
Reviewed-by: Jonathan Amsterdam <jba@google.com>
"DetailsHeader-pathInput" input, used for copying package path, was
showing up on larger displays than 1080p.
This commit fixes it by using display's width (vw) instead of rem
Fixesgolang/go#38162
Change-Id: Ide97e0308eb0cd56131507b933a7f3ed889ffc16
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/238477
Reviewed-by: Julie Qiu <julie@golang.org>
When a path page 404s, it will now render the notfound.tmpl page (once
the frontend-fetch feature flag is on), which provides a button for the
user to make a request to fetch the package.
Updates golang/go#36811
Updates golang/go#37002
Updates golang/go#37106
Change-Id: I17fedd018435e8d3e51e2a2a4a972d3cf673df56
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/753606
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
This change implements the beginnings of a sticky navigation
component on documentation pages.
It is only implemented for wide (desktop) viewports and has no
JavaScript to show selection while scrolling. That will come
in later changes as the hierarchy gets fleshed out.
This also slightly adjusts the amount of space given between
the site header and an element scrolled into view by an anchor.
Updates b/148095016
Change-Id: Id213f1dcb7a2600d5c64bf955c79e0bbc55581db
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/745552
Reviewed-by: Alexander Rakoczy <rakoczy@google.com>
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
+ Update the title suffix from go.dev to pkg.go.dev and some
incorrect usages
+ Add a meta description for SEO purposes
+ Lazy-load images in the footer (requires setting heights and
widths for both images because otherwise loading could cause
reflow
(see https://web.dev/native-lazy-loading/)
+ Use rel=noopener in places where it is not present or
where it was redundant with noreferrer. Both are not needed
(see https://web.dev/external-anchors-use-rel-noopener/)
Change-Id: I46767bd67e6db01c4d5921926381d5b32a89f018
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/752824
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
Reviewed-by: Alexander Rakoczy <rakoczy@google.com>
+ Load all JavaScript files at the end of the page so that DOM
parsing won’t be blocked by script execution.
+ Extract out Google Tag Manager script tag and place init logic in
a separate file instead of using an inscrutable, minified inline
script.
+ Add the JavaScript compilation script.
+ Update license headers to have a range so that multiple licenses
are not included in the minified source when only the date is
different.
+ Update the prettier config to avoid arrow parentheses unless they
are needed to match existing style.
Change-Id: I7331ee7fab04eb2ff45b5f59928b3e5817d35813
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/752822
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
Reviewed-by: Alexander Rakoczy <rakoczy@google.com>
This change removes Google Analytics in favor of just Google
Tag Manager since you can use the latter to send page view data
to the former.
Additionally, adds Google Tag Manager’s debugging view CSS domain
to the content security policy.
Only renders GTM resources when not in development mode.
Change-Id: I54149c378f7226e24d836c730a8fed641d9bcb54
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/751128
Reviewed-by: Julie Qiu <julieqiu@google.com>
During doc fetch, share each example to the Go playground,
then add a link to that shared example alongside the code.
Fixesgolang/go#36865
Change-Id: Iaff51f99dd0d6d4fb71463304ee7cb747f037cd7
We are no longer using go/feedback. Feedback is being
received on the GitHub issue tracker instead.
Change-Id: I3944c013cce00f808f39e161bdc05d383e150381
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/700759
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Alexander Rakoczy <rakoczy@google.com>
The header and footer content are updated.
Header:
* Solutions → Why Go
* Learn → Getting Started
* Explore → Discover Packages
* golang.org is moved to the footer
Footer, the following was removed:
- Connect: golang-weekly and r/golang
- Under About: Issue Tracker
- Share Feedback
Change-Id: Ia4714f58dec7ae3bac72c805c777b74d970bcc3c
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/695100
Reviewed-by: Jonathan Amsterdam <jba@google.com>
This changes the logic in the GodocURL middleware to use the placeholder
technique used by nonce and latest to avoid caching issues interacting
badly with the display of the “Back to godoc.org” button.
The button is shown (via CSS rules) if it has a non-empty href attribute.
Updates b/147492306
Change-Id: I978e9765df2fbf887ee89f4a30ed48a955434f0c
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/704879
Reviewed-by: Julie Qiu <julieqiu@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
This reverts commit 0cac64d3f37dcbaa5df38ca33120b7669d381691.
Reason for revert: decided to keep all content on go.dev/about in weekly meeting
Change-Id: I901bb8951858c0af8b08da29d68a2ace044d0181
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/702040
Reviewed-by: Jonathan Amsterdam <jba@google.com>
With the option to redirect automatically from godoc.org, there needs
to be a mechanism to return to godoc.org and turn it off if necessary.
Reliably knowing that a request is coming from a godoc.org redirect
is complicated as you can’t set cross-origin cookies and 3XX redirects
don’t alter the Referer header.
In order to reliably know that a request is coming to pkg.go.dev from
godoc.org, we look for a utm_source GET parameter set to 'godoc'.
If we see this, we set a temporary cookie and redirect to the
pkg.go.dev URL with the utm_source param stripped (so that it doesn’t
remain in all our URLs coming from godoc.org). If this temporary cookie
is seen, it is marked to be deleted and the correct value for the
“Back to godoc.org” link is set. The existence of this value will be
used to determine whether to show the button in the UI.
Updates b/147492306
Change-Id: I9c2e6b891ba4f23b7490c087d32583cd7f0f6ad8
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/696565
Reviewed-by: Julie Qiu <julieqiu@google.com>
On the license-policy page, remove links to licenses
that aren't on the OSI website.
If we later find links to the other licenses, it shouldn't
be hard to add them.
Fixesgolang/go#37872.
Change-Id: Icadd9128b18c4d2b408e9726d5fec7dc9c9fe4ea
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/692259
Reviewed-by: Julie Qiu <julieqiu@google.com>
The version tree builder was already overcomplicated (I wrote it), and
then our HTML got simpler, making this complication even more
unnecessary.
Also, even though it was sorting by semver it was actually implicitly
relying on the incoming sorting, because we weren't sorting by module
path.
Rip out this complication, and replace it with a relatively
straightforward loop. This assumes that versions are already sorted, but
they are.
Tested in unit tests, and using compare_pages.sh. For the latter, I
updated the diff command to ignore whitespace changes.
Fixes b/150141995
Change-Id: I52df51e1d52bf1f9efce1d5a4ec2c291efd2f317
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/683293
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Some of our licenses are no longer OSI-approved.
Change-Id: I79644cb4488d5c76416ef9f1808ae9524aa5e440
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/673874
Reviewed-by: Julie Qiu <julieqiu@google.com>
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Display some information from the config on the status
page.
Change-Id: I847ec7f350ca18e8dc3f9847342b5d91b7b961f6
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/672581
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
The GitHub issue tracker is now used to collect feedback instead of the
Feedback API.
Any code related to the Feedback API will be removed in future CLs.
Fixes b/150142572
Change-Id: I188f93418ebe78cdf8339fffa3ce8a12b2c80303
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/674931
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
To be in accordance with golang.org/wiki/CSSStyleGuide
While not noted in the CSS style guide, using the ID attribute should
only be used when a class won’t suffice (linking to a place in the page,
label “for” attribute values, etc.). Otherwise it ends up on the window
object, polluting the global namespace.
Change-Id: Ibc4954d72455b89cc284d5baa87711c9333b83fb
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/672138
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
Previously we relied on short-circuited search to jump directly to the
package page on auto-completion, but that doesn't work for standard
library packages such as fmt (perhaps it should...).
In any case, we know the package we want to navigate to -- just go
there.
Change-Id: I7518b8a2cb1b26d2d74f894f8ae2c6c5c50896f4
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/658563
Reviewed-by: Julie Qiu <julieqiu@google.com>
It's unnecessary and stutters when using experiment flags, e.g.
pkg.go.dev?experiment=experiment-autocomplete
vs
pkg.go.dev?experiment=autocomplete
Change-Id: I019727fb6bc11acb7ffc52b40a3072889f55571b
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/657885
Reviewed-by: Julie Qiu <julieqiu@google.com>
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
We have enough status codes for ETL fetches that it's hard
to understand the table on the status page. Add a description
for each code.
Change-Id: I45c225dd032a9da80d24891a3eafe523db3c8ee5
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/623924
Reviewed-by: Julie Qiu <julieqiu@google.com>
- Mention that we use licensecheck.
- Ask package users to contact package authors, rather than us.
Change-Id: I4334136d486e2acec128c35c6fc9cc1112fe6c0e
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/620961
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
A fake experiment handle is used to guard the autocomplete feature
behind a flag. It defaults to false (experiment off).
Change-Id: Ib9f26c00a6e0374277c27c605aa8c9809464623f
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/619084
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
Reviewed-by: Alexander Rakoczy <rakoczy@google.com>
Previously, we were relying on GetPackage returning an error in order
for directories not to show the latest badge. Aside from making an
unnecessary database call, there are some cases where we're serving a
directory for a path, but that path is a valid package at another
version, so GetPackage(..., "latest") actually succeeds. In fact, it's
possible that the latest valid package version is actually *earlier*
than the directory version we're currently serving, which is especially
confusing for the user.
In order to be consistent about showing the badge only on module and
package pages, a new field 'PageType' is introduced on Details to expose
exactly which details handler is serving the page. This is then used in
the latestVersion function.
The new PageType field holds strictly more information than the existing
Namespace field, so Namespace was removed and all uses were updated to
use PageType.
Additionally, the order of 'packagePath' and 'modulePath' in the
latestVersion function was reversed. In all other argument lists
packagePath precedes modulePath (typically pkgPath, modulePath,
version), so this was changed purely for consistency.
Fixes b/143814014
Change-Id: I3d9fd40c44f0d3f02c38755950c3988699a00891
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/616656
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
Auto-completion is added to the search dialog, both on the home page and
in the navbar. This is achieved using autoComplete.js for autocompletion
behavior, but with heavy modification to make the component accessible.
Additionally, some DOM changes are made to support the visual styling of
the auto-completion dialog:
+ The SearchForm and Header-searchForm components are made
position:absolute.
+ Relatively positioned container components are added to control the
positioning and spacing of the search forms.
The header search form is made to have a white background, as the blue
background looked incorrect when the completion list overlaid the white
of the body content.
Fixes b/143370178
Change-Id: Ic0b527643c8c5aa6e04101082e7e630325486802
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/604267
Reviewed-by: Alexander Rakoczy <rakoczy@google.com>
When rendering a details page, the Header field can be either a Module,
Directory, or Package, and in our templates we rely on fields having
consistent meaning.
Renaming Module.Path to Module.ModulePath makes this simpler: we can
just refer to $header.ModulePath regardless of which namespace we're in.
Updates b/143814014
Change-Id: I0e3542244467af70a4ea45b43836eef8a0a52a24
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/613504
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
Add 'F' (shift-f) as an alternative to 'f' for opening
the jump-to-identifier dialog.
The intent is to give people who use screen readers
an alternative way to bring up the dialog, in case
'f' doesn't work with their screen reader.
Updates b/145609006.
Change-Id: Ia0562f62097fda9fa22d6ba1f542e55b04c22c91
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/611025
Reviewed-by: Julie Qiu <julieqiu@google.com>
Link to our license policy whenever we say we can't
display something due to license restrictions.
For overview.tmpl, I had to inline the empty-content template because
I couldn't figure out how to pass HTML that didn't get escaped.
Change-Id: I803f9624892fa32d94c4c662c33f769c9f8e0693
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/611024
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
This reverts commit be7963c72f1b33c28a4af1e7d3ddf4493f7508cc.
Reason for revert: user feedback that we should use doc as default tab
Change-Id: I1b5655ac5b7dffd8a756a553f9c73e6d46c16f63
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/607442
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Andrew Bonventre <andybons@google.com>
Distinguish the "page title," which is put in the <title> element
and thus appears in tabs, from the title that appears at the top
of a details page.
The title in a tab should start with the resource name (e.g. "io package")
so it's readable when many tabs are open.
The page title should read more naturally (e.g. "package io").
Fixes b/145124550.
Change-Id: I29d5a92f0f51c6b2f20691dd383695dacbdd1956
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/606800
Reviewed-by: Julie Qiu <julieqiu@google.com>
This reverts commit a13a2bf99ae64c9cce01a5caaf441a9b8121afd6.
Reason for revert: tests are failing for TestServer
Change-Id: Icb3c23c158e7ea77190883e4441160535e257975
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/606421
Reviewed-by: Julie Qiu <julieqiu@google.com>
Distinguish the "page title," which is put in the <title> element
and thus appears in tabs, from the title that appears at the top
of a details page.
The title in a tab should start with the resource name (e.g. "io package")
so it's readable when many tabs are open.
The page title should read more naturally (e.g. "package io").
Fixes b/145124550.
Change-Id: Iaffedd3b7c7f9944fb13c528e4229b2a29481b25
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/606104
Reviewed-by: Julie Qiu <julieqiu@google.com>
It is unused.
Change-Id: Iddf5caa5be1f724f448c801cff10601548b68924
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/604412
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Put the link in the latest-version badge in the form
mod@version/suffix.
The best way to do this was to move the latest-badge-link
logic from the template to the server itself.
Also, rename the Suffix field of Package to PathAfterDirectory
to more accurately describe it.
Fixes b/144681389.
Change-Id: I16a78224ee6fa53b60954716338347a298dbef21
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/604414
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Avoid the use of the naked term "version" in the details
header. Instead, we have:
- DisplayVersion: the version formatted for human readability.
- LinkVersion: the version to use in links to the discovery site.
Also, use the link version in nav tab links:
Fixes b/144873325.
And improve test coverage.
Change-Id: Ida80867b6bd70a32c18f45b21b0b361b9e8e904f
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/603789
Reviewed-by: Robert Findley <rfindley@google.com>
We were using the formatted version as one input to our latest-version
check, and comparing it with the linkable version. That fails with
pseudoversions.
Use the linkable version in both cases.
Fixes b/144860268.
Change-Id: I0f4c82dbec42863378e5d649bbbe5ebe99de8b53
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/602829
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Add data-test-id attributes to the license and module parts
of the info label, so we can more reliably extract them
for tests.
This practice is suggested by the TotT "Select DOM Elements by User-Facing Properties"
Change-Id: Ie4bf1cac8c3e88b728c2561256d210ab58819968
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/600820
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Use server-side string replacement to determine what to show for the
latest-version badge, rather than client-side code that calls back to
the server.
Using the same technique as for script nonces, we embed placeholders
in the HTML, and a middleware layer replaces them with the correct
values. The HTML with placeholders is indefinitely cacheable,
yet we still serve a page whose body can change dynamically.
The replaced information is kept to a minimum: the latest version for
use in the "go to latest" link, and a CSS class. Both alternatives for
the badge are in the HTML, and the CSS class determines which one is
displayed.
An additional challenge we did not face with nonces: how to extract
information embedded on the page that we must use to determine the
placeholder values. In this case, that is the version being served,
the module path, and in the case of a package, the package path. We
could find that information by parsing the HTML, but that is overkill,
and slow.
I first tried embedding the information in an HTML comment and
used a regexp to extract it, but surprisingly, HTML comments are
stripped out by html/template, and there is no easy workaround. So I
added the information to the HTML as data-XXX attributes, but I still
extract them by regexp for speed. Since this data appears before any
user-provided text (like documentation or a README), and we find the
first match, there is no way for users to spoof it. But it is fragile,
as the comment in details.tmpl points out.
Now that the latest-version badge is done on the server, we can
add checks for it to TestServer, which I've done.
Fixes b/144098197.
Change-Id: I3a126f1cac48cd35c0317d47035bf227483cdbf1
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/599082
Reviewed-by: Alexander Rakoczy <rakoczy@google.com>
- Make the highlight color match the sticky header. This also
makes it pass the AA requirements for contrast, which the previous
color did not.
- Add some padding to items so the highlight is not at the left edge
of the item text.
- Make the text input bigger.
Fixes b/144358048.
Change-Id: Id484afbf66f0973cf7e39a67efd5cee0a6e933f4
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/599083
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Alexander Rakoczy <rakoczy@google.com>
- Fix the position of the latest-version badge.
- Fix the height of the DetailsHeader-title div.
- Inline the copy icon.
Also, rewrote the breadcrumb test to use
the new html-scraping stuff, to make it less brittle.
Tested:
- Using "Slow 3G" mode in Chrome.
- I made Heschi look at it and he said it's fine.
Change-Id: I3706a6e59e70c7094a2c7fd1d210dabf01a51cb3
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/597501
Reviewed-by: Alexander Rakoczy <rakoczy@google.com>
GOOS and GOARCH are now only displayed for packages where GOOS != linux.
The copy is changed to Documentation was rendered with GOOS={{.GOOS}}
and GOARCH={{.GOARCH}}.
Fixes b/144172566
Change-Id: I28c06227a5a86f23a564a5014105588e7d454fb0
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/597563
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Also cleans up some unused CSS.
Fixes b/144213173
Change-Id: Iecb50b9e9fd6aff05530fe890d51f81a271e04ab
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/596740
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Alexander Rakoczy <rakoczy@google.com>
These are now being handled by the go.dev static app.
Change-Id: I3831465bc8d0e1518bdb9bb29be5f7192efbc7d4
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/596644
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Coverts header to be sticky. position: sticky is supported on major
browsers since 2017, including mobile devices.
Updates b/143764322
Change-Id: I984775345d85fa597ae3a69715c8d014b0616cf4
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/595590
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
Sorts color variables alphabetically. Adds a new color for the footer
background.
Removes some top-margin for serach on the homepage.
Updates b/143764322
Change-Id: I998d970edaced0989f647263c21a7b063c7e96e0
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/595475
Reviewed-by: Julie Qiu <julieqiu@google.com>
When a user visits a URL that does not have the tab query param
specified, they will now be redirected to the doc tab. Previously, the
user was shown the doc tab without being redirected.
Additionally, always show the repository URL and module page link on the
overview tab, regardless of the license. When a package/module is not
redistributable, the user is now shown the overview tab.
Updates b/143953613
Change-Id: I655cca597c6f31accf4f8f2806a442a6588cb692
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/594571
Reviewed-by: Jonathan Amsterdam <jba@google.com>
This replaces the site header with the header from godev.
Adds a nearly duplicate search form template to allow styling the header
search form differently.
Updates b/143764322
Change-Id: Ib8c8b11dc7b6ae86d257a4038ff84d1e4b1eb432
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/593072
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
This CL fixes padding and font-sizes on the search results page.
Change-Id: I9ac4333fb08d613c851661ed83796a9418e55777
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/593068
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Because of cache timings, it's possible for unversioned details pages to
point to a different version than the /latest-version endpoint. This
could result in the poor experience where the user clicks on the 'Go to
latest' badge, and is taken to a page that still contains a 'Go to
latest' badge.
This CL changes the 'Go to latest' badge to explicitly link to the
version returned by the /latest-version endpoint, in order to avoid the
situation described above. It's still possible for the caches to go out
of sync, but I think this makes it less visible.
Fixes b/143761646
Change-Id: If07d94fe5939fc59e076aa58d26a3c5c1c098ffb
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/593056
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
- Don't log an error if it's NotFound: that happens all the time with
directories.
- Don't return an error on error, just the empty string.
- Explictly check for the empty string in the javascript and do nothing.
Change-Id: I05a42eef96949c53a81981635c60d7254707bfae
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/592559
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Alexander Rakoczy <rakoczy@google.com>
- Make the search input background white even in dark mode.
- Remove the horizontal scrollbar on the nav unless the screen is small.
Fixes b/143611569.
Fixes b/143613221.
Change-Id: I770b2a7fd9594d3d1152e9d8bcc8558d36affdc4
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/592089
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Alexander Rakoczy <rakoczy@google.com>
Change the visual appearance of our image buttons when the
cursor hovers over them, and clicks on them.
We have two buttons that are images: the search magnifying glass,
and the copy-path button.
- Give them both the "ImageButton" class.
- Add css rules for .ImageButton that change the background
based on the state.
- Round the bounding box of the button to look nice.
Fixes b/143613876.
Change-Id: If90d603f12b84ef1c13a3690910ff91e59b4f80a
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/589895
Reviewed-by: Alexander Rakoczy <rakoczy@google.com>
If the overview tab is displaying a package, include a link
to the directory containing the package source code.
Fixes b/141744510.
Change-Id: I1526ea1477899ce2b7f7b94739fb29879099eb35
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/590630
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
Previously, the /latest-version endpoint returned the latest module
version. This wasn't always correct for packages: the latest version
of a package might not be the latest version of its module (since it
might have been removed from the module in later versions).
Example: github.com/docker/docker is both a package and a module.
- The package's latest version is v0.9.1.
- The module's latest version is v1.13.1.
Visiting /github.com/docker/docker takes you to v0.9.1. As of this CL,
the badge says "Latest". Previously it said "Go to latest," but the
link took you back to the same page.
Fixes b/143833787.
Change-Id: I9600ac7e1db22ae0c4168e310a633f757dae9cd6
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/590622
Reviewed-by: Robert Findley <rfindley@google.com>
Fixes a couple whitespace issues and missing semicolons in details.tmpl,
and simplfies a conditional.
Corrects usage of == to ===
Change-Id: I7e2168ee66dde3a090c9a5f6254d6b3d0d212d19
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/589959
Reviewed-by: Julie Qiu <julieqiu@google.com>
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
In some browsers (e.g. Firefox), clicking the copy
button would cause the page to jump. This was because the hidden
input element gained focus, and firefox wants to jump to the focus.
Releasing focus (AFTER the copy, as I learned the hard way) fixed it.
Fixes b/143613723.
Change-Id: I47c9ae322514d381824f9d787f463243483396b6
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/589179
Reviewed-by: Alexander Rakoczy <rakoczy@google.com>
(Based on a suggestion of Alex)
Instead of encoding the latest-version into the page, have it
fetch that dynamically. That means many pages are cachable for a long
time (essentially forever).
- Replace the latest-badge logic in the template with an empty div.
- Some javascript on the page queries the server for whether the module
version is the latest. Currently this request hits the DB; future
CLs can improve on that.
- The js then updates the div with the appropriate content.
Some details:
- The original idea of using <img src="/queryToServer"> doesn't quite work, because
we need the result to be a link only when it's not the latest version.
We could have the Latest badge be a link to the same page, but that seems ugly.
- Per Alex's suggestion, we pass info to the js function via data-XXX attributes
on the element, to avoid templating javascript.
Testing:
I tested this manually in the four cases:
- stdlib package
- stdlib module
- other package
- other module
Change-Id: I8353f29804643149ce98e24c0ef6863da67289a5
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/589184
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
The styles for the static pages (license-policy, search-help, TOS, etc.)
are updated to be consistent with styles for the search results and
details pages.
Updates b/143299004
Change-Id: I32d82f3f20a07a9679360448c03fefea29833f68
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/584255
Reviewed-by: Alexander Rakoczy <rakoczy@google.com>
Support the jump-to-identifier dialog on Safari by adding
Chrome's dialog polyfill (drop-in replacement) for the <dialog>
element.
- I started a thirdparty directory under content/static
and copied the css and js for the polyfill there, along with
its license.
- This CL always loads the css and js for the polyfill, regardless
of browser. This could be fixed with clever javascript if
necessary.
Fixes b/143456593.
Change-Id: Iffb35d44f90755df1a989550c388b4f0e03200ce
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/586896
Reviewed-by: Alexander Rakoczy <rakoczy@google.com>
The following changes are made to the documentation HTML / CSS:
* Increase color contrast in code blocks
* <ul> tags now only contain <li> elements
* Removes TODOs and any notes that are not bugs
Fixes b/143614144
Fixes b/143613728
Fixes b/143612970
Change-Id: Ifdd178bccd519a4c62ed380d3dcc7b1fa3487d8f
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/588173
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
In order to get the package count, we need to make an extra query when
rendering the Overview tab. This information doesn't seem to be useful
enough to account given the additional latency.
Fixes b/143607035
Change-Id: I41bb41499aedacb8794f9d02e86311edcda6cbbf
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/588351
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Some browsers have background and padding set in their user-agent
stylesheets. Ensure it looks and behaves like the other elements in
the footer (along with underline on hover).
Also fixes some formatting bugs via prettier auto-format.
Fixes b/143641315
Change-Id: I4747ab7867d1ff10be327258ea7cd29eeaabbdcf
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/588353
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Display the currently active list item specially, and
allow the user to change it with up and down arrows.
Fixes b/143454398.
Change-Id: I5ba04d79ec984b479ab3fd60eea8ef30ed2cfda0
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/585840
Reviewed-by: Alexander Rakoczy <rakoczy@google.com>
Scroll the jump dialog to the top of the list whenever it is opened or
updated.
Matches gddo dialog behavior.
Change-Id: I739ba425ab07737b6f09ec8433cdece61436c568
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/585838
Reviewed-by: Alexander Rakoczy <rakoczy@google.com>
Add styles to improve the look of the the jump-to-identifier dialog.
Also some DOM changes.
Fixes b/143456340.
Change-Id: Id8e4b15bc36ea174aa0578c3b4f9ee1cbb48a412
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/585836
Reviewed-by: Alexander Rakoczy <rakoczy@google.com>
On the documentation page, add a dialog box that lets the user jump to
an identifier's documentation.
Based on the similar feature in gddo, but reimplemented
to avoid jquery and bootstrap.
Still to be done:
- (b/143456340) Add style to css
- (b/143454398) Highlight the active element in the box and support up and down arrow keys
- (b/143456593) Add a polyfill for browsers that don't support <dialog>
Change-Id: Ic89c5bdb7e758f8b55d1b8368a4bc5acd899af8d
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/584342
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Alexander Rakoczy <rakoczy@google.com>
Make the copy-import-path button into a proper button. This makes it
part of the tab order, correctly highlights it when it has focus, and
makes the special keypress event handlers unnecessary.
The only way I could get the icon to display in medium turquoise was
to set the fill directly on the svg element (and remove overriding
fill attributes on sub-elements).
Change-Id: I3c16a4f99a6b7d41ad8df096de02680090c1a16d
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/584335
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Alexander Rakoczy <rakoczy@google.com>
The directory view is implemented using the same template as the package
view, so that there is visual consistency when users are navigating
through directories. It supports the tabs:
* Subdirectories (default)
* Overview
* Licenses
Other tabs that are normally present on the packages view displayed but
disabled and grayed out.
The concept of an internal.Directory has been changed from a directory
that contains multiple internal.VersionedPackages (possibly from
different modules), to a directory that contains multiple
internal.Package, with the same internal.VersionInfo (i.e. packages from
the same module version).
Changes were made to the frontend code for generating the subdirectories tab:
* fetchPackageDirectoryDetails and fetchModuleDirectoryDetails (used to
create the subdirectories tab) have been merged into
fetchDirectoryDetails
* Logic in fetchPackagesInDirectory (used to get directories for the
directory view) has been merged into serveDirectoryPage
* DirectoryDetails was deprecated and Directory is used instead
postgres.GetDirectory is changed to:
* Use packages.tsv_parent_directories to filter data
* Accept module_path as a param
Fixes b/140191811
Updates b/142392929
Updates b/142673556
Change-Id: I0dc76ece392e5438c0d8e496bc1a318716b8506e
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/574229
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Update CSS for the documentation view based on mocks in
go/go-discovery-gallery. This included updates to font-size, padding,
link color, and adding a border below types and functions.
Updates b/135755729
Change-Id: I0fbd74bae30cfb0d2994543eb3edd82e1322b01a
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/579451
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Alexander Rakoczy <rakoczy@google.com>
Add a "copy" icon next to our breadcrumb path that lets
the user copy the package or module path to the clipboard.
This supports:
- Pasting a package path into a Go import declaration;
- Pasting a module path into a go.mod file.
The appearance is based on the mock
Complicated by the case where the module is the standard library itself;
then there's nothing to copy, so we don't show the icon.
Change-Id: I3827424a105ea4fa9e941d3e56b5424451b19f23
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/579359
Reviewed-by: Alexander Rakoczy <rakoczy@google.com>
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
The empty gopher page is displayed if the documentation or versions tabs
are empty.
Fixes b/140266266
Change-Id: Ic4758e2758157f7fae465b7bc3bb8ef55eb8b8a7
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/576215
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
As of CL 574222 (commit 67c0c405440e36d5b557d7d5994f919f7718b2bf),
collapsible examples are implemented via the <details> HTML element,
and don't need frontend JavaScript code to collapse and expand.
Fixes b/138500956
Change-Id: I47179ec770af240740e82cab51898f5afeabb26a
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/574223
Reviewed-by: Julie Qiu <julieqiu@google.com>
Disable link for the tab a user is currently viewing.
Fixes b/142828953
Change-Id: I832eacc9d905e08706958533eb4f22188673beb4
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/575635
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
This change updates the documentation rendering to address some
high priority issues, including:
• documentation for commands incorrectly showed top-level identifiers
• example permanent-links were using an unfinished URL design
• documentation notes (BUGs, TODOs, etc.) weren't implemented
• there wasn't a limit on documentation HTML size
• large string literals and slices weren't trimmed
It also addresses minor issues such as a rogue '}' character in the
variables heading anchor ID and missing margins around headers.
The collapsible examples have been implemented using the <details> HTML
element, instead of a <div> that required custom JavaScript.
As part of this change, more care was paid to improving accessibility
and following best practices, such as having better keyboard navigation
that makes it possible to select anchor links, and using semantic HTML
<ul> tags to implement lists, rather than <dl>s with custom CSS for
indentation.
Various constants that define limits used when processing modules
during the ETL process have been gathered in a new limit.go file.
The dzip package has become very small, and its only remaining
helper was made unexported and moved into the etl package.
Fixes b/137941664
Fixes b/137941785
Fixes b/142251857
Fixes b/139555662
Fixes b/137939861
Updates b/137941999
Updates b/137567588
Updates b/138500956
Change-Id: Ib6f4a2da540f0cf2b3df75c64add22da0a619dbb
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/574222
Reviewed-by: Robert Findley <rfindley@google.com>
at:
The following changes are made:
* The module and source code information are now displayed
* Border added around the README
* The module page now has a breadcrumb
Fixes b/139529503
Change-Id: I0733529176488eb4dbd9659c996701c3848a1f44
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/572678
Reviewed-by: Alexander Rakoczy <rakoczy@google.com>
The source code link is removed from the package/module header. It
will be moved to the Overview (currently README) tab in a later CL.
Updates b/139529503
Change-Id: I6084d72dafae37371b0b09ab329ffbfd28d3ce07
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/571343
Reviewed-by: Jonathan Amsterdam <jba@google.com>
The package and module headers are updated based on updated beta designs
at: go/go-discovery-gallery
A badge is added to the package header to indicate if it is the latest
version.
This adds an additional query when the version is not known to be the
latest version. Performance optimizations for handling this will be made
in a future CL.
Fixes b/139411794
Change-Id: Id1ff4e2a3688bf29e0c0447240dc03f3034fce7b
The change described in
was not what ended up getting committed. This is the intended change.
Change-Id: If368f15a6a69f57e4cefd1bcda22803d800366da
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/569278
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
The previous rule
.Documentation-source
was being overridden by
.Documentation h3 a
so I changed it to
.Documentation h3 a.Documentation-source
to make it more specific.
Change-Id: Ibe2b8d8f18a4e2bfc65244f651f9d5c612958731
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/567958
Reviewed-by: Julie Qiu <julieqiu@google.com>
Reviewed-by: Alexander Rakoczy <rakoczy@google.com>
Requests for packages/modules in standard library are now routed through
handleStdLib and use Go tags instead of semver.
Fixes b/142058801
Updates b/140191811
Change-Id: I452123a38e7f2263ee290e51411e95541f9052af
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/567738
Reviewed-by: Jonathan Amsterdam <jba@google.com>
An initial version of the url design described at go/go-discovery-urls
is implemented. The discovery site now accepts requests for packages at:
/<module-path>[@<version/<suffix>]
Requests for stdlib packages are accepted at:
/<pkgPath>@<version>
Requests for the stdlib is accept at:
/std
Additional work is needed for using Go tags instead of semantic versions
for stdlib packages, to redirect request to <pkg-path>@<version> to
<module-path>@<version>.
Updates b/140191811
Updates b/136484298
Change-Id: I42ba52177f2760a65399e361cddf302560ffa772
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/565996
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
The previous popularSearcher(cutoff) search methods relied on partial
indexes to pre-filter search results to popular documents, and then
used the boundaries of our scoring function to determine whether such
partial searches were complete. This was a lot faster for popular search
terms, but still left something to be desired:
+ The partial index thresholds (8 importers and 50 importers) required
quite a lot of analysis to calibrate.
+ Postgres was not able to use the search document GIN index in the
search, so these popular searches were essentially scanning all
documents in their popular index. This resulted in a lot of extra
scanning when search results could have been satisfied by an even
smaller search.
In order to address these problems, we move away from declarative
queries (and playing games with the query planner), by using the
popular_search stored function to scan packages in descending order of
popularity, and exit as soon as possible.
Along the way, a few other trivial search methods are added to
optionally compare against the (now default) FastSearch.
An off-by-one error is fixed in hyperloglog estimation: we were
operating on the number of leading zeros, rather than the index of first
non-zero bit.
Updates b/141182438
Change-Id: Ib4c6bf16a456e603082d9c9e5c6d430e88879dbb
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/564976
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
It is helpful to be able to at least temporarily test searches in the
frontend using different search methods. This CL adds a hidden query
param that allows executing the search using different query types.
Additionally, the pagination summary is updated to handle the case where
results counts are approximate.
Updates b/141182438
Change-Id: Ie56b2a7a5d47639025afb354042d048be52368cd
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/560267
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
After etl parses files, use use source.Info to generate links from the
ast.Nodes.
Add that function to the template that dochtml uses, and call it
on types and function names.
Updates b/140431331.
Change-Id: I2494a1b20e137b11d4cc35b52e53effc93fcded1
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/561218
Reviewed-by: Julie Qiu <julieqiu@google.com>
Currently, the package details URL will contain the original search
query if it was arrived at from the search page. This is now removed, since
users want to be able to copy and paste the URL without first having to
make it shorter.
Fixes b/140329357
Change-Id: I8ae78d82667c8f721e487799af1f25e69fae45cf
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/561352
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Additionally, class="Header" when used in details.tmpl is renamed to
class="DetailsHeader", to avoid confusion when class="Header" is used in
base.tmpl.
Fixes b/141545555
Change-Id: I1680335a3458ac5be0ebe40ec7add580c1157067
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/561735
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
The documentation HTML now uses <ul> instead of <dl> tags, and <li>
instead of <dd>.
This will not be fixed for a given package until it has been
reprocessed.
Fixes b/139369560
Change-Id: Ie020bf7c372e8b4111e3246140dcfc4386edafca
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/556706
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Don't display the word "Versions" on the versions tab when all
versions belong to a single module. It's redundant with the tab
title.
Leave everything as is for the multi-module case. This still leaves
nested h2 tags, but that doesn't break anything, and it's rare.
Fixes b/139371418.
Change-Id: Ie69c2337323446069e989688aba9ba8e0b1a1990
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/556726
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
The H1 header of these packages now says "Package NAME" or "Directory PATH".
Above that, the full path is shown with links to each prefix.
Also fixed spacing with css.
Fixes b/140750550.
Change-Id: Idb997b72059e2df48f64920cc94b8aca6cd2e480
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/555196
Reviewed-by: Julie Qiu <julieqiu@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Update the 'No license files detected' message to not mention files, as
(1) license files can contain multiple licenses, and (2) in some cases
candidate license files are found, but licenses are not detected.
Fixes b/141250924
Change-Id: Idc224ed6e262e7340ba325cfbd1aa2f9942f27d7
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/553910
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
The directory page and subdirectories / packages tabs are updated based
on mocks from aotsu@.
Fixes b/140485028
Change-Id: I657cd0eb1f08104d8ba0f9747d6ed8670eb32190
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/552837
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
For modules hosted on github.com, bitbucket.org and golang.org, the URL
path is displayed. For other modules the zip filepath is displayed.
Fixes b/140933339
Fixes b/137207297
Change-Id: I536051c638d6fe05696d91aae0a40f065d563918
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/553297
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Format times on the status page more readably.
For now, localize to New York, since we're all here.
There is no easy way to get the browser's timezone, but if we figure
that out we can display local times better.
Change-Id: I4816e041900920b025e1be186768c2cb56744b6e
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/551715
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
The module tab on the packages view is replaced with a subdirectories
tab, which only contains packages in that package path directory.
fetchModuleDetails is replaced with fetchPackageDirectoryDetails and
fetchModuleDirectoryDetails, which handle the subdirectories tab in the
packages view and packages tab in the modules view respectively.
The title for the module page is now constructed using the moduleTitle
func. All instances of "std" are replaced with "Standard library".
Fixes b/139371789
Updates b/140485028
Change-Id: Ie0ce25263c0ec6f3979445a51487eef37e5c8914
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/543274
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>