-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding multiple new Views, components and models
- Loading branch information
Showing
12 changed files
with
156 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,5 @@ export default function OffCanvasSideBar(id: string, contentBody: ReactNode) { | |
{contentBody} | ||
</div> | ||
</div> | ||
|
||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* useNodes | ||
* @author: ooemperor | ||
*/ | ||
import {useState} from "react"; | ||
import {ErrorMessage} from "../models/ErrorMessage"; | ||
import {NodesResponse} from "../models/proxmox/Node"; | ||
import {proxmoxService} from "../services/ProxmoxService"; | ||
|
||
/** | ||
* useNodes for Proxmox | ||
* Method used in loading the data in the Route | ||
* Helper method for later use in useEffect for loading data from the thingy | ||
*/ | ||
export const useNodes = () => { | ||
const [errorMessage, setErrorMessageProps] = useState<ErrorMessage>({error: false, message: ''}); | ||
const [isLoading, setIsLoading] = useState<Boolean>(false); | ||
|
||
const getNodes = async () => { | ||
setIsLoading(true); | ||
setErrorMessageProps({error: false, message:''}); | ||
|
||
const nodesResponse: NodesResponse = await proxmoxService.getNodes(); | ||
if (!nodesResponse.success) { | ||
setErrorMessageProps({error: false, message: nodesResponse.message}); | ||
} | ||
setIsLoading(false); | ||
return nodesResponse; | ||
} | ||
|
||
return {getNodes, isLoading, errorMessage}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export interface ErrorMessage { | ||
error: boolean | null; | ||
message: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
* Rendering of the Proxmox LXC view | ||
* @author ooemperor | ||
*/ | ||
import React from "react"; | ||
|
||
export default function LXCs() { | ||
return ( | ||
<div className="container"> | ||
<div className={"row"}> | ||
<div className="col"> | ||
<h1>LXC's</h1> | ||
</div> | ||
</div> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/** | ||
* Rendering of the Proxmox Nodes view | ||
* @author ooemperor | ||
*/ | ||
import React, {useEffect, useState} from "react"; | ||
import {useNodes} from "../../hooks/useNodes"; | ||
import {Node} from "../../models/proxmox/Node"; | ||
|
||
/** | ||
* Render the main content of the Nodes page | ||
* @constructor | ||
*/ | ||
export default function Nodes() { | ||
|
||
const {getNodes, errorMessage, isLoading} = useNodes(); | ||
|
||
const [nodes, setNodes] = useState<Node[]>([]); | ||
|
||
useEffect(() => { | ||
const loadNodes = async () => { | ||
const nodesData = await getNodes(); | ||
setNodes(nodesData.nodes); | ||
} | ||
|
||
loadNodes(); | ||
|
||
}, []); | ||
|
||
return ( | ||
<div className="container"> | ||
<div className={"row"}> | ||
<div className="col"> | ||
<h1>Nodes</h1> | ||
</div> | ||
</div> | ||
<div className="row"> | ||
<div className="col"> | ||
<table className="table table-hover"> | ||
<thead> | ||
<tr> | ||
<th>Node</th> | ||
<th>Status</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
|
||
{!isLoading && nodes.map((node) => ( | ||
<tr className="clickable-row" key={node.node}> | ||
<td>{node.node}</td> | ||
<td>{node.status}</td> | ||
</tr> | ||
))} | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
* Rendering of the Proxmox VMs view | ||
* @author ooemperor | ||
*/ | ||
import React from "react"; | ||
|
||
export default function VMs() { | ||
return ( | ||
<div className="container"> | ||
<div className={"row"}> | ||
<div className="col"> | ||
<h1>VM's</h1> | ||
</div> | ||
</div> | ||
</div> | ||
) | ||
} |