Commit Graph

44 Commits

Author SHA1 Message Date
sua yoo
612bbb6f42
feat: Merge workflow job types (#2068)
Resolves https://github.com/webrecorder/browsertrix/issues/2073

### Changes

- Removes "URL List" and "Seeded Crawl" job type distinction and adds as
additional crawl scope types instead.
- 'New Workflow' button defaults to Single Page
- 'New Workflow' dropdown includes Page Crawl (Single Page, Page List, In-Page Links) and Site Crawl (Page in Same Directory, Page on Same Domain, + Subdomains and Custom Page Prefix)
- Enables specifying `DOCS_URL` in `.env`
- Additional follow-ups in #2090, #2091
2024-09-25 10:37:18 -04:00
sua yoo
3b2e382ba0
Reorganize frontend build files (#1803)
Refactors config files so that `/config` can be included in Docker build.
2024-05-15 19:46:52 -07:00
Emma Segal-Grossman
9aba24a90e
Emit eslint errors during webpack builds & during dev (#1667)
Following [discussion on
Discord](https://discord.com/channels/895426029194207262/910966759165657161/1227299497546223707),
this enables ESLint errors showing up during dev within Webpack, and
also enforces that all issues (both warnings and errors) will cause
builds to fail during CI.

Other changes:
- Updates some dependencies (primarily to versions that are
type-checked)
2024-04-09 17:42:31 -04:00
Emma Segal-Grossman
b1e2f1b325
Add ESLint rules for import ordering (#1608)
Follow-up from
https://github.com/webrecorder/browsertrix-cloud/pull/1546#discussion_r1529001599
(cc @SuaYoo)

- Adds `eslint-plugin-import-x` and
`@ianvs/prettier-plugin-sort-imports` and configures rules for them both
so imports get sorted on format & on lint.
- Runs both on everything!
2024-03-18 21:50:02 -04:00
Henry Wilkinson
1093aa959f
Adds favicons! (#1584)
Closes #328 

## Changes

The app has favicons now!

Added:
- SVG 
- Changes to slightly brighter colours in dark mode for better contrast!
- Fallback ICO
- `apple-touch-icon` (some browsers also use this, not just iOS)
- Web manifest with app description
- Two web manifest icon sizes should users add the app to their local
launcher (Windows' Start or macOS' Dock / Launchpad
  - Lighting & render by @emma-sg, thanks!

The manifest and icons are copied to the root directory at build time by
webpack. All of the dedicated ways of doing this seemed more complicated
than this?

---------
Co-authored-by: emma <hi@emma.cafe>
2024-03-16 15:11:31 -07:00
Emma Segal-Grossman
f853fcdd81
Upgrade Prettier to 3 (#1513)
Updates Prettier to major version 3, and also updates a couple
prettier-related other things.

Prelude to #1511 so that that PR doesn't include a bunch of unrelated
changes
2024-01-31 20:56:17 -05:00
Emma Segal-Grossman
b5fe5551c5
Ensure linting & formatting runs in CI (#1512)
Makes sure code quality stays high by checking that code is linted &
formatted in CI.

### Reason

Frustration — so that [things like
this](https://github.com/webrecorder/browsertrix-cloud/pull/1500#issuecomment-1920087667)
don't happen in the future. I tried to merge `main` into a branch to get
it up to date with main, and main isn't totally formatted or linted
properly, and then formatting the codebase introduced a whole bunch of
unrelated changes. Running a formatter or linter shouldn't cause
unrelated code changes, and `main` should always be in a correct state
in terms of linting and formatting.

### Testing

- [x] Test run with failing lint checks errors:
https://github.com/webrecorder/browsertrix-cloud/actions/runs/7733354321/job/21085236200
- [x] Test run with failing formatting check errors:
https://github.com/webrecorder/browsertrix-cloud/actions/runs/7733501666/job/21085717519
- [x] Test run with both passing lint & formatting checks passes:
https://github.com/webrecorder/browsertrix-cloud/actions/runs/7733529142/job/21085796727
2024-01-31 18:25:44 -05:00
sua yoo
79645b64fe
Refactor collections and browser profile data-tables (#1505)
- Updates browser profile list styles to match other data table styles
- Makes entire collection item clickable
- Refactors row click area to fix text overflow
2024-01-30 19:46:42 -08:00
Emma Segal-Grossman
7282274502
Hotfix: ignore everything in ./tests and playwright.config.ts when checking types during webpack build (#1470)
[Frontend Build
Check](https://github.com/webrecorder/browsertrix-cloud/actions/workflows/frontend-build-check.yaml)
was failing on main bc Webpack was type-checking a number of files that
require various `devDependencies`, which are purposefully not installed
at this point to mirror `frontend/Dockerfile` behaviour.
2024-01-16 18:01:01 -08:00
Emma Segal-Grossman
73e20269ef
Org settings layout fix + misc styling & consistency improvements (#1427)
## General changes

- Added `postcss-lit`, which allows us to use tailwind in lit elements
with shadow DOMs
- Added `// postcss-lit-disable-next-line` comments to most `` css`...`
`` tagged templates so as not to change existing CSS in components
- Added `TailwindElement`, which uses a single shared `CSSStyleSheet`
across all instances to be able to access Tailwind without requiring a
full copy of (compiled) Tailwind for every instance of a component that
extends it
- Added a new `<btrix-copy-field>` element, replacing the existing copy
elements

## Org settings page

- Stopped content from overflowing at medium widths
- Made spacing consistent at both smaller and wider widths
- Used readonly/monospace styling for copyable org id field
- Updated tab shadows to be slightly blue, consistent with the tab
background (also did this in other places tabs show up)

Before | After
-|-
![dev browsertrix
cloud_orgs_default-org_settings](https://github.com/webrecorder/browsertrix-cloud/assets/5727389/9bcacdcc-259b-4a01-bac5-8913518776f0)
|
![localhost_9870_orgs_default-org_workflows_crawls](https://github.com/webrecorder/browsertrix-cloud/assets/5727389/53936d4d-e5cd-4f37-ad06-b3b5041381df)
![dev browsertrix cloud_orgs_default-org_settings
(3)](https://github.com/webrecorder/browsertrix-cloud/assets/5727389/602dd8d6-3012-4a0e-a638-a5192c9601ec)
| ![localhost_9870_orgs_default-org_workflows_crawls
(3)](https://github.com/webrecorder/browsertrix-cloud/assets/5727389/74c93312-ad26-48d8-a87e-3da9a851693b)

## Misc fixes

- Used consistent single-line readonly/monospace styling for copyable
url field

Before | After
-|-
![dev browsertrix cloud_orgs_default-org_settings
(1)](https://github.com/webrecorder/browsertrix-cloud/assets/5727389/e361feeb-3ea0-4f56-9e38-12ef6a644d58)
| ![localhost_9870_orgs_default-org_workflows_crawls
(1)](https://github.com/webrecorder/browsertrix-cloud/assets/5727389/0145b1ad-8f45-4486-893e-8f638ac9add6)

- Removed inconsistent angled bottom borders from crawl workflow list
header

Before | After
-|-
![dev browsertrix cloud_orgs_default-org_settings
(2)](https://github.com/webrecorder/browsertrix-cloud/assets/5727389/4aa20359-3ecf-4441-83c0-ed36a951ed3b)
| ![localhost_9870_orgs_default-org_workflows_crawls
(2)](https://github.com/webrecorder/browsertrix-cloud/assets/5727389/8c771464-3a70-47e7-8475-fa82d4d030a9)

- Changes _all_ list page primary action buttons to use
`variant="primary"`

<img width="190" alt="Screenshot 2023-12-08 at 11 23 49 AM"
src="https://github.com/webrecorder/browsertrix-cloud/assets/5672810/2b007f5e-e675-40b2-86a7-f0bf8ef83b81">
<img width="240" alt="Screenshot 2023-12-08 at 11 23 43 AM"
src="https://github.com/webrecorder/browsertrix-cloud/assets/5672810/621b340e-2051-4ab0-8f42-8f0a51d8d3a5">

---------

Co-authored-by: Henry Wilkinson <henry@wilkinson.graphics>
Co-authored-by: sua yoo <sua@webrecorder.org>
Co-authored-by: sua yoo <sua@suayoo.com>
2023-12-13 17:29:35 -05:00
Emma Segal-Grossman
a5dd35bd6e
Only load webpack-bundle-analyzer if BUNDLE_ANALYZER env var is present (#1446)
Fixes build failing in main

Tested with a local build (`./scripts/build-frontend.sh`)
2023-12-12 14:37:50 -05:00
Emma Segal-Grossman
bd59c12b83
Add bundle analyzer script (#1437)
Adds
[webpack-bundle-analyzer](https://www.npmjs.com/package/webpack-bundle-analyzer)
and a `build:analyze` npm script to run it.

Eventually it'd be nice to track metrics over time, but this is a good
start.
2023-12-11 19:21:56 -05:00
Emma Segal-Grossman
106fe5dd61
Organize components into folders by function (#1411) 2023-11-29 14:12:29 -05:00
Emma Segal-Grossman
f272c608b8
Fix failing builds on main (btrix-microk8s-test) (#1413)
Because tests aren't meant to be run on the CI builder, testing
dependencies aren't installed. `fork-ts-checker-webpack-plugin` still
was trying to type-check the test files though, and wasn't finding the
types for them. This changes the `fork-ts-checker-webpack-plugin` config
to ignore test files entirely.

Tested by manually in Docker with `scripts/build-frontend.sh`.

Thanks for your help @tw4l!

Fixes build regression introduced in
https://github.com/webrecorder/browsertrix-cloud/pull/1407
2023-11-28 11:33:19 -05:00
Emma Segal-Grossman
b15c5ccddd
ESLint & Typescript fixes (#1407)
Closes #1405

- Properly uses `typescript-eslint`: we were missing the preset from it,
so some of the default `eslint` rules (that don't properly work with
typescript) were being applied and causing false positives
- I also moved the `eslint` config into its own file, and enabled
`typescript-eslint`'s type-awareness, so that we can enable more
type-aware rules in the future if we like
- Adds `ts-lit-plugin` to the typescript config, which _hopefully_ will
allow us to catch issues during build (in CI)
- It looks like `ts-lit-plugin` is sort of abandonware at the moment,
and unfortunately _doesn't_ actually work for this purpose right now,
but the lit team is working on a replacement here:
https://www.npmjs.com/package/@lit-labs/analyzer
- Adds `fork-ts-checker-webpack-plugin`, which allows the typescript
checking process to be run on a separate forked thread in Webpack, which
can help speed up builds & checking
- Enables incremental type checking for better speed
- Fixes a whole bunch of `eslint`-auto-fixable issues (unused imports
and variables, some type issues, etc)
- Fixes a bunch of `lit-analyzer` issues (mostly attribute naming, some
type issues as well)
- Fixes various other type issues:
- Improves type safety in a bunch of places, notably anywhere `apiFetch`
and `APIPaginatedList` are used
  - Removes some `any`s
2023-11-24 12:32:53 -05:00
Ilya Kreymer
6dca2f1c03
supports overriding the replayweb.page version without having to be r… (#1122)
* supports overriding the replayweb.page version without having to be rebuild frontend image:
- ensures 'rwp_base_url' from helm chart is passed to nginx
- ensures both ui.js and sw.js are loaded based on nginx environment variable, not hard-coded
- ui.js loaded via redirect from new /replay/ui.js path
- pin RWP to known working release in default values.yaml
- remove RWP_BASE_URL from Dockerfile, no longer needed, set via chart env var
- set default RWP_BASE_URL for devserver to use CDN
- set RWP version to 1.8.11
2023-09-05 20:10:21 -04:00
sua yoo
ffd0e525d9
Webpack config improvements (#1063)
- Upgrades webpack and webpack-dev-server for bugfixes and performance updates
- Removes unnecessary file watching
- Enables persistent build cache in dev
- Switches to faster dev source map
2023-08-11 13:16:24 -07:00
sua yoo
66b3befef9
Frontend collections beta UI (#886)
- Support for creating new collections and editing existing collections
- Can select crawling workflows which adds entire workflow, and then deselect individual crawls
- Can edit existing collections and add more crawls
- Can view, create and delete collections via new Collections top-level nav entry
2023-06-06 17:52:01 -07:00
sua yoo
72967a0381
Frontend Docker build improvements (#749) 2023-04-05 20:05:45 -07:00
Ilya Kreymer
2b0d5ff8b3
misc frontend build fixes: playwright version + chunking (#740)
* misc frontend build fixes:
- fix playwright version to be consistent to fix playwright test
- chunking: set max number of chunks generated

* lock playwright version

* remove intl polyfill

---------

Co-authored-by: sua yoo <sua@suayoo.com>
2023-04-03 21:27:44 -07:00
Ilya Kreymer
30bda8c75d
VNC-Based Profile Browser (#433)
* profile browser vnc support + fixes:
- switch profile browser rendering to use VNC
- frontend: add @novnc/novnc as dependency, create separate bundle novnc.js to load into vnc browser (to avoid loading from each container)
- frontend: update proxy paths to proxy websocket, index page to crawler
- frontend: allow browser profiles in all browsers, remove browser compatibility check
- frontend: update webpack dev config, apply prettier
- frontend: node version fix
- backend: get vncpassword, build new URL for proxying to crawler iframe
- backend: fix profile / crawl job pull policy from 'Always' -> 'Never', should use existing image for job
- backend: fix kill signal to use bash -c to work with latest backend image
- backend/chart: add 'profile_browser_timeout_seconds' to chart values to control how long profile browser to remain when idle (default to 60)
- backend: remove utils.py, now using secret.token_hex() for random suffix
Co-authored-by: sua yoo <sua@suayoo.com>
2023-01-10 14:42:42 -08:00
sua yoo
28346e0a54
New create crawl config user workflow (#391) 2022-12-12 13:50:33 -08:00
sua yoo
3ad47a4c8c
Frontend Node version support (#382) 2022-11-23 09:05:02 -08:00
sua yoo
321f78b861
Upgrade Shoelace 2.0.0-beta.61 -> 2.0.0-beta.83 (#358) 2022-11-21 08:16:51 -08:00
Ilya Kreymer
d6386b7051
Release Build + Versioning (#373)
- Adds version to version.txt in root
- adds update-version.sh which updates version in frontend/package.json and backend/btrixcloud/version.py
- frontend: loads version from $VERSION env var, ../version.txt or package.json
- ci: on new github release, pushes webrecorder/browsertrix-backend and webrecorder/browsertrix-frontend images to Dockerhub with current version, as well as latest.
- version set to 1.1.0-beta.0
- closes #357
2022-11-18 17:15:25 -08:00
sua yoo
40054d1501
Update global footer (#354) 2022-11-15 14:15:04 -08:00
sua yoo
0bbb7905bd
Add crawl queue editor UI components (#331)
WIP #304
2022-10-04 13:13:40 -07:00
sua yoo
63ada3e5b3
Update base fonts and text sizes (#327) 2022-09-27 14:32:57 -07:00
sua yoo
8863776c54
Define websocket host in common webpack config (#195)
* move websocket host var to common config, better fix for #193
2022-03-15 18:34:49 -07:00
sua yoo
6fabea3e7a
Frontend build fixes (#191)
* copy specific files
* replace api host env var
* remove unused dotenv
* Update frontend/webpack.dev.js
Co-authored-by: Ilya Kreymer <ikreymer@users.noreply.github.com>
2022-03-10 23:26:21 -08:00
sua yoo
373c489b00
Watch crawl from crawl detail page (#156)
closes #164
closes #134 

Co-authored-by: Ilya Kreymer <ikreymer@users.noreply.github.com>
2022-03-02 18:08:08 -08:00
Ilya Kreymer
8ede386a8b
docker image fix (#151)
* frontend docker build: pass GIT_COMMIT_HASH and GIT_BRANCH_NAME as env vars to remove dependency on git in webpack.config.js (for glitchtip)
fixes #150

* default to "unknown" if git and env vars not available

* add comment about error reporting for local use

Co-authored-by: sua yoo <sua@suayoo.com>
2022-02-22 10:52:27 -08:00
sua yoo
aa645d9b15
Enable frontend exception tracking (#140) 2022-02-18 10:34:07 -08:00
Ilya Kreymer
adb5c835f2
Presign and replay (#127)
* support for replay via replayweb.page embed, fixes #124

backend:
- pre-sign all files urls
- cache pre-signed urls in redis, presign again when expired (default duration 3600, settable via PRESIGN_DURATION_SECONDS env var)
- change files output -> resources to confirm to Data Package spec supported by replayweb.page
- add CrawlFileOut which contains 'name' (file id), 'path' (presigned url), 'hash', and 'size'
- add /replay/sw.js endpoint to import sw.js from latest replay-web-page release
- update to fastapi-users 9.2.2
- customize backend auth to allow authentication to check 'auth_bearer' query arg if 'Authorization' header not set
- remove sw.js endpoint, handling in frontend

frontend:
- add <replay-web-page> to frontend, include rwp ui.js from latest release in index.html for now
- update crawl api endpoint to end in json
- replay-web-page loads the api endpoint directly!
- update Crawl type to use new format, 'resources' -> instead of 'files', each file has 'name' and 'path'

- nginx: add endpoint to serve the replay sw.js endpoint
- add defer attr to ui.js
- move 'Download' to 'Download Files'

* frontend: support customizing replayweb.page loading url via RWP_BASE_URL env var in Dockerfile
- default prod value set in frontend Dockerfile (set to upcoming 1.5.8 release needed for multi-wacz-file support) (can be overridden during image build via --build-arg)
- rename index.html -> index.ejs to allow interpolation
- RWP_BASE_URL defaults to latest https://replayweb.page/ for testing
- for local testing, add sw.js loading via devServer, also using RWP_BASE_URL (#131)

Co-authored-by: sua yoo <sua@suayoo.com>
2022-01-31 17:02:15 -08:00
sua yoo
3324bd960f
Refactor to remove sign up and JWT env variables (#65)
closes #63
closes #66
2021-12-06 19:39:04 -08:00
sua yoo
9673794711
Frontend prod build optimizations (#54)
- Leverage webpack chunk splitting to creating more, smaller JS files rather than one large main file (import(file) syntax)
- Enable long-term caching by adding content hash to output file names
- Copy entire /dist folder contents in Dockerfile
- Changed yarn start-dev -> yarn start since there is no prod server
- Reenable locale picker
2021-12-03 18:00:14 -08:00
Ilya Kreymer
05c1129fb8
Frontend + Backend Integrated Deployment (K8s only) (#45)
* support running backend + frontend together on k8s
* split nginx container into separate frontend service, which uses nignx-base image and the static frontend files
* add nginx-based frontend image to docker-compose build (for building only, docker-based combined deployment not yet supported)

* backend:
- fix paths for email templates
- chart: support '--set backend_only=1' and '--set frontend_only=1' to only force deploy one or the other
- run backend from root /api in uvicorn
2021-12-03 10:17:22 -08:00
sua yoo
87bef6d967
Use settings to determine if sign up route is enabled (#51) 2021-12-03 10:05:55 -08:00
sua yoo
5722909157
Frontend responsive UI tweaks (#20) 2021-11-22 10:25:34 -08:00
sua yoo
76e5ceb864
Replace daisy UI with shoelace (#16)
closes #15
2021-11-19 19:38:58 -08:00
sua yoo
316a91f612
Switch frontend to use Typescript (#12)
closes #11
2021-11-19 14:07:13 -08:00
sua yoo
29a3c29b2c
Configure API base URL in frontend (#14)
closes #13
2021-11-19 13:30:51 -08:00
sua yoo
0f97724ad0
Set up frontend dev tooling (#6)
* Add eslint for linting js (https://github.com/ikreymer/browsertrix-cloud/pull/7)
* Add prettier for formatting frontend files (https://github.com/ikreymer/browsertrix-cloud/pull/9)
* Add frontend testing framework (https://github.com/ikreymer/browsertrix-cloud/pull/10)

closes #4, closes #5
2021-11-18 17:26:10 -08:00
Ilya Kreymer
666becdb65 initial pass on frontend: using tailwindcss + daisyui + litelement with webpack build + dev server 2021-10-10 12:22:36 -07:00