feat: 展示小程序构建过程和日志
This commit is contained in:
1 parent
8b4d27b0ee
commit
998e32e49c
7 files changed
+182
-14
No files matched your search
@@ -89,6 +89,12 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
||||
privateKey: "",
|
||||
});
|
||||
}, [miniAppSettings.data, miniAppSettingsForm]);
|
||||
useEffect(() => {
|
||||
const building = miniAppReleases.data?.find((task) => task.status === "building");
|
||||
if (!building) return;
|
||||
const timer = setInterval(() => void miniAppReleases.refetch(), 1500);
|
||||
return () => clearInterval(timer);
|
||||
}, [miniAppReleases.data, miniAppReleases]);
|
||||
const refresh = () => {
|
||||
for (const key of [
|
||||
"publication-brand",
|
||||
@@ -532,9 +538,11 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
||||
color={
|
||||
task.status === "published"
|
||||
? "green"
|
||||
: task.status === "failed"
|
||||
: task.status === "failed" || task.status === "build_failed"
|
||||
? "red"
|
||||
: "blue"
|
||||
: task.status === "building"
|
||||
? "orange"
|
||||
: "blue"
|
||||
}
|
||||
>
|
||||
{task.status}
|
||||
@@ -545,7 +553,27 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
||||
</Typography.Text>
|
||||
)}
|
||||
{task.error && <Typography.Text type="danger">{task.error}</Typography.Text>}
|
||||
{task.status === "built" && (
|
||||
{task.status === "building" && (
|
||||
<Typography.Text type="secondary">正在构建微信小程序...</Typography.Text>
|
||||
)}
|
||||
{task.status === "build_failed" && (
|
||||
<Typography.Text type="secondary">微信小程序构建失败</Typography.Text>
|
||||
)}
|
||||
{task.buildLogs?.length ? (
|
||||
<Space direction="vertical" style={{ width: "100%" }}>
|
||||
{task.buildLogs.slice(-8).map((log, index) => (
|
||||
<Typography.Paragraph
|
||||
key={`${log.at}-${index}`}
|
||||
type={log.stream === "stderr" ? "danger" : "secondary"}
|
||||
style={{ marginBottom: 0, whiteSpace: "pre-wrap", fontSize: 12 }}
|
||||
code
|
||||
>
|
||||
{log.message}
|
||||
</Typography.Paragraph>
|
||||
))}
|
||||
</Space>
|
||||
) : null}
|
||||
{(task.status === "built" || task.status === "build_failed") && (
|
||||
<Button
|
||||
size="small"
|
||||
loading={uploadMiniAppRelease.isPending}
|
||||
|
||||
Reference in new issue
Block a user