shipthis
Version:
ShipThis manages building and uploading your Godot games to the App Store and Google Play.
68 lines (65 loc) • 3.45 kB
JavaScript
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
import { Box, Text } from 'ink';
import Spinner from 'ink-spinner';
import { DateTime } from 'luxon';
import { useState, useEffect } from 'react';
import { J as JobStatus } from './index-BwnzoldS.js';
import '@tanstack/react-query';
import 'axios';
import 'node:fs';
import 'crypto-js';
import 'uuid';
import { d as getStageColor, c as getJobStatusColor } from './index-CJWMt1s-.js';
import { a as getJobSummary } from './index-hoHfGrjg.js';
import 'fast-glob';
import 'yazl';
import 'socket.io-client';
import { u as useJobWatching } from './JobLogTail-D35FO5v-.js';
import 'fullscreen-ink';
import { a as StatusRow, b as StatusRowLabel } from './StatusTable-DzRWcMr4.js';
import { T as Title } from './Title-BCQtayg6.js';
const JobStatusSpinner = ({ showSpinner, status }) => /* @__PURE__ */ jsxs(Fragment, { children: [
/* @__PURE__ */ jsx(Box, { width: JobStatus.PROCESSING.length, children: /* @__PURE__ */ jsx(Text, { color: getJobStatusColor(status), children: `${status}` }) }),
showSpinner && /* @__PURE__ */ jsxs(Fragment, { children: [
/* @__PURE__ */ jsx(Text, { children: " " }),
/* @__PURE__ */ jsx(Spinner, { type: "dots" })
] })
] });
const JobStatusTable = ({ isWatching, jobId, onJobUpdate, projectId }) => {
const { data: job, isLoading, stage } = useJobWatching({ isWatching, jobId, onJobUpdate, projectId });
const [time, setTime] = useState(DateTime.now());
useEffect(() => {
if (!isWatching) return;
const interval = setInterval(() => setTime(DateTime.now()), 1e3);
return () => {
clearInterval(interval);
};
}, []);
const isJobInProgress = job && ![JobStatus.COMPLETED, JobStatus.FAILED].includes(job.status);
const summary = job ? getJobSummary(job, time) : null;
return /* @__PURE__ */ jsx(Box, { flexDirection: "row", children: /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [
/* @__PURE__ */ jsx(Title, { children: "Job Details" }),
isLoading && /* @__PURE__ */ jsx(Spinner, { type: "dots" }),
summary && job && /* @__PURE__ */ jsxs(Box, { flexDirection: "row", children: [
/* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginLeft: 2, children: [
/* @__PURE__ */ jsx(StatusRow, { label: "ID", value: summary.id }),
/* @__PURE__ */ jsx(StatusRow, { label: "Platform", value: summary.platform }),
/* @__PURE__ */ jsxs(Box, { flexDirection: "row", children: [
/* @__PURE__ */ jsx(StatusRowLabel, { label: "Status" }),
/* @__PURE__ */ jsx(JobStatusSpinner, { showSpinner: isWatching && Boolean(isJobInProgress), status: job.status })
] }),
/* @__PURE__ */ jsxs(Box, { flexDirection: "row", children: [
/* @__PURE__ */ jsx(StatusRowLabel, { label: "Stage" }),
stage && /* @__PURE__ */ jsx(Text, { color: getStageColor(stage), children: `${stage}` })
] })
] }),
/* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginLeft: 2, children: [
/* @__PURE__ */ jsx(StatusRow, { label: "Version", value: summary.version }),
/* @__PURE__ */ jsx(StatusRow, { label: "Git Info", value: summary.gitInfo }),
/* @__PURE__ */ jsx(StatusRow, { label: "Started At", value: summary.createdAt }),
/* @__PURE__ */ jsx(StatusRow, { label: "Runtime", value: summary.runtime })
] })
] })
] }) });
};
export { JobStatusTable as J };