diff --git a/.github/workflows/halo.yaml b/.github/workflows/halo.yaml index 29ba8b93ae..caddd9d821 100644 --- a/.github/workflows/halo.yaml +++ b/.github/workflows/halo.yaml @@ -19,6 +19,10 @@ on: types: - published +concurrency: + group: ${{github.workflow}} - ${{github.ref}} + cancel-in-progress: true + jobs: test: if: github.event_name == 'pull_request' || github.event_name == 'push' @@ -30,6 +34,7 @@ jobs: - name: Check Halo run: ./gradlew check - name: Upload coverage reports to Codecov + if: github.repository == 'halo-dev/halo' uses: codecov/codecov-action@v4 build: @@ -51,6 +56,7 @@ jobs: - name: Build Halo run: ./gradlew clean && ./gradlew downloadPluginPresets && ./gradlew build -x check - name: Upload Artifacts + if: github.repository == 'halo-dev/halo' uses: actions/upload-artifact@v4 with: name: halo-artifacts @@ -69,6 +75,7 @@ jobs: name: halo-artifacts path: application/build/libs - name: Upload Artifacts + if: github.repository == 'halo-dev/halo' env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: gh release upload ${{ github.event.release.tag_name }} application/build/libs/* diff --git a/ui/console-src/modules/contents/pages/SinglePageSnapshots.vue b/ui/console-src/modules/contents/pages/SinglePageSnapshots.vue index fb0e5ad95c..246bcee878 100644 --- a/ui/console-src/modules/contents/pages/SinglePageSnapshots.vue +++ b/ui/console-src/modules/contents/pages/SinglePageSnapshots.vue @@ -1,12 +1,15 @@ diff --git a/ui/console-src/modules/contents/pages/components/SnapshotListItem.vue b/ui/console-src/modules/contents/pages/components/SnapshotListItem.vue index d4ad9446bc..bdc3bcadb5 100644 --- a/ui/console-src/modules/contents/pages/components/SnapshotListItem.vue +++ b/ui/console-src/modules/contents/pages/components/SnapshotListItem.vue @@ -109,6 +109,9 @@ const isBase = computed(() => { {{ $t("core.page_snapshots.status.draft") }} + + {{ $t("core.page_snapshots.status.base") }} + import { + Dialog, IconHistoryLine, + Toast, VButton, VCard, VLoading, VPageHeader, + VSpace, } from "@halo-dev/components"; -import { useQuery } from "@tanstack/vue-query"; +import { useQuery, useQueryClient } from "@tanstack/vue-query"; import { useRoute } from "vue-router"; import { apiClient } from "@/utils/api-client"; import { computed, watch } from "vue"; @@ -14,8 +17,11 @@ import { OverlayScrollbarsComponent } from "overlayscrollbars-vue"; import { useRouteQuery } from "@vueuse/router"; import SnapshotContent from "@console/modules/contents/posts/components/SnapshotContent.vue"; import SnapshotListItem from "@console/modules/contents/posts/components/SnapshotListItem.vue"; +import { useI18n } from "vue-i18n"; +const { t } = useI18n(); const route = useRoute(); +const queryClient = useQueryClient(); const postName = computed(() => route.query.name as string); @@ -70,6 +76,43 @@ watch( immediate: true, } ); + +function handleCleanup() { + Dialog.warning({ + title: t("core.post_snapshots.operations.cleanup.title"), + description: t("core.post_snapshots.operations.cleanup.description"), + confirmText: t("core.common.buttons.confirm"), + cancelText: t("core.common.buttons.cancel"), + async onConfirm() { + const { releaseSnapshot, baseSnapshot, headSnapshot } = + post.value?.spec || {}; + const snapshotsToDelete = snapshots.value?.filter((snapshot) => { + const { name } = snapshot.metadata; + return ![releaseSnapshot, baseSnapshot, headSnapshot] + .filter(Boolean) + .includes(name); + }); + + if (!snapshotsToDelete?.length) { + Toast.info(t("core.post_snapshots.operations.cleanup.toast_empty")); + return; + } + + for (let i = 0; i < snapshotsToDelete?.length; i++) { + await apiClient.post.deletePostContent({ + name: postName.value, + snapshotName: snapshotsToDelete[i].metadata.name, + }); + } + + await queryClient.invalidateQueries({ + queryKey: ["post-snapshots-by-post-name", postName], + }); + + Toast.success(t("core.post_snapshots.operations.cleanup.toast_success")); + }, + }); +} diff --git a/ui/console-src/modules/contents/posts/components/SnapshotListItem.vue b/ui/console-src/modules/contents/posts/components/SnapshotListItem.vue index 4790d26465..5d5e0ada4d 100644 --- a/ui/console-src/modules/contents/posts/components/SnapshotListItem.vue +++ b/ui/console-src/modules/contents/posts/components/SnapshotListItem.vue @@ -107,6 +107,9 @@ const isBase = computed(() => { {{ $t("core.post_snapshots.status.draft") }} + + {{ $t("core.post_snapshots.status.base") }} + import type { PropType } from "vue"; -import type { Editor, AnyExtension } from "@/tiptap/vue-3"; +import type { AnyExtension, Editor } from "@/tiptap/vue-3"; import BubbleMenu from "@/components/bubble/BubbleMenu.vue"; import type { NodeBubbleMenu } from "@/types"; import BubbleItem from "@/components/bubble/BubbleItem.vue"; -import type { EditorView, EditorState } from "@/tiptap/pm"; +import type { EditorState, EditorView } from "@/tiptap/pm"; const props = defineProps({ editor: { @@ -71,7 +71,7 @@ const shouldShow = ( :default-animation="bubbleMenu.defaultAnimation" >