Граф коммитов

577 Коммитов

Автор SHA1 Сообщение Дата
Jamal Carvalho ed2b6b22c3 content/static: drop empty details page sections with exceptions
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>
2020-09-29 14:31:10 +00:00
Jamal Carvalho 58f2885207 content/static: metadata page link update
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>
2020-09-29 14:08:54 +00:00
Jamal Carvalho 9c1943b7d7 content/static: jump to indentifier sidebar element
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>
2020-09-28 21:50:45 +00:00
Jamal Carvalho db069347ea content/static: add js-documentation class selector for jump.js
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>
2020-09-25 20:28:08 +00:00
Jamal Carvalho 0d66fc4d5e content/static: module and package page title badges
Adds badges to unit page for packages and modules.
A unit that contains both a module and package
will show both badges.

https://drive.google.com/file/d/1aXb3xGUw6fHDegdw5F_sK_Xb2N_qYjkp/view

Change-Id: I5c72694970633e84da68d6a248eb9052d6d83a17
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/257200
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
2020-09-24 20:47:01 +00:00
Jamal Carvalho e15472716d content,internal: remove safehtml.HTML pointers from unitpage struct
Removes pointers from unit page struct
replacing nil values with empty HTML values.

Change-Id: I1ada25a8ee59b41f67ba4399a37fed3301050b94
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/257197
Trust: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
2020-09-24 20:41:26 +00:00
Jamal Carvalho 484f6716e3 content/static: add back button to package data pages
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>
2020-09-24 20:39:31 +00:00
Jamal Carvalho d9ef819191 content/static: responsive layout fixes
Adds minor fixes for responsive layout to
follow updated rules in styleguide.

Change-Id: I6f2cb51a2350473199adc6b4974635c3d3b16ae5
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/257139
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
2020-09-24 20:17:07 +00:00
Julie Qiu 89b49a7abd content/static/html/pages: remove experiment executable-examples
Change-Id: I3e81ceab33e45f43db44ff65515f9aeb4e39a5a9
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/257199
Trust: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
2020-09-24 19:03:13 +00:00
Jamal Carvalho 61f3346b76 content,internal: add metadata tab content to unit page
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>
2020-09-24 15:39:47 +00:00
Jonathan Amsterdam 1c8f229061 internal/worker: add cgroup memory statistics
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>
2020-09-23 21:25:02 +00:00
Jamal Carvalho 8314b73291 content/static: add unit metadata to fixed nav
Replaces tab navigation in fixed nav with unit metadata links.

Change-Id: Ib21bd7a1b473ac9af0f49220dd77db79c5d1960d
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/256819
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>
2020-09-23 20:22:58 +00:00
Jamal Carvalho 9ed9db4fd2 content,internal: fixed nav a11y updates
Uses aria-hidden to hide the duplicated content
and prevents tab navigation into child anchors.

Change-Id: I56f75bfa68e9c136254d26f28ab65e4a3ba87a9f
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/256539
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>
2020-09-23 20:22:38 +00:00
Jamal Carvalho d5eb0625a0 content,internal: separate and rename fixed header ui code
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>
2020-09-23 20:22:27 +00:00
Jamal Carvalho 20eb00166b content,internal: add the doc index to the unit page
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>
2020-09-23 20:22:13 +00:00
Jamal Carvalho d2aeefc581 content/static: update responsive panel rules
Updates breakpoints for responsive layout and
centers content with max width on large screens.

Change-Id: I981bdd944047fef13d3805b74fdcedc9e96a4212
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/256305
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>
2020-09-23 20:21:57 +00:00
Jamal Carvalho 01500ba3f8 content,internal: add sidenav and mobile nav
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>
2020-09-23 20:21:45 +00:00
Jonathan Amsterdam 235d95262a internal/worker: remove experiment update form if from config
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>
2020-09-22 15:16:18 +00:00
Jonathan Amsterdam bff646bd52 internal/fetch: make a loadshedding struct
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>
2020-09-21 20:32:09 +00:00
Jonathan Amsterdam 45eb81e124 internal/worker: compute and display stats
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>
2020-09-18 20:10:28 +00:00
Miguel Acero d24daa283b content/static/css: fix incorrect path in comments
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>
2020-09-18 16:17:59 +00:00
Jamal Carvalho 1836aa16cd internal,content: add fixed header and clean up unit page template
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>
2020-09-17 19:29:29 +00:00
Jamal Carvalho b7a364fa53 content/static: implements boilerplate for sidenav layout on unit page
Initial scaffolding of double sidebar layout on the unit page.

Change-Id: I99e56956e9a05899bd6308624185f2be259bc87e
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/255361
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>
2020-09-17 13:57:20 +00:00
Jamal Carvalho 80d96cd5ca content/static: html template and styles for directories section
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>
2020-09-16 19:39:45 +00:00
Jamal Carvalho fb6d3f0014 content/static: html template and styles for docs section
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>
2020-09-16 19:31:55 +00:00
Jamal Carvalho 65ae8f792a content/static: html template and styles for readme section
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>
2020-09-16 19:31:22 +00:00
Jamal Carvalho ddc09e6a12 content/static: update "Search Help" button on homepage with a11y fixes
This change adds various a11y fixes and reconfigures the search help button.

Updates golang/go#40624

Change-Id: Ifaad23aca326a8d88b55d0385eed16d32ddea85c
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/254878
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
2020-09-16 16:46:50 +00:00
Jonathan Amsterdam c4480d418e content/static/html/pages: link to package-adding instructions on 404
In addition to providing a frontend fetch button, link to the manual
way to add a package.

Fixes golang/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>
2020-09-16 14:14:02 +00:00
Julie Qiu a594912ed2 Revert "content/static/css: delete unused Documentation classes"
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>
2020-09-15 15:15:46 +00:00
Julie Qiu 6a12a42408 internal/frontend: remove tab=doc query param
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.

Fixes golang/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>
2020-09-15 13:38:12 +00:00
Julie Qiu dd6f8882c0 content/static/css: delete unused Documentation classes
These classes are no longer used and are deleted:

- Documentation-nav
- Documentation-toc
- Documentation-tocItem

Change-Id: I9cc35ffe252c9bd0953e3ffcac90302f03b82977
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/254749
Trust: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
2020-09-15 01:54:50 +00:00
Jamal Carvalho 300c31bfb8 content,internal: implement redesigned header for unit page
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>
2020-09-14 20:41:21 +00:00
Miguel Acero 4be2e9ddc1 content/static: add HTML/CSS changes for nested modules in the subdirectories page
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>
2020-09-11 16:19:25 +00:00
Jonathan Amsterdam e1846b8bb9 content/static/js: prettify analytics.js
prettier seems to want this file to change.

