feat: better deploys page and single deploy page
parent
68283207bb
commit
6ee977d8c6
@ -1,34 +1,34 @@
|
||||
---
|
||||
import { Value } from '@client/Inspect'
|
||||
import Layout from '../layouts/Layout.astro'
|
||||
import Docker from 'dockerode'
|
||||
|
||||
const docker = new Docker({ socketPath: '/var/run/docker.sock' })
|
||||
|
||||
const containers = await docker.listContainers({ all: true })
|
||||
|
||||
console.dir(containers, { depth: null })
|
||||
---
|
||||
|
||||
<Layout title="Containers | phCD">
|
||||
<h1>Containers</h1>
|
||||
<ul>
|
||||
{
|
||||
containers.map(container => (
|
||||
<li>
|
||||
<strong>Name:</strong> {container.Names[0]} <br />
|
||||
<strong>Command:</strong> <code>{container.Command}</code> <br />
|
||||
<strong>Image:</strong> <code>{container.Image}</code> <br />
|
||||
<strong>Status:</strong> {container.Status} <br />
|
||||
<strong>Mounts:</strong>
|
||||
<ul>
|
||||
{container.Mounts.map(mount => (
|
||||
<li>
|
||||
<strong>Type:</strong> {mount.Type} <br />
|
||||
<strong>From:</strong> <code>{mount.Source}</code> <br />
|
||||
<strong>To:</strong> <code>{mount.Destination}</code> <br />
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</li>
|
||||
))
|
||||
}
|
||||
</ul>
|
||||
{containers.map(container => <Value client:load value={container} borderless={false} />)}
|
||||
<!-- <ul>
|
||||
<li>
|
||||
<strong>Name:</strong> {container.Names[0]} <br />
|
||||
<strong>Command:</strong> <code>{container.Command}</code> <br />
|
||||
<strong>Image:</strong> <code>{container.Image}</code> <br />
|
||||
<strong>Status:</strong> {container.Status} <br />
|
||||
<strong>Mounts:</strong>
|
||||
<ul>
|
||||
{container.Mounts.map(mount => (
|
||||
<li>
|
||||
<strong>Type:</strong> {mount.Type} <br />
|
||||
<strong>From:</strong> <code>{mount.Source}</code> <br />
|
||||
<strong>To:</strong> <code>{mount.Destination}</code> <br />
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</li>
|
||||
</ul> -->
|
||||
</Layout>
|
||||
|
@ -0,0 +1,31 @@
|
||||
---
|
||||
import { Deploy } from '@client/Deploy'
|
||||
import { Value } from '@client/Inspect'
|
||||
|
||||
import { loadConfig } from '@/config'
|
||||
import Layout from '@layouts/Layout.astro'
|
||||
import { createUrlQuery } from '@/lib/utils'
|
||||
|
||||
const { name } = Astro.params
|
||||
|
||||
const { deploys } = await loadConfig()
|
||||
const deploy = deploys.find(d => d.name === name)
|
||||
|
||||
if (!deploy) {
|
||||
return Astro.redirect(
|
||||
createUrlQuery('/error', {
|
||||
message: `No deploy with name "${name}"`,
|
||||
previous: `/deploys`,
|
||||
})
|
||||
)
|
||||
}
|
||||
---
|
||||
|
||||
<Layout title={`${name} | Deploy | phCD`}>
|
||||
<h1>
|
||||
<div class="kind">Deploy</div>
|
||||
<div class="title">{name}</div>
|
||||
</h1>
|
||||
|
||||
<Value value={deploy} borderless />
|
||||
</Layout>
|
Loading…
Reference in New Issue