diff --git a/src/ic/ic-pages/kubernetes-page.js b/src/ic/ic-pages/kubernetes-page.js new file mode 100644 index 0000000..32c545b --- /dev/null +++ b/src/ic/ic-pages/kubernetes-page.js @@ -0,0 +1,114 @@ +/** + * 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 IconButton from "../../common/icon-button"; +import {Col, Container, Row, Table} from "react-bootstrap"; +import { refresh, ICParamsTable, rawDataTable } from "../ic" + +class KubernetesICPage extends React.Component { + + constructor(props) { + super(props); + + this.state = { + jobLink: "", + podLinks: [] + }; + } + + static getDerivedStateFromProps(props, state){ + + let jobLink = ""; + let podLinks = []; + + //should be configurable via the backend + let rancher_url = "rancher.k8s.eonerc.rwth-aachen.de"; + let cluster_name = "local"; + + //! statusupdateraw properties only placeholders, not the right property names + if(typeof props.statusupdateraw !== "undefined" && typeof props.statusupdateraw.namespace !== "undefined"){ + + let firstPart = "https://" + rancher_url + "/dashboard/c/" + cluster_name + "/explorer"; + + if(typeof props.statusupdateraw.name !== "undefined"){ + jobLink = firstPart + "/batch.job/" + props.statusupdateraw.namespace + "/" + props.statusupdateraw.job_name; + } + + if(typeof props.statusupdateraw.pod_names !== []){ + props.statusupdateraw.pod_names.map(name => ( + podLinks.push(firstPart + "/pod/" + props.statusupdateraw.namespace + "/" + name) + )) + } + } + + return { + jobLink: jobLink, + podLinks: podLinks + }; + } + + render() { + return (
+ +

{this.props.ic.name} + + + this.props.refresh(this.props.ic, this.props.sessionToken)} + icon='sync-alt' + buttonStyle={this.props.buttonStyle} + iconStyle={this.props.iconStyle} + /> + +

+ + + + + + + {this.state.jobLink !== "" ? + + : + <>} + {this.state.podLinks !== [] && this.state.podLinks.map(link => + + ) + } + +
Rancher UI pages:
Job:{this.state.jobLink}
Pod:{link}
+
+ + + {ICParamsTable(this.props.ic)} + + + Raw Status + {rawDataTable(this.props.ic.statusupdateraw)} + + +
+
+ ) + } + +} + +export default KubernetesICPage; diff --git a/src/ic/ic.js b/src/ic/ic.js index af2fe67..279a061 100644 --- a/src/ic/ic.js +++ b/src/ic/ic.js @@ -26,7 +26,8 @@ import ReactJson from 'react-json-view'; import GatewayVillasNode from './ic-pages/gateway-villas-node' import ManagerVillasRelay from './ic-pages/manager-villas-relay' import DefaultICPage from './ic-pages/default-page' -import DefaultManagerPage from './ic-pages/default-manager-page'; +import DefaultManagerPage from './ic-pages/default-manager-page' +import KubernetesICPage from './ic-pages/kubernetes-page' class InfrastructureComponent extends React.Component { constructor(props) { @@ -181,6 +182,15 @@ class InfrastructureComponent extends React.Component { buttonStyle = {buttonStyle} iconStyle = {iconStyle} /> + } else if (this.state.ic.category === "simulator" && this.state.ic.type === "kubernetes") { + page = }else { page =