Change-Id: Iccbe119050ebe9cb8d92252892f22581125c199c
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/254237
Reviewed-by: Julie Qiu <julie@golang.org>
2020-09-11 15:29:52 +00:00
Julie Qiu 2589034d31 content: update example searches on homepage
Change-Id: Id6ec4515a3139a581cc36151a0bb65907f9f0e64
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/254177
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-09-10 22:48:39 +00:00
Julie Qiu a5c6be2ad4 devtools/cmd/css: moved from content/static/css
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>
2020-09-09 21:13:57 +00:00
Miguel Acero c8f2699f91 content/static/css: remove commented line to enable executable examples
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>
2020-09-09 19:54:11 +00:00
Jamal Carvalho 7ccd23c20a content/static: add rejected promise tracking
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>
2020-09-08 17:26:58 +00:00
Jamal Carvalho f4642ae1ac content/static,internal/middleware: add unhandled exception tracking
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>
2020-09-02 19:14:58 +00:00
Jamal Carvalho 97f55b5d3f content,internal,third_party: adds web vitals script for metrics tracking
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>
2020-09-02 19:08:33 +00:00
Julie Qiu ecdf6e4d07 content,internal/worker: move VersionStates to /versions page
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>
2020-09-02 16:55:18 +00:00
Jamal Carvalho 3b43f7523b content/static: fixes search input focus and supports quickfind in Firefox
Fixes search input focus key on detail pages and removes the behavior
in Firefox to support quickfind.

Updates golang/go#41093

Change-Id: Iae0c8fdde0df592e7f9eeac37183b27231bb441c
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/252117
Reviewed-by: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
2020-09-01 18:07:41 +00:00
Miguel Acero a611316e91 internal: add GetLatestMajorVersion banner in documentation HTML
This change creates the HTML and CSS changes necessary to show the
latest major version banner.

before (desktop): https://i.imgur.com/YaVw9c8.png
after (desktop): https://i.imgur.com/3XVQPlT.png
before (mobile): https://i.imgur.com/gj54j1o.png
after (mobile): https://i.imgur.com/Xl68EjN.png

Fixes golang/go#37765

Change-Id: I60d6818385c986f9d1ab4dcc8ff663da0e9fe3a3
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/251817
Reviewed-by: Julie Qiu <julie@golang.org>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
2020-09-01 17:45:24 +00:00
Miguel Acero 2a24ee1d3c internal/middleware: change latestversion to latestminorversion
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>
2020-08-28 13:57:26 +00:00
Miguel Acero 4d82bb1a3f content/static: expand examples automatically when clicked or navigated
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>
2020-08-25 20:55:57 +00:00
Jonathan Amsterdam 41dc6b274d internal/worker: improve home page
- 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>
2020-08-25 18:43:50 +00:00
Rahul Wadhwani 99719cd130 x/pkgsite: fix the width of Subdirectories table
The subdirectories table is overflowing for package
https://pkg.go.dev//k8s.io/kubernetes hence adding a maximum width
to the table.

Fixes golang/go#40946

Change-Id: I6166292fe0d3dfefb634491660f8408addaa3735
GitHub-Last-Rev: ea918f1e1e
GitHub-Pull-Request: golang/pkgsite#4
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/249839
Reviewed-by: Julie Qiu <julie@golang.org>
2020-08-22 00:56:00 +00:00
Jonathan Amsterdam 605d451104 content/static/html: restore GTM iframe
Add the iframe that loads Google Tag Manager when JS is disabled.
It doesn't need a nonce.

Fixes golang/go#40321.

Change-Id: I93871833c55aa41185cf5d1c2d5a759937fe79b7
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/245557
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2020-08-21 19:57:46 +00:00
Andrew Bonventre 47151e4cbe content/static,internal: allow fluid width for documentation
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#40612
Fixes golang/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>
2020-08-20 20:13:29 +00:00
Kush Patel 6440758d8a content/static,internal/frontend,internal/middleware: add 'y' keyboard shortcut to canonicalise URL with version
The address bar URL will be updated to be the canonical url of package.
Canonical url includes the module version in address bar.

Fixes golang/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>
2020-08-20 19:08:49 +00:00
smasher164 b0853e144b content/static/css: add word-break to filenames in documentation
In the "Package Files" section, filenames longer than the
column-limit overflow onto the next column.
See https://i.imgur.com/5SrSWaZ.png.

This change fixes this behavior by adding a word-break to
the files list.
See https://i.imgur.com/rw8anB9.png.

Fixes golang/go#40889.

Change-Id: I716066644436576063779f33e56e15f7eb2f3f4f
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/249122
Reviewed-by: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
2020-08-19 21:28:11 +00:00
Andrew Bonventre a1b9579989 content/static: fix various issues with homepage
+ 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>
2020-08-13 20:17:53 +00:00
Andrew Bonventre 658a7a46d3 content/static,internal/fetch/dochtml: expand all nav elements by default
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#40612
Fixes golang/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>
2020-08-13 20:17:46 +00:00
Miguel Acero 350fd05e0b content/static: fix css margins for playground examples
The changes here will not appear until the display: none; experiment
flag is removed

If a playground example doesn't have an output and is accompanied by
another example right below, currently there is no margin that separates
the dropdown div and code input div above it. This change adds a
margin-top to the dropdown.

i.e: Non-executable example with no output
https://pkg.go.dev/github.com/prometheus/client_golang/prometheus?tab=doc#example-Timer
before: https://i.imgur.com/SpCNKQj.png
after:  https://i.imgur.com/iIr6ThE.png

If a playground example doesn't have an output, currently there is no
margin that separates the button and the code input div above it. This
change adds a margin-top on the button container.

i.e: Executable example with no output.
https://pkg.go.dev/cloud.google.com/go?tab=doc#example-package-ApplicationDefaultCredentials
before: https://i.imgur.com/yFMkKrt.png
after:  https://i.imgur.com/UkmqiHJ.png

The reason the margin-top in the button container doesn't add onto the
margin-bottom in an example with an output is because of margin
collapsing that occurs between margin top and bottom properties. This is
also true for the dropdown margin-top when the div above the dropdown is
not the code input div.

