mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-01 17:00:21 +08:00
Keep audit admins on read-only admin views
This commit is contained in:
@@ -414,7 +414,7 @@
|
|||||||
使用记录
|
使用记录
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
v-if="canCancel(task.status)"
|
v-if="authStore.canOperateAdmin && canCancel(task.status)"
|
||||||
variant="outline"
|
variant="outline"
|
||||||
size="sm"
|
size="sm"
|
||||||
class="h-7 text-xs text-red-500 border-red-200 hover:bg-red-50"
|
class="h-7 text-xs text-red-500 border-red-200 hover:bg-red-50"
|
||||||
@@ -830,7 +830,7 @@
|
|||||||
|
|
||||||
<!-- 操作按钮 -->
|
<!-- 操作按钮 -->
|
||||||
<div
|
<div
|
||||||
v-if="canCancel(selectedTask.status)"
|
v-if="authStore.canOperateAdmin && canCancel(selectedTask.status)"
|
||||||
class="pt-4 border-t border-border/60"
|
class="pt-4 border-t border-border/60"
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
@@ -902,7 +902,7 @@ import { useAuthStore } from '@/stores/auth'
|
|||||||
import { log } from '@/utils/logger'
|
import { log } from '@/utils/logger'
|
||||||
|
|
||||||
const authStore = useAuthStore()
|
const authStore = useAuthStore()
|
||||||
const isAdmin = computed(() => authStore.user?.role === 'admin')
|
const isAdmin = computed(() => authStore.canAccessAdmin)
|
||||||
const { toast } = useToast()
|
const { toast } = useToast()
|
||||||
const { copyToClipboard } = useClipboard()
|
const { copyToClipboard } = useClipboard()
|
||||||
|
|
||||||
|
|||||||
@@ -50,15 +50,15 @@
|
|||||||
>
|
>
|
||||||
<UsageModelTable
|
<UsageModelTable
|
||||||
:data="enhancedModelStats"
|
:data="enhancedModelStats"
|
||||||
:is-admin="authStore.isAdmin"
|
:is-admin="authStore.canAccessAdmin"
|
||||||
/>
|
/>
|
||||||
<UsageProviderTable
|
<UsageProviderTable
|
||||||
:data="providerStats"
|
:data="providerStats"
|
||||||
:is-admin="authStore.isAdmin"
|
:is-admin="authStore.canAccessAdmin"
|
||||||
/>
|
/>
|
||||||
<UsageApiFormatTable
|
<UsageApiFormatTable
|
||||||
:data="apiFormatStats"
|
:data="apiFormatStats"
|
||||||
:is-admin="authStore.isAdmin"
|
:is-admin="authStore.canAccessAdmin"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!-- 用户:模型 + API格式(2列) -->
|
<!-- 用户:模型 + API格式(2列) -->
|
||||||
@@ -68,7 +68,7 @@
|
|||||||
>
|
>
|
||||||
<UsageModelTable
|
<UsageModelTable
|
||||||
:data="enhancedModelStats"
|
:data="enhancedModelStats"
|
||||||
:is-admin="authStore.isAdmin"
|
:is-admin="authStore.canAccessAdmin"
|
||||||
/>
|
/>
|
||||||
<UsageApiFormatTable
|
<UsageApiFormatTable
|
||||||
:data="apiFormatStats"
|
:data="apiFormatStats"
|
||||||
@@ -81,7 +81,7 @@
|
|||||||
<UsageRecordsTable
|
<UsageRecordsTable
|
||||||
:records="displayRecords"
|
:records="displayRecords"
|
||||||
:is-admin="isAdminPage"
|
:is-admin="isAdminPage"
|
||||||
:show-actual-cost="authStore.isAdmin"
|
:show-actual-cost="authStore.canAccessAdmin"
|
||||||
:loading="isLoadingRecords"
|
:loading="isLoadingRecords"
|
||||||
:time-range="timeRange"
|
:time-range="timeRange"
|
||||||
:filter-search="filterSearch"
|
:filter-search="filterSearch"
|
||||||
|
|||||||
@@ -623,7 +623,7 @@ async function loadAnnouncements(page = 1) {
|
|||||||
currentPage.value = page
|
currentPage.value = page
|
||||||
try {
|
try {
|
||||||
const response = await announcementApi.getAnnouncements({
|
const response = await announcementApi.getAnnouncements({
|
||||||
active_only: !isAdmin.value, // 管理员可以看到所有公告
|
active_only: !authStore.canAccessAdmin, // 管理员和审计管理员可以看到所有公告
|
||||||
limit: pageSize.value,
|
limit: pageSize.value,
|
||||||
offset: (page - 1) * pageSize.value
|
offset: (page - 1) * pageSize.value
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user