-
Notifications
You must be signed in to change notification settings - Fork 6
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
e8ab060
commit 52e7fa8
Showing
4 changed files
with
107 additions
and
88 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,23 @@ | ||
import rubicox from "rubico/x"; | ||
const { isIn } = rubicox; | ||
import { type Context } from "@grucloud/bau-ui/context"; | ||
|
||
const isCompleted = isIn(["completed", "error"]); | ||
|
||
export default function (context: Context) { | ||
const { bau } = context; | ||
const { section, img } = bau.tags; | ||
|
||
return function Diagram(props: any) { | ||
const { data }: any = props; | ||
return section( | ||
() => | ||
isCompleted(data.val.status) && | ||
!data.val.error && | ||
img({ | ||
src: data.val.svgUrl, | ||
alt: "Resources", | ||
}) | ||
); | ||
}; | ||
} |
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,116 +1,104 @@ | ||
import rubicox from "rubico/x"; | ||
const { isIn } = rubicox; | ||
import { type Context } from "@grucloud/bau-ui/context"; | ||
import tableContainer from "@grucloud/bau-ui/tableContainer"; | ||
import keyValueList from "@grucloud/bau-ui/keyValueList"; | ||
|
||
import tableSkeleton from "../tableSkeleton"; | ||
import runStatus from "./runStatus"; | ||
|
||
export default function (context: Context) { | ||
const { bau, css, config } = context; | ||
const { table, tr, td, th, section, a, img, tbody } = bau.tags; | ||
const { div, section, a, li, label, span } = bau.tags; | ||
const KeyValueList = keyValueList(context); | ||
|
||
const TableSkeleton = tableSkeleton(context); | ||
const RunStatus = runStatus(context); | ||
const TableContainer = tableContainer(context, { | ||
class: css` | ||
& th { | ||
text-align: left; | ||
} | ||
`, | ||
}); | ||
|
||
const isCompleted = isIn(["completed", "error"]); | ||
|
||
return function RunDetailContent({ data, loading }: any) { | ||
return section( | ||
TableContainer( | ||
table(() => { | ||
const { | ||
org_id, | ||
workspace_id, | ||
project_id, | ||
run_id, | ||
status, | ||
stateUrl, | ||
logsUrl, | ||
svgUrl, | ||
error, | ||
} = data.val; | ||
return loading.val | ||
? TableSkeleton({ columnsSize: 2, rowSize: 8 }) | ||
: tbody( | ||
tr( | ||
th("Organisation"), | ||
td( | ||
a({ href: `${config.base}/org/${org_id}` }, data.val.org_id) | ||
return section(() => { | ||
const { | ||
org_id, | ||
workspace_id, | ||
project_id, | ||
run_id, | ||
status, | ||
stateUrl, | ||
logsUrl, | ||
svgUrl, | ||
error, | ||
} = data.val; | ||
return loading.val | ||
? TableSkeleton({ columnsSize: 2, rowSize: 8 }) | ||
: div( | ||
{ | ||
class: css` | ||
display: inline-flex; | ||
gap: 3rem; | ||
`, | ||
}, | ||
KeyValueList( | ||
li( | ||
label("Organisation"), | ||
span( | ||
a({ href: `${config.base}/org/${org_id}` }, data.val.org_id) | ||
) | ||
), | ||
li( | ||
label("Project"), | ||
span( | ||
a( | ||
{ | ||
href: `${config.base}/org/${org_id}/projects/${project_id}`, | ||
}, | ||
project_id | ||
) | ||
), | ||
tr( | ||
th("Project"), | ||
td( | ||
a( | ||
{ | ||
href: `${config.base}/org/${org_id}/projects/${project_id}`, | ||
}, | ||
project_id | ||
) | ||
) | ||
), | ||
li( | ||
label("Workspace"), | ||
span( | ||
a( | ||
{ | ||
href: `${config.base}/org/${org_id}/projects/${project_id}/workspaces/${workspace_id}`, | ||
}, | ||
workspace_id | ||
) | ||
), | ||
tr( | ||
th("Workspace"), | ||
td( | ||
) | ||
), | ||
li(label("RunId"), span(run_id)), | ||
li(label("Status"), span(RunStatus({ status, error }))) | ||
), | ||
isCompleted(status) && | ||
KeyValueList( | ||
li( | ||
label("State file"), | ||
span( | ||
a( | ||
{ | ||
href: `${config.base}/org/${org_id}/projects/${project_id}/workspaces/${workspace_id}`, | ||
}, | ||
workspace_id | ||
{ href: stateUrl, target: "_blank" }, | ||
"Download state file" | ||
) | ||
) | ||
), | ||
tr(th("Run Id"), td(run_id)), | ||
tr(th("Status"), td(RunStatus({ status, error }))), | ||
isCompleted(status) && [ | ||
tr( | ||
th("State file"), | ||
td( | ||
!error && | ||
li( | ||
label("Live Graph"), | ||
span( | ||
a( | ||
{ href: stateUrl, target: "_blank" }, | ||
"Download state file" | ||
{ href: svgUrl, target: "_blank" }, | ||
"Download resources graph" | ||
) | ||
) | ||
), | ||
!error && | ||
tr( | ||
th("Live Graph"), | ||
td( | ||
a( | ||
{ href: svgUrl, target: "_blank" }, | ||
"Download resources graph" | ||
) | ||
) | ||
), | ||
tr( | ||
th("Logs"), | ||
td( | ||
a( | ||
{ href: logsUrl, target: "_blank" }, | ||
"Download log file" | ||
) | ||
) | ||
), | ||
] | ||
); | ||
}), | ||
|
||
() => | ||
isCompleted(data.val.status) && | ||
!data.val.error && | ||
img({ | ||
src: data.val.svgUrl, | ||
alt: "Resources", | ||
}) | ||
) | ||
); | ||
li( | ||
label("Logs"), | ||
span( | ||
a({ href: logsUrl, target: "_blank" }, "Download log file") | ||
) | ||
) | ||
) | ||
); | ||
}); | ||
}; | ||
} |
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