i.e: Executable example with output the before and after will remain the
same https://i.imgur.com/hSzjvBn.png

i.e: Dropdown with paragraph element above the before and after will
remain the same https://i.imgur.com/niyfG7B.png

For golang/go#36865

Change-Id: I5a271cb6cb899fcec6cbd22920e885c69c20b52b
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/247401
Reviewed-by: Julie Qiu <julie@golang.org>
2020-08-07 19:50:27 +00:00
Julie Qiu 7b8f96c078 content,internal/worker: create versions page
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>
2020-08-07 13:14:19 +00:00
Andrew Bonventre 7acb4c684a content/static: properly disable details tabs
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.

Fixes golang/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>
2020-08-05 16:17:55 +00:00
Jonathan Amsterdam 2053b32a64 internal/frontend, content/static: check for insecure HTML ids
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>
2020-08-04 21:32:41 +00:00
Jamal Carvalho f4260bbd5d content/static,internal/experiment: remove deprecated homepage code
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>
2020-08-04 16:47:06 +00:00
Andrew Bonventre f177a8276c content/static/css: hide search text in header on small viewports
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>
2020-08-04 14:35:38 +00:00
Andrew Bonventre 25a3780d03 content/static/css: preserve casing of version in fixed header
Updates golang/go#40504

Change-Id: I74d1b5130f141e9db033ebec2a9ef309cd2e0229
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/246578
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
2020-08-04 14:35:34 +00:00
Andrew Bonventre f77b40c9ad content/static/css: update target padding and restrict to details pages
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>
2020-08-04 14:35:28 +00:00
Andrew Bonventre d1e3806277 content/static/css: constrain fixed position hack to mobile Safari
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#40504
Fixes golang/go#40552
Fixes golang/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>
2020-08-04 00:32:57 +00:00
Julie Qiu 2e0825b49f internal/fetch/dochtml: add Package Files to sidenav
Change-Id: I0d7bbc470adf4974c5ede6d97ce8d2f52aa2a68c
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/246438
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2020-08-03 17:23:50 +00:00
Julie Qiu 31bd5da443 content: change "POPULAR SEARCHES" to "EXAMPLE SEARCHES"
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>
2020-08-03 14:24:29 +00:00
Julie Qiu 6770e0a2cd content: display documentation source files
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>
2020-08-03 13:59:44 +00:00
Andrew Bonventre 02388aa5df content/static,internal/frontend: add more granular page types
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>
2020-07-30 19:32:45 +00:00
Andrew Bonventre 98472f3dd8 content/static,devtools,internal: update header to spec
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.

Fixes golang/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>
2020-07-30 19:31:21 +00:00
Jamal Carvalho 2c7f09d857 content/static,internal/worker: add experiment rollout update form to worker page
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>
2020-07-30 19:31:17 +00:00
Miguel Acero 11298021f9 content/static,internal: add JS functionality to the new embedded playground
This CL implements a "play button" for each example in a given package
that redirects to play.golang.org.

This code is based on https://golang.org/lib/godoc/playground.js, it was
modified to remove the dependence on jquery and bootstrap, as well as
removing DOM creation to prevent jittering of the website.

Example behavior: https://i.imgur.com/NcGO3kx.gif

For golang/go#36865

Change-Id: Ic17ebd038561ef4dabbd139f6fa2e378968b01a1
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/243699
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2020-07-30 16:59:53 +00:00
Julie Qiu 9884140fac content,internal: update text in fetch.tmpl
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>
2020-07-30 16:25:23 +00:00
Jamal Carvalho f6dd23f904 content/static: remove + symbol from popular search terms link
Fixes a typo in the popular search term links.

Change-Id: Idce1750fafd8387dab2dd9084e15d8b9b087468a
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/245881
Reviewed-by: Julie Qiu <julie@golang.org>
2020-07-30 15:04:18 +00:00
Julie Qiu aa8a734702 Revert "content: update text in fetch.tmpl for 404s"
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>
2020-07-30 14:59:04 +00:00
Julie Qiu 369bd985a3 content: update text in fetch.tmpl for 404s
For golang/go#36811
For golang/go#37002

Change-Id: I1853ecf2798e717589bb81ad0d749a3f814b55ec
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/245646
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-07-30 14:32:41 +00:00
Julie Qiu 43e9c6235d content: center text in h3.FetchMessage
For golang/go#36811
For golang/go#37002

Change-Id: I3438a8d72617f3c7af88310469b4799a5539616e
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/245401
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
2020-07-29 14:05:17 +00:00
Julie Qiu 76af5fd4f8 content: alphabetize classes with prefix Fetch
Class names with the prefix "Fetch" are alphabetized relative
to each other. No changes are made to the CSS.

For golang/go#36811
For golang/go#37002

Change-Id: I662829fd50f1e1634cc891ba50c4bf1d4f9ac0bd
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/245437
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-07-29 11:56:47 +00:00
Andrew Bonventre 2de09db4af internal/fetch/dochtml,content/static: update sidenav to be in spec
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>
2020-07-27 18:35:54 +00:00
Miguel Acero 71e1881af9 internal/fetch: remove fetchPlayUrl implementation
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>
2020-07-27 15:23:56 +00:00
Miguel Acero 843c57d22a internal/fetch: revert HideButtons field experiment flag
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>
2020-07-25 00:14:29 +00:00
Miguel Acero e13513c87d content/static: add CSS styling to the new embedded playground
This CL adds the CSS styling for the new playground examples. It is
currently under a feature flag, so the CL won't make any visible changes to the
website yet.

Without error: https://i.imgur.com/OK4V0sU.png
With error: https://i.imgur.com/sfqhZub.png

For golang/go#36865

Change-Id: I8d0e2aeeb4076bb863d36887bfe8cb0d791a1f25
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/243638
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2020-07-24 07:16:08 +00:00
Jamal Carvalho 46a7831d90 content/static, internal/experiment, internal/frontend: update pkg.go.dev homepage
We are updating the homepage. This change
implements the new homepage behind the "new-homepage" experiment.

https://drive.google.com/file/d/1UPRElFaBV_YRRyGH84xBJw0uMSyK2G1n
https://drive.google.com/file/d/1mt88Ljvh8WFiaabecfaRFZQUfR4sHr_i

