diff --git a/src/components/filter/FilterCleanButton.vue b/src/components/filter/FilterCleanButton.vue
new file mode 100644
index 00000000..b93b945c
--- /dev/null
+++ b/src/components/filter/FilterCleanButton.vue
@@ -0,0 +1,15 @@
+
+
+
+
+
diff --git a/src/components/filter/FilterTag.vue b/src/components/filter/FilterTag.vue
new file mode 100644
index 00000000..433fa2e8
--- /dev/null
+++ b/src/components/filter/FilterTag.vue
@@ -0,0 +1,25 @@
+
+
+
+
+
diff --git a/src/modules/contents/attachments/AttachmentList.vue b/src/modules/contents/attachments/AttachmentList.vue
index e5614fe8..9b2ad34d 100644
--- a/src/modules/contents/attachments/AttachmentList.vue
+++ b/src/modules/contents/attachments/AttachmentList.vue
@@ -15,7 +15,6 @@ import {
VPagination,
VSpace,
VEmpty,
- IconCloseCircle,
IconFolder,
VStatusDot,
VEntity,
@@ -40,6 +39,9 @@ import { isImage } from "@/utils/image";
import { useRouteQuery } from "@vueuse/router";
import { useFetchAttachmentGroup } from "./composables/use-attachment-group";
import { usePermission } from "@/utils/permission";
+import FilterTag from "@/components/filter/FilterTag.vue";
+import FilteCleanButton from "@/components/filter/FilterCleanButton.vue";
+import { getNode } from "@formkit/core";
const { currentUserHasPermission } = usePermission();
@@ -90,17 +92,47 @@ const selectedSortItemValue = computed(() => {
function handleSelectPolicy(policy: Policy | undefined) {
selectedPolicy.value = policy;
- handleFetchAttachments();
+ handleFetchAttachments(1);
}
function handleSelectUser(user: User | undefined) {
selectedUser.value = user;
- handleFetchAttachments();
+ handleFetchAttachments(1);
}
function handleSortItemChange(sortItem?: SortItem) {
selectedSortItem.value = sortItem;
- handleFetchAttachments();
+ handleFetchAttachments(1);
+}
+
+function handleKeywordChange() {
+ const keywordNode = getNode("keywordInput");
+ if (keywordNode) {
+ keyword.value = keywordNode._value as string;
+ }
+ handleFetchAttachments(1);
+}
+
+function handleClearKeyword() {
+ keyword.value = "";
+ handleFetchAttachments(1);
+}
+
+const hasFilters = computed(() => {
+ return (
+ selectedPolicy.value ||
+ selectedUser.value ||
+ selectedSortItem.value ||
+ keyword.value
+ );
+});
+
+function handleClearFilters() {
+ selectedPolicy.value = undefined;
+ selectedUser.value = undefined;
+ selectedSortItem.value = undefined;
+ keyword.value = "";
+ handleFetchAttachments(1);
}
const {
@@ -322,57 +354,44 @@ onMounted(() => {
class="flex items-center gap-2"
>
-
+ 关键词:{{ keyword }}
+
+
+
-
- 存储策略:{{ selectedPolicy?.spec.displayName }}
-
-
-
+ 存储策略:{{ selectedPolicy?.spec.displayName }}
+
-
-
- 上传者:{{ selectedUser?.spec.displayName }}
-
-
-
+ 上传者:{{ selectedUser?.spec.displayName }}
+
-
-
- 排序:{{ selectedSortItem.label }}
-
-
-
+ 排序:{{ selectedSortItem.label }}
+
+
+
@@ -521,7 +540,7 @@ onMounted(() => {
;
selectedAttachments: Ref>;
checkedAll: Ref;
- handleFetchAttachments: () => void;
+ handleFetchAttachments: (page?: number) => void;
handlePaginationChange: ({
page,
size,
@@ -68,11 +68,16 @@ export function useAttachmentControl(filterOptions?: {
const checkedAll = ref(false);
const refreshInterval = ref();
- const handleFetchAttachments = async () => {
+ const handleFetchAttachments = async (page?: number) => {
try {
clearInterval(refreshInterval.value);
loading.value = true;
+
+ if (page) {
+ attachments.value.page = page;
+ }
+
const { data } = await apiClient.attachment.searchAttachments({
policy: policy?.value?.metadata.name,
displayName: keyword?.value,
diff --git a/src/modules/contents/comments/CommentList.vue b/src/modules/contents/comments/CommentList.vue
index 56e7e51b..14d66a17 100644
--- a/src/modules/contents/comments/CommentList.vue
+++ b/src/modules/contents/comments/CommentList.vue
@@ -7,7 +7,6 @@ import {
VPageHeader,
VPagination,
VSpace,
- IconCloseCircle,
IconRefreshLine,
VEmpty,
Dialog,
@@ -19,9 +18,12 @@ import type {
ListedCommentList,
User,
} from "@halo-dev/api-client";
-import { onMounted, ref, watch } from "vue";
+import { computed, onMounted, ref, watch } from "vue";
import { apiClient } from "@/utils/api-client";
import { onBeforeRouteLeave } from "vue-router";
+import FilterTag from "@/components/filter/FilterTag.vue";
+import FilterCleanButton from "@/components/filter/FilterCleanButton.vue";
+import { getNode } from "@formkit/core";
const comments = ref({
page: 1,
@@ -41,11 +43,16 @@ const selectedCommentNames = ref([]);
const keyword = ref("");
const refreshInterval = ref();
-const handleFetchComments = async () => {
+const handleFetchComments = async (page?: number) => {
try {
clearInterval(refreshInterval.value);
loading.value = true;
+
+ if (page) {
+ comments.value.page = page;
+ }
+
const { data } = await apiClient.comment.listComments({
page: comments.value.page,
size: comments.value.size,
@@ -212,13 +219,16 @@ const SortFilterItems: {
value: "CREATE_TIME",
},
];
+
const selectedApprovedFilterItem = ref<{ label: string; value?: boolean }>(
ApprovedFilterItems[0]
);
+
const selectedSortFilterItem = ref<{
label: string;
value?: Sort;
}>(SortFilterItems[0]);
+
const selectedUser = ref();
const handleApprovedFilterItemChange = (filterItem: {
@@ -227,7 +237,7 @@ const handleApprovedFilterItemChange = (filterItem: {
}) => {
selectedApprovedFilterItem.value = filterItem;
selectedCommentNames.value = [];
- handlePaginationChange({ page: 1, size: 20 });
+ handleFetchComments(1);
};
const handleSortFilterItemChange = (filterItem: {
@@ -236,12 +246,42 @@ const handleSortFilterItemChange = (filterItem: {
}) => {
selectedSortFilterItem.value = filterItem;
selectedCommentNames.value = [];
- handlePaginationChange({ page: 1, size: 20 });
+ handleFetchComments(1);
};
function handleSelectUser(user: User | undefined) {
selectedUser.value = user;
- handlePaginationChange({ page: 1, size: 20 });
+ handleFetchComments(1);
+}
+
+function handleKeywordChange() {
+ const keywordNode = getNode("keywordInput");
+ if (keywordNode) {
+ keyword.value = keywordNode._value as string;
+ }
+ handleFetchComments(1);
+}
+
+function handleClearKeyword() {
+ keyword.value = "";
+ handleFetchComments(1);
+}
+
+const hasFilters = computed(() => {
+ return (
+ selectedApprovedFilterItem.value.value !== undefined ||
+ selectedSortFilterItem.value.value !== "LAST_REPLY_TIME" ||
+ selectedUser.value ||
+ keyword.value
+ );
+});
+
+function handleClearFilters() {
+ selectedApprovedFilterItem.value = ApprovedFilterItems[0];
+ selectedSortFilterItem.value = SortFilterItems[0];
+ selectedUser.value = undefined;
+ keyword.value = "";
+ handleFetchComments(1);
}
@@ -275,49 +315,46 @@ function handleSelectUser(user: User | undefined) {
class="flex items-center gap-2"
>
-
+ 关键词:{{ keyword }}
+
+
+
-
- 状态:{{ selectedApprovedFilterItem.label }}
-
-
-
-
+
+
-
- 评论者:{{ selectedUser?.spec.displayName }}
-
-
-
-
+
+
-
- 排序:{{ selectedSortFilterItem.label }}
-
-
-
+ 排序:{{ selectedSortFilterItem.label }}
+
+
+
@@ -409,7 +446,7 @@ function handleSelectUser(user: User | undefined) {
{
class="w-28 min-w-[7rem]"
:title="comment?.owner?.displayName"
:description="comment?.owner?.email"
- :route="{
- name: 'UserDetail',
- params: {
- name: comment?.owner?.name,
- },
- }"
>
diff --git a/src/modules/contents/pages/DeletedSinglePageList.vue b/src/modules/contents/pages/DeletedSinglePageList.vue
index aaa43348..36a807c4 100644
--- a/src/modules/contents/pages/DeletedSinglePageList.vue
+++ b/src/modules/contents/pages/DeletedSinglePageList.vue
@@ -22,6 +22,8 @@ import { formatDatetime } from "@/utils/date";
import { onBeforeRouteLeave, RouterLink } from "vue-router";
import cloneDeep from "lodash.clonedeep";
import { usePermission } from "@/utils/permission";
+import { getNode } from "@formkit/core";
+import FilterTag from "@/components/filter/FilterTag.vue";
const { currentUserHasPermission } = usePermission();
@@ -42,12 +44,16 @@ const checkedAll = ref(false);
const refreshInterval = ref();
const keyword = ref("");
-const handleFetchSinglePages = async () => {
+const handleFetchSinglePages = async (page?: number) => {
try {
clearInterval(refreshInterval.value);
loading.value = true;
+ if (page) {
+ singlePages.value.page = page;
+ }
+
const { data } = await apiClient.singlePage.listSinglePages({
labelSelector: [`content.halo.run/deleted=true`],
page: singlePages.value.page,
@@ -198,6 +204,20 @@ watch(selectedPageNames, (newValue) => {
});
onMounted(handleFetchSinglePages);
+
+// Filters
+function handleKeywordChange() {
+ const keywordNode = getNode("keywordInput");
+ if (keywordNode) {
+ keyword.value = keywordNode._value as string;
+ }
+ handleFetchSinglePages(1);
+}
+
+function handleClearKeyword() {
+ keyword.value = "";
+ handleFetchSinglePages(1);
+}
@@ -245,11 +265,18 @@ onMounted(handleFetchSinglePages);
class="flex items-center gap-2"
>
+
+
+ 关键词:{{ keyword }}
+
@@ -265,7 +292,7 @@ onMounted(handleFetchSinglePages);
([]);
const checkedAll = ref(false);
const refreshInterval = ref();
-const handleFetchSinglePages = async () => {
+const handleFetchSinglePages = async (page?: number) => {
try {
clearInterval(refreshInterval.value);
@@ -74,6 +76,10 @@ const handleFetchSinglePages = async () => {
);
}
+ if (page) {
+ singlePages.value.page = page;
+ }
+
const { data } = await apiClient.singlePage.listSinglePages({
labelSelector,
page: singlePages.value.page,
@@ -354,22 +360,54 @@ const keyword = ref("");
function handleVisibleItemChange(visibleItem: VisibleItem) {
selectedVisibleItem.value = visibleItem;
- handleFetchSinglePages();
+ handleFetchSinglePages(1);
}
const handleSelectUser = (user?: User) => {
selectedContributor.value = user;
- handleFetchSinglePages();
+ handleFetchSinglePages(1);
};
function handlePublishStatusItemChange(publishStatusItem: PublishStatusItem) {
selectedPublishStatusItem.value = publishStatusItem;
- handleFetchSinglePages();
+ handleFetchSinglePages(1);
}
function handleSortItemChange(sortItem?: SortItem) {
selectedSortItem.value = sortItem;
- handleFetchSinglePages();
+ handleFetchSinglePages(1);
+}
+
+function handleKeywordChange() {
+ const keywordNode = getNode("keywordInput");
+ if (keywordNode) {
+ keyword.value = keywordNode._value as string;
+ }
+ handleFetchSinglePages(1);
+}
+
+function handleClearKeyword() {
+ keyword.value = "";
+ handleFetchSinglePages(1);
+}
+
+const hasFilters = computed(() => {
+ return (
+ selectedContributor.value ||
+ selectedVisibleItem.value.value ||
+ selectedPublishStatusItem.value.value !== undefined ||
+ selectedSortItem.value ||
+ keyword.value
+ );
+});
+
+function handleClearFilters() {
+ selectedContributor.value = undefined;
+ selectedVisibleItem.value = VisibleItems[0];
+ selectedPublishStatusItem.value = PublishStatusItems[0];
+ selectedSortItem.value = undefined;
+ keyword.value = "";
+ handleFetchSinglePages(1);
}
@@ -411,60 +449,48 @@ function handleSortItemChange(sortItem?: SortItem) {
class="flex items-center gap-2"
>
-
+ 关键词:{{ keyword }}
+
+
+
-
- 状态:{{ selectedPublishStatusItem.label }}
-
-
-
-
+
+
-
- 可见性:{{ selectedVisibleItem.label }}
-
-
-
-
-
- 作者:{{ selectedContributor?.spec.displayName }}
-
-
-
-
+
+
+ 作者:{{ selectedContributor?.spec.displayName }}
+
+
+
-
- 排序:{{ selectedSortItem.label }}
-
-
-
+ 排序:{{ selectedSortItem.label }}
+
+
+
删除
@@ -574,7 +600,7 @@ function handleSortItemChange(sortItem?: SortItem) {
([]);
const refreshInterval = ref();
const keyword = ref("");
-const handleFetchPosts = async () => {
+const handleFetchPosts = async (page?: number) => {
try {
clearInterval(refreshInterval.value);
loading.value = true;
+ if (page) {
+ posts.value.page = page;
+ }
+
const { data } = await apiClient.post.listPosts({
labelSelector: [`content.halo.run/deleted=true`],
page: posts.value.page,
@@ -191,6 +197,19 @@ watch(selectedPostNames, (newValue) => {
onMounted(() => {
handleFetchPosts();
});
+
+function handleKeywordChange() {
+ const keywordNode = getNode("keywordInput");
+ if (keywordNode) {
+ keyword.value = keywordNode._value as string;
+ }
+ handleFetchPosts(1);
+}
+
+function handleClearKeyword() {
+ keyword.value = "";
+ handleFetchPosts(1);
+}
@@ -238,12 +257,18 @@ onMounted(() => {
class="flex items-center gap-2"
>
+
+
+ 关键词:{{ keyword }}
+
@@ -259,7 +284,7 @@ onMounted(() => {
([]);
const refreshInterval = ref();
-const handleFetchPosts = async () => {
+const handleFetchPosts = async (page?: number) => {
try {
clearInterval(refreshInterval.value);
@@ -93,6 +95,10 @@ const handleFetchPosts = async () => {
);
}
+ if (page) {
+ posts.value.page = page;
+ }
+
const { data } = await apiClient.post.listPosts({
labelSelector,
page: posts.value.page,
@@ -372,33 +378,69 @@ const keyword = ref("");
function handleVisibleItemChange(visibleItem: VisibleItem) {
selectedVisibleItem.value = visibleItem;
- handleFetchPosts();
+ handleFetchPosts(1);
}
function handlePublishStatusItemChange(publishStatusItem: PublishStatuItem) {
selectedPublishStatusItem.value = publishStatusItem;
- handleFetchPosts();
+ handleFetchPosts(1);
}
function handleSortItemChange(sortItem?: SortItem) {
selectedSortItem.value = sortItem;
- handleFetchPosts();
+ handleFetchPosts(1);
}
function handleCategoryChange(category?: Category) {
selectedCategory.value = category;
- handleFetchPosts();
+ handleFetchPosts(1);
}
function handleTagChange(tag?: Tag) {
selectedTag.value = tag;
- handleFetchPosts();
+ handleFetchPosts(1);
}
function handleContributorChange(user?: User) {
selectedContributor.value = user;
- handleFetchPosts();
+ handleFetchPosts(1);
}
+
+function handleKeywordChange() {
+ const keywordNode = getNode("keywordInput");
+ if (keywordNode) {
+ keyword.value = keywordNode._value as string;
+ }
+ handleFetchPosts(1);
+}
+
+function handleClearKeyword() {
+ keyword.value = "";
+ handleFetchPosts(1);
+}
+
+function handleClearFilters() {
+ selectedVisibleItem.value = VisibleItems[0];
+ selectedPublishStatusItem.value = PublishStatuItems[0];
+ selectedSortItem.value = undefined;
+ selectedCategory.value = undefined;
+ selectedTag.value = undefined;
+ selectedContributor.value = undefined;
+ keyword.value = "";
+ handleFetchPosts(1);
+}
+
+const hasFilters = computed(() => {
+ return (
+ selectedVisibleItem.value.value ||
+ selectedPublishStatusItem.value.value !== undefined ||
+ selectedSortItem.value ||
+ selectedCategory.value ||
+ selectedTag.value ||
+ selectedContributor.value ||
+ keyword.value
+ );
+});
-
-
- 状态:{{ selectedPublishStatusItem.label }}
-
-
-
-
-
- 可见性:{{ selectedVisibleItem.label }}
-
-
-
+
+ 关键词:{{ keyword }}
+
-
+ 状态:{{ selectedPublishStatusItem.label }}
+
+
+
+ 可见性:{{ selectedVisibleItem.label }}
+
+
+
-
- 分类:{{ selectedCategory.spec.displayName }}
-
-
-
-
-
- 标签:{{ selectedTag.spec.displayName }}
-
-
-
-
+
+
+ 标签:{{ selectedTag.spec.displayName }}
+
+
+
-
- 作者:{{ selectedContributor.spec.displayName }}
-
-
-
-
+
+
-
- 排序:{{ selectedSortItem.label }}
-
-
-
+ 排序:{{ selectedSortItem.label }}
+
+
+
@@ -792,7 +810,7 @@ function handleContributorChange(user?: User) {
{
+const handleFetchPlugins = async (page?: number) => {
try {
clearInterval(refreshInterval.value);
loading.value = true;
+ if (page) {
+ plugins.value.page = page;
+ }
+
const { data } = await apiClient.plugin.listPlugins({
page: plugins.value.page,
size: plugins.value.size,
@@ -132,12 +138,40 @@ const selectedSortItem = ref();
function handleEnabledItemChange(enabledItem: EnabledItem) {
selectedEnabledItem.value = enabledItem;
- handleFetchPlugins();
+ handleFetchPlugins(1);
}
function handleSortItemChange(sortItem?: SortItem) {
selectedSortItem.value = sortItem;
- handleFetchPlugins();
+ handleFetchPlugins(1);
+}
+
+function handleKeywordChange() {
+ const keywordNode = getNode("keywordInput");
+ if (keywordNode) {
+ keyword.value = keywordNode._value as string;
+ }
+ handleFetchPlugins(1);
+}
+
+function handleClearKeyword() {
+ keyword.value = "";
+ handleFetchPlugins(1);
+}
+
+const hasFilters = computed(() => {
+ return (
+ selectedEnabledItem.value?.value !== undefined ||
+ selectedSortItem.value?.value ||
+ keyword.value
+ );
+});
+
+function handleClearFilters() {
+ selectedEnabledItem.value = undefined;
+ selectedSortItem.value = undefined;
+ keyword.value = "";
+ handleFetchPlugins(1);
}
@@ -174,37 +208,34 @@ function handleSortItemChange(sortItem?: SortItem) {
>
-
+ 关键词:{{ keyword }}
+
+
+
-
- 启用状态:{{ selectedEnabledItem.label }}
-
-
-
-
+
+
-
- 排序:{{ selectedSortItem.label }}
-
-
-
+ 排序:{{ selectedSortItem.label }}
+
+
+
@@ -265,7 +296,7 @@ function handleSortItemChange(sortItem?: SortItem) {