diff --git a/src/branding/branding.js b/src/branding/branding.js new file mode 100644 index 0000000..5baa395 --- /dev/null +++ b/src/branding/branding.js @@ -0,0 +1,37 @@ +/** + * This file is part of VILLASweb. + * + * VILLASweb is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * VILLASweb is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with VILLASweb. If not, see . + ******************************************************************************/ + +import brands from './brands' +import config from '../config' +import _ from 'lodash'; + +class Branding { + constructor(chosenbrand) { + var brand = _.get(brands, [chosenbrand]); + if (!brand) { + console.error("Branding '" + chosenbrand + "' not available, will use 'villasweb' branding"); + brand = _.get(brands, ['villasweb']); + } + + this.brand = brand; + } + + static instance = Branding.instance || new Branding(config.branding); +}; + + +export default Branding; \ No newline at end of file diff --git a/src/branding/brands.js b/src/branding/brands.js new file mode 100644 index 0000000..45db6c7 --- /dev/null +++ b/src/branding/brands.js @@ -0,0 +1,70 @@ +/** + * This file is part of VILLASweb. + * + * VILLASweb is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * VILLASweb is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with VILLASweb. If not, see . + ******************************************************************************/ + +const brands = { + villasweb: { + title: 'VILLASweb', + subtitle: 'ACS', + logo: 'villas_web.svg', + pages: { + home: true, + scenarios: true, + infrastructure: true, + users: true, + account: true, + api: true, + }, + links: { + "VILLASframework project": "http://fein-aachen.org/projects/villas-framework/", + "VILLASweb Documentation": "https://villas.fein-aachen.org/doc/web.html", + "VILLASweb frontend source": "https://git.rwth-aachen.de/acs/public/villas/web", + "VILLASweb backend source":"https://git.rwth-aachen.de/acs/public/villas/web-backend-go", + } + }, + slew: { + title: 'SLEW', + subtitle: 'Second Life for Energiewende', + logo: "slew-logo.png", + pages: { + home: true, + scenarios: true, + infrastructure: false, + users: false, + account: false, + api: false + }, + links: { + "DPsim Simulator": "https://dpsim.fein-aachen.org", + "VILLASframework": "https://villas.fein-aachen.org/doc" + } + }, + test: { + title: 'SLEW', + subtitle: 'Second Life for Energiewende', + logo: "slew-logo.png", + pages: { + home: true, + scenarios: true, + infrastructure: false, + users: false, + account: false, + api: false + }, + } +} + +export default brands; \ No newline at end of file diff --git a/src/common/header.js b/src/common/header.js index c5c71b7..69b0980 100644 --- a/src/common/header.js +++ b/src/common/header.js @@ -19,14 +19,14 @@ import React from 'react'; import { Col, Button } from 'react-bootstrap'; import { Hidden } from 'react-grid-system' import Icon from './icon'; -import config from '../config'; +import Branding from '../branding/branding'; class Header extends React.Component { render() { return (
-

{config.instance} - {config.subtitle}

+

{Branding.instance.brand.title} - {Branding.instance.brand.subtitle}

diff --git a/src/common/home.js b/src/common/home.js index 5932022..f8aa894 100644 --- a/src/common/home.js +++ b/src/common/home.js @@ -17,9 +17,11 @@ import React from 'react'; -import config from '../config'; import { Redirect } from "react-router-dom"; import { NavLink } from 'react-router-dom'; +import Branding from '../branding/branding'; + +const images = require.context('../img', true) class Home extends React.Component { @@ -38,50 +40,19 @@ class Home extends React.Component { return (); } + const brand = Branding.instance.brand; + return (
- Logo VILLASweb + Logo VILLASweb

Home

- {/*Welcome to {config.instance} hosted by {config.admin.name}!
*/} - Welcome to {config.instance}! + Welcome to {Branding.instance.brand.title}!

You are logged in as user {currentUser.username} with ID {currentUser.id} and role {currentUser.role}.

- - {/*

Data Model

- Datamodel VILLASweb - -

Terminology

- -
Infrastructure Component
-
    -
  • A component of research infrastructure
  • -
  • Category: for example simulator, gateway, amplifier, database, etc.
  • -
  • Type: for example RTDS, OpalRT, VILLASnode, Cassandra
  • -
- -
Component Configuration
-
    -
  • Input signals: Signals that can be modified in VILLASweb
  • -
  • Output signals: Signals that can be visualized on dashboards of VILLASweb
  • -
  • Parameters: Further configuration parameters of the infrastructure component
  • -
- -
Dashboard
-
    -
  • Visualize ongoing experiments in real-time
  • -
  • Interact with ongoing experiments in real-time
  • -
- -
Scenario
-
    -
  • A collection of component configurations and dashboards for a specific experiment
  • -
  • Users can have access to multiple scenarios
  • -
*/} -

Credits

VILLASweb is an open source project developed by the Institute for Automation of Complex Power Systems at RWTH Aachen University.

Logo ACS diff --git a/src/common/menu-sidebar.js b/src/common/menu-sidebar.js index 2e953f8..1b7208e 100644 --- a/src/common/menu-sidebar.js +++ b/src/common/menu-sidebar.js @@ -17,24 +17,53 @@ import React from 'react'; import { NavLink } from 'react-router-dom'; +import Branding from '../branding/branding'; + class SidebarMenu extends React.Component { render() { + const brand = Branding.instance.brand; + console.log(brand.links) + let links = [] + + /*++++ + for (var key of Object.keys(brand.links) ) { + console.log(`${key}: ${brand.links[key]}`); + links.push(
  • {key}
  • ); + }*/ + + if (brand.links) { + Object.keys(brand.links).forEach(key => { + console.log(`${key}: ${brand.links[key]}`); + links.push(
  • {key}
  • ); + }) + } + + return (

    Menu

      -
    • Home
    • -
    • Scenarios
    • -
    • Infrastructure Components
    • - { this.props.currentRole === 'Admin' ? -
    • User Management
    • : '' + + + + {this.props.currentRole === 'Admin' ? +
    • User Management
    • : '' } -
    • Account
    • +
    • Logout
    • -
    • API Browser
    • +
    + { + links.length > 0 ? +
    +

    +

    Links

    +
      {links}
    +
    + : '' + }
    ); } diff --git a/src/config.js b/src/config.js index 874e58f..c7998c0 100644 --- a/src/config.js +++ b/src/config.js @@ -16,13 +16,12 @@ ******************************************************************************/ const config = { - publicPathBase: 'public/', - instance: 'VILLASweb', - subtitle: 'ACS', - admin: { - name: 'Institute for Automation of Complex Power Systems (ACS), RWTH Aachen University, Germany', - mail: 'stvogel@eonerc.rwth-aachen.de' - } -}; + publicPathBase: 'public/', + admin: { + name: 'Institute for Automation of Complex Power Systems (ACS), RWTH Aachen University, Germany', + mail: 'stvogel@eonerc.rwth-aachen.de' + }, + branding: 'slew', +} export default config diff --git a/src/img/slew-logo.png b/src/img/slew-logo.png new file mode 100644 index 0000000..747bf83 Binary files /dev/null and b/src/img/slew-logo.png differ diff --git a/src/router.js b/src/router.js index 05cf900..6b9321d 100644 --- a/src/router.js +++ b/src/router.js @@ -29,6 +29,7 @@ import InfrastructureComponents from './ic/ics'; import Users from './user/users'; import User from "./user/user"; + class Root extends React.Component { render() { return (