Change-Id: I149c5ee2a08b943c69f848729f78b9dd9ccdb9fc
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/243702
Reviewed-by: Julie Qiu <julie@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2020-07-23 19:25:39 +00:00
Miguel Acero b973c9e73d internal/fetch: modify the documentation HTML/CSS to a play button for executable examples
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>
2020-07-22 14:05:23 +00:00
Julie Qiu 817a08e341 content: fix bug referring to gtmID.dataset.path
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>
2020-07-21 17:46:19 +00:00
Jonathan Amsterdam 9ecc8fe356 content/static/html/worker: add Clear Cache button
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>
2020-07-21 12:38:30 +00:00
Jonathan Amsterdam ab821ecd42 content/static/html: remove bad JS
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>
2020-07-21 12:35:55 +00:00
Julie Qiu e28af9a0fe content: update search page for no results
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>
2020-07-20 19:29:04 +00:00
Jamal Carvalho 66d7d7c20c content/static: fix badge dynamic update
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.

Fixes golang/go#40216

Change-Id: I6a484d3daf7e7e6b09b8a110339b505031b8fada
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/242737
Reviewed-by: Julie Qiu <julie@golang.org>
2020-07-15 14:59:53 +00:00
Daniel Martí 130a4e343b content: clarify that "expand example" is clickable
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>
2020-07-14 21:43:33 +00:00
Jamal Carvalho 2f4e4a8df3 content,internal: fix markdown badge snippet
This change fixes the urls for the markdown snippet
on the badge generation tool. The image and documentation
urls were switched.

Fixes golang/go#40216

Change-Id: I8bfa409019f00c79116875da1ee9755b2238250e
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/242641
Reviewed-by: Julie Qiu <julie@golang.org>
2020-07-14 20:51:22 +00:00
Julie Qiu 47787dc2f0 content,README.md: use golang.org/s/pkgsite-feedback
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>
2020-07-14 19:48:04 +00:00
Jamal Carvalho d37103e11f content,internal: add badge generation for package authors
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.

Fixes golang/go#36982

Change-Id: Ia64ba9db73ed92b853f1f955330caf93d996da91
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/241273
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2020-07-14 18:56:54 +00:00
Julie Qiu ca40ea1770 internal/frontend: display full semantic version on versions tab
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>
2020-07-14 13:18:05 +00:00
Julie Qiu a31de3da16 all: set GoogleTagManagerID using environment variable
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>
2020-07-13 18:29:39 +00:00
Julie Qiu 71c954f70e content,internal: allow POST requests for fetch endpoint
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.

Fixes golang/go#39979.

Change-Id: Icc4d7f6ab7ebdbabdae43eab5a1c29a6446651bb
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/241378
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-07-08 13:28:41 +00:00
Jonathan Amsterdam 073d8fe5ef internal/frontend: use safehtml
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>
2020-07-07 17:14:32 +00:00
Andrew Bonventre 683c518140 content/static: select side navigation element when scrolling
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>
2020-07-07 16:33:03 +00:00
Julie Qiu 01357d1483 content: remove duplicate class .Documentation-tocItem--types
Change-Id: Ifc547bb506b2bf876a1913807d1046b70cd33eb9
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/241160
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-07-06 21:54:58 +00:00
Julie Qiu 29325727ba content: set Documentation-tocItem--funcsAndTypes to display:none
Fixes golang/go#40078

Change-Id: Ie6a563a225747d744ac092d62f7cff234b2ec13f
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/241157
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-07-06 20:28:32 +00:00
Jonathan Amsterdam b770da1d30 content/static/js: prettify fetch.js
Change-Id: Ic66c947110edbc63b93a0fb913de0fa142b2f736
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/241058
Reviewed-by: Julie Qiu <julie@golang.org>
2020-07-06 14:10:47 +00:00
shaquilleq 20e1c1312d internal/fetch: add explicit package file links to doc tab
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.

Fixes golang/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>
2020-07-01 20:41:41 +00:00
Julie Qiu 993436f73a content: update frontend fetch UI
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>
2020-07-01 17:52:00 +00:00
Kush Patel 87b93cfbfe content/static: add keyboard shortcut '/' to focus search box
This change allows a user to press the '/' key to focus the search
box, but only in the documentation view.

Fixes golang/go#36805

Change-Id: I59af717438729e4411c5bc06fd614940475b3796
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/240297
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2020-06-30 16:33:31 +00:00
Andrew Bonventre 417bf46857 content/static: update doc sidenav with collapsible funcs and types
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>
2020-06-30 13:50:27 +00:00
Jonathan Amsterdam 1940919ec2 many: change CSP to use hashes instead of nonces
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>
2020-06-29 21:25:26 +00:00
Jonathan Amsterdam a269441684 internal/frontend: move breadcrumb HTML to template
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>
2020-06-29 21:25:13 +00:00
Jonathan Amsterdam 08e8e660a6 internal/worker: add /poll and /enqueue endpoints.
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>
2020-06-26 21:13:17 +00:00
Julie Qiu 461688d812 content,internal: add experiments and excluded to worker homepage
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>
2020-06-26 15:00:56 +00:00
Jonathan Amsterdam 8acea93dd9 internal/{source,frontend}: escape HTML
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>
2020-06-23 13:36:35 +00:00
Julie Qiu e648379573 all: clean up issue links
This is CL finishes removing TODOs that are outdated, and
replacing internal issue links with GitHub issue links.

Fixes golang/go#39621

Change-Id: I09e820b26864ce15404989f5c7683a71e6ed9660
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/238577
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-06-23 12:51:41 +00:00
nyaascii 80f9cec73c content/static/css: hide pathInput element on larger displays
"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

Fixes golang/go#38162

Change-Id: Ide97e0308eb0cd56131507b933a7f3ed889ffc16
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/238477
Reviewed-by: Julie Qiu <julie@golang.org>
2020-06-17 15:58:02 +00:00
Julie Qiu 2b3b7078c6 content: add banner in support of our black community
Change-Id: I2bd5c3632a1fdbf0779e8181417950c7f9408146
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/767238
Reviewed-by: Russ Cox <rsc@google.com>
Reviewed-by: Andrew Bonventre <andybons@google.com>
2020-06-11 17:59:32 -04:00
Julie Qiu 9c2d7b5fc8 content: update files from running prettier
`./all.bash prettier` was run and the following files were updated.

