diff --git a/src/client/Deploy.jsx b/src/client/Deploy.jsx index 333f62c..86504db 100644 --- a/src/client/Deploy.jsx +++ b/src/client/Deploy.jsx @@ -1,3 +1,4 @@ +import { normalizeURL } from '@/lib/utils' import { Value } from './Inspect.jsx' // const GitRef = ({ type, value }) => { @@ -17,15 +18,30 @@ import { Value } from './Inspect.jsx' // // +/** + * @param {{ deploy: import('@/config.js').Deploy }} param0 + */ + export const Deploy = ({ deploy }) => { return (
-
{deploy.name}
-
{deploy.type}
-
{deploy.type}
-
{deploy.type}
- - + +
{deploy.type}
+ {deploy.type === 'docker' ? ( +
{deploy.options.image}
+ ) : ( + <> +
+ {deploy.url.startsWith('/') ? ( + deploy.url + ) : ( + {deploy.url} + )} +
+ + )}
) } diff --git a/src/client/Inspect.jsx b/src/client/Inspect.jsx index 11dc320..672be24 100644 --- a/src/client/Inspect.jsx +++ b/src/client/Inspect.jsx @@ -1,8 +1,20 @@ import _ from 'lodash' import { clsx } from '@/lib/utils' -export const Value = ({ value, borderless }) => { - return Array.isArray(value) ? ( +export const Value = ({ value, borderless } = {}) => { + return value === undefined ? ( + undefined + ) : value === null ? ( + null + ) : value === true ? ( + true + ) : value === false ? ( + false + ) : typeof value === 'string' && value.trim().length === 0 ? ( + Empty string + ) : !value ? ( + value + ) : Array.isArray(value) ? ( ) : typeof value === 'object' ? ( @@ -12,7 +24,9 @@ export const Value = ({ value, borderless }) => { } export const ValueArray = ({ value, borderless }) => { - return ( + return value.length === 0 ? ( + Empty array + ) : (
{value.map(item => (
diff --git a/src/client/JobLogs.jsx b/src/client/JobLogs.jsx index f88dbe2..99a28ce 100644 --- a/src/client/JobLogs.jsx +++ b/src/client/JobLogs.jsx @@ -1,4 +1,4 @@ -import { useEffect, useState } from "preact/hooks" +import { useEffect, useState } from 'preact/hooks' export const JobLogs = ({}) => { const [logLines, setLogLines] = useState([]) @@ -13,13 +13,11 @@ export const JobLogs = ({}) => { const es = new EventSource(location.href + '/logs?format=sse') es.addEventListener('message', ({ data }) => { const event = JSON.parse(data) - setLogLines(lines => [ - ...lines, - event.content, - ]) + setLogLines(lines => [...lines, event.content]) }) }, []) + // prettier-ignore return (
{logLines.join('\n')}
) diff --git a/src/client/JobsPage.jsx b/src/client/JobsPage.jsx index ec1b0a8..9b27a82 100644 --- a/src/client/JobsPage.jsx +++ b/src/client/JobsPage.jsx @@ -42,12 +42,14 @@ export const JobsPage = ({}) => { const res = await fetch(location.href + '?format=json') const jobs = await res.json() - const result = {} + // const result = {} - for (const item of jobs) { - result[item.uuid] = item - } + // for (const item of jobs) { + // result[item.uuid] = item + // } + const result = _.keyBy(jobs, 'uuid') + console.log(result) setJobStore(result) // Setup SSE diff --git a/src/components/Sidebar.astro b/src/components/Sidebar.astro index 9a92f06..db3f2bf 100644 --- a/src/components/Sidebar.astro +++ b/src/components/Sidebar.astro @@ -1,13 +1,16 @@