#feature: update layout
This commit is contained in:
@@ -1,144 +1,175 @@
|
||||
<template>
|
||||
<div class="bg-white rounded-xl shadow-sm border border-gray-200 p-8">
|
||||
<div class="flex items-start justify-between gap-4">
|
||||
<div class="space-y-4">
|
||||
<div class="bg-white rounded-lg shadow-sm border border-gray-200 flex flex-col h-full">
|
||||
<!-- Header -->
|
||||
<div class="bg-gray-50 px-4 py-3 border-b border-gray-200 flex justify-between items-center">
|
||||
<div>
|
||||
<h3 class="text-lg font-medium text-gray-900">IP 用户映射</h3>
|
||||
<p class="text-gray-500 mt-1">维护 IP 与用户标识的对应关系。</p>
|
||||
<h3 class="text-sm font-bold text-gray-800">IP 用户映射</h3>
|
||||
<p class="text-xs text-gray-500">维护 IP 与用户标识的对应关系</p>
|
||||
</div>
|
||||
<button
|
||||
class="px-4 py-2 bg-gray-100 text-gray-700 rounded-md hover:bg-gray-200 disabled:opacity-50"
|
||||
:disabled="loading"
|
||||
@click="loadMappings"
|
||||
:disabled="loading"
|
||||
class="text-gray-500 hover:text-blue-600 transition-colors p-1.5 rounded hover:bg-gray-200"
|
||||
title="刷新列表"
|
||||
>
|
||||
{{ loading ? '加载中...' : '刷新' }}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-4 h-4" :class="{'animate-spin': loading}">
|
||||
<path fill-rule="evenodd" d="M15.312 11.424a5.5 5.5 0 01-9.201 2.466l-.312-.311h2.433a.75.75 0 000-1.5H3.989a.75.75 0 00-.75.75v4.242a.75.75 0 001.5 0v-2.43l.31.31a7 7 0 0011.712-3.138.75.75 0 00-1.449-.39zm1.23-3.723a.75.75 0 00.219-.53V2.929a.75.75 0 00-1.5 0v2.433l-.31-.31a7 7 0 00-11.712 3.138.75.75 0 001.449.39 5.5 5.5 0 019.201-2.466l.312.312h-2.433a.75.75 0 000 1.5h4.185a.75.75 0 00.53-.219z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="mt-6 grid grid-cols-1 md:grid-cols-4 gap-4">
|
||||
<input
|
||||
v-model="newMapping.ip_address"
|
||||
type="text"
|
||||
class="px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
placeholder="IP 地址"
|
||||
/>
|
||||
<input
|
||||
v-model="newMapping.user_name"
|
||||
type="text"
|
||||
class="px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
placeholder="用户标识"
|
||||
/>
|
||||
<input
|
||||
v-model="newMapping.remark"
|
||||
type="text"
|
||||
class="px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
placeholder="备注(可选)"
|
||||
/>
|
||||
<button
|
||||
class="px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 disabled:opacity-50"
|
||||
:disabled="saving"
|
||||
@click="createMapping"
|
||||
>
|
||||
{{ saving ? '保存中...' : '新增映射' }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="unmappedIps.length"
|
||||
class="mt-6 border border-amber-200 bg-amber-50 rounded-lg p-4"
|
||||
>
|
||||
<div class="flex items-center justify-between">
|
||||
<div class="text-sm font-medium text-amber-700">待匹配 IP(来自日志)</div>
|
||||
<div class="text-xs text-amber-600">共 {{ unmappedIps.length }} 个</div>
|
||||
</div>
|
||||
<div class="mt-3 grid grid-cols-1 md:grid-cols-2 gap-2 max-h-64 overflow-auto">
|
||||
<div
|
||||
v-for="item in unmappedIps"
|
||||
:key="item.ip_address"
|
||||
class="flex items-center justify-between gap-3 bg-white border border-amber-100 rounded px-3 py-2 text-sm"
|
||||
>
|
||||
<div class="flex flex-col">
|
||||
<span class="font-mono text-gray-800">{{ item.ip_address }}</span>
|
||||
<span class="text-xs text-gray-500">
|
||||
{{ item.logs_count }} 次日志 · 最近 {{ formatTime(item.last_seen_at) }}
|
||||
</span>
|
||||
</div>
|
||||
<button
|
||||
class="px-2 py-1 text-xs text-amber-700 bg-amber-100 rounded hover:bg-amber-200"
|
||||
@click="fillIp(item.ip_address)"
|
||||
>
|
||||
填入
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="message" class="mt-4 text-sm text-green-700 bg-green-50 border border-green-200 rounded-md px-3 py-2">
|
||||
<!-- Messages -->
|
||||
<div v-if="message" class="mx-4 mt-4 text-sm text-green-600 bg-green-50 px-3 py-2 rounded border border-green-100">
|
||||
{{ message }}
|
||||
</div>
|
||||
<div v-if="error" class="mt-4 text-sm text-red-700 bg-red-50 border border-red-200 rounded-md px-3 py-2">
|
||||
<div v-if="error" class="mx-4 mt-4 text-sm text-red-600 bg-red-50 px-3 py-2 rounded border border-red-100">
|
||||
{{ error }}
|
||||
</div>
|
||||
|
||||
<div v-if="loading" class="mt-4 text-sm text-gray-400">加载中...</div>
|
||||
<div v-else class="mt-4 overflow-x-auto border border-gray-200 rounded-lg">
|
||||
<table class="min-w-full text-sm">
|
||||
<thead class="bg-gray-50 text-gray-600">
|
||||
<!-- Add New Form -->
|
||||
<div class="p-4 bg-white border-b border-gray-100">
|
||||
<div class="flex flex-col md:flex-row gap-3 items-end md:items-center">
|
||||
<div class="flex-1 w-full">
|
||||
<label class="block text-xs text-gray-500 mb-1">IP 地址</label>
|
||||
<input
|
||||
v-model="newMapping.ip_address"
|
||||
type="text"
|
||||
class="w-full px-3 py-2 text-sm font-mono border border-gray-300 rounded focus:ring-1 focus:ring-blue-500"
|
||||
placeholder="192.168.1.100"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex-1 w-full">
|
||||
<label class="block text-xs text-gray-500 mb-1">用户标识</label>
|
||||
<input
|
||||
v-model="newMapping.user_name"
|
||||
type="text"
|
||||
class="w-full px-3 py-2 text-sm border border-gray-300 rounded focus:ring-1 focus:ring-blue-500"
|
||||
placeholder="zhangsan"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex-[1.5] w-full">
|
||||
<label class="block text-xs text-gray-500 mb-1">备注</label>
|
||||
<input
|
||||
v-model="newMapping.remark"
|
||||
type="text"
|
||||
class="w-full px-3 py-2 text-sm border border-gray-300 rounded focus:ring-1 focus:ring-blue-500"
|
||||
placeholder="可选备注"
|
||||
/>
|
||||
</div>
|
||||
<button
|
||||
@click="createMapping"
|
||||
:disabled="saving"
|
||||
class="w-full md:w-auto px-4 py-2 bg-blue-600 text-white text-sm font-medium rounded hover:bg-blue-700 disabled:opacity-50 flex items-center justify-center gap-1 h-[38px] mt-4 md:mt-0"
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-4 h-4">
|
||||
<path d="M10.75 4.75a.75.75 0 00-1.5 0v4.5h-4.5a.75.75 0 000 1.5h4.5v4.5a.75.75 0 001.5 0v-4.5h4.5a.75.75 0 000-1.5h-4.5v-4.5z" />
|
||||
</svg>
|
||||
新增
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Unmapped IPs Section -->
|
||||
<div v-if="unmappedIps.length" class="px-4 py-3 bg-amber-50 border-b border-amber-100">
|
||||
<div class="flex items-center justify-between mb-2">
|
||||
<div class="text-sm font-bold text-amber-800 flex items-center gap-1">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-4 h-4">
|
||||
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
待匹配 IP ({{ unmappedIps.length }})
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-3 max-h-48 overflow-y-auto pr-1 custom-scrollbar">
|
||||
<div
|
||||
v-for="item in unmappedIps"
|
||||
:key="item.ip_address"
|
||||
class="group flex items-center justify-between gap-2 bg-white border border-amber-200 rounded px-3 py-2 text-sm shadow-sm hover:border-amber-400 transition-colors cursor-pointer"
|
||||
@click="fillIp(item.ip_address)"
|
||||
title="点击填入"
|
||||
>
|
||||
<div class="flex flex-col min-w-0">
|
||||
<span class="font-mono text-gray-800 font-medium truncate">{{ item.ip_address }}</span>
|
||||
<span class="text-xs text-gray-500 truncate">
|
||||
{{ formatTime(item.last_seen_at) }} ({{ item.logs_count }})
|
||||
</span>
|
||||
</div>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-4 h-4 text-amber-300 group-hover:text-amber-600">
|
||||
<path d="M10.75 4.75a.75.75 0 00-1.5 0v4.5h-4.5a.75.75 0 000 1.5h4.5v4.5a.75.75 0 001.5 0v-4.5h4.5a.75.75 0 000-1.5h-4.5v-4.5z" />
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Table -->
|
||||
<div class="overflow-x-auto flex-1">
|
||||
<table class="min-w-full divide-y divide-gray-200">
|
||||
<thead class="bg-gray-50">
|
||||
<tr>
|
||||
<th class="text-left px-4 py-3 font-medium">IP 地址</th>
|
||||
<th class="text-left px-4 py-3 font-medium">用户标识</th>
|
||||
<th class="text-left px-4 py-3 font-medium">备注</th>
|
||||
<th class="text-left px-4 py-3 font-medium">操作</th>
|
||||
<th scope="col" class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider w-1/4">IP 地址</th>
|
||||
<th scope="col" class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider w-1/4">用户标识</th>
|
||||
<th scope="col" class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">备注</th>
|
||||
<th scope="col" class="px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider w-24">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-200">
|
||||
<tr v-for="mapping in mappings" :key="mapping.id" class="text-gray-700">
|
||||
<td class="px-4 py-3 font-mono">
|
||||
<tbody class="bg-white divide-y divide-gray-200">
|
||||
<tr v-for="mapping in mappings" :key="mapping.id" class="hover:bg-gray-50 group">
|
||||
<td class="px-4 py-2 align-top">
|
||||
<input
|
||||
v-model="mapping.ip_address"
|
||||
type="text"
|
||||
class="w-full px-2 py-1 border border-gray-200 rounded-md focus:outline-none focus:ring-1 focus:ring-blue-500"
|
||||
class="w-full text-sm font-mono bg-transparent border-none p-0 focus:ring-0 text-gray-900 placeholder-gray-400 group-hover:bg-white focus:bg-white rounded px-1"
|
||||
/>
|
||||
</td>
|
||||
<td class="px-4 py-3">
|
||||
<td class="px-4 py-2 align-top">
|
||||
<input
|
||||
v-model="mapping.user_name"
|
||||
type="text"
|
||||
class="w-full px-2 py-1 border border-gray-200 rounded-md focus:outline-none focus:ring-1 focus:ring-blue-500"
|
||||
class="w-full text-sm bg-transparent border-none p-0 focus:ring-0 text-gray-900 group-hover:bg-white focus:bg-white rounded px-1"
|
||||
/>
|
||||
</td>
|
||||
<td class="px-4 py-3">
|
||||
<td class="px-4 py-2 align-top">
|
||||
<input
|
||||
v-model="mapping.remark"
|
||||
type="text"
|
||||
class="w-full px-2 py-1 border border-gray-200 rounded-md focus:outline-none focus:ring-1 focus:ring-blue-500"
|
||||
class="w-full text-sm bg-transparent border-none p-0 focus:ring-0 text-gray-600 group-hover:bg-white focus:bg-white rounded px-1"
|
||||
/>
|
||||
</td>
|
||||
<td class="px-4 py-3 whitespace-nowrap">
|
||||
<div class="flex items-center gap-2">
|
||||
<td class="px-4 py-2 align-top text-right whitespace-nowrap">
|
||||
<div class="flex items-center justify-end gap-1 opacity-0 group-hover:opacity-100 focus-within:opacity-100 transition-opacity">
|
||||
<button
|
||||
class="px-3 py-1 bg-blue-600 text-white rounded-md hover:bg-blue-700 disabled:opacity-50"
|
||||
:disabled="mapping._saving"
|
||||
@click="updateMapping(mapping)"
|
||||
:disabled="mapping._saving"
|
||||
class="p-1.5 text-blue-600 hover:bg-blue-50 rounded"
|
||||
title="保存"
|
||||
>
|
||||
{{ mapping._saving ? '保存中...' : '保存' }}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-4 h-4">
|
||||
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
</button>
|
||||
<button
|
||||
class="px-3 py-1 bg-red-50 text-red-700 rounded-md hover:bg-red-100 disabled:opacity-50"
|
||||
:disabled="mapping._deleting"
|
||||
@click="deleteMapping(mapping)"
|
||||
:disabled="mapping._deleting"
|
||||
class="p-1.5 text-red-600 hover:bg-red-50 rounded"
|
||||
title="删除"
|
||||
>
|
||||
{{ mapping._deleting ? '删除中...' : '删除' }}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-4 h-4">
|
||||
<path fill-rule="evenodd" d="M8.75 1A2.75 2.75 0 006 3.75v.443c-.795.077-1.584.176-2.365.298a.75.75 0 10.23 1.482l.149-.022.841 10.518A2.75 2.75 0 007.596 19h4.807a2.75 2.75 0 002.742-2.53l.841-10.52.149.023a.75.75 0 00.23-1.482A41.03 41.03 0 0014 4.193V3.75A2.75 2.75 0 0011.25 1h-2.5zM10 4c.84 0 1.673.025 2.5.075V3.75c0-.69-.56-1.25-1.25-1.25h-2.5c-.69 0-1.25.56-1.25 1.25v.325C8.327 4.025 9.16 4 10 4z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="mappings.length === 0">
|
||||
<td colspan="4" class="px-4 py-6 text-center text-gray-400">暂无映射</td>
|
||||
<td colspan="4" class="px-4 py-8 text-center text-sm text-gray-400">
|
||||
暂无映射数据
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -167,7 +198,8 @@ export default {
|
||||
if (!value) {
|
||||
return '-';
|
||||
}
|
||||
return value.replace('T', ' ').replace('Z', '');
|
||||
// Simple date formatter, removing seconds for compactness
|
||||
return value.replace('T', ' ').replace('Z', '').substring(5, 16);
|
||||
},
|
||||
async parseJsonResponse(response) {
|
||||
const contentType = response.headers.get('content-type') || '';
|
||||
@@ -261,6 +293,7 @@ export default {
|
||||
this.message = '已新增映射';
|
||||
this.newMapping = { ip_address: '', user_name: '', remark: '' };
|
||||
await this.loadMappings();
|
||||
setTimeout(() => { this.message = ''; }, 3000);
|
||||
} catch (error) {
|
||||
this.error = error.message;
|
||||
} finally {
|
||||
@@ -299,6 +332,7 @@ export default {
|
||||
}
|
||||
|
||||
this.message = '已更新映射';
|
||||
setTimeout(() => { this.message = ''; }, 3000);
|
||||
} catch (error) {
|
||||
this.error = error.message;
|
||||
} finally {
|
||||
@@ -306,6 +340,7 @@ export default {
|
||||
}
|
||||
},
|
||||
async deleteMapping(mapping) {
|
||||
if (!confirm('确定要删除吗?')) return;
|
||||
mapping._deleting = true;
|
||||
this.error = '';
|
||||
this.message = '';
|
||||
@@ -331,6 +366,7 @@ export default {
|
||||
|
||||
this.message = '已删除映射';
|
||||
await this.loadMappings();
|
||||
setTimeout(() => { this.message = ''; }, 3000);
|
||||
} catch (error) {
|
||||
this.error = error.message;
|
||||
} finally {
|
||||
|
||||
@@ -1,31 +1,33 @@
|
||||
<template>
|
||||
<div class="space-y-6">
|
||||
<div class="bg-white rounded-xl shadow-sm border border-gray-200 p-8">
|
||||
<div class="flex items-start justify-between gap-4">
|
||||
<div>
|
||||
<h3 class="text-lg font-medium text-gray-900">操作日志</h3>
|
||||
<p class="text-gray-500 mt-1">记录对系统产生影响的请求(POST/PUT/PATCH/DELETE)。</p>
|
||||
<p v-if="currentIp" class="text-xs text-gray-400 mt-1">当前 IP: {{ currentIp }}</p>
|
||||
</div>
|
||||
<button
|
||||
class="px-4 py-2 bg-gray-100 text-gray-700 rounded-md hover:bg-gray-200 disabled:opacity-50"
|
||||
:disabled="logsLoading"
|
||||
@click="loadLogs"
|
||||
>
|
||||
{{ logsLoading ? '加载中...' : '刷新' }}
|
||||
</button>
|
||||
<div class="space-y-4">
|
||||
<div class="bg-white rounded-lg shadow-sm border border-gray-200 flex flex-col h-full">
|
||||
<!-- Header & Filters -->
|
||||
<div class="bg-gray-50 px-4 py-3 border-b border-gray-200 flex flex-col md:flex-row justify-between items-start md:items-center gap-3">
|
||||
<div class="flex items-center gap-2">
|
||||
<h3 class="text-base font-bold text-gray-800">操作日志</h3>
|
||||
<span v-if="currentIp" class="text-xs bg-blue-50 text-blue-600 px-2 py-0.5 rounded border border-blue-100 font-mono">
|
||||
IP: {{ currentIp }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="mt-6 flex flex-wrap items-center gap-3">
|
||||
<div class="flex flex-wrap items-center gap-2 w-full md:w-auto">
|
||||
<div class="relative flex-grow md:flex-grow-0">
|
||||
<input
|
||||
v-model="filters.q"
|
||||
type="text"
|
||||
class="w-full md:w-64 px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
class="w-full md:w-56 pl-3 pr-8 py-1.5 text-sm border border-gray-300 rounded focus:ring-1 focus:ring-blue-500"
|
||||
placeholder="搜索 IP / 用户 / 路径"
|
||||
@keyup.enter="applyFilters"
|
||||
/>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-4 h-4 absolute right-2.5 top-2 text-gray-400">
|
||||
<path fill-rule="evenodd" d="M9 3.5a5.5 5.5 0 100 11 5.5 5.5 0 000-11zM2 9a7 7 0 1112.452 4.391l3.328 3.329a.75.75 0 11-1.06 1.06l-3.329-3.328A7 7 0 012 9z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
</div>
|
||||
|
||||
<select
|
||||
v-model="filters.method"
|
||||
class="px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
class="py-1.5 pl-2 pr-8 text-sm border border-gray-300 rounded focus:ring-1 focus:ring-blue-500 bg-white"
|
||||
@change="applyFilters"
|
||||
>
|
||||
<option value="">全部方法</option>
|
||||
<option value="POST">POST</option>
|
||||
@@ -33,89 +35,121 @@
|
||||
<option value="PATCH">PATCH</option>
|
||||
<option value="DELETE">DELETE</option>
|
||||
</select>
|
||||
|
||||
<select
|
||||
v-model.number="logsPerPage"
|
||||
class="px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
class="py-1.5 pl-2 pr-8 text-sm border border-gray-300 rounded focus:ring-1 focus:ring-blue-500 bg-white"
|
||||
@change="applyFilters"
|
||||
>
|
||||
<option :value="20">20条/页</option>
|
||||
<option :value="50">50条/页</option>
|
||||
<option :value="100">100条/页</option>
|
||||
<option :value="20">20/页</option>
|
||||
<option :value="50">50/页</option>
|
||||
<option :value="100">100/页</option>
|
||||
</select>
|
||||
|
||||
<button
|
||||
class="px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 disabled:opacity-50"
|
||||
class="p-1.5 text-gray-500 hover:text-blue-600 hover:bg-gray-100 rounded transition-colors"
|
||||
:disabled="logsLoading"
|
||||
@click="applyFilters"
|
||||
@click="loadLogs"
|
||||
title="刷新"
|
||||
>
|
||||
查询
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-5 h-5" :class="{'animate-spin': logsLoading}">
|
||||
<path fill-rule="evenodd" d="M15.312 11.424a5.5 5.5 0 01-9.201 2.466l-.312-.311h2.433a.75.75 0 000-1.5H3.989a.75.75 0 00-.75.75v4.242a.75.75 0 001.5 0v-2.43l.31.31a7 7 0 0011.712-3.138.75.75 0 00-1.449-.39zm1.23-3.723a.75.75 0 00.219-.53V2.929a.75.75 0 00-1.5 0v2.433l-.31-.31a7 7 0 00-11.712 3.138.75.75 0 001.449.39 5.5 5.5 0 019.201-2.466l.312.312h-2.433a.75.75 0 000 1.5h4.185a.75.75 0 00.53-.219z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="logsError" class="mt-4 text-sm text-red-700 bg-red-50 border border-red-200 rounded-md px-3 py-2">
|
||||
<div v-if="logsError" class="mx-4 mt-4 text-sm text-red-600 bg-red-50 px-3 py-2 rounded border border-red-100">
|
||||
{{ logsError }}
|
||||
</div>
|
||||
|
||||
<div v-if="logsLoading" class="mt-4 text-sm text-gray-400">加载中...</div>
|
||||
<div v-else class="mt-4">
|
||||
<div class="overflow-x-auto border border-gray-200 rounded-lg">
|
||||
<table class="min-w-full text-sm">
|
||||
<thead class="bg-gray-50 text-gray-600">
|
||||
<!-- Table -->
|
||||
<div class="overflow-x-auto flex-1">
|
||||
<table class="min-w-full divide-y divide-gray-200">
|
||||
<thead class="bg-gray-50">
|
||||
<tr>
|
||||
<th class="text-left px-4 py-3 font-medium">时间</th>
|
||||
<th v-if="isAdmin" class="text-left px-4 py-3 font-medium">用户</th>
|
||||
<th class="text-left px-4 py-3 font-medium">IP</th>
|
||||
<th class="text-left px-4 py-3 font-medium">方法</th>
|
||||
<th class="text-left px-4 py-3 font-medium">路径</th>
|
||||
<th class="text-left px-4 py-3 font-medium">状态</th>
|
||||
<th class="text-left px-4 py-3 font-medium">请求数据</th>
|
||||
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider w-40">时间</th>
|
||||
<th v-if="isAdmin" class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider w-32">用户</th>
|
||||
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider w-36">IP</th>
|
||||
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider w-20">方法</th>
|
||||
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">路径</th>
|
||||
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider w-20">状态</th>
|
||||
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider w-20">Payload</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-200">
|
||||
<tr v-for="log in logs" :key="log.id" class="text-gray-700">
|
||||
<td class="px-4 py-3 whitespace-nowrap">{{ formatTime(log.created_at) }}</td>
|
||||
<td v-if="isAdmin" class="px-4 py-3 whitespace-nowrap font-mono">{{ log.user_label || '-' }}</td>
|
||||
<td class="px-4 py-3 whitespace-nowrap font-mono">{{ log.ip_address }}</td>
|
||||
<td class="px-4 py-3 whitespace-nowrap font-mono">{{ log.method }}</td>
|
||||
<td class="px-4 py-3 whitespace-nowrap">{{ log.path }}</td>
|
||||
<td class="px-4 py-3 whitespace-nowrap">{{ log.status_code }}</td>
|
||||
<td class="px-4 py-3">
|
||||
<details v-if="hasPayload(log.request_payload)">
|
||||
<summary class="cursor-pointer text-blue-600">查看</summary>
|
||||
<pre class="mt-2 text-xs bg-gray-50 p-2 rounded whitespace-pre-wrap">{{ formatPayload(log.request_payload) }}</pre>
|
||||
</details>
|
||||
<span v-else>-</span>
|
||||
<tbody class="bg-white divide-y divide-gray-200">
|
||||
<template v-for="log in logs" :key="log.id">
|
||||
<tr class="hover:bg-gray-50 text-sm">
|
||||
<td class="px-4 py-2 whitespace-nowrap text-gray-500">{{ formatTime(log.created_at) }}</td>
|
||||
<td v-if="isAdmin" class="px-4 py-2 whitespace-nowrap font-medium text-gray-700">{{ log.user_label || '-' }}</td>
|
||||
<td class="px-4 py-2 whitespace-nowrap font-mono text-gray-600">{{ log.ip_address }}</td>
|
||||
<td class="px-4 py-2 whitespace-nowrap font-bold" :class="methodColor(log.method)">{{ log.method }}</td>
|
||||
<td class="px-4 py-2 whitespace-nowrap text-gray-600 font-mono truncate max-w-xs" :title="log.path">{{ log.path }}</td>
|
||||
<td class="px-4 py-2 whitespace-nowrap">
|
||||
<span :class="statusColor(log.status_code)" class="px-2 py-0.5 rounded text-xs font-mono border">
|
||||
{{ log.status_code }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="px-4 py-2 whitespace-nowrap">
|
||||
<button
|
||||
v-if="hasPayload(log.request_payload)"
|
||||
@click="log._expanded = !log._expanded"
|
||||
class="text-blue-600 hover:text-blue-800 text-xs font-medium flex items-center gap-1 focus:outline-none"
|
||||
>
|
||||
{{ log._expanded ? '收起' : '查看' }}
|
||||
</button>
|
||||
<span v-else class="text-gray-300">-</span>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- Expanded Payload Row -->
|
||||
<tr v-if="log._expanded && hasPayload(log.request_payload)" class="bg-gray-50/50">
|
||||
<td :colspan="logColumnCount" class="px-4 py-3 border-b border-gray-100">
|
||||
<pre class="text-xs font-mono text-gray-600 bg-white border border-gray-200 rounded p-3 overflow-x-auto custom-scrollbar">{{ formatPayload(log.request_payload) }}</pre>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
<tr v-if="logs.length === 0">
|
||||
<td :colspan="logColumnCount" class="px-4 py-6 text-center text-gray-400">暂无记录</td>
|
||||
<td :colspan="logColumnCount" class="px-4 py-10 text-center text-sm text-gray-400">
|
||||
暂无操作记录
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="mt-4 flex items-center justify-between text-sm text-gray-500">
|
||||
<div>共 {{ logsTotal }} 条</div>
|
||||
<!-- Footer / Pagination -->
|
||||
<div class="bg-gray-50 border-t border-gray-200 px-4 py-3 flex items-center justify-between">
|
||||
<div class="text-sm text-gray-500 font-medium">
|
||||
共 <span class="text-gray-900">{{ logsTotal }}</span> 条记录
|
||||
</div>
|
||||
<div class="flex items-center gap-2">
|
||||
<button
|
||||
class="px-3 py-1 bg-gray-100 rounded-md hover:bg-gray-200 disabled:opacity-50"
|
||||
class="p-1.5 rounded border border-gray-300 bg-white hover:bg-gray-50 disabled:opacity-30 disabled:hover:bg-white text-gray-600 transition-colors shadow-sm"
|
||||
:disabled="logsPage <= 1"
|
||||
@click="changePage(logsPage - 1)"
|
||||
title="上一页"
|
||||
>
|
||||
上一页
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-5 h-5">
|
||||
<path fill-rule="evenodd" d="M12.79 5.23a.75.75 0 01-.02 1.06L8.832 10l3.938 3.71a.75.75 0 11-1.04 1.08l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 011.06.02z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
</button>
|
||||
<div>第 {{ logsPage }} / {{ logsLastPage || 1 }} 页</div>
|
||||
<span class="text-sm font-semibold text-gray-700 min-w-[4rem] text-center">
|
||||
{{ logsPage }} / {{ logsLastPage || 1 }}
|
||||
</span>
|
||||
<button
|
||||
class="px-3 py-1 bg-gray-100 rounded-md hover:bg-gray-200 disabled:opacity-50"
|
||||
class="p-1.5 rounded border border-gray-300 bg-white hover:bg-gray-50 disabled:opacity-30 disabled:hover:bg-white text-gray-600 transition-colors shadow-sm"
|
||||
:disabled="logsPage >= logsLastPage"
|
||||
@click="changePage(logsPage + 1)"
|
||||
title="下一页"
|
||||
>
|
||||
下一页
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-5 h-5">
|
||||
<path fill-rule="evenodd" d="M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -159,7 +193,7 @@ export default {
|
||||
if (!value) {
|
||||
return '-';
|
||||
}
|
||||
return value.replace('T', ' ').replace('Z', '');
|
||||
return value.replace('T', ' ').replace('Z', '').substring(0, 19);
|
||||
},
|
||||
hasPayload(payload) {
|
||||
return payload && Object.keys(payload).length > 0;
|
||||
@@ -167,6 +201,22 @@ export default {
|
||||
formatPayload(payload) {
|
||||
return JSON.stringify(payload, null, 2);
|
||||
},
|
||||
methodColor(method) {
|
||||
const map = {
|
||||
'POST': 'text-green-600',
|
||||
'PUT': 'text-amber-600',
|
||||
'PATCH': 'text-amber-600',
|
||||
'DELETE': 'text-red-600'
|
||||
};
|
||||
return map[method] || 'text-gray-600';
|
||||
},
|
||||
statusColor(code) {
|
||||
if (code >= 200 && code < 300) return 'text-green-700 bg-green-50 border-green-200';
|
||||
if (code >= 300 && code < 400) return 'text-blue-700 bg-blue-50 border-blue-200';
|
||||
if (code >= 400 && code < 500) return 'text-amber-700 bg-amber-50 border-amber-200';
|
||||
if (code >= 500) return 'text-red-700 bg-red-50 border-red-200';
|
||||
return 'text-gray-700 bg-gray-50 border-gray-200';
|
||||
},
|
||||
buildLogQuery() {
|
||||
const params = new URLSearchParams();
|
||||
params.set('page', String(this.logsPage));
|
||||
@@ -193,7 +243,7 @@ export default {
|
||||
}
|
||||
|
||||
const pagination = data.data.pagination || {};
|
||||
this.logs = data.data.logs || [];
|
||||
this.logs = (data.data.logs || []).map(l => ({...l, _expanded: false}));
|
||||
this.logsTotal = pagination.total || 0;
|
||||
this.logsLastPage = pagination.last_page || 1;
|
||||
this.logsPage = pagination.current_page || 1;
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
<div class="flex items-center justify-between bg-white p-4 rounded-lg shadow-sm border border-gray-200">
|
||||
<div>
|
||||
<h3 class="text-lg font-bold text-gray-800">系统设置</h3>
|
||||
<p class="text-xs text-gray-500">管理本地偏好与服务端全局配置</p>
|
||||
<p class="text-sm text-gray-500">管理本地偏好与服务端全局配置</p>
|
||||
</div>
|
||||
<div v-if="jira.loading || configs.loading" class="text-xs text-blue-600 animate-pulse">
|
||||
<div v-if="jira.loading || configs.loading" class="text-sm text-blue-600 animate-pulse">
|
||||
数据同步中...
|
||||
</div>
|
||||
</div>
|
||||
@@ -18,24 +18,24 @@
|
||||
<div class="bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden">
|
||||
<div class="bg-gray-50 px-4 py-3 border-b border-gray-200 flex justify-between items-center">
|
||||
<h4 class="font-semibold text-gray-700 text-sm">JIRA 偏好</h4>
|
||||
<span class="text-[10px] text-gray-400 uppercase tracking-wider">Local</span>
|
||||
<span class="text-xs text-gray-400 uppercase tracking-wider">Local</span>
|
||||
</div>
|
||||
|
||||
<div class="p-4 space-y-4">
|
||||
<!-- Default User Input -->
|
||||
<div>
|
||||
<label class="block text-xs font-medium text-gray-600 mb-1">默认查询用户 (本地)</label>
|
||||
<div class="flex gap-1">
|
||||
<label class="block text-sm font-medium text-gray-600 mb-1">默认查询用户 (本地)</label>
|
||||
<div class="flex gap-2">
|
||||
<input
|
||||
type="text"
|
||||
v-model="jira.localDefaultQueryUserDraft"
|
||||
class="flex-1 min-w-0 block w-full px-2 py-1.5 text-sm border border-gray-300 rounded focus:ring-1 focus:ring-blue-500 focus:border-blue-500"
|
||||
class="flex-1 min-w-0 block w-full px-3 py-2 text-sm border border-gray-300 rounded focus:ring-1 focus:ring-blue-500 focus:border-blue-500"
|
||||
placeholder="如: zhangsan"
|
||||
/>
|
||||
<button
|
||||
@click="save"
|
||||
:disabled="jira.saving"
|
||||
class="px-3 py-1.5 bg-blue-600 text-white text-xs font-medium rounded hover:bg-blue-700 disabled:opacity-50 transition-colors"
|
||||
class="px-3 py-2 bg-blue-600 text-white text-sm font-medium rounded hover:bg-blue-700 disabled:opacity-50 transition-colors"
|
||||
title="保存本地设置"
|
||||
>
|
||||
<svg v-if="!jira.saving" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-4 h-4">
|
||||
@@ -46,7 +46,7 @@
|
||||
<button
|
||||
@click="clear"
|
||||
:disabled="jira.saving"
|
||||
class="px-2 py-1.5 bg-gray-100 text-gray-600 text-xs font-medium rounded hover:bg-gray-200 disabled:opacity-50 transition-colors"
|
||||
class="px-2 py-2 bg-gray-100 text-gray-600 text-sm font-medium rounded hover:bg-gray-200 disabled:opacity-50 transition-colors"
|
||||
title="清除并使用默认值"
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-4 h-4">
|
||||
@@ -54,32 +54,32 @@
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
<p class="mt-1 text-[10px] text-gray-400">留空则使用服务端默认值。</p>
|
||||
<p class="mt-1 text-xs text-gray-400">留空则使用服务端默认值。</p>
|
||||
</div>
|
||||
|
||||
<!-- Messages -->
|
||||
<div v-if="jira.message" class="text-xs text-green-600 bg-green-50 px-2 py-1 rounded border border-green-100 flex items-center gap-1">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-3 h-3">
|
||||
<div v-if="jira.message" class="text-sm text-green-600 bg-green-50 px-3 py-2 rounded border border-green-100 flex items-center gap-1">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-4 h-4">
|
||||
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
{{ jira.message }}
|
||||
</div>
|
||||
<div v-if="jira.error" class="text-xs text-red-600 bg-red-50 px-2 py-1 rounded border border-red-100">
|
||||
<div v-if="jira.error" class="text-sm text-red-600 bg-red-50 px-3 py-2 rounded border border-red-100">
|
||||
{{ jira.error }}
|
||||
</div>
|
||||
|
||||
<!-- Server Info Compact -->
|
||||
<div class="bg-gray-50 rounded border border-gray-200 p-3 space-y-2">
|
||||
<div class="flex justify-between items-center text-xs">
|
||||
<div class="bg-gray-50 rounded border border-gray-200 p-4 space-y-3">
|
||||
<div class="flex justify-between items-center text-sm">
|
||||
<span class="text-gray-500">生效用户:</span>
|
||||
<span class="font-mono font-medium text-gray-800 bg-white px-1.5 py-0.5 rounded border border-gray-200">{{ effectiveDefaultQueryUser || '-' }}</span>
|
||||
<span class="font-mono font-medium text-gray-800 bg-white px-2 py-0.5 rounded border border-gray-200">{{ effectiveDefaultQueryUser || '-' }}</span>
|
||||
</div>
|
||||
<div class="border-t border-gray-200 my-1"></div>
|
||||
<div class="flex justify-between items-center text-xs">
|
||||
<div class="flex justify-between items-center text-sm">
|
||||
<span class="text-gray-500">服务端默认:</span>
|
||||
<span class="font-mono text-gray-700">{{ jira.serverDefaultUser || '-' }}</span>
|
||||
</div>
|
||||
<div class="flex justify-between items-start text-xs gap-2">
|
||||
<div class="flex justify-between items-start text-sm gap-2">
|
||||
<span class="text-gray-500 shrink-0">Host:</span>
|
||||
<span class="font-mono text-gray-700 text-right break-all">{{ jira.host || '-' }}</span>
|
||||
</div>
|
||||
@@ -99,7 +99,7 @@
|
||||
v-if="isAdmin"
|
||||
@click="loadConfigs"
|
||||
:disabled="configs.loading"
|
||||
class="text-gray-500 hover:text-blue-600 transition-colors p-1 rounded hover:bg-gray-200"
|
||||
class="text-gray-500 hover:text-blue-600 transition-colors p-1.5 rounded hover:bg-gray-200"
|
||||
title="刷新列表"
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-4 h-4" :class="{'animate-spin': configs.loading}">
|
||||
@@ -117,42 +117,42 @@
|
||||
<!-- Admin Content -->
|
||||
<div v-else class="flex-1 flex flex-col min-h-0">
|
||||
<!-- Status Messages -->
|
||||
<div v-if="configs.message" class="mx-4 mt-4 text-xs text-green-600 bg-green-50 px-2 py-1.5 rounded border border-green-100">
|
||||
<div v-if="configs.message" class="mx-4 mt-4 text-sm text-green-600 bg-green-50 px-3 py-2 rounded border border-green-100">
|
||||
{{ configs.message }}
|
||||
</div>
|
||||
<div v-if="configs.error" class="mx-4 mt-4 text-xs text-red-600 bg-red-50 px-2 py-1.5 rounded border border-red-100">
|
||||
<div v-if="configs.error" class="mx-4 mt-4 text-sm text-red-600 bg-red-50 px-3 py-2 rounded border border-red-100">
|
||||
{{ configs.error }}
|
||||
</div>
|
||||
|
||||
<!-- Add New Config Form -->
|
||||
<div class="p-4 bg-white border-b border-gray-100">
|
||||
<div class="flex flex-col md:flex-row gap-2 items-start md:items-center">
|
||||
<div class="flex flex-col md:flex-row gap-3 items-start md:items-center">
|
||||
<input
|
||||
v-model="configs.newConfig.key"
|
||||
type="text"
|
||||
class="flex-1 w-full md:w-auto px-2 py-1.5 text-xs font-mono border border-gray-300 rounded focus:ring-1 focus:ring-blue-500"
|
||||
class="flex-1 w-full md:w-auto px-3 py-2 text-sm font-mono border border-gray-300 rounded focus:ring-1 focus:ring-blue-500"
|
||||
placeholder="Key (e.g. workspace.repo)"
|
||||
/>
|
||||
<input
|
||||
v-model="configs.newConfig.description"
|
||||
type="text"
|
||||
class="flex-1 w-full md:w-auto px-2 py-1.5 text-xs border border-gray-300 rounded focus:ring-1 focus:ring-blue-500"
|
||||
class="flex-1 w-full md:w-auto px-3 py-2 text-sm border border-gray-300 rounded focus:ring-1 focus:ring-blue-500"
|
||||
placeholder="描述"
|
||||
/>
|
||||
<div class="relative flex-grow-[2] w-full md:w-auto">
|
||||
<input
|
||||
v-model="configs.newConfig.valueText"
|
||||
type="text"
|
||||
class="w-full px-2 py-1.5 text-xs font-mono border border-gray-300 rounded focus:ring-1 focus:ring-blue-500"
|
||||
class="w-full px-3 py-2 text-sm font-mono border border-gray-300 rounded focus:ring-1 focus:ring-blue-500"
|
||||
placeholder='Value (JSON)'
|
||||
/>
|
||||
</div>
|
||||
<button
|
||||
@click="createConfig"
|
||||
:disabled="configs.saving"
|
||||
class="w-full md:w-auto px-3 py-1.5 bg-blue-600 text-white text-xs font-medium rounded hover:bg-blue-700 disabled:opacity-50 flex items-center justify-center gap-1"
|
||||
class="w-full md:w-auto px-4 py-2 bg-blue-600 text-white text-sm font-medium rounded hover:bg-blue-700 disabled:opacity-50 flex items-center justify-center gap-1"
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-3.5 h-3.5">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-4 h-4">
|
||||
<path d="M10.75 4.75a.75.75 0 00-1.5 0v4.5h-4.5a.75.75 0 000 1.5h4.5v4.5a.75.75 0 001.5 0v-4.5h4.5a.75.75 0 000-1.5h-4.5v-4.5z" />
|
||||
</svg>
|
||||
新增
|
||||
@@ -165,43 +165,43 @@
|
||||
<table class="min-w-full divide-y divide-gray-200">
|
||||
<thead class="bg-gray-50">
|
||||
<tr>
|
||||
<th scope="col" class="px-3 py-2 text-left text-xs font-medium text-gray-500 uppercase tracking-wider w-1/4">Key</th>
|
||||
<th scope="col" class="px-3 py-2 text-left text-xs font-medium text-gray-500 uppercase tracking-wider w-1/4">描述</th>
|
||||
<th scope="col" class="px-3 py-2 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Value (JSON)</th>
|
||||
<th scope="col" class="px-3 py-2 text-right text-xs font-medium text-gray-500 uppercase tracking-wider w-20">操作</th>
|
||||
<th scope="col" class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider w-1/4">Key</th>
|
||||
<th scope="col" class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider w-1/4">描述</th>
|
||||
<th scope="col" class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Value (JSON)</th>
|
||||
<th scope="col" class="px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider w-24">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="bg-white divide-y divide-gray-200">
|
||||
<tr v-for="config in configs.items" :key="config.id" class="hover:bg-gray-50 group">
|
||||
<td class="px-3 py-1.5 align-top">
|
||||
<td class="px-4 py-2 align-top">
|
||||
<input
|
||||
v-model="config.key"
|
||||
type="text"
|
||||
class="w-full text-xs font-mono bg-transparent border-none p-0 focus:ring-0 text-gray-900 placeholder-gray-400 group-hover:bg-white focus:bg-white rounded"
|
||||
class="w-full text-sm font-mono bg-transparent border-none p-0 focus:ring-0 text-gray-900 placeholder-gray-400 group-hover:bg-white focus:bg-white rounded px-1"
|
||||
/>
|
||||
</td>
|
||||
<td class="px-3 py-1.5 align-top">
|
||||
<td class="px-4 py-2 align-top">
|
||||
<input
|
||||
v-model="config.description"
|
||||
type="text"
|
||||
class="w-full text-xs bg-transparent border-none p-0 focus:ring-0 text-gray-600 group-hover:bg-white focus:bg-white rounded"
|
||||
class="w-full text-sm bg-transparent border-none p-0 focus:ring-0 text-gray-600 group-hover:bg-white focus:bg-white rounded px-1"
|
||||
/>
|
||||
</td>
|
||||
<td class="px-3 py-1.5 align-top">
|
||||
<td class="px-4 py-2 align-top">
|
||||
<textarea
|
||||
v-model="config.valueText"
|
||||
rows="1"
|
||||
class="w-full text-xs font-mono bg-transparent border-transparent focus:border-blue-300 focus:ring-1 focus:ring-blue-200 text-gray-600 rounded px-1 py-0.5 resize-y min-h-[1.5rem]"
|
||||
class="w-full text-sm font-mono bg-transparent border-transparent focus:border-blue-300 focus:ring-1 focus:ring-blue-200 text-gray-600 rounded px-1 py-0.5 resize-y min-h-[1.75rem]"
|
||||
@focus="$event.target.rows = 3"
|
||||
@blur="$event.target.rows = 1"
|
||||
></textarea>
|
||||
</td>
|
||||
<td class="px-3 py-1.5 align-top text-right whitespace-nowrap">
|
||||
<td class="px-4 py-2 align-top text-right whitespace-nowrap">
|
||||
<div class="flex items-center justify-end gap-1 opacity-0 group-hover:opacity-100 focus-within:opacity-100 transition-opacity">
|
||||
<button
|
||||
@click="updateConfig(config)"
|
||||
:disabled="config._saving"
|
||||
class="p-1 text-blue-600 hover:bg-blue-50 rounded"
|
||||
class="p-1.5 text-blue-600 hover:bg-blue-50 rounded"
|
||||
title="保存"
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-4 h-4">
|
||||
@@ -211,7 +211,7 @@
|
||||
<button
|
||||
@click="deleteConfig(config)"
|
||||
:disabled="config._deleting"
|
||||
class="p-1 text-red-600 hover:bg-red-50 rounded"
|
||||
class="p-1.5 text-red-600 hover:bg-red-50 rounded"
|
||||
title="删除"
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-4 h-4">
|
||||
@@ -222,7 +222,7 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="configs.items.length === 0">
|
||||
<td colspan="4" class="px-4 py-8 text-center text-xs text-gray-400">
|
||||
<td colspan="4" class="px-4 py-8 text-center text-sm text-gray-400">
|
||||
暂无配置数据
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user