Change-Id: I312c4371c96ba58f92482fec501fd796bf315857
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/766269
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-06-09 22:56:38 +00:00
Julie Qiu 348a802a41 content: update license policy to use GitHub for feedback
Change-Id: I1da6cee0141c2a6ae76739c74972ace06bcc9588
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/766406
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-06-09 22:56:20 +00:00
Julie Qiu ccee67b0a2 content,internal/frontend: make a request to /fetch on path 404
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>
2020-06-04 15:56:15 +00:00
Andrew Bonventre bd43c94d8d all: add initial side navigation UI experiment
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>
2020-06-02 16:31:09 +00:00
Andrew Bonventre 5ab9d78a3e all: clean up some issues noticed by Lighthouse
+ 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>
2020-05-26 17:21:35 +00:00
Andrew Bonventre dec9db9ed0 content/static: rearrange loading order of scripts plus cleanup
+ 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>
2020-05-26 17:03:21 +00:00
Andrew Bonventre dc3877069a internal/frontend, content/static/html: use GTM only
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>
2020-05-20 22:27:41 +00:00
Sameer Ajmani 90861f00a2 internal/fetch: add playground links for examples
During doc fetch, share each example to the Go playground,
then add a link to that shared example alongside the code.

Fixes golang/go#36865

Change-Id: I541774af5f29e0bdbb9bd812496cc6e4fd39fcb6
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/715584
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-04-13 21:35:11 +00:00
Sameer Ajmani 99709dcc27 Revert "internal/fetch: add playground links for examples"
This reverts commit 4a41701448.

Reason for revert: accidental merge

Change-Id: Id8ef4321a260a0f75587ddad320865aaf1539772
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/715580
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-04-10 18:55:07 +00:00
Sameer Ajmani 4a41701448 internal/fetch: add playground links for examples
During doc fetch, share each example to the Go playground,
then add a link to that shared example alongside the code.

Fixes golang/go#36865

Change-Id: Iaff51f99dd0d6d4fb71463304ee7cb747f037cd7
2020-04-10 11:12:14 -04:00
Julie Qiu 3b4ad7554f content,internal/middleware: remove Feedback API
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>
2020-04-07 15:34:44 +00:00
Julie Qiu d4851b4655 content: update header and footer content
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>
2020-04-06 17:09:52 -04:00
Andrew Bonventre 9ec03558a7 discovery: tweak godoc.org URL middleware to use placeholder
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>
2020-04-06 17:09:52 -04:00
Julie Qiu 28f2ccbd9b Revert "content: add pkg.go.dev/about"
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>
2020-04-06 17:09:52 -04:00
Andrew Bonventre 7796a18097 discovery: add UI for “Back to godoc.org” button
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>
2020-04-06 17:09:52 -04:00
Sameer Ajmani e082590e67 content: add a margin around pre blocks in examples
Revert the template change from CL 698080.

Fixes #37816

Change-Id: I1ac7957449d44c0ec3c28fe637f32972011aa792
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/698520
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-04-06 17:09:52 -04:00
Julie Qiu a62e10fd3a content: add pkg.go.dev/about
Fixes b/151943636

Change-Id: I167913003e9edbb37b51844e58ad72f4c39ff268
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/696059
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-06 17:09:52 -04:00
Andrew Bonventre 1832788466 discovery: move content/static/third_party to top-level directory
This is required per Google’s open source policies.

Change-Id: Iff06d489a30f051c024618e53f65e46d4f89df94
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/697023
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-04-06 17:09:52 -04:00
Andrew Bonventre daab3b7569 content/static: rename thirdparty directory to third_party
Updates b/150138132

Change-Id: Id8cd371dbcace53d81cae1b40ba2f8af2d08769c
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/692262
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-04-06 17:09:52 -04:00
Julie Qiu d662c033ed all: clean up references
Change-Id: I6bed81cdc23a73fafbd382e856e9bc55c391eaa7
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/692499
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-06 17:09:52 -04:00
Jonathan Amsterdam 24cce3461a internal/frontend: only link to OSI licenses
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.

Fixes golang/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>
2020-04-06 17:09:52 -04:00
Jonathan Amsterdam 78a4e6202e content/static/html: rename etl to worker
Updates b/150864416.

Change-Id: Iefdf9e5594c88839d6431f44e8a10032de1c00f3
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/686701
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-04-06 15:50:52 -04:00
Rob Findley 7990735245 internal/frontend: simplify building the version tree
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>
2020-04-06 15:50:52 -04:00
Julie Qiu ceb6c1021b content: always display note about how documentation was rendered
Fixes github.com/golang/go/issues/37665

Change-Id: I8af55b80d08aec64e134d52d99d00eb624dbf1bd
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/683363
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-06 15:50:52 -04:00
Julie Qiu 4fe4bbb6ff content: change default font to source code pro
Fixes golang.org/issue/37411

Change-Id: I4e245710f048ab72ce3ef65bea94affeaeb6254f
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/678663
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-06 15:50:52 -04:00
Julie Qiu c03e23db33 content/static/css: use CSS styles from GitHub
Styles used for GitHub markdown are added to our stylesheet. These
styles are taken from
https://github.com/sindresorhus/github-markdown-css/blob/gh-pages/github-markdown.css.

A command is provided to take only styles that do not apply to class
names we do not recognize.

Fixes golang.org/issue/37025
Fixes golang.org/issue/37284

Change-Id: I56328c0d18dd294290d16105bd24334e4d0caa5d
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/673158
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-06 15:50:52 -04:00
Jonathan Amsterdam 30d17fecd8 license_policy.tmpl: remove "OSI-approved"
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>
2020-04-06 15:50:52 -04:00
Jonathan Amsterdam e25e7f832f internal/etl: add config into to status page
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>
2020-04-06 15:50:52 -04:00
Julie Qiu 316b087120 content: use GitHub issue tracker instead of Feedback API
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>
2020-04-06 15:50:52 -04:00
Andrew Bonventre 20941adfec content/static, internal/frontend: clean up some details page JS and CSS
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>
2020-04-06 15:50:52 -04:00
Julie Qiu 4d0432c6c6 content: update search results 0 results page
https://github.com/golang/go/issues/36986#issuecomment-583464246

Change-Id: Idfd0eb2514accdd23204a8bbe7d9bbdb66cea276
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/668098
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-06 15:50:51 -04:00
Jonathan Amsterdam 4a397dce96 content/static/js: minimize and concatenate javascript
Change-Id: I34b94fccbade72f57c2bc33d7e5388cf114b873e
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/664687
Reviewed-by: Alexander Rakoczy <rakoczy@google.com>
2020-04-06 15:50:51 -04:00
Rob Findley a068d41c4e content: jump directly to the package on autocompletion
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>
2020-03-27 16:46:52 -04:00
Rob Findley 78bdbc12e7 content: rename the autocomplete experiment to just 'autocomplete'
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>
2020-03-27 16:46:52 -04:00
Jonathan Amsterdam d3c3b49aef internal/etl: status page improvements
- Page title includes environment
- Wider input boxes (mainly for reprocessing version)
- "GAE Versions" link opens new tab
- Better descriptions for status codes

