Remove separate live logs section, update logs in deployment card
This commit is contained in:
@@ -312,9 +312,6 @@ document.addEventListener("alpine:init", () => {
|
||||
appId: config.appId,
|
||||
currentDeploymentId: null,
|
||||
isDeploying: false,
|
||||
liveLogs: "Waiting for logs...",
|
||||
liveStatus: "building",
|
||||
showLiveLogs: false,
|
||||
|
||||
init() {
|
||||
// Check for in-progress deployments on page load
|
||||
@@ -327,13 +324,12 @@ document.addEventListener("alpine:init", () => {
|
||||
10,
|
||||
);
|
||||
this.isDeploying = true;
|
||||
this.showLiveLogs = true;
|
||||
}
|
||||
|
||||
this.fetchAppStatus();
|
||||
setInterval(() => {
|
||||
this.fetchAppStatus();
|
||||
this.fetchLiveLogs();
|
||||
this.fetchDeploymentLogs();
|
||||
}, 1000);
|
||||
},
|
||||
|
||||
@@ -351,7 +347,6 @@ document.addEventListener("alpine:init", () => {
|
||||
) {
|
||||
this.currentDeploymentId = data.latestDeploymentID;
|
||||
if (deploying) {
|
||||
this.showLiveLogs = true;
|
||||
this.isDeploying = true;
|
||||
}
|
||||
}
|
||||
@@ -366,23 +361,15 @@ document.addEventListener("alpine:init", () => {
|
||||
}
|
||||
},
|
||||
|
||||
async fetchLiveLogs() {
|
||||
async fetchDeploymentLogs() {
|
||||
if (!this.currentDeploymentId || !this.isDeploying) return;
|
||||
try {
|
||||
const res = await fetch(
|
||||
`/apps/${this.appId}/deployments/${this.currentDeploymentId}/logs`,
|
||||
);
|
||||
const data = await res.json();
|
||||
this.liveLogs = data.logs || "Waiting for logs...";
|
||||
this.liveStatus = data.status;
|
||||
|
||||
this.$nextTick(() => {
|
||||
Alpine.store("utils").scrollToBottom(
|
||||
this.$refs.liveLogsWrapper,
|
||||
);
|
||||
});
|
||||
|
||||
// Update matching deployment card if present
|
||||
// Update the deployment card
|
||||
const card = document.querySelector(
|
||||
`[data-deployment-id="${this.currentDeploymentId}"]`,
|
||||
);
|
||||
@@ -411,20 +398,6 @@ document.addEventListener("alpine:init", () => {
|
||||
|
||||
submitDeploy() {
|
||||
this.isDeploying = true;
|
||||
this.showLiveLogs = true;
|
||||
this.liveLogs = "Starting deployment...";
|
||||
this.liveStatus = "building";
|
||||
},
|
||||
|
||||
get liveStatusBadgeClass() {
|
||||
return (
|
||||
Alpine.store("utils").statusBadgeClass(this.liveStatus) +
|
||||
" text-xs"
|
||||
);
|
||||
},
|
||||
|
||||
get liveStatusLabel() {
|
||||
return Alpine.store("utils").statusLabel(this.liveStatus);
|
||||
},
|
||||
|
||||
formatTime(isoTime) {
|
||||
|
||||
Reference in New Issue
Block a user