Skip to content

Fix clean metadata #1235

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

priya-tik
Copy link

Refactored the "transformMetadataForUpdate" function to clean the metadata payload and ensure only the essential fields (id and value) are included in the request.

This change reduces the size of the payload and ensures it aligns with the backend's expected structure.

Copy link
Contributor

Hi @priya-tik
Thank you for contributing to the Opencast Admin UI.
We noticed that you have not yet filed an Individual Contributor License Agreement. Doing that (once) helps us to ensure that Opencast stays free for all. If you make your contribution on behalf of an institution, you might also want to file a Corporate Contributor License Agreement (giving you as individual contributor a bit more security as well). It can take a while for this bot to find out about new filings, so if you just filed one or both of the above do not worry about this message!
Please let us know if you have any questions regarding the CLA.

Copy link
Contributor

Use docker or podman to test this pull request locally.

Run test server using develop.opencast.org as backend:

podman run --rm -it -p 127.0.0.1:3000:3000 ghcr.io/opencast/opencast-admin-interface:pr-1235

Specify a different backend like stable.opencast.org:

podman run --rm -it -p 127.0.0.1:3000:3000 -e PROXY_TARGET=https://stable.opencast.org ghcr.io/opencast/opencast-admin-interface:pr-1235

It may take a few seconds for the interface to spin up.
It will then be available at http://127.0.0.1:3000.
For more options you can pass on to the proxy, take a look at the README.md.

Copy link
Contributor

github-actions bot commented May 13, 2025

This pull request is deployed at test.admin-interface.opencast.org/1235/2025-05-23_10-13-06/ .
It might take a few minutes for it to become available.

@Arnei Arnei added the type:bug Something isn't working label May 13, 2025
Copy link
Contributor

@ppettit ppettit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This helps with #1230 a little. It only requests /admin-ng/event/new/metadata once each time you click "create event", but now it looks like nothing is happening for several seconds while it loads. Closing the dialog also takes a couple of seconds.

metadata.fix.mp4

Also for opening an existing event metadata there are still 2 requests

metadata.fix.existing.mp4

It also looks like there are a bunch of unrelated changes in this PR.

@ppettit
Copy link
Contributor

ppettit commented May 13, 2025

on further testing I don't think this PR has an effect on #1230 at all. @priya-tik did you comment on the correct issue?

@priya-tik
Copy link
Author

@ppettit, Thanks for the feedback! You're right — this looks like a separate issue. My PR focuses on reducing the amount of unnecessary series data fetched from /admin-ng/event/{id}/metadata, but it doesn’t address the number of times the endpoint is called. I agree that repeated calls on open and close are a performance concern — I can look into that next as a follow-up task.

Copy link
Contributor

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

Copy link
Contributor

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

@priya-tik priya-tik force-pushed the fix-clean-metadata branch from 8b3f6e9 to 8f72174 Compare May 22, 2025 06:18
Copy link
Member

@Arnei Arnei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does very significantly reduce the payload when sending updated event or series metadata to the backend. Code looks generally good and from my testing nothing else seems to break.

Mostly nitpicks below.

@@ -1,3 +1,4 @@
import { User } from "../../slices/userSlice";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dead import

// Redirect to login if not in ROLE_ADMIN_UI
if (!(res.roles.includes('ROLE_ADMIN') || res.roles.includes('ROLE_ADMIN_UI'))) {
window.location.href = "/login.html";
export const fetchUserInfo = createAppAsyncThunk(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All changes in this file seem unrelated to the issue you are trying to fix. If you still feel like they belong in the codebase, please explain why they belong in this PR or submit them as another PR and state your intentions there,

@@ -69,6 +69,7 @@ export const fetchUsers = createAppAsyncThunk('users/fetchUsers', async (_, { ge
// This will automatically dispatch a `pending` action first,
// and then `fulfilled` or `rejected` actions based on the promise.
const res = await axios.get("/admin-ng/users/users.json", { params: params });
console.log("this is the response", res);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superfluous logging statement.

@Arnei
Copy link
Member

Arnei commented May 23, 2025

While you're latest commit addressed some of the style issues, it also applied style changes to a bunch of unrelated code. It would be nice if you could avoid that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants