Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
abf7efd
Fix IC creation bouncing issue
SystemsPurge Oct 23, 2024
94c906a
remove shutdown button from ic actions
Anyandsi Oct 23, 2024
1c3a800
Add missing parameters when sending action to ic
Anyandsi Oct 24, 2024
fdfe7b8
Refactor PlayerWidget into a functional component
Anyandsi Oct 24, 2024
9825122
fix: incomplete URL, remove useless files from rebase
SystemsPurge Oct 24, 2024
957f55a
fix: status widget and player widget
SystemsPurge Oct 28, 2024
c83e6ca
Add hooks for activation and deactivation of player widget, on ic sta…
SystemsPurge Oct 28, 2024
91a7c02
fix: icstatus due to bouncing, player for responsiveness, python dial…
SystemsPurge Oct 28, 2024
b815c07
add: handling for missing use case in player widget
SystemsPurge Oct 30, 2024
79f34f7
add: downtime for play button
SystemsPurge Oct 30, 2024
f24cb36
fix: duplicate widgets for duplicated scenarios
SystemsPurge Oct 30, 2024
67a2f36
Clean up logs
SystemsPurge Oct 31, 2024
181d2e8
add: start parameters update from within dashboard
SystemsPurge Oct 31, 2024
28db73e
fix: wrong variable name
SystemsPurge Nov 4, 2024
df3c63e
change: recreate action to recreate every managed component, includin…
SystemsPurge Nov 11, 2024
063984f
Remove useless logging
SystemsPurge Nov 11, 2024
ac4671d
Transferr branding code to right branch
SystemsPurge Jan 8, 2025
9a5757b
Add missing branding cases in branding.js
SystemsPurge Jan 8, 2025
9d901b1
fix: mistake in ic type case enumeration
SystemsPurge Jan 10, 2025
301ceb8
Fix readonly widget.customProperties, add websocketSlice reducer and …
SystemsPurge Mar 19, 2025
e2ec45d
Add enershare branding
SystemsPurge Mar 19, 2025
755ea39
Make widget component report initial values without simStart
SystemsPurge Mar 19, 2025
6b63625
Add enershare branding to build CI
SystemsPurge Mar 19, 2025
f81051e
Update modal for the ICs creation
Anyandsi Nov 13, 2024
050efe8
Fix small typo in a comment
Anyandsi Nov 25, 2024
c06b16c
Add error boundary to the dashboard and start refactoring
Anyandsi Dec 3, 2024
faae8b1
Change widget context menu into a functional component
Anyandsi Jan 16, 2025
a20c86a
Update refactored widget behavior
Anyandsi Jan 22, 2025
6f87dfa
Fix wrong ic modal type/category filtration
Anyandsi Apr 9, 2025
3247cce
add error boundary to the dashboard refactor widgets and dashboard co…
Anyandsi Dec 3, 2024
3a274c1
add Kopernikus branding
Anyandsi Dec 4, 2024
7e538ac
remove new branding from the wrong branch
Anyandsi Dec 4, 2024
f65502e
transfer dashboard and widgets changes to a new branch
Anyandsi Apr 8, 2025
38e1361
Update Button Widget
Anyandsi Apr 17, 2025
7f019bb
fix: duplicate/missing declarations in multiple files
SystemsPurge May 7, 2025
ed8a623
remove useless code
SystemsPurge May 8, 2025
5d59133
fix: missing export in authslice
SystemsPurge May 8, 2025
3e807b4
fix: missing useRef definition in app.js
SystemsPurge May 8, 2025
81ee331
fix: missing imports in dashboard and kube ic page
SystemsPurge May 8, 2025
848ca90
fix: wrong prop name, missing imports in various widgets
SystemsPurge May 8, 2025
8c1242a
add usergroups back to user page
SystemsPurge May 8, 2025
e3c2b8c
fix: sequence not updating on ws message input
SystemsPurge May 14, 2025
7aee9e5
add: enershare branding
SystemsPurge Jun 3, 2025
e074aff
fix: wrong variable name in branding
SystemsPurge Jun 3, 2025
bb0f6e1
fix: missing prop passed to IcActionBoard
SystemsPurge Jun 17, 2025
0a8c0f1
Merge branch 'fix-requests' into branding
SystemsPurge Jun 17, 2025
6cf341e
remove brand specific data, make branding applicable through a volume…
SystemsPurge Aug 19, 2025
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
34 changes: 2 additions & 32 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,52 +10,22 @@ build:
stage: build
image:
name: docker
variables:
BRANDING: villasweb
DOCKER_TAG: ${CI_COMMIT_BRANCH}-${BRANDING}
script:
- docker build --build-arg REACT_APP_BRAND=${BRANDING} --tag ${DOCKER_IMAGE}:${DOCKER_TAG} .
- docker build --build-arg REACT_APP_BRAND=${BRANDING} --tag ${DOCKER_IMAGE}:${CI_COMMIT_BRANCH} .
tags:
- docker

build.slew:
variables:
BRANDING: slew
DOCKER_TAG: ${CI_COMMIT_BRANCH}-${BRANDING}
extends: build

build.opalrt:
variables:
BRANDING: opalrt
DOCKER_TAG: ${CI_COMMIT_BRANCH}-${BRANDING}
extends: build

deploy:
stage: deploy
variables:
BRANDING: villasweb
DOCKER_TAG: ${CI_COMMIT_BRANCH}-${BRANDING}
before_script:
- docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY}
script:
- docker push ${DOCKER_IMAGE}:${DOCKER_TAG}
- docker push ${DOCKER_IMAGE}:${CI_COMMIT_BRANCH}
tags:
- docker
dependencies:
- build

deploy.slew:
extends: deploy
variables:
BRANDING: slew
DOCKER_TAG: ${CI_COMMIT_BRANCH}-${BRANDING}

deploy.opalrt:
extends: deploy
variables:
BRANDING: opalrt
DOCKER_TAG: ${CI_COMMIT_BRANCH}-${BRANDING}

deploy.latest:
extends: deploy
variables:
Expand Down
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,16 @@ ARG REACT_APP_BRAND
COPY . /usr/src/app
# Production build, CI=false prevents warnings from being treated as errors
RUN CI=false npm run build
WORKDIR /usr/src/app/build

RUN sed -i 's/<\/body>/<script src="\/static\/js\/injector.js"><\/script><link href="\/static\/css\/style.css" rel="stylesheet"><\/body>/g' index.html
RUN mkdir -p branding/img
ADD ./src/branding/default /usr/src/app/build/branding
ADD ./src/branding/img /usr/src/app/build/branding/img
ADD ./src/branding/injector.js /usr/src/app/build/static/js
ADD ./src/branding/style.css /usr/src/app/build/static/css

FROM nginx

