-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3236b9b
commit f0f76da
Showing
4 changed files
with
162 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
"use client"; | ||
|
||
import React from "react"; | ||
|
||
import Card from "./Card"; | ||
import StatusIcon from "./StatusIcon"; | ||
|
||
export const InstallStatus: FC<{ install: Record<string, any> }> = ({ | ||
install, | ||
}) => { | ||
let sandboxStatus = "pending"; | ||
let sandboxStatusDescription = "Sandbox has not deployed yet."; | ||
if (install.install_sandbox_runs && install.install_sandbox_runs.length > 0) { | ||
const lastRun = install.install_sandbox_runs[0]; | ||
sandboxStatus = lastRun.status; | ||
sandboxStatusDescription = lastRun.status_description; | ||
} | ||
|
||
const components = install.install_components.map((component, idx) => { | ||
let status = "pending"; | ||
let status_description = "Component has not deployed yet."; | ||
if (component.install_deploys.length > 0) { | ||
const lastDeploy = component.install_deploys[0]; | ||
status = lastDeploy.status; | ||
status_description = lastDeploy.status_description; | ||
} | ||
return ( | ||
<div key={idx}> | ||
<span className="font-medium"> | ||
<StatusIcon status={sandboxStatus} /> {component.component.name}: | ||
</span>{" "} | ||
<span>{status_description}</span> | ||
</div> | ||
); | ||
}); | ||
|
||
return ( | ||
<div> | ||
<Card className="grid p-4 divide-y mb-4"> | ||
<div className="font-bold"> | ||
<StatusIcon status={sandboxStatus} /> Sandbox | ||
</div> | ||
<div>{sandboxStatusDescription}</div> | ||
</Card> | ||
<Card className="grid p-4 divide-y"> | ||
<div className="font-bold">Components</div> | ||
{components} | ||
</Card> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from "react"; | ||
|
||
const StatusIcon: FC<{ status: string; status_description: string }> = ({ | ||
status, | ||
className, | ||
}) => { | ||
let clr = "yellow-500"; | ||
if (status === "active") { | ||
clr = "green-600"; | ||
} else if (status === "error") { | ||
clr = "red-500"; | ||
} | ||
|
||
return <span className={`text-${clr} ${className}`}>⏺</span>; | ||
}; | ||
|
||
export default StatusIcon; |