mirror of
https://github.com/cuigh/swirl
synced 2025-06-26 18:16:50 +00:00
Implement event pruning
This commit is contained in:
@@ -28,6 +28,10 @@ export class EventApi {
|
||||
search(args: SearchArgs) {
|
||||
return ajax.get<SearchResult>('/event/search', args)
|
||||
}
|
||||
|
||||
prune(days: number) {
|
||||
return ajax.post<Result<Object>>('/event/prune', { days })
|
||||
}
|
||||
}
|
||||
|
||||
export default new EventApi
|
||||
|
||||
@@ -247,6 +247,10 @@ export default {
|
||||
"title": "Prune volume",
|
||||
"body": "Are you sure you want to clean up unused data volumes?",
|
||||
},
|
||||
"prune_event": {
|
||||
"title": "Prune event",
|
||||
"label": "Retention days",
|
||||
},
|
||||
},
|
||||
"objects": {
|
||||
"registry": "Registry | Registries",
|
||||
|
||||
@@ -247,6 +247,10 @@ export default {
|
||||
"title": "清理数据卷",
|
||||
"body": "是否确实要清理未使用的数据卷?",
|
||||
},
|
||||
"prune_event": {
|
||||
"title": "清理事件",
|
||||
"label": "保留天数",
|
||||
},
|
||||
},
|
||||
"objects": {
|
||||
"registry": "镜像仓库",
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { reactive } from "vue";
|
||||
import { h, reactive, ref } from "vue";
|
||||
import {
|
||||
NSpace,
|
||||
NButton,
|
||||
@@ -53,6 +53,8 @@ import {
|
||||
NSelect,
|
||||
NInput,
|
||||
NIcon,
|
||||
NFormItem,
|
||||
NInputNumber,
|
||||
} from "naive-ui";
|
||||
import { CloseOutline as CloseIcon } from "@vicons/ionicons5";
|
||||
import XPageHeader from "@/components/PageHeader.vue";
|
||||
@@ -61,7 +63,6 @@ import type { Event } from "@/api/event";
|
||||
import { useDataTable } from "@/utils/data-table";
|
||||
import { renderLink, renderTag, renderTime } from "@/utils/render";
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import type { RouteLocationRaw } from "vue-router";
|
||||
|
||||
const { t } = useI18n()
|
||||
const filter = reactive({
|
||||
@@ -225,6 +226,21 @@ function renderObject(e: Event) {
|
||||
}
|
||||
|
||||
function prune() {
|
||||
window.message.info("TODO...")
|
||||
const days = ref(7) as any
|
||||
window.dialog.warning({
|
||||
title: t('dialogs.prune_event.title'),
|
||||
content: () => h(
|
||||
NFormItem,
|
||||
{ label: t('dialogs.prune_event.label'), labelPlacement: 'top', showFeedback: false },
|
||||
{ default: () => h(NInputNumber, { min: 0, defaultValue: days, style: 'width: 100%' }) }
|
||||
),
|
||||
positiveText: t('buttons.confirm'),
|
||||
negativeText: t('buttons.cancel'),
|
||||
onPositiveClick: async () => {
|
||||
eventApi.prune(days.value);
|
||||
window.message.success(t('texts.action_success'))
|
||||
fetchData()
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user