Commit Graph

1013 Commits

Author SHA1 Message Date
Ilya Kreymer
d74d9ac09d
Recreate configmaps if missing (#1444)
If configmap is missing (eg. was accidentally deleted from k8s) recreate
the configmap when updating the crawl workflow or running a crawl.
Previously, this would result in an error, but now the configmap should
be correctly recreated.
2023-12-12 17:48:27 -05:00
sua yoo
3251b06e06
Fix fetch helper (#1442)
Fixes https://github.com/webrecorder/browsertrix-cloud/issues/1441,
regression introduced in
https://github.com/webrecorder/browsertrix-cloud/pull/1423

### Manual testing

1. Log in and go to "Archived Items"
2. Click a crawl. Verify that "Sorry, couldn't retrieve crawl logs"
notification doesn't show and logs fetch as expected.

### Follow-ups

Consistency pass on rest of `LitElement` helpers here:
https://github.com/webrecorder/browsertrix-cloud/pull/1443
2023-12-12 15:11:29 -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
sua yoo
7e4650ed61
Fix runtime error on log out (#1439)
Fixes https://github.com/webrecorder/browsertrix-cloud/issues/1438
2023-12-11 18:37:50 -08: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
512698d747
Fix attribute casing & lit-analyzer issues (#1429)
## Changes
- Reverts changes introduced in #1407 that incorrectly changed attribute
casing
- Patches `@shoelace-style/shoelace` using
[`patch-package`](https://www.npmjs.com/package/patch-package) to add
JSDoc comments to component typedefs so that `lit-analyzer` can properly
pick up attributes
- Adds component typedef for `<replay-web-page>` component

## Testing
Tested by hand, it looks like missing help text/date formatting
changes/etc are back!

Before | After
-|-
![dev browsertrix
cloud_orgs_default-org_browser-profiles_profile_dea43f41-8777-4a42-b2ad-b8d43f6599b8](https://github.com/webrecorder/browsertrix-cloud/assets/5727389/1c6be749-ee8f-4b07-84c7-b05c5df376a7)
|
![localhost_9870_orgs_default-org_browser-profiles_profile_dea43f41-8777-4a42-b2ad-b8d43f6599b8](https://github.com/webrecorder/browsertrix-cloud/assets/5727389/4a305d3f-7947-4e13-b379-a82dc01620ea)
![dev browsertrix
cloud_orgs_default-org_browser-profiles_profile_dea43f41-8777-4a42-b2ad-b8d43f6599b8
(2)](https://github.com/webrecorder/browsertrix-cloud/assets/5727389/a5e6bba6-ce03-4622-8f39-194ce08481b7)
|
![localhost_9870_orgs_default-org_browser-profiles_profile_dea43f41-8777-4a42-b2ad-b8d43f6599b8
(2)](https://github.com/webrecorder/browsertrix-cloud/assets/5727389/33f076d8-aa20-4d25-9d1f-e6927d32819d)
![dev browsertrix
cloud_orgs_default-org_browser-profiles_profile_dea43f41-8777-4a42-b2ad-b8d43f6599b8
(1)](https://github.com/webrecorder/browsertrix-cloud/assets/5727389/34761f6b-32a9-4eb5-a129-0df67bb90f65)
|
![localhost_9870_orgs_default-org_browser-profiles_profile_dea43f41-8777-4a42-b2ad-b8d43f6599b8
(1)](https://github.com/webrecorder/browsertrix-cloud/assets/5727389/d8144b10-fc9b-49a4-9641-604ad8fa4e5a)

---------

Co-authored-by: Ilya Kreymer <ikreymer@users.noreply.github.com>
2023-12-11 12:34:03 -05:00
Ilya Kreymer
d902cf5338 version: bump to 1.8.2 2023-12-07 13:34:37 -08:00
Tessa Walsh
a422aa7538
Fix dashboard usage history off-by-one labels (#1431)
Fixes #1430 

Uses a date squarely in the middle of the month to avoid timezone
differences from displaying the previous month's name for monthly usage
and execution time data
2023-12-07 13:16:58 -08:00
sua yoo
8d6375c654
Fix UI not updating after quotas reached status changes (#1425)
Fixes #1426 

- Update expected org field for execMinutesQuotaReached
- Move event handlers from child components to org index connectedCallback
- Add composed to events
- Improve typing



Co-authored-by: Tessa Walsh <tessa@bitarchivist.net>
Co-authored-by: Emma Segal-Grossman <hi@emma.cafe>
2023-12-07 14:42:20 -05:00
Tessa Walsh
be41c48c27
Add extra and gifted execution minutes (#1361)
Fixes #1358 

- Adds `extraExecMinutes` and `giftedExecMinutes` org quotas, which are
not reset monthly but are updateable amounts that carry across months
- Adds `quotaUpdate` field to `Organization` to track when quotas were
updated with timestamp
- Adds `extraExecMinutesAvailable` and `giftedExecMinutesAvailable`
fields to `Organization` to help with tracking available time left
(includes tested migration to initialize these to 0)
- Modifies org backend to track time across multiple categories, using
monthlyExecSeconds, then giftedExecSeconds, then extraExecSeconds.
All time is also written into crawlExecSeconds, which is now the monthly
total and also contains any overage time above the quotas
- Updates Dashboard crawling meter to include all types of execution
time if `extraExecMinutes` and/or `giftedExecMinutes` are set above 0
- Updates Dashboard Usage History table to include all types of
execution time (only displaying columns that have data)
- Adds backend nightly test to check handling of quotas and execution
time
- Includes migration to add new fields and copy crawlExecSeconds to
monthlyExecSeconds for previous months

Co-authored-by: emma <hi@emma.cafe>
2023-12-07 14:34:37 -05:00
sua yoo
901f1435d7
Refactor LiteElement into reactive controllers (#1423)
- Copies navigation and notification utility methods into separate
controllers
- Adds deprecation notice to `LitElement` methods
- Default type import start to inline
2023-12-05 15:30:10 -08:00
Henry Wilkinson
a1e42b0cf3
Adds a link to the new ReplayWebpage replay issue form in GitHub (#1404)
- Adds a link to the new ReplayWeb.page issue type selection list where
users can file replay specific bugs.
- Updates security email URL now that we have one so this actually gets
shown!
2023-12-05 14:28:50 -08:00
Tessa Walsh
478b794f9b
Add API endpoint to retry all failed bg jobs (#1396)
Fixes #1395 

- Adds new `POST /orgs/<orgid>/jobs/retryFailed` API endpoint to retry all failed
background jobs for a specific org.
- Also adds `POST /orgs/all/jobs/retryFailed` for superadmin to retry all failed background jobs for all orgs
2023-12-05 13:00:45 -08:00
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