From 90fae26aa4bd0e0eb3272ff6e6524060e9004fbb Mon Sep 17 00:00:00 2001 From: Georgios Andreadis Date: Mon, 29 Jun 2020 15:47:09 +0200 Subject: Prepare frontend repository for monorepo This change prepares the frontend Git repository for the monorepo residing at https://github.com/atlarge-research.com/opendc. To accomodate for this, we move all files into a frontend subdirectory. --- .../topology/machine/BackToRackComponent.js | 10 +++ .../topology/machine/DeleteMachineComponent.js | 10 +++ .../topology/machine/MachineNameComponent.js | 7 ++ .../topology/machine/MachineSidebarComponent.js | 27 ++++++++ .../sidebars/topology/machine/UnitAddComponent.js | 46 +++++++++++++ .../app/sidebars/topology/machine/UnitComponent.js | 78 ++++++++++++++++++++++ .../sidebars/topology/machine/UnitListComponent.js | 29 ++++++++ .../sidebars/topology/machine/UnitTabsComponent.js | 65 ++++++++++++++++++ 8 files changed, 272 insertions(+) create mode 100644 frontend/src/components/app/sidebars/topology/machine/BackToRackComponent.js create mode 100644 frontend/src/components/app/sidebars/topology/machine/DeleteMachineComponent.js create mode 100644 frontend/src/components/app/sidebars/topology/machine/MachineNameComponent.js create mode 100644 frontend/src/components/app/sidebars/topology/machine/MachineSidebarComponent.js create mode 100644 frontend/src/components/app/sidebars/topology/machine/UnitAddComponent.js create mode 100644 frontend/src/components/app/sidebars/topology/machine/UnitComponent.js create mode 100644 frontend/src/components/app/sidebars/topology/machine/UnitListComponent.js create mode 100644 frontend/src/components/app/sidebars/topology/machine/UnitTabsComponent.js (limited to 'frontend/src/components/app/sidebars/topology/machine') diff --git a/frontend/src/components/app/sidebars/topology/machine/BackToRackComponent.js b/frontend/src/components/app/sidebars/topology/machine/BackToRackComponent.js new file mode 100644 index 00000000..7f56aca0 --- /dev/null +++ b/frontend/src/components/app/sidebars/topology/machine/BackToRackComponent.js @@ -0,0 +1,10 @@ +import React from "react"; + +const BackToRackComponent = ({ onClick }) => ( +
+ + Back to rack +
+); + +export default BackToRackComponent; diff --git a/frontend/src/components/app/sidebars/topology/machine/DeleteMachineComponent.js b/frontend/src/components/app/sidebars/topology/machine/DeleteMachineComponent.js new file mode 100644 index 00000000..d8774bf9 --- /dev/null +++ b/frontend/src/components/app/sidebars/topology/machine/DeleteMachineComponent.js @@ -0,0 +1,10 @@ +import React from "react"; + +const DeleteMachineComponent = ({ onClick }) => ( +
+ + Delete this machine +
+); + +export default DeleteMachineComponent; diff --git a/frontend/src/components/app/sidebars/topology/machine/MachineNameComponent.js b/frontend/src/components/app/sidebars/topology/machine/MachineNameComponent.js new file mode 100644 index 00000000..0ad8b79c --- /dev/null +++ b/frontend/src/components/app/sidebars/topology/machine/MachineNameComponent.js @@ -0,0 +1,7 @@ +import React from "react"; + +const MachineNameComponent = ({ position }) => ( +

Machine at slot {position}

+); + +export default MachineNameComponent; diff --git a/frontend/src/components/app/sidebars/topology/machine/MachineSidebarComponent.js b/frontend/src/components/app/sidebars/topology/machine/MachineSidebarComponent.js new file mode 100644 index 00000000..5ccaf25c --- /dev/null +++ b/frontend/src/components/app/sidebars/topology/machine/MachineSidebarComponent.js @@ -0,0 +1,27 @@ +import React from "react"; +import LoadBarContainer from "../../../../../containers/app/sidebars/elements/LoadBarContainer"; +import LoadChartContainer from "../../../../../containers/app/sidebars/elements/LoadChartContainer"; +import BackToRackContainer from "../../../../../containers/app/sidebars/topology/machine/BackToRackContainer"; +import DeleteMachineContainer from "../../../../../containers/app/sidebars/topology/machine/DeleteMachineContainer"; +import MachineNameContainer from "../../../../../containers/app/sidebars/topology/machine/MachineNameContainer"; +import UnitTabsContainer from "../../../../../containers/app/sidebars/topology/machine/UnitTabsContainer"; + +const MachineSidebarComponent = ({ inSimulation, machineId }) => { + return ( +
+ + + {inSimulation ? ( +
+ + +
+ ) : ( + + )} + +
+ ); +}; + +export default MachineSidebarComponent; diff --git a/frontend/src/components/app/sidebars/topology/machine/UnitAddComponent.js b/frontend/src/components/app/sidebars/topology/machine/UnitAddComponent.js new file mode 100644 index 00000000..0c903228 --- /dev/null +++ b/frontend/src/components/app/sidebars/topology/machine/UnitAddComponent.js @@ -0,0 +1,46 @@ +import PropTypes from "prop-types"; +import React from "react"; + +class UnitAddComponent extends React.Component { + static propTypes = { + units: PropTypes.array.isRequired, + onAdd: PropTypes.func.isRequired + }; + + render() { + return ( +
+
+ + +
+
+ ); + } +} + +export default UnitAddComponent; diff --git a/frontend/src/components/app/sidebars/topology/machine/UnitComponent.js b/frontend/src/components/app/sidebars/topology/machine/UnitComponent.js new file mode 100644 index 00000000..7c27043d --- /dev/null +++ b/frontend/src/components/app/sidebars/topology/machine/UnitComponent.js @@ -0,0 +1,78 @@ +import React from "react"; +import jQuery from "../../../../../util/jquery"; + +class UnitComponent extends React.Component { + componentDidMount() { + jQuery(".unit-info-popover").popover({ + trigger: "focus" + }); + } + + render() { + let unitInfo; + if (this.props.unitType === "cpu" || this.props.unitType === "gpu") { + unitInfo = + "Clockrate: " + + this.props.unit.clockRateMhz + + " MHz
" + + "Num. Cores: " + + this.props.unit.numberOfCores + + "
" + + "Energy Cons.: " + + this.props.unit.energyConsumptionW + + " W"; + } else if ( + this.props.unitType === "memory" || + this.props.unitType === "storage" + ) { + unitInfo = + "Speed: " + + this.props.unit.speedMbPerS + + " Mb/s
" + + "Size: " + + this.props.unit.sizeMb + + " MB
" + + "Energy Cons.: " + + this.props.unit.energyConsumptionW + + " W"; + } + + return ( +
  • + + {this.props.unit.manufacturer + + " " + + this.props.unit.family + + " " + + this.props.unit.model + + " " + + this.props.unit.generation} + + + + {this.props.inSimulation ? ( + undefined + ) : ( + + + + )} + +
  • + ); + } +} + +export default UnitComponent; diff --git a/frontend/src/components/app/sidebars/topology/machine/UnitListComponent.js b/frontend/src/components/app/sidebars/topology/machine/UnitListComponent.js new file mode 100644 index 00000000..38df806b --- /dev/null +++ b/frontend/src/components/app/sidebars/topology/machine/UnitListComponent.js @@ -0,0 +1,29 @@ +import React from "react"; +import UnitContainer from "../../../../../containers/app/sidebars/topology/machine/UnitContainer"; + +const UnitListComponent = ({ unitType, unitIds, inSimulation }) => ( + +); + +export default UnitListComponent; diff --git a/frontend/src/components/app/sidebars/topology/machine/UnitTabsComponent.js b/frontend/src/components/app/sidebars/topology/machine/UnitTabsComponent.js new file mode 100644 index 00000000..0683c796 --- /dev/null +++ b/frontend/src/components/app/sidebars/topology/machine/UnitTabsComponent.js @@ -0,0 +1,65 @@ +import React from "react"; +import UnitAddContainer from "../../../../../containers/app/sidebars/topology/machine/UnitAddContainer"; +import UnitListContainer from "../../../../../containers/app/sidebars/topology/machine/UnitListContainer"; + +const UnitTabsComponent = ({ inSimulation }) => ( +
    + +
    +
    + {inSimulation ? undefined : } + +
    +
    + {inSimulation ? undefined : } + +
    +
    + {inSimulation ? undefined : } + +
    +
    + {inSimulation ? undefined : } + +
    +
    +
    +); + +export default UnitTabsComponent; -- cgit v1.2.3