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://development.opencast.org
VITE_TEST_SERVER_AUTH="admin:opencast"
  • Loading branch information
geichelberger committed Jun 4, 2024
1 parent df844de commit 71d4edf
Show file tree
Hide file tree
Showing 195 changed files with 13 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 @@ -22,6 +22,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 @@ -30,10 +34,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 src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from "react";
import ReactDOM from "react-dom";
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) {
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);
}

ReactDOM.render(
<React.StrictMode>
<Provider store={store}>
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 71d4edf

Please sign in to comment.