diff --git a/src/app.js b/src/app.js
index 07207a9..9f1e67d 100644
--- a/src/app.js
+++ b/src/app.js
@@ -29,21 +29,20 @@ import Home from './common/home';
import Header from './common/header';
import Menu from './common/menu';
-import InfrastructureComponents from './ic/ics';
-import InfrastructureComponent from './ic/ic';
+import InfrastructureComponent from './pages/infrastructure/ic';
import Dashboard from './dashboard/dashboard';
import Scenarios from './scenario/scenarios';
import Scenario from './scenario/scenario';
import Users from './user/users';
import User from './user/user';
import APIBrowser from './common/api-browser';
-import LoginStore from './user/login-store'
import './styles/app.css';
+import './styles/login.css';
import branding from './branding/branding';
-
+import Infrastructure from './pages/infrastructure/infrastructure'
class App extends React.Component {
@@ -53,10 +52,6 @@ class App extends React.Component {
this.state = {}
}
- static getStores() {
- return [LoginStore]
- }
-
componentDidMount() {
NotificationsDataManager.setSystem(this.refs.notificationSystem);
@@ -126,8 +121,12 @@ class App extends React.Component {
>
: '' }
{ currentUser.role === "Admin" || pages.infrastructure ? <>
-
-
+
+
+
+
+
+
>
: '' }
{ pages.account ? : '' }
diff --git a/src/common/confirm-command.js b/src/common/confirm-command.js
new file mode 100644
index 0000000..43b6885
--- /dev/null
+++ b/src/common/confirm-command.js
@@ -0,0 +1,48 @@
+/**
+ * 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 React from 'react';
+import { Button, Modal} from 'react-bootstrap';
+
+class ConfirmCommand extends React.Component {
+ onModalKeyPress = (event) => {
+ if (event.key === 'Enter') {
+ event.preventDefault();
+
+ this.props.onClose(false);
+ }
+ }
+
+ render() {
+ return this.props.onClose(false)} onKeyPress={this.onModalKeyPress}>
+
+ Confirm {this.props.command}
+
+
+
+ Are you sure you want to {this.props.command} '{this.props.name}'?
+
+
+
+
+
+
+ ;
+ }
+}
+
+export default ConfirmCommand;
diff --git a/src/common/rawDataTable.js b/src/common/rawDataTable.js
new file mode 100644
index 0000000..87ff5ba
--- /dev/null
+++ b/src/common/rawDataTable.js
@@ -0,0 +1,23 @@
+import { isJSON } from "../utils/isJson";
+import ReactJson from "react-json-view";
+
+const RawDataTable = (props) => {
+ if(props.rawData !== null && isJSON(props.rawData)){
+ return (
+
+ )
+ } else {
+ return (
+
No valid JSON raw data available.
+ )
+ }
+}
+
+export default RawDataTable;
\ No newline at end of file
diff --git a/src/localStorage.js b/src/localStorage.js
new file mode 100644
index 0000000..6486af4
--- /dev/null
+++ b/src/localStorage.js
@@ -0,0 +1,20 @@
+/**
+ * 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 .
+ ******************************************************************************/
+
+//authentication
+export const sessionToken = localStorage.getItem("token");
+export const currentUser = JSON.parse(localStorage.getItem("currentUser"));
\ No newline at end of file
diff --git a/src/pages/infrastructure/ic-category-table.js b/src/pages/infrastructure/ic-category-table.js
new file mode 100644
index 0000000..dce214a
--- /dev/null
+++ b/src/pages/infrastructure/ic-category-table.js
@@ -0,0 +1,225 @@
+/**
+ * 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 { useSelector, useDispatch } from "react-redux";
+
+import {Table, ButtonColumn, CheckboxColumn, DataColumn, LabelColumn, LinkColumn } from '../../common/table';
+import { Badge } from 'react-bootstrap';
+import FileSaver from 'file-saver';
+import _ from 'lodash';
+import moment from 'moment'
+import IconToggleButton from "../../common/buttons/icon-toggle-button";
+
+import { checkICsByCategory } from "../../store/icSlice";
+import { useState } from "react";
+
+import { stateLabelStyle } from "./styles";
+
+//a Table of IC components of specific category from props.category
+//titled with props.title
+const ICCategoryTable = (props) => {
+
+ const ics = useSelector(state => state.infrastructure.ICsArray);
+
+ let currentUser = JSON.parse(localStorage.getItem("currentUser"));
+
+ const checkedICs = useSelector(state => state.infrastructure.checkedICsArray);
+
+ const [isGenericDisplayed, setIsGenericDisplayed] = useState(false)
+
+ const exportIC = (index) => {
+ // filter properties
+ let ic = Object.assign({}, ics[index]);
+ delete ic.id;
+
+ // show save dialog
+ const blob = new Blob([JSON.stringify(ic, null, 2)], { type: 'application/json' });
+ FileSaver.saveAs(blob, 'ic-' + (_.get(ic, 'name') || 'undefined') + '.json');
+ }
+
+ const modifyUptimeColumn = (uptime, component) => {
+ if (uptime >= 0) {
+ let momentDurationFormatSetup = require("moment-duration-format");
+ momentDurationFormatSetup(moment)
+
+ let timeString = moment.duration(uptime, "seconds").humanize();
+ return {timeString}
+ }
+ else {
+ return unknown
+ }
+ }
+
+ const stateUpdateModifier = (updatedAt, component) => {
+ let dateFormat = 'ddd, DD MMM YYYY HH:mm:ss ZZ';
+ let dateTime = moment(updatedAt, dateFormat);
+ return dateTime.fromNow()
+ }
+
+ const statePrio = (state) => {
+ switch (state) {
+ case 'running':
+ case 'starting':
+ return 1;
+ case 'paused':
+ case 'pausing':
+ case 'resuming':
+ return 2;
+ case 'idle':
+ return 3;
+ case 'shutdown':
+ return 4;
+ case 'error':
+ return 10;
+ default:
+ return 99;
+ }
+ }
+
+
+ //if category of the table is manager we need to filter the generic-typed ics
+ //according to the state of IconToggleButton
+ let tableData = [];
+
+ if(props.category == "manager"){
+ tableData = ics.filter(ic=> (ic.category == props.category) && (isGenericDisplayed ** (ic.type == "generic")))
+ }else{
+ tableData = ics.filter(ic=> ic.category == props.category)
+ }
+
+ tableData.sort((a, b) => {
+ if (a.state !== b.state) {
+ return statePrio(a.state) > statePrio(b.state);
+ }
+ else if (a.name !== b.name) {
+ return a.name < b.name;
+ }
+ else {
+ return a.stateUpdatedAt < b.stateUpdatedAt;
+ }
+ })
+
+ const isLocalIC = (index, ics) => {
+ let ic = ics[index]
+ return !ic.managedexternally
+ }
+
+ const checkAllICs = (ics, title) => {
+ //TODO
+ }
+
+ const isICchecked = (ic) => {
+ //TODO
+ return false
+ }
+
+ const areAllChecked = (title) => {
+ //TODO
+ return false
+ }
+
+ const onICChecked = (ic, event) => {
+ //TODO
+ }
+
+ return (
+ );
+}
+
+export default ICCategoryTable;
\ No newline at end of file
diff --git a/src/pages/infrastructure/ic-pages/default-ic-page.js b/src/pages/infrastructure/ic-pages/default-ic-page.js
new file mode 100644
index 0000000..674f6fb
--- /dev/null
+++ b/src/pages/infrastructure/ic-pages/default-ic-page.js
@@ -0,0 +1,75 @@
+/**
+ * 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 React, { useEffect, useState } from 'react';
+import {Col, Row} from "react-bootstrap";
+import IconButton from '../../../common/buttons/icon-button';
+import ManagedICsTable from "./managed-ics-table";
+
+import { useDispatch } from 'react-redux';
+import { loadICbyId } from '../../../store/icSlice';
+import { sessionToken, currentUser } from '../../../localStorage';
+import { loadConfig } from '../../../store/configSlice';
+import { useSelector } from 'react-redux';
+import {refresh, rawDataTable} from "../ic"
+
+import ICParamsTable from '../ic-params-table';
+import RawDataTable from '../../../common/rawDataTable';
+
+import { iconStyle, buttonStyle } from "../styles";
+
+const DefaultICPage = (props) => {
+ const ic = props.ic;
+
+ const dispatch = useDispatch();
+
+ const refresh = () => {
+ dispatch(loadICbyId({token: sessionToken, id: ic.id}));
+ }
+
+ useEffect(() => {
+ }, []);
+
+ return (
+ )
+
+}
+
+export default DefaultICPage;
diff --git a/src/pages/infrastructure/ic-pages/default-manager-page.js b/src/pages/infrastructure/ic-pages/default-manager-page.js
new file mode 100644
index 0000000..79324ad
--- /dev/null
+++ b/src/pages/infrastructure/ic-pages/default-manager-page.js
@@ -0,0 +1,88 @@
+/**
+ * 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 React, { useEffect, useState } from 'react';
+import {Col, Row} from "react-bootstrap";
+import IconButton from '../../../common/buttons/icon-button';
+import ManagedICsTable from "./managed-ics-table";
+
+import { useDispatch } from 'react-redux';
+import { loadICbyId } from '../../../store/icSlice';
+import { sessionToken, currentUser } from '../../../localStorage';
+import { loadConfig } from '../../../store/configSlice';
+import { useSelector } from 'react-redux';
+import {refresh, rawDataTable} from "../ic"
+
+import ICParamsTable from '../ic-params-table';
+import RawDataTable from '../../../common/rawDataTable';
+
+import { iconStyle, buttonStyle } from "../styles";
+
+const DefaultManagerPage = (props) => {
+ const ic = props.ic;
+
+ const ics = useSelector((state) => state.infrastructure.ICsArray);
+
+ const dispatch = useDispatch();
+
+ const managedICs = ics.filter(managedIC => managedIC.category !== "manager" && managedIC.manager === ic.uuid);
+ const [jobName, setJobName] = useState(null);
+
+ const refresh = () => {
+ dispatch(loadICbyId({token: sessionToken, id: ic.id}));
+ }
+
+ useEffect(() => {
+ }, []);
+
+ return (
+ )
+
+}
+
+export default GatewayVillasNode;
\ No newline at end of file
diff --git a/src/pages/infrastructure/ic-pages/kubernetes-ic-page.js b/src/pages/infrastructure/ic-pages/kubernetes-ic-page.js
new file mode 100644
index 0000000..18873b9
--- /dev/null
+++ b/src/pages/infrastructure/ic-pages/kubernetes-ic-page.js
@@ -0,0 +1,170 @@
+/**
+ * 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 { useState, useEffect } from "react";
+import { Col, Row, Container, Table } from "react-bootstrap";
+import IconButton from "../../../common/buttons/icon-button";
+import ManagedICsTable from "./managed-ics-table";
+import FileSaver from 'file-saver';
+import RawDataTable from "../../../common/rawDataTable";
+import { downloadGraph } from "../../../utils/icUtils";
+import { sessionToken, currentUser } from "../../../localStorage";
+import { useDispatch, useSelector } from "react-redux";
+import { loadAllICs, loadICbyId } from "../../../store/icSlice";
+
+import ICParamsTable from "../ic-params-table";
+
+import { iconStyle, buttonStyle } from "../styles";
+
+const KubernetesICPage = (props) => {
+
+ const dispatch = useDispatch();
+
+ const ic = props.ic;
+
+ const ics = useSelector((state) => state.infrastructure.ICsArray);
+ const config = useSelector((state) => state.config.config);
+ //const managedICs = ics.filter(managedIC => managedIC.category !== "manager" && managedIC.manager === ic.uuid);
+
+ let namespace = null;
+ let jobName = null;
+ let podNames = [];
+ let clusterName = null;
+ let rancherURL = null;
+
+ let managerIC = ics.find(manager => manager.uuid === ic.manager);
+
+ // Take k8s cluster details from managers status update
+ if (managerIC != null) {
+ let managerProps = managerIC.statusupdateraw.properties;
+
+ if (managerProps != null) {
+ rancherURL = managerProps.rancher_url;
+ clusterName = managerProps.cluster_name;
+ }
+ }
+
+ // Fallback to backend config
+ if (config != null && config.kubernetes != null) {
+ let k8s = config.kubernetes;
+ if (k8s != null) {
+ if (rancherURL == null) {
+ rancherURL = k8s.rancher_url
+ }
+
+ if (clusterName == null) {
+ clusterName = k8s.cluster_name
+ }
+ }
+ }
+
+ if (rancherURL != null && clusterName != null) {
+ if (ic.statusupdateraw != null) {
+ let icProps = ic.statusupdateraw.properties
+ if (icProps != null && icProps.namespace != null) {
+ namespace = icProps.namespace;
+ jobName = icProps.job_name;
+
+ if (icProps.pod_names != null) {
+ podNames = icProps.pod_names;
+ }
+ }
+ }
+ }
+
+ let rancherTableRows = []
+
+ if (rancherURL != null && clusterName != null) {
+ let baseURL = rancherURL + "/dashboard/c/" + clusterName + "/explorer";
+
+ if (namespace != null) {
+ if (jobName != null) {
+ let url = baseURL + "/batch.job/" + namespace + "/" + jobName;
+
+ rancherTableRows.push(
+ )
+}
+
+export default KubernetesICPage;
diff --git a/src/pages/infrastructure/ic-pages/managed-ics-table.js b/src/pages/infrastructure/ic-pages/managed-ics-table.js
new file mode 100644
index 0000000..40c8414
--- /dev/null
+++ b/src/pages/infrastructure/ic-pages/managed-ics-table.js
@@ -0,0 +1,59 @@
+/**
+ * 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 React from 'react';
+import { Table, LabelColumn, LinkColumn, DataColumn } from '../../../common/table';
+import { stateLabelStyle } from "../styles";
+
+
+class ManagedICsTable extends React.Component {
+
+ render() {
+
+ return (
+ )
+ }
+
+}
+
+export default ManagedICsTable;
diff --git a/src/pages/infrastructure/ic-pages/manager-villas-node.js b/src/pages/infrastructure/ic-pages/manager-villas-node.js
new file mode 100644
index 0000000..6221c17
--- /dev/null
+++ b/src/pages/infrastructure/ic-pages/manager-villas-node.js
@@ -0,0 +1,99 @@
+/**
+ * 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 { useState, useEffect } from "react";
+import { Col, Row } from "react-bootstrap";
+import IconButton from "../../../common/buttons/icon-button";
+import ManagedICsTable from "./managed-ics-table";
+import FileSaver from 'file-saver';
+import RawDataTable from "../../../common/rawDataTable";
+import { downloadGraph } from "../../../utils/icUtils";
+import { sessionToken, currentUser } from "../../../localStorage";
+import { useDispatch, useSelector } from "react-redux";
+import { loadAllICs, loadICbyId } from "../../../store/icSlice";
+
+import ICParamsTable from "../ic-params-table";
+
+import { iconStyle, buttonStyle } from "../styles";
+
+const ManagerVillasNode = (props) => {
+
+ const dispatch = useDispatch();
+
+ const ic = props.ic;
+
+ const ics = useSelector((state) => state.infrastructure.ICsArray);
+ const managedICs = ics.filter(managedIC => managedIC.category !== "manager" && managedIC.manager === ic.uuid);
+ const graphURL = ic.apiurl !== "" ? ic.apiurl + "/graph.svg" : "";
+
+ const refresh = () => {
+ dispatch(loadICbyId({token: sessionToken, id: ic.id}));
+ }
+
+ return (
+
)
+}
+
+export default ManagerVillasNode;
diff --git a/src/pages/infrastructure/ic-pages/manager-villas-relay.js b/src/pages/infrastructure/ic-pages/manager-villas-relay.js
new file mode 100644
index 0000000..92f1d6f
--- /dev/null
+++ b/src/pages/infrastructure/ic-pages/manager-villas-relay.js
@@ -0,0 +1,81 @@
+/**
+ * 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 { useState, useEffect } from "react";
+import { Col, Row, Container } from "react-bootstrap";
+import IconButton from "../../../common/buttons/icon-button";
+import ManagedICsTable from "./managed-ics-table";
+import RawDataTable from "../../../common/rawDataTable";
+import { sessionToken, currentUser } from "../../../localStorage";
+import { useDispatch, useSelector } from "react-redux";
+import { loadAllICs, loadICbyId } from "../../../store/icSlice";
+
+import ICParamsTable from "../ic-params-table";
+
+import { iconStyle, buttonStyle } from "../styles";
+
+const ManagerVillasRelay = (props) => {
+
+ const dispatch = useDispatch();
+
+ const ic = props.ic;
+
+ const ics = useSelector((state) => state.infrastructure.ICsArray);
+ const managedICs = ics.filter(managedIC => managedIC.category !== "manager" && managedIC.manager === ic.uuid);
+
+ const refresh = () => {
+ dispatch(loadICbyId({token: sessionToken, id: ic.id}));
+ }
+
+ return (
+ )
+}
+
+export default ICParamsTable;
\ No newline at end of file
diff --git a/src/pages/infrastructure/ic.js b/src/pages/infrastructure/ic.js
new file mode 100644
index 0000000..d7b3d2a
--- /dev/null
+++ b/src/pages/infrastructure/ic.js
@@ -0,0 +1,63 @@
+/**
+ * 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 { useEffect, useRef } from "react";
+import { sessionToken, currentUser } from "../../localStorage";
+import { useDispatch, useSelector } from "react-redux";
+import { useParams } from 'react-router-dom';
+import { loadAllICs, loadICbyId } from "../../store/icSlice";
+import { loadConfig } from "../../store/configSlice";
+
+import DefaultManagerPage from "./ic-pages/default-manager-page";
+import GatewayVillasNode from "./ic-pages/gateway-villas-node";
+import ManagerVillasNode from "./ic-pages/manager-villas-node";
+import ManagerVillasRelay from "./ic-pages/manager-villas-relay";
+import KubernetesICPage from "./ic-pages/kubernetes-ic-page";
+import DefaultICPage from "./ic-pages/default-ic-page";
+
+const InfrastructureComponent = (props) => {
+ const params = useParams();
+ const id = params.ic;
+ const dispatch = useDispatch();
+
+ const ic = useSelector(state => state.infrastructure.currentIC);
+ const isICLoading = useSelector(state => state.infrastructure.isCurrentICLoading);
+
+ useEffect(() => {
+ dispatch(loadAllICs({token: sessionToken}));
+ dispatch(loadICbyId({token: sessionToken, id: id}));
+ dispatch(loadConfig({token: sessionToken}));
+ }, []);
+
+ if(ic == null || ic === undefined){
+ return
Loading...
+ } else if(ic.category ==="gateway" && ic.type === "villas-node"){
+ return
+ } else if(ic.category ==="manager" && ic.type === "villas-node"){
+ return
+ } else if(ic.category ==="manager" && ic.type === "villas-relay"){
+ return
+ } else if(ic.category ==="manager") {
+ return
+ } else if(ic.category === "simulator" && ic.type === "kubernetes"){
+ return
+ } else {
+ return
+ }
+}
+
+export default InfrastructureComponent;
\ No newline at end of file
diff --git a/src/pages/infrastructure/infrastructure.js b/src/pages/infrastructure/infrastructure.js
new file mode 100644
index 0000000..a69211d
--- /dev/null
+++ b/src/pages/infrastructure/infrastructure.js
@@ -0,0 +1,140 @@
+/**
+ * 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 { useEffect, useState } from "react"
+import { useDispatch } from "react-redux";
+import { useSelector } from "react-redux";
+import { Badge } from 'react-bootstrap';
+
+import { loadAllICs, loadICbyId } from "../../store/icSlice";
+import { set } from "lodash";
+
+import IconButton from "../../common/buttons/icon-button";
+
+import ICCategoryTable from "./ic-category-table";
+
+import { sessionToken, currentUser } from "../../localStorage";
+
+const Infrastructure = (props) => {
+ const dispatch = useDispatch();
+
+ const ICsArray = useSelector(state => state.infrastructure.ICsArray);
+
+ //track status of the modals
+ const [isEditModalOpened, setIsEditModalOpened] = useState(false);
+ const [isNewModalOpened, setIsNewModalOpened] = useState(false);
+ const [isImportModalOpened, setIsImportModalOpened] = useState(false);
+ const [isDeleteModalOpened, setIsDeleteModalOpened] = useState(false);
+ const [isICModalOpened, setIsICModalOpened] = useState(false);
+
+ const [checkedICs, setCheckedICs] = useState([]);
+
+ const currentUser = JSON.parse(localStorage.getItem("currentUser"));
+
+ useEffect(() => {
+ //load array of ics and start a timer for periodic refresh
+ dispatch(loadAllICs({token: sessionToken}));
+ let timer = window.setInterval(() => refresh(), 10000);
+
+ return () => {
+ window.clearInterval(timer);
+ }
+ }, []);
+
+ const refresh = () => {
+ //if none of the modals are currently opened, we reload ics array
+ if(!(isEditModalOpened || isDeleteModalOpened || isICModalOpened)){
+ dispatch(loadAllICs({token: sessionToken}));
+ }
+ }
+
+ const buttonStyle = {
+ marginLeft: '10px',
+ }
+
+ const iconStyle = {
+ height: '30px',
+ width: '30px'
+ }
+
+ return (
+