feat(admin-web/articles): show partial-success publish status from records

ArticlePublishStatus now derives partial_success when both succeeded and
failed records are present, fetches publish_records eagerly with a 30s
stale window so the popover lights up without a click, and ArticleDetail
Drawer reuses the component instead of its own tag. Relabel partial_
success copy to 部分发布 / Partially Published to match the new bucket.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-29 21:02:36 +08:00
parent e8c4fedb45
commit 2f3055babd
4 changed files with 21 additions and 9 deletions
@@ -7,6 +7,7 @@ import type { ArticleVersion, PublishRecord } from "@geo/shared-types";
import { computed, ref, watch } from "vue";
import { useI18n } from "vue-i18n";
import ArticlePublishStatus from "@/components/ArticlePublishStatus.vue";
import MarkdownPreview from "@/components/MarkdownPreview.vue";
import {
articlesApi,
@@ -121,7 +122,6 @@ const displayMarkdown = computed(() => streamMarkdown.value || detail.value?.mar
const generateMeta = computed(() =>
getGenerateStatusMeta(streamStatus.value || detail.value?.generate_status),
);
const publishMeta = computed(() => getPublishStatusMeta(detail.value?.publish_status));
const sourceArticleTitle = computed(() => detail.value?.source_title?.trim() || "");
const sourceArticleURL = computed(() => detail.value?.source_url?.trim() || "");
@@ -274,7 +274,11 @@ async function copyPublishLink(record: PublishRecord): Promise<void> {
<div class="article-drawer__tags">
<a-tag :color="generateMeta.color">{{ generateMeta.label }}</a-tag>
<a-tag :color="publishMeta.color">{{ publishMeta.label }}</a-tag>
<ArticlePublishStatus
:status="detail.publish_status"
:article-id="detail.id"
:show-platforms="false"
/>
</div>
</section>
@@ -40,7 +40,8 @@ const props = withDefaults(defineProps<{
const { t } = useI18n();
const popoverOpen = ref(false);
const shouldLoadPlatforms = computed(() => props.showPlatforms && Boolean(props.articleId) && props.status !== "unpublished");
const shouldLoadRecords = computed(() => Boolean(props.articleId) && props.status !== "unpublished");
const shouldLoadPlatforms = computed(() => props.showPlatforms && shouldLoadRecords.value);
const platformsQuery = useQuery({
queryKey: ["media", "platforms", "publish-status"],
@@ -50,12 +51,13 @@ const platformsQuery = useQuery({
});
const publishRecordsQuery = useQuery({
queryKey: computed(() => ["articles", "publish-records", props.articleId, "publish-status"]),
enabled: computed(() => popoverOpen.value && shouldLoadPlatforms.value),
queryKey: computed(() => ["articles", "publish-records", props.articleId]),
enabled: shouldLoadRecords,
queryFn: () => articlesApi.publishRecords(props.articleId as number),
staleTime: 30 * 1000,
});
const hasPopover = computed(() => shouldLoadPlatforms.value);
const hasPopover = computed(() => props.showPlatforms && shouldLoadRecords.value);
const platformMap = computed(() => {
return new Map(
@@ -108,6 +110,10 @@ const pendingEntries = computed(() =>
);
const displayStatus = computed(() => {
if (successEntries.value.length > 0 && failedEntries.value.length > 0) {
return "partial_success";
}
if (failedEntries.value.length > 0) {
return "failed";
}
@@ -121,7 +127,7 @@ const displayStatus = computed(() => {
}
if (props.status === "partial_success") {
return "failed";
return "partial_success";
}
if (props.status === "publish_success" || props.status === "published") {
@@ -149,6 +155,8 @@ const statusTone = computed(() => {
return "failed";
case "publishing":
return "processing";
case "partial_success":
return "warning";
default:
return "default";
}
+1 -1
View File
@@ -596,7 +596,7 @@ const enUS = {
publishing: "Publishing",
success: "Published",
failed: "Failed",
partial_success: "Partial Success",
partial_success: "Partially Published",
published: "Published",
publish_success: "Published",
publish_failed: "Failed",
+1 -1
View File
@@ -596,7 +596,7 @@ const zhCN = {
publishing: "发布中",
success: "发布成功",
failed: "发布失败",
partial_success: "部分成功",
partial_success: "部分发布",
published: "发布成功",
publish_success: "发布成功",
publish_failed: "发布失败",