Integrate Alpine.js for reactive UI
- Add Alpine.js (self-hosted, embedded in static/) - Refactor app.js to use Alpine.js stores and components - Update templates to use x-data, x-bind, x-show, x-text directives - Add reactive deploy button state, live logs, status badges - Add auto-dismiss alerts with close button and transitions - Add copy-to-clipboard component with feedback - Add confirm dialog component for destructive actions - Add relative time component with auto-update - Add prettier to make fmt target for JS formatting
This commit is contained in:
parent
ab7e917b03
commit
f1cc7d65a6
1
Makefile
1
Makefile
@ -16,6 +16,7 @@ lint:
|
||||
fmt:
|
||||
gofmt -s -w .
|
||||
goimports -w .
|
||||
npx prettier --write --tab-width 4 static/js/*.js
|
||||
|
||||
test:
|
||||
go test -v -race -cover ./...
|
||||
|
||||
5
static/js/alpine.min.js
vendored
Normal file
5
static/js/alpine.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1051
static/js/app.js
1051
static/js/app.js
File diff suppressed because it is too large
Load Diff
@ -5,7 +5,12 @@
|
||||
{{define "content"}}
|
||||
{{template "nav" .}}
|
||||
|
||||
<main class="max-w-4xl mx-auto px-4 py-8">
|
||||
<main class="max-w-4xl mx-auto px-4 py-8" x-data="appDetail({
|
||||
appId: '{{.App.ID}}',
|
||||
initialDeploymentId: {{if .LatestDeployment}}{{.LatestDeployment.ID}}{{else}}null{{end}},
|
||||
initialStatus: '{{.App.Status}}',
|
||||
initialBuildStatus: '{{if .LatestDeployment}}{{.LatestDeployment.Status}}{{else}}{{end}}'
|
||||
})">
|
||||
<div class="mb-6">
|
||||
<a href="/" class="text-primary-600 hover:text-primary-800 inline-flex items-center">
|
||||
<svg class="w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
@ -23,15 +28,15 @@
|
||||
<div>
|
||||
<div class="flex items-center gap-3">
|
||||
<h1 class="text-2xl font-medium text-gray-900">{{.App.Name}}</h1>
|
||||
<span id="app-status" class="{{if eq .App.Status "running"}}badge-success{{else if eq .App.Status "building"}}badge-warning{{else if eq .App.Status "error"}}badge-error{{else}}badge-neutral{{end}}">{{.App.Status}}</span>
|
||||
<span x-bind:class="statusBadgeClass" x-text="statusLabel"></span>
|
||||
</div>
|
||||
<p class="text-gray-500 font-mono text-sm mt-1">{{.App.RepoURL}}@{{.App.Branch}}</p>
|
||||
</div>
|
||||
<div class="flex gap-3">
|
||||
<a href="/apps/{{.App.ID}}/edit" class="btn-secondary">Edit</a>
|
||||
<form id="deploy-form" method="POST" action="/apps/{{.App.ID}}/deploy" class="inline">
|
||||
<button id="deploy-btn" type="submit" class="btn-success" {{if or (eq .App.Status "building") (eq .App.Status "deploying")}}disabled{{end}}>
|
||||
<span id="deploy-btn-text">{{if or (eq .App.Status "building") (eq .App.Status "deploying")}}Deploying...{{else}}Deploy Now{{end}}</span>
|
||||
<form method="POST" action="/apps/{{.App.ID}}/deploy" class="inline" @submit="submitDeploy()">
|
||||
<button type="submit" class="btn-success" x-bind:disabled="deploying" x-bind:class="{ 'opacity-50 cursor-not-allowed': deploying }">
|
||||
<span x-text="deploying ? 'Deploying...' : 'Deploy Now'"></span>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
@ -41,17 +46,20 @@
|
||||
<div class="card p-6 mb-6">
|
||||
<h2 class="section-title mb-4">Deploy Key</h2>
|
||||
<p class="text-sm text-gray-500 mb-3">Add this SSH public key to your repository as a read-only deploy key:</p>
|
||||
<div class="copy-field">
|
||||
<div class="copy-field" x-data="copyButton('deploy-key')">
|
||||
<code id="deploy-key" class="copy-field-value text-xs">{{.DeployKey}}</code>
|
||||
<button
|
||||
type="button"
|
||||
data-copy-target="deploy-key"
|
||||
@click="copy()"
|
||||
class="copy-btn"
|
||||
title="Copy to clipboard"
|
||||
>
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"/>
|
||||
</svg>
|
||||
<span x-show="!copied">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"/>
|
||||
</svg>
|
||||
</span>
|
||||
<span x-show="copied" class="text-success-500 text-sm font-medium">Copied!</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -60,17 +68,20 @@
|
||||
<div class="card p-6 mb-6">
|
||||
<h2 class="section-title mb-4">Webhook URL</h2>
|
||||
<p class="text-sm text-gray-500 mb-3">Add this URL as a push webhook in your Gitea repository:</p>
|
||||
<div class="copy-field">
|
||||
<div class="copy-field" x-data="copyButton('webhook-url')">
|
||||
<code id="webhook-url" class="copy-field-value text-xs">{{.WebhookURL}}</code>
|
||||
<button
|
||||
type="button"
|
||||
data-copy-target="webhook-url"
|
||||
@click="copy()"
|
||||
class="copy-btn"
|
||||
title="Copy to clipboard"
|
||||
>
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"/>
|
||||
</svg>
|
||||
<span x-show="!copied">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"/>
|
||||
</svg>
|
||||
</span>
|
||||
<span x-show="copied" class="text-success-500 text-sm font-medium">Copied!</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -94,7 +105,7 @@
|
||||
<td class="font-mono font-medium">{{.Key}}</td>
|
||||
<td class="font-mono text-gray-500">{{.Value}}</td>
|
||||
<td class="text-right">
|
||||
<form method="POST" action="/apps/{{$.App.ID}}/env/{{.ID}}/delete" class="inline" data-confirm="Delete this environment variable?">
|
||||
<form method="POST" action="/apps/{{$.App.ID}}/env/{{.ID}}/delete" class="inline" x-data="confirmAction('Delete this environment variable?')" @submit="confirm($event)">
|
||||
<button type="submit" class="text-error-500 hover:text-error-700 text-sm">Delete</button>
|
||||
</form>
|
||||
</td>
|
||||
@ -137,7 +148,7 @@
|
||||
<td class="font-mono font-medium">{{.Key}}</td>
|
||||
<td class="font-mono text-gray-500">{{.Value}}</td>
|
||||
<td class="text-right">
|
||||
<form method="POST" action="/apps/{{$.App.ID}}/labels/{{.ID}}/delete" class="inline" data-confirm="Delete this label?">
|
||||
<form method="POST" action="/apps/{{$.App.ID}}/labels/{{.ID}}/delete" class="inline" x-data="confirmAction('Delete this label?')" @submit="confirm($event)">
|
||||
<button type="submit" class="text-error-500 hover:text-error-700 text-sm">Delete</button>
|
||||
</form>
|
||||
</td>
|
||||
@ -180,7 +191,7 @@
|
||||
{{end}}
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<form method="POST" action="/apps/{{$.App.ID}}/volumes/{{.ID}}/delete" class="inline" data-confirm="Delete this volume mount?">
|
||||
<form method="POST" action="/apps/{{$.App.ID}}/volumes/{{.ID}}/delete" class="inline" x-data="confirmAction('Delete this volume mount?')" @submit="confirm($event)">
|
||||
<button type="submit" class="text-error-500 hover:text-error-700 text-sm">Delete</button>
|
||||
</form>
|
||||
</td>
|
||||
@ -232,7 +243,7 @@
|
||||
{{end}}
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<form method="POST" action="/apps/{{$.App.ID}}/ports/{{.ID}}/delete" class="inline" data-confirm="Delete this port mapping?">
|
||||
<form method="POST" action="/apps/{{$.App.ID}}/ports/{{.ID}}/delete" class="inline" x-data="confirmAction('Delete this port mapping?')" @submit="confirm($event)">
|
||||
<button type="submit" class="text-error-500 hover:text-error-700 text-sm">Delete</button>
|
||||
</form>
|
||||
</td>
|
||||
@ -266,10 +277,10 @@
|
||||
<div class="card p-6 mb-6">
|
||||
<div class="flex items-center justify-between mb-4">
|
||||
<h2 class="section-title">Container Logs</h2>
|
||||
<span id="container-status" class="badge-neutral text-xs">Loading...</span>
|
||||
<span x-bind:class="containerStatusBadgeClass" x-text="containerStatusLabel"></span>
|
||||
</div>
|
||||
<div id="container-logs-wrapper" class="bg-gray-900 rounded-lg p-4 overflow-auto" style="max-height: 400px;">
|
||||
<pre id="container-logs" class="text-gray-100 text-xs font-mono whitespace-pre-wrap">Loading container logs...</pre>
|
||||
<div x-ref="containerLogsWrapper" class="bg-gray-900 rounded-lg p-4 overflow-auto" style="max-height: 400px;">
|
||||
<pre class="text-gray-100 text-xs font-mono whitespace-pre-wrap" x-text="containerLogs"></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -279,56 +290,47 @@
|
||||
<h2 class="section-title">Recent Deployments</h2>
|
||||
<a href="/apps/{{.App.ID}}/deployments" class="text-primary-600 hover:text-primary-800 text-sm">View All</a>
|
||||
</div>
|
||||
{{if .Deployments}}
|
||||
<div class="overflow-x-auto">
|
||||
<table class="table">
|
||||
<thead class="table-header">
|
||||
<tr>
|
||||
<th>Finished</th>
|
||||
<th>Duration</th>
|
||||
<th>Status</th>
|
||||
<th>Commit</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="deployments-tbody" class="table-body">
|
||||
{{range .Deployments}}
|
||||
<tr>
|
||||
<td class="text-gray-500">
|
||||
<span class="relative-time" data-time="{{.FinishedAtISO}}" title="{{.FinishedAtFormatted}}">{{.FinishedAtFormatted}}</span>
|
||||
</td>
|
||||
<td class="text-gray-500">{{if .Duration}}{{.Duration}}{{else}}-{{end}}</td>
|
||||
<td>
|
||||
{{if eq .Status "success"}}
|
||||
<span class="badge-success">Success</span>
|
||||
{{else if eq .Status "failed"}}
|
||||
<span class="badge-error">Failed</span>
|
||||
{{else if eq .Status "building"}}
|
||||
<span class="badge-warning">Building</span>
|
||||
{{else if eq .Status "deploying"}}
|
||||
<span class="badge-info">Deploying</span>
|
||||
{{else}}
|
||||
<span class="badge-neutral">{{.Status}}</span>
|
||||
{{end}}
|
||||
</td>
|
||||
<td class="font-mono text-gray-500 text-xs">{{.ShortCommit}}</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{{else}}
|
||||
<p class="text-gray-500 text-sm">No deployments yet.</p>
|
||||
{{end}}
|
||||
<template x-if="deployments.length > 0">
|
||||
<div class="overflow-x-auto">
|
||||
<table class="table">
|
||||
<thead class="table-header">
|
||||
<tr>
|
||||
<th>Finished</th>
|
||||
<th>Duration</th>
|
||||
<th>Status</th>
|
||||
<th>Commit</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="table-body">
|
||||
<template x-for="d in deployments" :key="d.id">
|
||||
<tr>
|
||||
<td class="text-gray-500">
|
||||
<span x-text="formatTime(d.finishedAtISO)" :title="d.finishedAtLabel"></span>
|
||||
</td>
|
||||
<td class="text-gray-500" x-text="d.duration || '-'"></td>
|
||||
<td>
|
||||
<span x-bind:class="deploymentStatusClass(d.status)" x-text="deploymentStatusLabel(d.status)"></span>
|
||||
</td>
|
||||
<td class="font-mono text-gray-500 text-xs" x-text="d.shortCommit"></td>
|
||||
</tr>
|
||||
</template>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</template>
|
||||
<template x-if="deployments.length === 0">
|
||||
<p class="text-gray-500 text-sm">No deployments yet.</p>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<!-- Last Deployment Build Logs -->
|
||||
<div id="build-logs-section" class="card p-6 mb-6" {{if not .LatestDeployment}}style="display: none;"{{end}}>
|
||||
<div class="card p-6 mb-6" x-show="showBuildLogs" x-cloak>
|
||||
<div class="flex items-center justify-between mb-4">
|
||||
<h2 class="section-title">Last Deployment Build Logs</h2>
|
||||
<span id="build-status" class="badge-neutral text-xs">{{if .LatestDeployment}}{{.LatestDeployment.Status}}{{end}}</span>
|
||||
<span x-bind:class="buildStatusBadgeClass" x-text="buildStatusLabel"></span>
|
||||
</div>
|
||||
<div id="build-logs-wrapper" class="bg-gray-900 rounded-lg p-4 overflow-auto" style="max-height: 400px;">
|
||||
<pre id="build-logs" class="text-gray-100 text-xs font-mono whitespace-pre-wrap">{{if .LatestDeployment}}Loading build logs...{{else}}No deployments yet{{end}}</pre>
|
||||
<div x-ref="buildLogsWrapper" class="bg-gray-900 rounded-lg p-4 overflow-auto" style="max-height: 400px;">
|
||||
<pre class="text-gray-100 text-xs font-mono whitespace-pre-wrap" x-text="buildLogs"></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -336,16 +338,9 @@
|
||||
<div class="card border-2 border-error-500/20 bg-error-50/50 p-6">
|
||||
<h2 class="text-lg font-medium text-error-700 mb-4">Danger Zone</h2>
|
||||
<p class="text-error-600 text-sm mb-4">Deleting this app will remove all configuration and deployment history. This action cannot be undone.</p>
|
||||
<form method="POST" action="/apps/{{.App.ID}}/delete" data-confirm="Are you sure you want to delete this app? This action cannot be undone.">
|
||||
<form method="POST" action="/apps/{{.App.ID}}/delete" x-data="confirmAction('Are you sure you want to delete this app? This action cannot be undone.')" @submit="confirm($event)">
|
||||
<button type="submit" class="btn-danger">Delete App</button>
|
||||
</form>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<script>
|
||||
upaas.initAppDetailPage({
|
||||
appId: "{{.App.ID}}",
|
||||
initialDeploymentId: {{if .LatestDeployment}}{{.LatestDeployment.ID}}{{else}}null{{end}}
|
||||
});
|
||||
</script>
|
||||
{{end}}
|
||||
|
||||
@ -7,12 +7,14 @@
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
<title>{{block "title" .}}µPaaS{{end}}</title>
|
||||
<link rel="stylesheet" href="/s/css/tailwind.css">
|
||||
<style>[x-cloak] { display: none !important; }</style>
|
||||
</head>
|
||||
<body class="bg-gray-50 min-h-screen flex flex-col">
|
||||
<div class="flex-grow">
|
||||
{{block "content" .}}{{end}}
|
||||
</div>
|
||||
{{template "footer" .}}
|
||||
<script defer src="/s/js/alpine.min.js"></script>
|
||||
<script src="/s/js/app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@ -55,12 +57,19 @@
|
||||
|
||||
{{define "alert-error"}}
|
||||
{{if .Error}}
|
||||
<div class="alert-error" data-auto-dismiss="8000">
|
||||
<div class="flex items-center">
|
||||
<svg class="w-5 h-5 mr-2 flex-shrink-0" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd"/>
|
||||
</svg>
|
||||
<span>{{.Error}}</span>
|
||||
<div class="alert-error" x-data="autoDismiss(8000)" x-show="show" x-transition:leave="transition ease-in duration-300" x-transition:leave-start="opacity-100" x-transition:leave-end="opacity-0">
|
||||
<div class="flex items-center justify-between">
|
||||
<div class="flex items-center">
|
||||
<svg class="w-5 h-5 mr-2 flex-shrink-0" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd"/>
|
||||
</svg>
|
||||
<span>{{.Error}}</span>
|
||||
</div>
|
||||
<button @click="dismiss()" class="text-error-500 hover:text-error-700 ml-4">
|
||||
<svg class="w-4 h-4" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
@ -68,12 +77,19 @@
|
||||
|
||||
{{define "alert-success"}}
|
||||
{{if .Success}}
|
||||
<div class="alert-success" data-auto-dismiss="5000">
|
||||
<div class="flex items-center">
|
||||
<svg class="w-5 h-5 mr-2 flex-shrink-0" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/>
|
||||
</svg>
|
||||
<span>{{.Success}}</span>
|
||||
<div class="alert-success" x-data="autoDismiss(5000)" x-show="show" x-transition:leave="transition ease-in duration-300" x-transition:leave-start="opacity-100" x-transition:leave-end="opacity-0">
|
||||
<div class="flex items-center justify-between">
|
||||
<div class="flex items-center">
|
||||
<svg class="w-5 h-5 mr-2 flex-shrink-0" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/>
|
||||
</svg>
|
||||
<span>{{.Success}}</span>
|
||||
</div>
|
||||
<button @click="dismiss()" class="text-success-500 hover:text-success-700 ml-4">
|
||||
<svg class="w-4 h-4" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
{{define "content"}}
|
||||
{{template "nav" .}}
|
||||
|
||||
<main class="max-w-6xl mx-auto px-4 py-8">
|
||||
<main class="max-w-6xl mx-auto px-4 py-8" x-data="dashboard()">
|
||||
{{template "alert-success" .}}
|
||||
{{template "alert-error" .}}
|
||||
|
||||
@ -58,9 +58,7 @@
|
||||
</td>
|
||||
<td class="text-gray-500 text-sm">
|
||||
{{if .LastDeployTime}}
|
||||
<span class="relative-time cursor-default" data-time="{{.LastDeployISO}}" title="{{.LastDeployLabel}}">
|
||||
{{.LastDeployLabel}}
|
||||
</span>
|
||||
<span x-data="relativeTime('{{.LastDeployISO}}')" x-text="display" class="cursor-default" title="{{.LastDeployLabel}}"></span>
|
||||
{{else}}
|
||||
<span class="text-gray-400">-</span>
|
||||
{{end}}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
{{define "content"}}
|
||||
{{template "nav" .}}
|
||||
|
||||
<main class="max-w-4xl mx-auto px-4 py-8">
|
||||
<main class="max-w-4xl mx-auto px-4 py-8" x-data="deploymentsPage({ appId: '{{.App.ID}}' })">
|
||||
<div class="mb-6">
|
||||
<a href="/apps/{{.App.ID}}" class="text-primary-600 hover:text-primary-800 inline-flex items-center">
|
||||
<svg class="w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
@ -17,19 +17,21 @@
|
||||
|
||||
<div class="section-header">
|
||||
<h1 class="text-2xl font-medium text-gray-900">Deployment History</h1>
|
||||
<form id="deploy-form" method="POST" action="/apps/{{.App.ID}}/deploy">
|
||||
<button id="deploy-btn" type="submit" class="btn-success">Deploy Now</button>
|
||||
<form method="POST" action="/apps/{{.App.ID}}/deploy" @submit="submitDeploy()">
|
||||
<button type="submit" class="btn-success" x-bind:disabled="isDeploying" x-bind:class="{ 'opacity-50 cursor-not-allowed': isDeploying }">
|
||||
<span x-text="isDeploying ? 'Deploying...' : 'Deploy Now'"></span>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Live Build Logs (shown during active deployment) -->
|
||||
<div id="live-logs-section" class="card p-6 mb-4" style="display: none;">
|
||||
<div class="card p-6 mb-4" x-show="showLiveLogs" x-cloak>
|
||||
<div class="flex items-center justify-between mb-4">
|
||||
<h2 class="section-title">Live Build Logs</h2>
|
||||
<span id="live-status" class="badge-neutral text-xs">Building</span>
|
||||
<span x-bind:class="liveStatusBadgeClass" x-text="liveStatusLabel"></span>
|
||||
</div>
|
||||
<div id="live-logs-wrapper" class="bg-gray-900 rounded-lg p-4 overflow-auto" style="max-height: 400px;">
|
||||
<pre id="live-logs" class="text-gray-100 text-xs font-mono whitespace-pre-wrap">Waiting for logs...</pre>
|
||||
<div x-ref="liveLogsWrapper" class="bg-gray-900 rounded-lg p-4 overflow-auto" style="max-height: 400px;">
|
||||
<pre class="text-gray-100 text-xs font-mono whitespace-pre-wrap" x-text="liveLogs"></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -42,7 +44,7 @@
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"/>
|
||||
</svg>
|
||||
<span class="relative-time" data-time="{{.StartedAt.Format "2006-01-02T15:04:05Z07:00"}}" title="{{.StartedAt.Format "2006-01-02 15:04:05"}}">{{.StartedAt.Format "2006-01-02 15:04:05"}}</span>
|
||||
<span x-data="relativeTime('{{.StartedAt.Format `2006-01-02T15:04:05Z07:00`}}')" x-text="display" title="{{.StartedAt.Format `2006-01-02 15:04:05`}}"></span>
|
||||
{{if .FinishedAt.Valid}}
|
||||
<span class="text-gray-400">•</span>
|
||||
<span>{{.Duration}}</span>
|
||||
@ -100,8 +102,10 @@
|
||||
<h3 class="empty-state-title">No deployments yet</h3>
|
||||
<p class="empty-state-description">Deploy your application to see the deployment history here.</p>
|
||||
<div class="mt-6">
|
||||
<form id="deploy-form-empty" method="POST" action="/apps/{{.App.ID}}/deploy">
|
||||
<button id="deploy-btn-empty" type="submit" class="btn-success">Deploy Now</button>
|
||||
<form method="POST" action="/apps/{{.App.ID}}/deploy" @submit="submitDeploy()">
|
||||
<button type="submit" class="btn-success" x-bind:disabled="isDeploying" x-bind:class="{ 'opacity-50 cursor-not-allowed': isDeploying }">
|
||||
<span x-text="isDeploying ? 'Deploying...' : 'Deploy Now'"></span>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@ -109,10 +113,4 @@
|
||||
{{end}}
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<script>
|
||||
upaas.initDeploymentsPage({
|
||||
appId: "{{.App.ID}}"
|
||||
});
|
||||
</script>
|
||||
{{end}}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user