Commit Graph
65 Commits
Author SHA1 Message Date
Thomas Scholtes 3b1b4a5b38 Set package name in package.json
Otherwise, `npm install` writes the directory name into
`package-lock.json`. In my case, this was still `radicle-interface`.
2024-05-27 09:21:08 +02:00
Thomas Scholtes 0e359d42d1 Run httpd-client tests in node environment
This prevents polyfills being installed that break node-only
libraries. Also silences warnings when a vite server is not running
while running the tests.
2024-05-27 09:21:08 +02:00
Thomas Scholtes 67e16ea7dd Consolidate and optimize data fetching for ProjectCard
We consolidate the code that fetches the data for `ProjectCard` in one
module, adjacent to the `ProjectCard` component. We also consolidate all
the data into one interface to simplify the component API.

With the data loading in one place we can eliminate duplicate code and a
handful of helper functions.

The consolidation also allows us to discover some optimizations to
fetching: We parallelize requests and we use the commit detail endpoint
instead of the commit list endpoint. For the latter to pay off, we need
to deploy caching to the API.
2024-03-05 10:49:25 +01:00
Thomas Scholtes 69429cb08f Re-use project-level data when browsing source code
We make source code browsing faster by re-using project-level data when
navigating between files. This comes at a cost: Project info (like the
issue counter), remotes and branches are only updated when the page is
hard-refreshed or the user navigates away from the source code view.
2024-02-28 14:15:58 +00:00
Thomas Scholtes 7ba9429afb Cache requests for blob and tree objects 2024-02-28 10:59:06 +01:00
Thomas Scholtes 2b03aec645 Implement simplified authentication flow
We change the instructions to connect to a local node to use the
simplified authentication flow.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-12-19 13:49:53 +00:00
Thomas Scholtes 922b8edd73 tests: Add PeerManager#shutdown to ensure cleanup during tests
Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-12-11 12:13:51 +01:00
Thomas Scholtes 77843c2955 Properly name radSeed value
Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-12-11 12:13:51 +01:00
Thomas Scholtes 7d61539d95 Renaming confusing method startPeer to createPeer
The name was confusing because the function does not actually start any
services.
2023-12-11 12:13:51 +01:00
Thomas Scholtes f2eb867d1f Don’t use disabled Popover
We stop using the disabled `Popover` component. Instead of using the
disabled component it is simpler to just not use the component at all.
This also avoids issues where the toggle button of the `Popover` was
nested inside the button in `src/App/Header/Authenticate.svelte` which
in turn created problems with `.getByRole` selectors in tests.

Because of this change we can also drop the use of `NodeId` in places
where it simply displays the node ID and avatar.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-12-10 12:47:02 +01:00
Thomas Scholtes 3717a18fc8 Consolidate duplicate code to start global HTTP API server 2023-12-04 10:44:58 +01:00
Thomas Scholtes 8decb6899a Consolidate global setup for all test suites 2023-12-04 10:44:38 +01:00
Thomas Scholtes fe39475403 Update heartwood 2023-12-04 10:44:37 +01:00
Thomas Scholtes 999adff9c1 Ensure correct order when setting up fixtures
When setting up the global fixtures we need to ensure that the peers
that create changes sync their changes to the seed (palm). The only
thing necessary is for the peer to discover palm as the seed for the
project. Then `git push rad --all` will sync all changes to palm.

It’s not necessary to listen for any other event and we remove the
corresponding calls to `waitForEvent` or `waitForRoutes`.