COPY --from=builder /usr/src/app/build /usr/share/nginx/html
#EXPECT BRANDING VOLUME TO /usr/share/nginx/html/branding
9 changes: 9 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
services:
web:
build:
context: .
volumes:
- ./brand-mount:/usr/share/nginx/html/branding
ports:
- 2980:80
- 2443:443
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@
"react-scripts": "^4.0.3"
},
"scripts": {
"start": "react-scripts --openssl-legacy-provider start",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"proxy": "https://villas.k8s.eonerc.rwth-aachen.de",
"proxy": "https://slew.k8s.eonerc.rwth-aachen.de/",
"browserslist": {
"production": [
">0.2%",
Expand Down
185 changes: 108 additions & 77 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,102 +15,133 @@
* along with VILLASweb. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/

import React from 'react';
import { DndProvider } from 'react-dnd';
import { HTML5Backend }from 'react-dnd-html5-backend';
import NotificationSystem from 'react-notification-system';
import { Redirect, Route } from 'react-router-dom';
import jwt from 'jsonwebtoken';
import NotificationsDataManager from './common/data-managers/notifications-data-manager';
import Home from './common/home';
import Header from './common/header';
import Menu from './common/menu';
import InfrastructureComponent from './pages/infrastructure/ic';
import Scenarios from './pages/scenarios/scenarios';
import APIBrowser from './common/api-browser';
import Scenario from './pages/scenarios/scenario';
import Users from './pages/users/users';
import Dashboard from './pages/dashboards/dashboard';
import Account from './pages/account/account';
import './styles/app.css';
import './styles/login.css';
import branding from './branding/branding';
import Logout from './pages/login/logout';
import Infrastructure from './pages/infrastructure/infrastructure';
import { useSelector } from 'react-redux';
import React from "react";
import { useRef, useEffect } from "react";
import { DndProvider } from "react-dnd";
import { HTML5Backend } from "react-dnd-html5-backend";
import NotificationSystem from "react-notification-system";
import { Redirect, Route } from "react-router-dom";
import jwt from "jsonwebtoken";
import NotificationsDataManager from "./common/data-managers/notifications-data-manager";
import Home from "./common/home";
import Header from "./common/header";
import Menu from "./common/menu";
import InfrastructureComponent from "./pages/infrastructure/ic";
import Scenarios from "./pages/scenarios/scenarios";
import APIBrowser from "./common/api-browser";
import Scenario from "./pages/scenarios/scenario";
import Users from "./pages/users/users";
import Dashboard from "./pages/dashboards/dashboard.jsx";
import Account from "./pages/account/account";
import "./styles/app.css";
import "./styles/login.css";
import Logout from "./pages/login/logout";
import Infrastructure from "./pages/infrastructure/infrastructure";
import Usergroup from "./pages/usergroups/usergroup";
import { useSelector } from "react-redux";
import DashboardErrorBoundary from "./pages/dashboards/dashboard-error-boundry";
import { villasweb_footer } from "./branding/functions.js";

const App = () => {

const isTokenExpired = (token) => {
let decodedToken = jwt.decode(token);
let timeNow = (new Date().getTime() + 1) / 1000;
return decodedToken.exp < timeNow;
}
};

const notificationSystem = useRef(null);

useEffect(() => {
NotificationsDataManager.setSystem(notificationSystem.current);

return () => {
NotificationsDataManager.setSystem(null);
};
}, []);

const { isAuthenticated, token, user } = useSelector((state) => state.auth);

if (!isAuthenticated || isTokenExpired(token)) {
console.log("APP redirecting to logout/login");
return (<Redirect to="/logout" />);
return <Redirect to="/logout" />;
} else {

console.log("APP rendering app");
const pages = branding.values.pages;

return (<DndProvider backend={HTML5Backend} >
<div className="app">
<NotificationSystem />
<Header />
return (
<DndProvider backend={HTML5Backend}>
<div className="app">
<NotificationSystem ref={notificationSystem} />
<Header />

<div className='app-body app-body-spacing'>
<Menu currentRole={user.role} />
<div className="app-body app-body-spacing">
<Menu currentRole={user.role} />

<div className='app-content app-content-margin-left'>
<Route exact path="/" component={Home} />
{ pages.home ? <Route path="/home" component={Home} /> : '' }
{ pages.scenarios ? <>
<Route exact path="/scenarios">
<Scenarios />
</Route>
<Route exact path="/logout">
<Logout />
</Route>
<Route path="/scenarios/:scenario">
<Scenario />
</Route>
<Route path="/dashboards/:dashboard">
<Dashboard />
</Route>
<Route path="/dashboards-new/:dashboard">
<Dashboard />
</Route>
</>
: '' }
{ user.role === "Admin" || pages.infrastructure ? <>
<Route exact path="/infrastructure">
<Infrastructure />
</Route>
<Route path="/infrastructure/:ic">
<InfrastructureComponent />
</Route>
</>
: '' }
{ pages.account ? <Route path="/account"><Account /></Route> : '' }
{ user.role === "Admin" ?
<Route path="/users">
<Users />
</Route>
: '' }
{ user.role === "Admin" || pages.api ?
<Route path="/api" component={APIBrowser} />
: '' }
<div className="app-content app-content-margin-left">
<Route exact path="/" component={Home} />
<Route path="/home" component={Home} />
<>
<Route exact path="/scenarios">
<Scenarios />
</Route>
<Route exact path="/logout">
<Logout />
</Route>
<Route path="/scenarios/:scenario">
<Scenario />
</Route>
<Route path="/dashboards/:dashboard">
<DashboardErrorBoundary>
<Dashboard />
</DashboardErrorBoundary>
</Route>
<Route path="/dashboards-new/:dashboard">
<Dashboard />
</Route>
</>

{user.role === "Admin" ? (
<>
<Route exact path="/infrastructure">
<Infrastructure />
</Route>
<Route path="/infrastructure/:ic">
<InfrastructureComponent />
</Route>
</>
) : (
""
)}
<Route path="/account">
<Account />
</Route>

{user.role === "Admin" ? (
<>
<Route path="/users">
<Users />
</Route>
<Route path="/usergroup/:usergroup">
<Usergroup />
</Route>
</>
) : (
""
)}
{user.role === "Admin"? (
<Route path="/api" component={APIBrowser} />
) : (
""
)}
</div>
</div>
<footer className="app-footer" id="brand-footer">
{villasweb_footer()}
</footer>
</div>

{branding.getFooter()}
</div>
</DndProvider>)
</DndProvider>
);
}
}
};

export default App;
Loading