From 2ae5d222d9de92f042e8f3f6bff217b08b2cd3a8 Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Wed, 26 Jun 2024 17:58:50 +0800 Subject: [PATCH] feat: add batch setting for partial post fields (#6142) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #### What type of PR is this? /kind feature /area ui /milestone 2.17.x #### What this PR does / why we need it: 支持批量为文章设置部分属性。 ![image](https://github.com/halo-dev/halo/assets/21301288/cc4aa912-20ba-4b50-869b-705702f56d7d) #### Which issue(s) this PR fixes: Fixes https://github.com/halo-dev/halo/issues/4631 #### Special notes for your reviewer: #### Does this PR introduce a user-facing change? ```release-note 支持批量为文章设置部分属性。 ``` --- .../modules/contents/posts/PostList.vue | 26 ++ .../components/PostBatchSettingModal.vue | 307 ++++++++++++++++++ ui/src/locales/en.yaml | 21 ++ ui/src/locales/zh-CN.yaml | 21 ++ ui/src/locales/zh-TW.yaml | 21 ++ 5 files changed, 396 insertions(+) create mode 100644 ui/console-src/modules/contents/posts/components/PostBatchSettingModal.vue diff --git a/ui/console-src/modules/contents/posts/PostList.vue b/ui/console-src/modules/contents/posts/PostList.vue index 958cbdf56..130d7c5d9 100644 --- a/ui/console-src/modules/contents/posts/PostList.vue +++ b/ui/console-src/modules/contents/posts/PostList.vue @@ -28,6 +28,7 @@ import UserFilterDropdown from "@/components/filter/UserFilterDropdown.vue"; import CategoryFilterDropdown from "@/components/filter/CategoryFilterDropdown.vue"; import TagFilterDropdown from "@/components/filter/TagFilterDropdown.vue"; import PostListItem from "./components/PostListItem.vue"; +import PostBatchSettingModal from "./components/PostBatchSettingModal.vue"; const { t } = useI18n(); @@ -320,6 +321,23 @@ const handleCancelPublishInBatch = async () => { }); }; +// Batch settings +const batchSettingModalVisible = ref(false); +const batchSettingPosts = ref([]); + +function handleOpenBatchSettingModal() { + batchSettingPosts.value = selectedPostNames.value.map((name) => { + return posts.value?.find((post) => post.post.metadata.name === name); + }) as ListedPost[]; + + batchSettingModalVisible.value = true; +} + +function onBatchSettingModalClose() { + batchSettingModalVisible.value = false; + batchSettingPosts.value = []; +} + watch( () => selectedPostNames.value, (newValue) => { @@ -342,6 +360,11 @@ watch( +