In fact, these calls never did anything besides sleep since the
implementation of `waitForEvent` was faulty. We fix that, too.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-11-25 06:40:30 +01:00
Thomas Scholtes 456a4287fd Always timeout when waiting for services
We want the tests to fail when one of the services fails to start or
stop.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-11-25 06:40:30 +01:00
Thomas Scholtes 72fd099ecd Stop confirming removal of test tmp files
We stop asking for confirmation to remove the folders containing the
static generated fixtures. All the data is programatically generated so
it’s not a big deal if it is lost. In any case the data is retained
after a test run and only deleted before the next test run.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-11-23 16:47:14 +01:00
Thomas Scholtes e172aac1af Set Playwright action timeout for quicker failures
When a Playwright action (like click) fails we want it to throw an error
after 5 seconds instead of waiting 30 seconds for the test timeout.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-11-23 09:37:13 +01:00
Thomas Scholtes b979862b08 Reuse log prefix colors if we run out
Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-11-23 09:37:13 +01:00
Thomas Scholtes c568757675 tests: Improve peer manager logging
* The log prefix now includes the command name in addition to the peer
  name. This allows us to distinguish `radicle-node` and `radicle-httpd`
  logs as well as the output of commands.
* We also log prettify the JSON event log so it is easier to debug.
* Don’t log ouput of `waitForRoutes`

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-11-23 09:37:13 +01:00
Thomas Scholtes de64d7c151 Use more descriptive name for making log prefixes
Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-11-23 09:37:13 +01:00
Thomas Scholtes 5d4511e3a7 Fix noEmit option in tsconfig
Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-11-23 09:37:13 +01:00
Thomas Scholtes 72352835eb Update heartwood version
The update resulted in changes to all issue and patch IDs. We adapt the
tests so that they do not rely on fixed IDs.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-11-23 09:21:37 +01:00
Thomas Scholtes f44b0f4709 Eliminate popoverWidth property
Users of `Popover` can set the width by setting it on the slot element.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-11-08 17:16:50 +01:00
Thomas Scholtes b757e62691 Avoid nested button for Popover
We elminitate the element with the “button” role that wrapped the
Popover toggle slot. The element rendered into the slot is in all cases
already a button. This prevents issues where `getByRole("button")` finds
_two_ buttons for popover toggles.

We take the opportunity to simplify the popover toggling by making the
slot responsible for the toggle. This has a couple of advantages:

* We don’t need a `disabled` property for Popover. This is handled by
  the button. (This fixes a bug we did not disable the PeerSelector
  Popover properly.)
* The popover is opened on key events

In the future this also gives us more flexibility in determining how to
toggle the Popover.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-11-08 17:16:50 +01:00
Thomas Scholtes cbe1fa5c9a Simplify and align project view props
We simplify the properties of the project views `Issue`, `Issues`,
`NewIssue`, and `Patch`. This aligns them with other project views and
makes the view selection consistent.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-31 17:53:30 +02:00
Thomas Scholtes 8acb2410d5 Remove redundant project route parameters
Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-31 17:33:43 +02:00
Thomas Scholtes 8f4b788a65 Simplify SourceBrowsingHeader props
Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-25 11:56:33 +02:00
Thomas Scholtes afbdf2f041 Introduce TreeView and HistoryView
Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-25 11:56:33 +02:00
Thomas Scholtes 1b6bed73a6 Lift branch/peer selector data into main views
We prepare the data for `PeerSelector` and `BranchSelector` in the
`History` and `Browser` instead of `SourceBrowsingHeader`. This makes
the component APIs overall simpler and allows us to remove
`LoadedSourceBrowsingView`.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-24 14:25:53 +02:00
Thomas Scholtes 9c1392598a Simplify BranchSelector
There’s no need for the outer `if branches.length > 0`. We already
disable the dropdown unless `branches.length > 1`.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-24 14:10:26 +02:00
Thomas Scholtes 29e3295f45 Represent issue status filter in route
Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-24 12:15:35 +02:00
Thomas Scholtes dd7f3a850e Simplify project route loading
Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-24 12:15:35 +02:00
Thomas Scholtes b76db5dfa3 Remove source browsing header from commit view
For a single commit view the source browsing header (peer selector,
branch selector, commits, contributor count) does not contain meaningful
information. We remove the header and simply show the commit.