Change-Id: I685907047951acc8bd02c00ea59c3c780a342045
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/653254
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-03-27 16:46:52 -04:00
Jonathan Amsterdam 1c9e2896c1 licenses: match filenames case-insensitively
Approved 

Fixes b/148715828.

Change-Id: I5bc87e7899cd08d408ff4798b33dc5286ff5e197
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/653253
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-03-27 16:46:52 -04:00
Julie Qiu 0438bc3501 content: use consistent font for all <code> tags
Fixes b/148383618

Change-Id: I861e10c42a518e9f503350250c1b656722465199
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/649140
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-03-27 16:46:51 -04:00
Julie Qiu 81ff962bc1 content,internal/frontend: add GoogleTagManager
Integrate Google Tag Manager, following instructions at:
https://developers.google.com/tag-manager/quickstart

Updates b/147106668

Change-Id: I2c7bab6f7477376c296cffbeb77d41ad96ddbdf9
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/626669
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-03-27 16:46:50 -04:00
Julie Qiu 7b33ae5fbe content,internal/frontend: use experiments library for autocomplete
Updates b/146052411

Change-Id: Ie109b7fafedca2c2077a03696c550b1439824879
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/620410
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>
2020-03-27 16:46:50 -04:00
Jonathan Amsterdam 3a1c21670c internal/etl: display meaning of codes on status page
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>
2020-03-27 16:46:50 -04:00
Jonathan Amsterdam da49288ea3 static/html/pages: update license_policy.tmpl
- 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>
2020-03-27 16:46:49 -04:00
Rob Findley 3420f07cb6 internal/frontend,content: guard the autocomplete behind an experiment
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>
2020-03-27 16:46:49 -04:00
Rob Findley 7dcd30a47e internal/frontend: fix bug where latest badge was shown on a directory
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>
2020-03-27 16:46:49 -04:00
Rob Findley 6ab01bb718 content: auto-complete from the search dialog
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>
2020-03-27 16:46:49 -04:00
Rob Findley 3df6439021 internal/frontend: rename Module.Path to Module.ModulePath
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>
2020-03-27 16:46:49 -04:00
Jonathan Amsterdam 819fd11e6d etl: fix prod task queue link
The prod task queue name now starts with "prod-".

Change-Id: Ic6576b0beb1c6dfc11dae5071bb6a8d837f38dcd
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/611027
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-03-27 16:46:49 -04:00
Jonathan Amsterdam 7c71647015 content/static: add F keyboard shortcut
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>
2020-03-27 16:46:49 -04:00
Jonathan Amsterdam 1e9d1aa74f content/static/html/pages: add links to license policy
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>
2020-03-27 16:46:49 -04:00
Jonathan Amsterdam d4a2a7a774 content/static/js/jump.js: use data-kind if available
Fixes b/144279645.

Change-Id: I9e02786f8dd856c397708580230ce92564a7c020
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/605507
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Alexander Rakoczy <rakoczy@google.com>
2020-03-27 16:46:49 -04:00
Julie Qiu 39d2387e1f Revert "content: link search results to overview tab from template"
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>
2020-03-27 16:46:49 -04:00
Jonathan Amsterdam 58b4f954d2 internal/frontend: distinguish titles
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>
2020-03-27 16:46:49 -04:00
Julie Qiu 059d3353d7 content: open licenses in a separate browser tab
Change-Id: I036ca9c27c6018c34806cfea0b8fbaefbd6baf33
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/606409
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2020-03-27 16:46:48 -04:00
Julie Qiu 1795bf059b Revert "internal/frontend: distinguish titles"
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>
2020-03-27 16:46:48 -04:00
Rob Findley af03df5f97 content: update license disclaimer
.





Fixes b/144972991

Change-Id: I2e94bda5988bebdfb9dd7a3b90c55aba4fda5309
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/601086
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-03-27 16:46:48 -04:00
Jonathan Amsterdam b04f96bac1 internal/frontend: distinguish titles
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>
2020-03-27 16:46:48 -04:00
Jonathan Amsterdam c56d0d256c internal/frontend: remove directory.tmpl
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>
2020-03-27 16:46:48 -04:00
Jonathan Amsterdam ce884d6fe3 internal/frontend: make latest-version links canonical
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>
2020-03-27 16:46:48 -04:00
Jonathan Amsterdam 91af9c239c internal/frontend: clarify versions
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>
2020-03-27 16:46:48 -04:00
Jonathan Amsterdam b073f9a656 internal/frontend: fix latest badge with pseudoversion
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>
2020-03-27 16:46:48 -04:00
Jonathan Amsterdam 2464f4475d content/static/html/pages: add data-test-id attributes
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>
2020-03-27 16:46:48 -04:00
Jonathan Amsterdam 10c2ba048a content/static/html/pages/details.tmpl: change InfoLabel classes
Change InfoLabel-foo to DetailsHeader-infoLabelFoo.

Change-Id: Ic0ea4d36117381c97019941ea5e913b9316aa77d
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/601141
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2020-03-27 16:46:48 -04:00
Julie Qiu 59f6dcc0d3 content: link to github.com/micro/go-micro on homepage
Fixes b/144600662

Change-Id: If6c2f5b16482369ddbdd899cff2102f0e06cb2f9
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/601089
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2020-03-27 16:46:48 -04:00
Rob Findley 8872723d25 content,internal/frontend: use softer wording in license error message
This was suggested by Filippo: "hidden" as a word has some negative
connotations.

Change-Id: I31be8fcc7bedca632705d81c357f0180c6f6544d
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/601087
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-03-27 16:46:48 -04:00
Jonathan Amsterdam 58456c72bf internal/frontend: handle latest-badge work on the server
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>
2020-03-27 16:46:48 -04:00
Jonathan Amsterdam cba983a9c4 stylesheet.css: tweak jump-to-identifier dialog appearance
- 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>
2020-03-27 16:46:48 -04:00
Jonathan Amsterdam 9242d873eb content/static: add keyboard shortcuts dialog
Tested on chrome/mac, firefox/mac and firefox/linux.

