Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "Create series" API and route #1325

Draft
wants to merge 17 commits into
base: next
Choose a base branch
from
Draft

Conversation

owi92
Copy link
Member

@owi92 owi92 commented Jan 28, 2025

Step 3 in adding features for proper series management.

This adds a new page and UI to create a series in Tobira and Opencast.
The UI allows setting title, description and ACL for the series.

Next steps:

Based on #1313

@github-actions github-actions bot temporarily deployed to test-deployment-pr1325 January 28, 2025 17:29 Destroyed
@owi92 owi92 added the changelog:user User facing changes label Feb 3, 2025
@github-actions github-actions bot temporarily deployed to test-deployment-pr1325 February 3, 2025 10:38 Destroyed
@github-actions github-actions bot added the status:conflicts This PR has conflicts that need to be resolved label Feb 4, 2025
Copy link

github-actions bot commented Feb 4, 2025

This pull request has conflicts ☹
Please resolve those so we can review the pull request.
Thanks.

@github-actions github-actions bot removed the status:conflicts This PR has conflicts that need to be resolved label Feb 5, 2025
@github-actions github-actions bot temporarily deployed to test-deployment-pr1325 February 5, 2025 13:28 Destroyed
@github-actions github-actions bot temporarily deployed to test-deployment-pr1325 February 11, 2025 18:08 Destroyed
@github-actions github-actions bot added the status:conflicts This PR has conflicts that need to be resolved label Feb 24, 2025
Copy link

This pull request has conflicts ☹
Please resolve those so we can review the pull request.
Thanks.

owi92 added 11 commits February 24, 2025 17:28
This generalizes the `Nav` and `Details` code that
was used for videos, and repurposes it for series
as well.

With these changes, it should also be fairly
easy to add this for playlists later on.
This required a bunch of changes:
- The `update_acl` endpoint which talks to Opencast
  was generalized to work for both events and series,
  as their acl `put` endpoints pretty much work the same.
- The access page of events was refactored and most code
  is now usable for both events and series. This tries to
  walk the thin line between modularity and overspecialization
  by attempting to balance out reusablility and complexity,
  limiting both duplicated code and prop drilling.
This adds a somewhat generic function that can be used
to send `update metadata` put requests to Opencast for
both events and series, as their respective endpoints
only differ in one string (i.e. `series` vs `events`).

For now, the function is only used to update title and
description, but it can be used for any kind of dublincore
metadata.
This refactors the metadata form to be more generic. Again,
it's a tradeoff between limiting duplication and making the
code more complicated.

I also changed the naming convention of the series/video
details and access pages to use more specific names, which
will hopefully be less confusing.
This repurposes the `delete` endpoint previously used
by events, and basically mirrors everything done when
an event is deleted.

This means the series table is renamed to `all_series`
and gets a field `tobiraDeletionTimestamp`, which is
used to mark a series as deleted. The original series
table is moved to a view.

When a series is deleted in Tobira, the timestamp is saved
and series marked as deleted, but still present in Opencast
get a special entry in the `My series` table. Every other
place uses the series view without deleted series.

When the series is actually deleted in Opencast and removed
from the DB with sync, the entry from the `My series` table
also disappears.
This, once again, is a bunch of generalization to leverage
the fact that we already have basically all that is needed
for this.
While that makes it sound relatively simple, this was still
a lot of work, mostly to not just copy everything but factor
out as much as possible and make it usable for both events and
series, and possibly also playlists in the future.
There are still some things that need ironing out:
- There is a deserialization error where postgres complains
about a null value
- The translation/i18n doesn't seem to be working correctly for all
cases
This page uses the `series_by_id` api, which doesn't
use the new `thumbnailStack` field. It could, but that would
need some additional mapping in backend and should then
probably also be used in all other places that need
a series thumbnail.
That would have the added benefit of these thumbnails always
having the same order everywhere. Right now, that's not given
since the only place the `thumbnailStack` is used as of now
orders them in backend by their creation date (ascending),
which we don't do for the other occurences that are mapped in
frontend.
So this is super annoying. The endpoint in opencast will
start `republish metadata` workflows for each event in the
series. This takes roughly 10 second **per video**.
Not in parallel but.. in.. series (pun intended? idk).

So long story short, it could take several minutes to return,
at which point it probably just responds with a `503`.
The series is still being deleted though, so I don't know how
to handle that case.

Anyway, this workaround will send the request, mark the series
as deleted and then just return without waiting. If it fails,
it will **eventually** become apparent, but until then it's just
showing as `deletion pending`, or sth. Actually, depending on
the configured interval, it will already show `deletion failed`
after a couple of minutes or sooner, when the "deletion process"
is still running in Opencast. So all in all a poor solution but
idk what else to do here other than an Opencast rewrite™.
@github-actions github-actions bot removed the status:conflicts This PR has conflicts that need to be resolved label Feb 26, 2025
@github-actions github-actions bot temporarily deployed to test-deployment-pr1325 February 26, 2025 11:53 Destroyed
This could also be used for other purposes, but is
currently only used for displaying a message on
the "My series" table when a series gets deleted.
The notification will clear when the user navigates away
from the table.

This commit also fixes the table layout on narrow screens.
Previously, the table would squish the "Title" column
and overlap it with the one right next to it. Now each
column uses a fixed width on smaller screens and adds
a scrollbar, it it gets too crammed.
This could also be used for other purposes, but is
currently only used for displaying a message on
the "My series" table when a series gets deleted.
The notification will clear when the user navigates away
from the table.

This commit also fixes the table layout on narrow screens.
Previously, the table would squish the "Title" column
and overlap it with the one right next to it. Now each
column uses a fixed width on smaller screens and adds
a scrollbar, it it gets too crammed.
This adds:
- a function to send a `create` request to Opencast
- the graphQL endpoint to call that function from the frontend

The function needs to be given ACL and a title as parameters,
and can be given a description. It then constructs the
metadata json that is expected by the Opencast endpoint and
appends this and the serialized ACL information.

The Opencast endpoint returns a new Opencast ID for the
series, which in conjunction with the title and ACL  can be
used to "prefigure" the series in Tobira.
Doing so allows a new series entry to be shown in the
"My series" table without having to wait for sync.
This route features an interface with can be used to configure
title, description and ACL for a new series and create said
series using the API endpoint from the previous commit.
This utilizes the recently added notification context
to show a note "Series has been created" on the
series details page. The user will be redirected to that
page after a series has been freshly created.
The note will clear when the user navigates away from
that page.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:user User facing changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant