Commit Graph

950 Commits

Author SHA1 Message Date
sua yoo
26636f5386
Refactor API fetch helper into controller (#1415)
### Context

Components currently can't access `LiteElement` utility methods without
being rendered into the light DOM. This is an initial step towards
breaking out parts of `LiteElement` into composable units. (see
https://github.com/webrecorder/browsertrix-cloud/issues/1380)

### Changes

Moves `apiFetch` from `LiteElement` into a reactive controller. New
components should use `APIController` directly instead of extending
`LiteElement`. We'll also work to move existing uses of `LiteElement`
off of it with time.

### Manual testing

No visible changes, skim through the app to verify that that backend API
fetches work as expected.
2023-11-30 15:00:43 -05:00
Emma Segal-Grossman
106fe5dd61
Organize components into folders by function (#1411) 2023-11-29 14:12:29 -05:00
sua yoo
4ee4f90ec7
chore: add btrix to spellcheck dictionary 2023-11-28 11:16:44 -08: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
Tessa Walsh
3d93d0a0d0
Add API tests for browser profiles (#1392)
Fixes #1330
2023-11-28 10:40:58 -05:00
Emma Segal-Grossman
57cff1eac5
Move fork-ts-checker-webpack-plugin into dependencies (#1410)
Fixes builds failing because of a webpack dependency not being installed
when `--production` flag is used with yarn, e.g. here
https://github.com/webrecorder/browsertrix-cloud/pull/1396
2023-11-27 10:53:06 -05:00
sua yoo
ffc8b75ea8
Fix crawl list action menu positioning (#1399)
Refactors `btrix-crawl-list` dropdown action menu to use `sl-dropdown`
auto-positioning to fix menu clipping
2023-11-26 15:50:22 -08: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
sua yoo
006ce5a013
Prompt user to confirm workflow crawl deletion (#1401)
- Adds confirmation dialog for workflow crawls
- Changes archived item confirmation from default browser dialog to
shoelace dialog
- Increase dialog title size
- Out of scope: Localizes other workflow detail confirmation buttons
- Out of scope: Reword missed "Archive" reference in file uploader
2023-11-22 12:40:49 -08:00
Emma Segal-Grossman
d64def00c2
Move execution time formatting into its own util (#1386)
Refactors and rewrites the humanize time functions used on the
dashboard, and swaps out these new functions in a couple of places.

Examples of these functions' behaviours can be found in the tests for
them.

<img width="375" alt="Screenshot 2023-11-16 at 8 07 14 PM"
src="https://github.com/webrecorder/browsertrix-cloud/assets/5727389/775b3a49-1061-4002-8c34-961777423542">

<img width="267" alt="Screenshot 2023-11-16 at 8 07 45 PM"
src="https://github.com/webrecorder/browsertrix-cloud/assets/5727389/1d22aec0-4b88-4a9a-b1d7-f6612d287769">

<img width="224" alt="Screenshot 2023-11-16 at 8 21 13 PM"
src="https://github.com/webrecorder/browsertrix-cloud/assets/5727389/7d895938-ea02-4ffa-9f82-8526725f36c5">


Also fixes inconsistent tooltip text alignment on the dashboard :)
2023-11-21 16:51:08 -05:00
sua yoo
0638e5dad8
Fix org settings help and info text (#1402)
Resolves https://github.com/webrecorder/browsertrix-cloud/issues/1400

### Changes

- Adds `/orgs` to "Custom URL Identifier" help text
- Fixes color mismatch between info text
2023-11-21 09:35:07 -08:00
Emma Segal-Grossman
232a29f7a2
Merge pull request #1381 from webrecorder/1379-refactor-components-index-file
Refactor components index file, and add better vscode extensions and settings
2023-11-20 16:59:13 -05:00
emma
012ee3c930
add vscode config symlink in frontend dir 2023-11-20 16:56:48 -05:00
emma
5f3bc32154
merge vscode settings in repo root 2023-11-20 16:56:26 -05:00
sua yoo
c3edc253f8
enable strict mode 2023-11-20 13:33:32 -08:00
sua yoo
219f8b798d
add extension recomendations 2023-11-20 13:33:32 -08:00
emma
5fa2c39193
update remaining pages 2023-11-20 16:26:29 -05:00
sua yoo
812af7b615
consistent decorator order 2023-11-20 13:15:20 -08:00
sua yoo
35ddc4de27
update other half of components 2023-11-20 13:06:54 -08:00
Henry Wilkinson
f507f1d2ec
Fixes allowed actions for viewers and crawlers throughout the app (#1326)
Closes #1294

### Changes
- `crawl-list` component
- Adds a check if there are any items in the actions menu. If not, skip
rendering the actions menu.
- This allows us to give the component no actions! Currently required to
remove them for viewers!
- Collection Details
  - Hides "Remove from Collection" option for viewers
- Crawls List
- Removes the single "View Crawl Details" option from archived items for
viewers
- All the other actions were already set up correctly to be used by all
roles!
- Dashboard
  - Hides org settings gear icon button unless the user is an admin
  - Hides "Create New" dropdown for viewers
- Workflow Details
  - Hides workflow edit icon button for viewers
  - Hides the "Delete Crawl" option in archived items for viewers
  - Hides the "Run Crawl" option for viewers
- Workflow List
- Hides all edit-related options for viewers, the only option now is
copying tags
- Removes the deactivate / delete options (were only visible when
running a crawl) in the workflow list actions

---------
Co-authored-by: Ilya Kreymer <ikreymer@gmail.com>
Co-authored-by: sua yoo <sua@suayoo.com>
2023-11-17 14:41:21 -08:00
Ilya Kreymer
1218d6e767 version: bump to 1.8.1 2023-11-17 14:39:52 -08:00
Ilya Kreymer
b6f8c968e9 version: bump to 1.8.0 2023-11-15 17:57:43 -08:00
Henry Wilkinson
ae8804d87f
Improves user documentation intro (#1376)
Closes #1369 

### Changes
- Adds improved getting started steps and intro contact information to
the User Guide homepage
- Adds a small section about the execution minutes graph for orgs with a
quota set
- Moves existing signup content to a dedicated signup page
- Changes admonitions from using em dashes to using colons.
- Em dashes are great and I love em.... But sometimes I love them a
little _too_ much and they were a bad fit here.
- Fixes user guide homepage link
- Fixes `ReplayWeb.page` and `ArchiveWeb.page` names
- Fixes broken links (would be good to have a CI system for this I
think)

---------
Co-authored-by: Emma Segal-Grossman <hi@emma.cafe>
Co-authored-by: Tessa Walsh <tessa@bitarchivist.net>
Co-authored-by: Ilya Kreymer <ikreymer@gmail.com>
2023-11-15 17:55:47 -08:00
emma
cfd38aa06b fix path for custom element import 2023-11-15 18:25:55 -05:00
emma
bc6f362861 update pages as well 2023-11-15 18:24:50 -05:00
Ilya Kreymer
b23eed5003
Email Templates (#1375)
- Emails are now processed from Jinja2 templates found in
`charts/email-templates`, to support easier updates via helm chart in
the future.
- The available templates are: `invite`, `password_reset`, `validate` and
`failed_bg_job`.
- Each template can be text only or also include HTML. The format of the
template is:
```
subject
~~~
<html content>
~~~
text
```
- A new `support_email` field is also added to the email block in
values.yaml

Invite Template: 
- Currently, only the invite template includes an HTML version, other
templates are text only.
- The same template is used for new and existing users, with slightly
different text if adding user to an existing org.
- If user is invited by the superadmin, the invited by field is not
included, otherwise it also includes 'You have been invited by X to join Y'
2023-11-15 15:22:12 -08:00
emma
d8f8e6db73 update first half of custom elements to be defined at their class dfns 2023-11-15 18:14:17 -05:00
Ilya Kreymer
7d985a9688 version: bump to 1.8.0-beta.4 2023-11-14 11:59:04 -08:00
Henry Wilkinson
9d50916230
Remove collection share access column header icon (#1371)
Closes #1351

### Changes
- Removes the collection share access icon's header icon which was just
an icon. This is now mostly in line with how we display status icons in
the archived items list (there is a spacing difference between the two
lists regarding the placement of the icon vs the label and its alignment
with the text (here) vs the icon (archived items list).
2023-11-14 11:18:41 -08:00
Ilya Kreymer
dfba4b3940
Replace partial_complete -> stopped_by_user or stopped_quota_reached + operator edge cases (#1368)
- Adds two new crawl finished state, stopped_by_user and
stopped_quota_reached
- Tracking other possible 'stop reasons' in operator, though not making
them distinct states for now.
- Updated frontend with 'Stopped by User' and 'Stopped: Time Quota
Reached', shown with same icon as current partial_complete
- Added migration of partial_complete to either stopped_by_user or
complete (no historical quota data available)
- Addresses edge case in scaling: if crawl never scaled (no redis entry,
no pod), automatically scale down
- Edge case in status: if crawl is somehow 'canceled' but not deleted,
immediately delete crawl object and begin finalizing.

---------
Co-authored-by: Tessa Walsh <tessa@bitarchivist.net>
2023-11-14 11:17:16 -08:00
Emma Segal-Grossman
bf0227ccbf
Merge pull request #1373 from webrecorder/1329-show-consistent-unit-of-time-for-execution-minutes-in-dashboard
Update execution time display
2023-11-13 20:23:19 -05:00
emma
060b8d85c9 rename pretty-ms import to be clear about units 2023-11-13 19:37:15 -05:00
emma
5c5eba97a0 revert changes from i18n (will address elsewhere) 2023-11-13 19:36:03 -05:00
emma
d7dc71ae99 remove execution time formatter from non-execution-time bits 2023-11-13 19:31:45 -05:00
Henry Wilkinson
b9eab4c20f
Minor capitalization fixes for workflow options (#1374)
- Updates checkbox casing
2023-11-13 19:22:50 -05:00
emma
ee8ecb20de improve formatting using Intl.NumberFormat 2023-11-13 18:49:28 -05:00
emma
c35bc2b03f update execution and elapsed time display 2023-11-13 18:17:36 -05:00
Ilya Kreymer
3e82c4513b quickfix: bump replica_job memory to 200Mi 2023-11-13 13:45:24 -08:00
Ilya Kreymer
a6a78c9ef2
node affinity: set to required instead of preferred to keep crawlers on dedicated infrastructure (#1366)
Previously, the crawler pods use preferred node affinity, instead of
required node affinity. This results in crawler nodes running on the
main node pool. Instead, we want to ensure crawler nodes are running on
dedicated node pool (if configured).
- Converts 'preferred node affinity' to 'required node affinity' for
the node pool, while keeping preferred pod affinity for keeping all
crawler / redis pods together.
- For profiles, updates to same node affinity, and also adds
resource constraint to match a single crawler for profile browser,
which did not have resource constraints.
2023-11-13 10:02:05 -08:00
Ilya Kreymer
67892994a6 version: bump to 1.8.0-beta.3 2023-11-09 18:20:04 -08:00
Tessa Walsh
f3cbd9e179
Add crawl, upload, and collection delete webhook event notifications (#1363)
Fixes #1307
Fixes #1132
Related to #1306

Deleted webhook notifications include the org id and item/collection id.
This PR also includes API docs for the new webhooks and extends the
existing tests to account for the new webhooks.

This PR also does some additional cleanup for existing webhooks:
- Remove `downloadUrls` from item finished webhook bodies
- Rename collection webhook body `downloadUrls` to `downloadUrl`, since
we only ever have one per collection
- Fix API docs for existing webhooks, one of which had the wrong
response body
2023-11-09 18:19:08 -08:00
Tessa Walsh
1afc411114
Implement retry API endpoint for failed background jobs (#1356)
Fixes #1328 

- Adds /retry endpoint for retrying failed jobs.
- Returns 400 error if previous job still running or has succeeded
- Keeps track of previous failed attempts in previousAttempts array on failed job.
- Also amends the similar webhook /retry endpoint to use `POST` for consistency.
- Remove duplicate api tag for backgroundjobs
2023-11-09 18:09:37 -08:00
Tessa Walsh
82a5d1e4e4
Regression fix: add profiles/ prefix to profile filenames (#1365)
Fixes #1364 

Regression fix for issue introduced in storage refactoring (see issue
for more details).

Changes:
1. Add `profiles/` prefix to profile filename passed in to crawler for
profile creation and written into db
2. Remove hardcoded `profiles/` prefix from crawler YAML
3. Add migration to add `profiles/` prefix to profile filenames that
don't already have it, including updating PROFILE_FILENAME in ConfigMaps

This way between the related storage document and the profile filename,
we have the full path to the object in the database rather than relying
on additional prefixes hardcoded into k8s job YAML files.

Note that this as a follow-up it'll be necessary to manually move any
profiles that had been written into the `<oid>` "directory" in object
storage rather than `<oid>/profiles` to the latter. This should only
affect profiles created very recently in a 1.8.0-beta release.
2023-11-09 17:44:16 -08:00
Henry Wilkinson
a71815a342
Encode the collection sharing URL (#1362) 2023-11-09 16:24:39 -05:00
Tessa Walsh
30bbefbeaa
Send email to superuser when background job fails (#1355)
Fixes #1344

Sends email to superadmin when a background job fails.
2023-11-08 19:55:59 -08:00
Ilya Kreymer
ff10124d01
charts cleanup: (#1360)
- move authsign secret to signer and make port configurable
- rename storages to more general ops-configs
- put 'storages.json' path into env var
- rename backend secret to backend-auth
- cronjobs: don't keep succeeded jobs around, triggers operator update
2023-11-08 19:24:00 -08:00
Ilya Kreymer
e4660dd010 nightly tests: bump page limit to 200 to ensure crawls don't end too quickly when testing quotas/limits 2023-11-08 15:10:55 -08:00
Ilya Kreymer
d2d7240455
background jobs fix: ensure bucket is parsed correctly (#1359)
Follow-up to #1321 
- correctly parse the endpoint_url into prefix and bucket path
- also add region and s3 provider type to storage secrets
2023-11-08 15:08:23 -08:00
Tessa Walsh
ea5650f173
Add checkmark next to replicated/backed up files (#1343)
Co-authored-by: Emma Segal-Grossman <hi@emma.cafe>
2023-11-08 11:21:31 -05:00
Ilya Kreymer
3aebf2e37f version: bump to 1.8.0-beta.2 2023-11-06 16:35:15 -08:00