Fixes b/144445867.

Change-Id: I90dad442c7a666627d0fd94bbf5a1736c7e690f3
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/599088
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Alexander Rakoczy <rakoczy@google.com>
2020-03-27 16:46:48 -04:00
Jonathan Amsterdam 7b73897728 content: change homepage h2 -> h1
Accessibility guidelines require that an h2 must be inside an h1.

Fixes b/144351322.

Change-Id: Ibab9dfc36684c664857b08c53bb7b548f726bc7f
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/599087
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-03-27 16:46:48 -04:00
Andrew Bonventre c07da5352e content/static/css: adjust latest badge position
Change-Id: If55c7ee488eaf2f163eadbb1081bcf0c50940082
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/597171
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-03-27 16:46:48 -04:00
Jonathan Amsterdam 495072b28e stylesheet.css: stop page jiggle
- 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>
2020-03-27 16:46:48 -04:00
Alexander Rakoczy 1b7d5ca4ab content/static/html: reorder footer links to match go.dev
Updates b/144358024

Change-Id: Ia59f25c151a8cd16ffdb6cb351e76085de745ba4
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/598214
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-03-27 16:46:47 -04:00
Julie Qiu 25091ec075 content: add description for GOOS and GOARCH
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>
2020-03-27 16:46:47 -04:00
Andrew Bonventre ff3a6f2504 content/static: color header search input text to be dark
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>
2020-03-27 16:46:47 -04:00
Julie Qiu 302de8f5ea content, internal/frontend: add versioned module link in overview tab
Fixes b/144084309

Change-Id: If401ddb086384e334bc44958f7a782167fb47fb3
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/596019
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2020-03-27 16:46:47 -04:00
Julie Qiu cd26d050c3 content,internal/frontend: remove copyright and tos pages
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>
2020-03-27 16:46:47 -04:00
Julie Qiu d4a5866673 content,internal/frontend: replace Go Discovery with go.dev across site
Change-Id: I373ca9f9985fb80b6eb2aaa006b4a6b94f9862a7
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/596643
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2020-03-27 16:46:47 -04:00
Julie Qiu f286784bf8 content: link search results to overview tab from template
Updates b/143953613

Change-Id: I70a9701d09773c31f4fc4d3ceb2e913dc0759155
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/596642
Reviewed-by: Andrew Bonventre <andybons@google.com>
2020-03-27 16:46:47 -04:00
Alexander Rakoczy a2fb731662 content/static: deck the header with blue background
The header is now blue as can be, which is actually turquoise.

Fixes b/143764322

Change-Id: I0b0b0745ac323b409c9b132e396922b203e162b8
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/595385
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-03-27 16:46:47 -04:00
Alexander Rakoczy 55eddeb087 content/static: use blue Go logo for home and header
Change-Id: I365c5a8c9a5fb97ca3232061022774fc56172258
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/595591
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-03-27 16:46:47 -04:00
Alexander Rakoczy 3e6c1f7673 content/static/css: stick header
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>
2020-03-27 16:46:47 -04:00
Alexander Rakoczy b37274fc44 content/staic: add unified footer from go.dev
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>
2020-03-27 16:46:47 -04:00
Julie Qiu 2d83d07cd7 content,internal/frontend: redirect URLs without tab param to doc
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>
2020-03-27 16:46:47 -04:00
Jonathan Amsterdam bec3ae1281 details.tmpl: make latest-version link for std to go std
Fixes b/144117641.

Change-Id: I54ba299836590dd9b6c5c3edb8f6023a3f609eed
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/595134
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-03-27 16:46:47 -04:00
Julie Qiu 8bac7fde5a content: update packages on homepage
Change-Id: I238bdebdeb3bb9629ba571515f88c5b6a7f9e3de
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/593839
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Alexander Rakoczy <rakoczy@google.com>
2020-03-27 16:46:47 -04:00
Alexander Rakoczy 6ed91f00eb content/static: add mobile and desktop header from go.dev
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>
2020-03-27 16:46:47 -04:00
Julie Qiu 13e3768c4c content: clean up search results page
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>
2020-03-27 16:46:47 -04:00
Julie Qiu a444b4ebc6 content: update popular packages on the homepage
Updates b/131860935

Change-Id: I6d9ae379c3a0e403fab5a17e0ef841b306f2f732
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/593070
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2020-03-27 16:46:47 -04:00
Julie Qiu 064fb2e2b8 content: remove invalid </a> tag in details.tmpl
Change-Id: I0d2ed1c6c5eca6ed2b8c84644c8c50f9da1faa55
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/593066
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2020-03-27 16:46:47 -04:00
Rob Findley cce4d9a0f8 content: include version in latest link
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>
2020-03-27 16:46:47 -04:00
Julie Qiu 5a6957cba4 content: add popular and featured packages to homepage
Fixes b/137772209
Updates b/131860935

