-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: restructure instance detail page
Co-authored-by: Julian Geywitz <geywitz@sipgate.de>
- Loading branch information
1 parent
49f5197
commit 5221294
Showing
14 changed files
with
245 additions
and
281 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,12 @@ | ||
.root { | ||
display: grid; | ||
grid-template-columns: 24px 1fr min-content; | ||
grid-template-areas: "icon title badge"; | ||
gap: 1rem; | ||
padding: 1rem; | ||
border: 1px solid var(--color-separator); | ||
border-radius: 4px; | ||
border-radius: 0.5rem; | ||
|
||
&.hasBody { | ||
grid-template-areas: "icon title badge" ". body body"; | ||
} | ||
|
||
&:not(:last-of-type) { | ||
> header { | ||
display: flex; | ||
gap: 1rem; | ||
font-weight: bold; | ||
margin-bottom: 1rem; | ||
} | ||
|
||
.icon { | ||
opacity: 0.65; | ||
} | ||
|
||
.icon, | ||
.title { | ||
align-self: center; | ||
} | ||
|
||
.body { | ||
grid-area: body; | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
47 changes: 47 additions & 0 deletions
47
web/src/components/InstanceBanner/InstanceBanner.module.scss
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,47 @@ | ||
.root { | ||
.divider { | ||
background: var(--color-separator); | ||
width: 1px; | ||
} | ||
|
||
.specifications { | ||
display: grid; | ||
grid-template-columns: 1fr auto 1fr; | ||
gap: 1rem 2rem; | ||
background: var(--overlay); | ||
padding: 1rem; | ||
border-radius: 0.5rem 0.5rem 0 0; | ||
} | ||
|
||
> footer { | ||
display: flex; | ||
justify-content: space-between; | ||
padding: 1rem; | ||
border: 1px solid var(--color-separator); | ||
border-top: 0; | ||
border-radius: 0 0 0.5rem 0.5rem; | ||
} | ||
|
||
.nodes { | ||
> h3 { | ||
font-size: 1rem; | ||
margin: 0 0 1rem; | ||
} | ||
|
||
.node { | ||
display: flex; | ||
justify-content: space-between; | ||
padding: 0.5rem 0; | ||
|
||
&:not(:last-child) { | ||
border-bottom: 1px solid var(--color-separator); | ||
} | ||
} | ||
} | ||
|
||
.tags, | ||
.osName { | ||
display: flex; | ||
gap: 0.5rem; | ||
} | ||
} |
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,79 @@ | ||
import { | ||
faComputer, | ||
faHdd, | ||
faMemory, | ||
faMicrochip, | ||
faTags, | ||
} from "@fortawesome/free-solid-svg-icons"; | ||
import React from "react"; | ||
import { GntInstance } from "../../api/models"; | ||
import { prettyPrintMiB } from "../../helpers"; | ||
import Icon from "../Icon/Icon"; | ||
import PrefixLink from "../PrefixLink"; | ||
import QuickInfoBanner from "../QuickInfoBanner/QuickInfoBanner"; | ||
import StatusBadge, { BadgeStatus } from "../StatusBadge/StatusBadge"; | ||
import styles from "./InstanceBanner.module.scss"; | ||
|
||
type Props = { | ||
instance: GntInstance; | ||
}; | ||
|
||
function InstanceBanner({ instance }: Props) { | ||
const totalStorage = instance.disks | ||
.map(({ capacity }) => capacity) | ||
.reduce((prev, cur) => prev + cur); | ||
|
||
return ( | ||
<div className={styles.root}> | ||
<div className={styles.specifications}> | ||
<QuickInfoBanner> | ||
<QuickInfoBanner.Item | ||
icon={faMicrochip} | ||
label="vCPUs" | ||
value={instance.cpuCount.toString()} | ||
/> | ||
<QuickInfoBanner.Item | ||
icon={faMemory} | ||
label="Memory" | ||
value={prettyPrintMiB(instance.memoryTotal)} | ||
/> | ||
<QuickInfoBanner.Item | ||
icon={faHdd} | ||
label="Storage" | ||
value={prettyPrintMiB(totalStorage)} | ||
/> | ||
</QuickInfoBanner> | ||
<div className={styles.divider}></div> | ||
<div className={styles.nodes}> | ||
<h3>Nodes</h3> | ||
<div className={styles.node} key={instance.primaryNode}> | ||
<PrefixLink to={`/nodes/${instance.primaryNode}`}> | ||
{instance.primaryNode} | ||
</PrefixLink> | ||
|
||
<StatusBadge status={BadgeStatus.PRIMARY}>Primary</StatusBadge> | ||
</div> | ||
{instance.secondaryNodes.map((node) => ( | ||
<div className={styles.node} key={node}> | ||
<PrefixLink to={`/nodes/${node}`}>{node}</PrefixLink> | ||
</div> | ||
))} | ||
</div> | ||
</div> | ||
<footer> | ||
<div className={styles.osName} title="Operating System"> | ||
<Icon icon={faComputer}></Icon> | ||
{instance.OS} | ||
</div> | ||
<div className={styles.tags}> | ||
<Icon icon={faTags}></Icon> | ||
{instance.tags.map((tag) => ( | ||
<StatusBadge key={tag}>{tag}</StatusBadge> | ||
))} | ||
</div> | ||
</footer> | ||
</div> | ||
); | ||
} | ||
|
||
export default InstanceBanner; |
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
7 changes: 4 additions & 3 deletions
7
web/src/components/QuickInfoBanner/QuickInfoBanner.module.scss
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 |
---|---|---|
|
@@ -11,3 +11,8 @@ | |
font-weight: bold; | ||
} | ||
} | ||
|
||
.clusterSpecifications { | ||
padding: 2rem; | ||
background: var(--overlay); | ||
} |
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
Oops, something went wrong.