Quellcode durchsuchen

feat: add name filtering to site and stream listing options

0xJacky vor 2 Wochen
Ursprung
Commit
8ad1f0cc33

+ 1 - 0
api/sites/list.go

@@ -14,6 +14,7 @@ func GetSiteList(c *gin.Context) {
 	// Parse query parameters
 	options := &site.ListOptions{
 		Search:     c.Query("search"),
+		Name:       c.Query("name"),
 		Status:     c.Query("status"),
 		OrderBy:    c.Query("sort_by"),
 		Sort:       c.DefaultQuery("order", "desc"),

+ 1 - 0
api/streams/streams.go

@@ -35,6 +35,7 @@ func GetStreams(c *gin.Context) {
 	// Parse query parameters
 	options := &stream.ListOptions{
 		Search:     c.Query("search"),
+		Name:       c.Query("name"),
 		Status:     c.Query("status"),
 		OrderBy:    c.Query("order_by"),
 		Sort:       c.DefaultQuery("sort", "desc"),

+ 9 - 9
app/package.json

@@ -18,8 +18,8 @@
     "@fingerprintjs/fingerprintjs": "^4.6.2",
     "@formkit/auto-animate": "^0.8.2",
     "@simplewebauthn/browser": "^13.1.2",
-    "@uozi-admin/curd": "^4.5.3",
-    "@uozi-admin/request": "^2.8.1",
+    "@uozi-admin/curd": "^4.5.7",
+    "@uozi-admin/request": "^2.8.4",
     "@vue/reactivity": "^3.5.18",
     "@vue/shared": "^3.5.18",
     "@vueuse/components": "^13.5.0",
@@ -30,7 +30,7 @@
     "@xterm/xterm": "^5.5.0",
     "ant-design-vue": "^4.2.6",
     "apexcharts": "^5.3.1",
-    "axios": "^1.10.0",
+    "axios": "^1.11.0",
     "dayjs": "^1.11.13",
     "highlight.js": "^11.11.1",
     "jsencrypt": "^3.3.2",
@@ -60,7 +60,7 @@
   "devDependencies": {
     "@antfu/eslint-config": "^5.0.0",
     "@iconify-json/fa": "1.2.1",
-    "@iconify-json/tabler": "^1.2.19",
+    "@iconify-json/tabler": "^1.2.20",
     "@iconify/tools": "^4.1.2",
     "@iconify/types": "^2.0.0",
     "@iconify/utils": "^2.3.0",
@@ -68,13 +68,13 @@
     "@types/lodash": "^4.17.20",
     "@types/nprogress": "^0.2.3",
     "@types/sortablejs": "^1.15.8",
-    "@vitejs/plugin-vue": "^6.0.0",
+    "@vitejs/plugin-vue": "^6.0.1",
     "@vitejs/plugin-vue-jsx": "^5.0.1",
     "@vue/compiler-sfc": "^3.5.18",
     "@vue/tsconfig": "^0.7.0",
     "ace-builds": "^1.43.2",
     "autoprefixer": "^10.4.21",
-    "eslint": "^9.31.0",
+    "eslint": "^9.32.0",
     "eslint-plugin-sonarjs": "^3.0.4",
     "less": "^4.4.0",
     "postcss": "^8.5.6",
@@ -82,9 +82,9 @@
     "unplugin-auto-import": "^19.3.0",
     "unplugin-vue-components": "^28.8.0",
     "unplugin-vue-define-options": "^1.5.5",
-    "vite": "npm:rolldown-vite@^7.0.10",
-    "vite-plugin-inspect": "^11.3.0",
+    "vite": "npm:rolldown-vite@^7.0.11",
+    "vite-plugin-inspect": "^11.3.2",
     "vite-svg-loader": "^5.1.0",
-    "vue-tsc": "^3.0.3"
+    "vue-tsc": "^3.0.4"
   }
 }

Datei-Diff unterdrückt, da er zu groß ist
+ 177 - 211
app/pnpm-lock.yaml


+ 2 - 2
app/src/components/ProxyTargets/ProxyTargets.vue

@@ -23,10 +23,10 @@ function getTargetText(target: ProxyTarget): string {
     return `${target.host}:${target.port}`
 
   if (result.online) {
-    return `${target.host}:${target.port} · ${result.latency.toFixed(2)}ms`
+    return `${target.host}:${target.port} (${result.latency.toFixed(2)}ms)`
   }
   else {
-    return `${target.host}:${target.port} · ${$gettext('Offline')}`
+    return `${target.host}:${target.port}`
   }
 }
 

+ 0 - 6
app/src/lib/http/interceptors.ts

@@ -5,14 +5,12 @@ import JSEncrypt from 'jsencrypt'
 import { storeToRefs } from 'pinia'
 import use2FAModal from '@/components/TwoFA/use2FAModal'
 import { getBrowserFingerprint } from '@/lib/helper'
-import { useNProgress } from '@/lib/nprogress/nprogress'
 import { useSettingsStore, useUserStore } from '@/pinia'
 import router from '@/routes'
 import { handleApiError, useMessageDedupe } from './error'
 
 const { setRequestInterceptor, setResponseInterceptor } = useAxios()
 
-const nprogress = useNProgress()
 const dedupe = useMessageDedupe()
 
 // Helper function for encrypting JSON data
@@ -78,7 +76,6 @@ export function setupRequestInterceptor() {
   const { token, secureSessionId } = storeToRefs(user)
   setRequestInterceptor(
     async config => {
-      nprogress.start()
       if (token.value) {
         config.headers.Authorization = token.value
       }
@@ -116,8 +113,6 @@ export function setupRequestInterceptor() {
 export function setupResponseInterceptor() {
   setResponseInterceptor(
     response => {
-      nprogress.done()
-
       // Check if full response is requested in config
       if (response?.config?.returnFullResponse) {
         return Promise.resolve(response)
@@ -129,7 +124,6 @@ export function setupResponseInterceptor() {
       // Setup stores and refs
       const user = useUserStore()
       const { secureSessionId } = storeToRefs(user)
-      nprogress.done()
       const otpModal = use2FAModal()
 
       // Handle authentication errors

+ 3 - 2
app/src/views/site/site_list/columns.tsx

@@ -33,13 +33,14 @@ const columns: StdTableColumn[] = [{
   edit: {
     type: 'input',
   },
+  search: true,
   width: 150,
   customRender: ({ text, record }: CustomRenderArgs) => {
     const template: JSXElements = []
 
     // Add site name
     template.push(
-      <div style="margin-bottom: 8px;">{text}</div>,
+      <div>{text}</div>,
     )
 
     // Add URLs below the name
@@ -66,7 +67,7 @@ const columns: StdTableColumn[] = [{
       }
 
       template.push(
-        <div style="display: flex; flex-wrap: wrap; margin-bottom: 4px;">{urlsContainer}</div>,
+        <div style="display: flex; flex-wrap: wrap; margin: 4px 0;">{urlsContainer}</div>,
       )
     }
 

+ 2 - 1
app/src/views/stream/columns.tsx

@@ -24,6 +24,7 @@ const columns: StdTableColumn[] = [{
 }, {
   title: () => $gettext('Name'),
   dataIndex: 'name',
+  search: true,
   sorter: true,
   pure: true,
   edit: {
@@ -35,7 +36,7 @@ const columns: StdTableColumn[] = [{
 
     // Add stream name
     template.push(
-      <div style="margin-bottom: 8px;">{text}</div>,
+      <div>{text}</div>,
     )
 
     return h('div', {}, template)

+ 10 - 4
internal/config/generic_list.go

@@ -16,6 +16,7 @@ import (
 // GenericListOptions represents the options for listing configurations
 type GenericListOptions struct {
 	Search      string
+	Name        string
 	Status      string
 	OrderBy     string
 	Sort        string
@@ -268,9 +269,12 @@ func SiteStatusMapBuilder(maintenanceSuffix string) StatusMapBuilder {
 	}
 }
 
-// DefaultFilterMatcher provides the standard filtering logic without name search
+// DefaultFilterMatcher provides the standard filtering logic with name search
 func DefaultFilterMatcher(fileName string, status ConfigStatus, envGroupID uint64, options *GenericListOptions) bool {
-	// Remove name filtering as it's now handled by fuzzy search
+	// Exact name matching
+	if options.Name != "" && fileName != options.Name {
+		return false
+	}
 	if options.Status != "" && status != ConfigStatus(options.Status) {
 		return false
 	}
@@ -282,8 +286,10 @@ func DefaultFilterMatcher(fileName string, status ConfigStatus, envGroupID uint6
 
 // FuzzyFilterMatcher provides filtering logic with fuzzy search support
 func FuzzyFilterMatcher(fileName string, status ConfigStatus, envGroupID uint64, options *GenericListOptions) bool {
-	// Name filtering is handled by fuzzy search in GetGenericConfigs
-	// Only apply other filters here
+	// Exact name matching takes precedence over fuzzy search
+	if options.Name != "" && fileName != options.Name {
+		return false
+	}
 	if options.Status != "" && status != ConfigStatus(options.Status) {
 		return false
 	}

+ 2 - 0
internal/site/list.go

@@ -12,6 +12,7 @@ import (
 // ListOptions represents the options for listing sites
 type ListOptions struct {
 	Search     string
+	Name       string
 	Status     string
 	OrderBy    string
 	Sort       string
@@ -23,6 +24,7 @@ func GetSiteConfigs(ctx context.Context, options *ListOptions, sites []*model.Si
 	// Convert to generic options
 	genericOptions := &config.GenericListOptions{
 		Search:      options.Search,
+		Name:        options.Name,
 		Status:      options.Status,
 		OrderBy:     options.OrderBy,
 		Sort:        options.Sort,

+ 2 - 0
internal/stream/list.go

@@ -12,6 +12,7 @@ import (
 // ListOptions represents the options for listing streams
 type ListOptions struct {
 	Search     string
+	Name       string
 	Status     string
 	OrderBy    string
 	Sort       string
@@ -23,6 +24,7 @@ func GetStreamConfigs(ctx context.Context, options *ListOptions, streams []*mode
 	// Convert to generic options
 	genericOptions := &config.GenericListOptions{
 		Search:      options.Search,
+		Name:        options.Name,
 		Status:      options.Status,
 		OrderBy:     options.OrderBy,
 		Sort:        options.Sort,

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.