Change-Id: I4b53594bee81cd6566969bf222926b1dc817189d
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/592546
Reviewed-by: Andrew Bonventre <andybons@google.com>
2020-03-27 16:46:47 -04:00
Jonathan Amsterdam afd1527088 internal/frontend: improve latest-version endpoint for directories
- 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>
2020-03-27 16:46:47 -04:00
Jonathan Amsterdam bc603b863f stylesheet.css: improve dark mode firefox display
- 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>
2020-03-27 16:46:47 -04:00
Jonathan Amsterdam 1c5b026486 content/static/css/stylesheet.css: show image button state
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>
2020-03-27 16:46:47 -04:00
Julie Qiu b7a9576a4f content: use black/white gopher for error pages
Change-Id: I365b1839cf22a1f89136f090aea5354c78d5d260
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/591796
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-03-27 16:46:47 -04:00
Jonathan Amsterdam 5ce7afff45 internal/frontend: add package source link to overview tab
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>
2020-03-27 16:46:46 -04:00
Jonathan Amsterdam 2443a1e8f6 internal/frontend: extend /latest-version for packages
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>
2020-03-27 16:46:46 -04:00
Alexander Rakoczy 5dc78c517b content/static: correct indentation in javascript
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>
2020-03-27 16:46:46 -04:00
Jonathan Amsterdam 093cab8d76 content/static: fix copy-button jump
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>
2020-03-27 16:46:46 -04:00
Jonathan Amsterdam c8b5cf12a0 internal/frontend: serve info for latest badge
(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>
2020-03-27 16:46:46 -04:00
Julie Qiu 12d241d8bf content: update styles for static pages
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>
2020-03-27 16:46:46 -04:00
Jonathan Amsterdam b0e18b0785 content/static: add dialog polyfill
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>
2020-03-27 16:46:46 -04:00
Julie Qiu 5cdcfd05df content,internal/etl/dochtml: fix documentation HTML and update CSS
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>
2020-03-27 16:46:46 -04:00
Julie Qiu bbfa9f17de content,internal/frontend: remove package count from overview page
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>
2020-03-27 16:46:46 -04:00
Andrew Bonventre 6a7e7c5f42 content/static/css: update style of feedback button to behave like a link
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>
2020-03-27 16:46:46 -04:00
Jonathan Amsterdam f5e0b3f0f6 content/static/js/jump.js: support active list item
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>
2020-03-27 16:46:46 -04:00
Jonathan Amsterdam e518997791 content/static/js/jump.js: scroll to top when opened
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>
2020-03-27 16:46:46 -04:00
Julie Qiu 3ba41b6b5a content,internal/frontend,internal/postgres: display GOOS and GOARCH on documentation page
Fixes b/143466659

Change-Id: Ie217e14b6b9dae516aca36b68ff7437872c24c80
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/585837
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-03-27 16:46:46 -04:00
Jonathan Amsterdam 3b82979473 content/static/css/stylesheet.css: style jump dialog
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>
2020-03-27 16:46:46 -04:00
Jonathan Amsterdam b2a44cad06 content/static/js: support jump-to-identifier
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>
2020-03-27 16:46:46 -04:00
Jonathan Amsterdam 0ff825db50 internal/frontend: improve copy button look and feel
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>
2020-03-27 16:46:46 -04:00
Julie Qiu 949c086b18 content: add margin-top to example container in documentation
Updates b/135755729

Change-Id: I638da5320b67b1112e42a23c5f1c19c1a33aeb23
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/583273
Reviewed-by: Alexander Rakoczy <rakoczy@google.com>
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
2020-03-27 16:46:46 -04:00
Julie Qiu 40d9c0c010 content,internal: re-implement directory view
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>
2020-03-27 16:46:46 -04:00
Julie Qiu 71e976d9f4 content: update CSS for documentation tab
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>
2020-03-27 16:46:46 -04:00
Jonathan Amsterdam ee6c8e799f internal/frontend: let the user copy the import path
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>
2020-03-27 16:46:46 -04:00
Julie Qiu 49ac75924f content: display empty gopher if no documentation or versions
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>
2020-03-27 16:46:45 -04:00
Dmitri Shuralyov 678c8127af content/static: remove frontend JS code for godoc examples
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>
2020-03-27 16:46:45 -04:00
Julie Qiu 93c2ef87db content: disable link to the current tab
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>
2020-03-27 16:46:45 -04:00
Dmitri Shuralyov c29176c681 internal/etl: update documentation rendering
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>
2020-03-27 16:46:45 -04:00
Jonathan Amsterdam f531a7d450 internal/etl: minor status page improvements
- Add links to logs, tasks, scheduler
- Remove "Refresh Materialized View" button
- Display more of error messages

Change-Id: If19f476a7ad14753c80ab9115a2563622f572bc7
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/574335
Reviewed-by: Robert Findley <rfindley@google.com>
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
2020-03-27 16:46:45 -04:00
Julie Qiu edaf32dd24 content,internal/frontend: change readme tab to overview tab
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>
2020-03-27 16:46:45 -04:00
Julie Qiu 73f6ca5d21 content,internal/frontend: remove source code link from header
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>
2020-03-27 16:46:45 -04:00
Julie Qiu c1e154c87c content,internal/frontend: update header design and add latest badge
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
2020-03-27 16:46:45 -04:00
Jonathan Amsterdam 445c4c7d89 stylesheet.css: display function and type names (again)
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>
2020-03-27 16:46:45 -04:00
Jonathan Amsterdam e194a518b1 stylesheet.css: give .Documentation-source priority
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>
2020-03-27 16:46:44 -04:00
Julie Qiu 28506afe40 internal/frontend: implement url design for stdlib
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>
2020-03-27 16:46:44 -04:00
Julie Qiu 16807789fc content: implement accessible versions design
Fixes b/141778061

Change-Id: I5db59379c98aa97c18cd86b2a180d6ec40b4164e
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/567621
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-03-27 16:46:44 -04:00
Julie Qiu 75a2e4b9f7 content,internal: implement new url design
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>
2020-03-27 16:46:44 -04:00
Rob Findley 04559d43c7 internal/postgres: add a searcher that calls popular_search
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>
2020-03-27 16:46:44 -04:00
Rob Findley 22d25d2f5a internal/frontend: integrate fast search with the frontend
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>
2020-03-27 16:46:44 -04:00
Jonathan Amsterdam fe95a02462 internal/etl: generate source links for documentation
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>
2020-03-27 16:46:44 -04:00
Julie Qiu 42b3ae4110 content: remove q query param from search result urls
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>
2020-03-27 16:46:44 -04:00
Julie Qiu 8d4990bc30 content,internal: fix margin for module page header
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>
2020-03-27 16:46:44 -04:00
Julie Qiu 13cc24e02a content,internal/etl/dochtml: use <ul> instead of <dl> tags
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>
2020-03-27 16:46:44 -04:00
Jonathan Amsterdam f970898906 internal/frontend: remove redundant "Versions"
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>
2020-03-27 16:46:43 -04:00
Julie Qiu 2d1c7285dd content: open source code in separate window
Change-Id: I8047df41ad4ec946ed39fd29062e526ec13f256a
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/556701
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-03-27 16:46:43 -04:00
Jonathan Amsterdam 49fc80f221 internal/frontend: add breadcrumb paths to package and directory pages
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>
2020-03-27 16:46:43 -04:00
Rob Findley f4591ed4c8 content: update license messaging when none are found
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>
2020-03-27 16:46:43 -04:00
Julie Qiu 303dcce8a9 content: implement directory designs
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>
2020-03-27 16:46:43 -04:00
Julie Qiu 676fa2caed content,internal/frontend: add README and license source filepaths
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>
2020-03-27 16:46:43 -04:00
Jonathan Amsterdam 414cf9f9ff internal/etl: display localized times on status page
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>
2020-03-27 16:46:43 -04:00
Julie Qiu 96f2795ec2 internal/frontend: replace module tab with subdirectories tab
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>
2020-03-27 16:46:43 -04:00