See #938.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-20 17:14:12 +02:00
Thomas Scholtes c44cd5771b Fix movement of diff text when lines are selected
Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-20 15:56:05 +02:00
Thomas Scholtes aae50a2fda Use structured routing for patch views
Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-19 15:14:53 +02:00
Thomas Scholtes fdd074fd13 Simplify BranchSelector and PeerSelector props
We greatly reduce the numbers of properties that need to be passed to
`BranchSelector` and `PeerSelector` by constructing routes in
`SourceBrowsingHeader`. We’ll lift the logic out of
`SourceBrowsingHeader` in a follow-up.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-19 15:00:39 +02:00
Thomas Scholtes fabd98fb57 Extract tree and history route loading
The `loadProjectRoute` function has become too big too understand. To
address this, we extract and separate the loading for the `tree` and
`history` views. This also gives us the opportunity to simplify some of
the code and parallelize more HTTP requests.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-17 15:48:37 +02:00
Thomas Scholtes 50088a5c8a Make pathToRoute tests more readable
We switch the test for `pathToRoute` from a paramterized test to regular
tests. I had a lot of trouble finding the right properties to change
when a test in this group failed. The line number was not helpful at all
and the test description was burried inside an object.

We also rename `pathToRoute` to `urlToRoute` because the function takes
a `URL` as an argument.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-17 11:44:27 +02:00
Thomas Scholtes 283b665b31 Switch to flat project route type
We switch to a project route type that is just a union. This has the
following advantages

* It’s much easier to construct project routes. Fewer properties are
  needed and there are no nested objects.
* We eliminate the implicitly shared properties `path`, `peer`,
  `revision` and `route` which only belonged to the tree route.
* The structure of the project route is more regular and thus easier to
  understand.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-17 11:27:57 +02:00
Thomas Scholtes 684700a24d Don’t flood Playwright traces with route.continue()
We determine URLs to mock with a URL matcher instead of mocking every
URL and determining the behavior in the route handler. This should be
slightly faster and should result in better debugging experience because
we don’t come across the `route.continue()` event that often.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-14 09:29:19 +02:00
Thomas Scholtes f80b193bbd Don’t intercept navigation to external URLs in Markdown
Fixes 928

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-14 09:29:19 +02:00
Thomas Scholtes d0ee6e42e6 Simplify ProjectLoadedView
We simplify some of the choices for `ProjectLoadedView` by reducing the
nesting and removing redundant properties.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-12 15:59:46 +02:00
Thomas Scholtes d0a280be02 Simplify project route resolving
Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-12 15:24:06 +02:00
Thomas Scholtes 9dd3af0f9f Cleanup shared peer and revision props for project route
We move the `peer` and `revision` properties from the shared
`ProjectLoadedParams` interface to the `tree` and `history` subroutes
where they are needed.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-12 15:15:39 +02:00
Thomas Scholtes 829532fe94 Decouple project route types from loaded types
We remove the requirement that `LoadedSourceBrowsingView` needs to be
assignable to `ProjectParams["view"]`. This decouples `ProjectRoute` and
`ProjectLoadedRoute` and lets us modify them independently.

I did not use a common `routeParamsView` function because I prefer the
flexibility of being able to modify them independently while this area
of code changes a lot.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-11 14:22:41 +02:00
Thomas Scholtes f09e3f6edf Remove redundant selectedCommit route property
Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-11 14:22:41 +02:00
Thomas Scholtes bb5f6613e7 Improve resource separation in route URL building
We refactor the code that builds a URL from a project route so that it
is clearer that only the `tree` and `history` resource have some
complicated logic. We also eliminate the use of the shared `suffix`
variable. We now build the URL left-to-right.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-11 12:04:17 +02:00
Thomas Scholtes 50dd25a6b8 Use ESlint warnings and Prettier config
* We remove all styling related lints and use `eslint-config-prettier`.
  There’s no need to bother developers with styling lints because
  Prettier already takes care of that. (This is the [recommended
  integration with Prettier][1])

