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

Replace react-script with vite #471

Merged
merged 11 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/deploy-container-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ jobs:
message: |
Use `docker` or `podman` to test this pull request locally.

Local test with mock data
Run test server using develop.opencast.org as backend:
```
podman run --rm -it -p 127.0.0.1:3000:3000 ${{ steps.meta.outputs.tags }}
```

Proxy data from develop.opencast.org
Specify a different backend like stable.opencast.org:
```
podman run --rm -it -p 127.0.0.1:3000:3000 -e PROXY_TARGET=https://develop.opencast.org ${{ steps.meta.outputs.tags }}
podman run --rm -it -p 127.0.0.1:3000:3000 -e PROXY_TARGET=https://stable.opencast.org ${{ steps.meta.outputs.tags }}
```

It may take a few seconds for the interface to spin up.
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ WORKDIR /admin-interface
RUN npm ci

ENV CI true
CMD [ "npm", "start" ]
ENV BROWSER none
CMD [ "npm", "start", "--", "--host", "0.0.0.0"]
18 changes: 2 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,17 @@ This runs a development server at `http://localhost:3000`, serving a development
of the admin UI, and automatically opens a browser tab pointed to it.
The build and the browser tab should automatically refresh on every change you make
to the codebase.
By default, this server also replies mock data to the various requests
the UI would normally send to the Opencast backend.

Not all functionality of the admin UI works in this mode. If you need to test
with real data, or need the ability to change it, you can rely on the
proxy functionality of said development server, instead of running the static file server. Run:

```sh
PROXY=1 npm start
```

This assumes you have an Opencast instance running at `http://localhost:8080`
to which the development server will then proxy all the backend request,
The default target for API calls is `https://develop.opencast.org` to which the development server will proxy all the backend request,
authenticating them as user `admin` with password `opencast`.

If you want to work with a different Opencast and/or user, you can change the command thusly:

```sh
PROXY_TARGET=https://develop.opencast.org npm start
PROXY_TARGET=http://localhost:8080 npm start
ziegenberg marked this conversation as resolved.
Show resolved Hide resolved
```

Here, `PROXY_TARGET` is the target URL of the Opencast instance you want to test against.
This can also be a local one like `http://localhost:8080`.

By default, this tries to authenticate backend requests using HTTP Basic Auth
as user `admin` with the default password `opencast`.
Expand All @@ -59,8 +47,6 @@ in the `PROXY_AUTH` variable in the format `user:password`, as in
PROXY_TARGET=http://localhost:8080 PROXY_AUTH=jdoe:aligator3 npm start
```

Note that `PROXY=1` is not required if you specify either `PROXY_TARGET` or `PROXY_AUTH`.

Similarly, if you want to change the port the development server itself runs at,
you can specify an alternative port in the `PORT` environment variable.

Expand Down
24 changes: 24 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="/manifest.json" />
<title>Opencast</title>
</head>
<body id="root">
<noscript>You need to enable JavaScript to run this app.</noscript>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>
Loading
Loading