|
@@ -1,6 +1,7 @@
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
import { ref, onMounted, computed } from 'vue'
|
|
import { ref, onMounted, computed } from 'vue'
|
|
|
import { Button } from '@/components/ui/button'
|
|
import { Button } from '@/components/ui/button'
|
|
|
|
|
+import { Input } from '@/components/ui/input'
|
|
|
import { Badge } from '@/components/ui/badge'
|
|
import { Badge } from '@/components/ui/badge'
|
|
|
import {
|
|
import {
|
|
|
Table,
|
|
Table,
|
|
@@ -36,6 +37,7 @@ const records = ref<DnsRecord[]>([])
|
|
|
const zones = ref<Zone[]>([])
|
|
const zones = ref<Zone[]>([])
|
|
|
const loading = ref(true)
|
|
const loading = ref(true)
|
|
|
const selectedZone = ref<string>('all')
|
|
const selectedZone = ref<string>('all')
|
|
|
|
|
+const searchQuery = ref('')
|
|
|
|
|
|
|
|
const dialogOpen = ref(false)
|
|
const dialogOpen = ref(false)
|
|
|
const editingRecord = ref<DnsRecord | null>(null)
|
|
const editingRecord = ref<DnsRecord | null>(null)
|
|
@@ -45,8 +47,17 @@ const deletingRecord = ref<DnsRecord | null>(null)
|
|
|
const syncing = ref(false)
|
|
const syncing = ref(false)
|
|
|
|
|
|
|
|
const filteredRecords = computed(() => {
|
|
const filteredRecords = computed(() => {
|
|
|
- if (selectedZone.value === 'all') return records.value
|
|
|
|
|
- return records.value.filter((r) => r.zone_id === Number(selectedZone.value))
|
|
|
|
|
|
|
+ let result = selectedZone.value === 'all'
|
|
|
|
|
+ ? records.value
|
|
|
|
|
+ : records.value.filter((r) => r.zone_id === Number(selectedZone.value))
|
|
|
|
|
+
|
|
|
|
|
+ if (searchQuery.value.trim()) {
|
|
|
|
|
+ const q = searchQuery.value.trim().toLowerCase()
|
|
|
|
|
+ result = result.filter(
|
|
|
|
|
+ (r) => r.name.toLowerCase().includes(q) || r.content.toLowerCase().includes(q),
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+ return result
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
const dynamicRecords = computed(() => filteredRecords.value.filter((r) => r.is_static === 0))
|
|
const dynamicRecords = computed(() => filteredRecords.value.filter((r) => r.is_static === 0))
|
|
@@ -171,6 +182,11 @@ onMounted(loadData)
|
|
|
</SelectItem>
|
|
</SelectItem>
|
|
|
</SelectContent>
|
|
</SelectContent>
|
|
|
</Select>
|
|
</Select>
|
|
|
|
|
+ <Input
|
|
|
|
|
+ v-model="searchQuery"
|
|
|
|
|
+ placeholder="Search by name or content..."
|
|
|
|
|
+ class="w-full sm:w-[260px]"
|
|
|
|
|
+ />
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<template v-if="loading">
|
|
<template v-if="loading">
|