Skip to content

Commit

Permalink
Replace mock data with live data
Browse files Browse the repository at this point in the history
This change allows to configure the Axios client to use a different base
URL and set the authentication header.

NODE_ENV=development
VITE_TEST_SERVER_URL=https://develop.opencast.org
VITE_TEST_SERVER_AUTH="admin:opencast"
  • Loading branch information
geichelberger committed Jun 5, 2024
1 parent 77cb35e commit c7a4414
Show file tree
Hide file tree
Showing 196 changed files with 19 additions and 10,110 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/deploy-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ jobs:
run: npm ci

- name: build project
env:
NODE_ENV: development
VITE_TEST_SERVER_URL: "https://develop.opencast.org"
VITE_TEST_SERVER_AUTH: "admin:opencast"
run: npm run build

- name: create pages directory
Expand All @@ -34,10 +38,6 @@ jobs:
- name: include admin interface
run: mv build gh-pages/admin-ui

- name: include mock data
working-directory: ./gh-pages
run: cp -rv ../test/GET/* .

- name: include landing page
run: cp .github/demo-page.html gh-pages/index.html

Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/deploy-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ jobs:
- name: build app
env:
PUBLIC_URL: /${{ steps.build-path.outputs.build }}
NODE_ENV: development
VITE_TEST_SERVER_URL: "https://develop.opencast.org"
VITE_TEST_SERVER_AUTH: "admin:opencast"
run: npm run build

- name: prepare git
Expand Down Expand Up @@ -63,10 +66,6 @@ jobs:
run: |
git checkout gh-pages
- name: include mock data
working-directory: admin-interface-test
run: cp -rv ../test/GET/* .

- name: store build
working-directory: admin-interface-test
env:
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ PROXY_TARGET=http://localhost:8080 PROXY_AUTH=jdoe:aligator3 npm start
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.

If you aim to test against a remote server without using a proxy, you have the option to configure the target server with the `VITE_TEST_SERVER_URL`, and the `VITE_TEST_SERVER_AUTH` environment variables while using the node development mode:

```sh
NODE_ENV=development VITE_TEST_SERVER_URL="https://develop.opencast.org" VITE_TEST_SERVER_AUTH="admin:opencast" npm start
```

How to cut a release for Opencast
---------------------------------

Expand Down
6 changes: 6 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from "react";
import ReactDOMClient from "react-dom/client";
import "./index.css";
import App from "./App";
import axios from "axios";

// redux imports
import { persistStore } from "redux-persist";
Expand Down Expand Up @@ -31,6 +32,11 @@ const theme = createTheme({
}
})

if (import.meta.env.DEV && import.meta.env.VITE_TEST_SERVER_URL) {
axios.defaults.baseURL = import.meta.env.VITE_TEST_SERVER_URL || ""
axios.defaults.headers.common['Authorization'] = import.meta.env.VITE_TEST_SERVER_AUTH && ("Basic " + window.btoa(import.meta.env.VITE_TEST_SERVER_AUTH));
}

const container = document.getElementById("root");
if (!container) {
throw new Error("Failed to find the root element");
Expand Down
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
1 change: 0 additions & 1 deletion test/DELETE/admin-ng/theme/1

This file was deleted.

28 changes: 0 additions & 28 deletions test/GET/acl-manager/acl/1601

This file was deleted.

28 changes: 0 additions & 28 deletions test/GET/acl-manager/acl/1851

This file was deleted.

29 changes: 0 additions & 29 deletions test/GET/admin-ng/acl/1601

This file was deleted.

29 changes: 0 additions & 29 deletions test/GET/admin-ng/acl/31151

This file was deleted.

37 changes: 0 additions & 37 deletions test/GET/admin-ng/acl/acls.json

This file was deleted.

1 change: 0 additions & 1 deletion test/GET/admin-ng/acl/roles.json

This file was deleted.

21 changes: 0 additions & 21 deletions test/GET/admin-ng/adopter/registration

This file was deleted.

48 changes: 0 additions & 48 deletions test/GET/admin-ng/capture-agents/F300.1

This file was deleted.

48 changes: 0 additions & 48 deletions test/GET/admin-ng/capture-agents/agent1

This file was deleted.

9 changes: 0 additions & 9 deletions test/GET/admin-ng/capture-agents/agent2

This file was deleted.

Loading

0 comments on commit c7a4414

Please sign in to comment.