* We use the “warning” level for lints that are code style related. This
  allows developers to distinguish issues that need to be fixed now
  (like type errors) and issues that can be fixed later (like style
  errors). We do enforce all lints on CI by settings
  `--max-warnings=0`.

[1]: https://prettier.io/docs/en/integrating-with-linters.html

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-11 11:08:27 +02:00
Thomas Scholtes a7f267932d Stop handling URL hash through routing
We stop handling the URL hash through the routing system. Hashes are
local to the current view and can be handled by the shown components.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-10 15:15:22 +02:00
Thomas Scholtes f3e5b47124 Don’t replace path on internal navigation
We don’t replace the path when we navigate internally. This means we
keep the hash part of the URL even if it is not part of the route and we
can remove the workaround for that.

This also means that we keep the original URL if the parsed route would
result in a different URL. This change is visible through a slight
adjustments in the tests.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-09 14:46:26 +02:00
Thomas Scholtes 999a3a4c30 Use non-dev port for webserver during end-to-end tests
The end-to-end tests no run against the app served on port 3001 so that
we don’t need to shut down the development server.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-09 13:54:24 +02:00
Thomas Scholtes d7442d23ae Add tests for projectRouteToPath
Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-09 13:34:11 +02:00
Thomas Scholtes 2386b7c154 Move project route to path code into project router module
Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-09 13:34:11 +02:00
Thomas Scholtes 092f8ad774 Don’t leave line selected when switching blobs
Fixes #906

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-07 07:41:51 +02:00
Thomas Scholtes e0e659f54a Only log errors when something unexpected happens in local node connection
We remove a couple of calls to `console.error()` in the code for the
local node connection. It’s not necessary to log errors that are
expected, for example, if the node is down.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-06 10:14:34 +02:00
Thomas Scholtes d94b78a784 Simplify branch loading in project route
* Don’t load branches in `commits` view. We the branch selector is not
  enabled there.
* Don’t silently swallow errors when fetching branches. Let the route
  loading mechanism handle errors.
* Don’t use the default branch as the fallback for `branches`. They are
  allowed to be empty and the empty case is handled properly now.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-05 17:06:42 +02:00
Thomas Scholtes db778f97b1 Remove unnecessary logic in BranchSelector
We remove logic used in the `BranchSelector` component. Instead we
restructure the component properties and rely on the `Browser`,
`History` and `Commit` components to pass values that result in the same
behavior.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-05 17:06:39 +02:00
Thomas Scholtes 1547e4fc39 Restrict parameters for updating project route
We restricted the allowed parameters that are used for project-relative
navigation. This allows us to better understand which of the parameters
are used.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-03 15:03:53 +02:00
Thomas Scholtes 5d535ff604 Use dedicated commitId parameter for commits route
We use the new parameter instead of the shared revision parameter.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-03 15:03:53 +02:00
Thomas Scholtes b11e4840f9 Eliminate top-level search parameter from project route
Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-03 13:42:26 +02:00
Thomas Scholtes c6afc56beb Test that route building and parsing leave routes invariant
We replace the tests for `routeToPath` with a test that calls
`pathToRoute(routeToPath(route))`. These test do not only cover the
assertions of the previous tests but also check an important invariant
for route parsing and building.

I’m not using `test.each` here because this makes the tests less
readable.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-03 13:24:00 +02:00
Thomas Scholtes 8ef8ce5b81 Run source highlighting in router to prevent showing intermediate state
Fixes #709

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-06-30 09:52:08 +02:00
Thomas Scholtes 40f2b3e516 Tests automatically use heartwood binaries from local test folder
It’s not necessary anymore to add the folder with the heartwood test
binaries to `PATH` before running the end-to-end tests.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-06-29 11:34:53 +02:00
Thomas Scholtes f5900b873f Move History state loading to router
Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-06-13 17:52:39 +02:00
Thomas Scholtes 5c7806ecff Fix anchor links
Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-05-11 10:51:35 +02:00