更新统计
This commit is contained in:
@@ -429,7 +429,7 @@ func (s *AdminReadService) Images(ctx context.Context, limit, offset int, kind s
|
|||||||
if offset < 0 {
|
if offset < 0 {
|
||||||
offset = 0
|
offset = 0
|
||||||
}
|
}
|
||||||
allFiles, stats, err := s.scanGeneratedFiles(ctx)
|
allFiles, _, err := s.scanGeneratedFiles(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, 0, nil, err
|
return nil, 0, nil, err
|
||||||
}
|
}
|
||||||
@@ -441,11 +441,19 @@ func (s *AdminReadService) Images(ctx context.Context, limit, offset int, kind s
|
|||||||
pinned = set
|
pinned = set
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// KPI stats must reflect what the manager actually shows, so recompute them
|
||||||
|
// after dropping showcase files (independent of the kind tab filter).
|
||||||
|
stats := map[string]any{"total": 0, "image": 0, "video": 0, "size_bytes": int64(0)}
|
||||||
filtered := make([]generatedFile, 0, len(allFiles))
|
filtered := make([]generatedFile, 0, len(allFiles))
|
||||||
for _, item := range allFiles {
|
for _, item := range allFiles {
|
||||||
if _, ok := pinned[strings.TrimLeft(item.Name, "/")]; ok {
|
if _, ok := pinned[strings.TrimLeft(item.Name, "/")]; ok {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if _, ok := stats[item.Kind]; ok {
|
||||||
|
stats[item.Kind] = stats[item.Kind].(int) + 1
|
||||||
|
}
|
||||||
|
stats["total"] = stats["total"].(int) + 1
|
||||||
|
stats["size_bytes"] = stats["size_bytes"].(int64) + item.Size
|
||||||
if kind == "" || item.Kind == kind {
|
if kind == "" || item.Kind == kind {
|
||||||
filtered = append(filtered, item)
|
filtered = append(filtered, item)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ const currentLabel = computed(() => {
|
|||||||
</button>
|
</button>
|
||||||
<router-link to="/settings" title="设置" @click="onSettings"
|
<router-link to="/settings" title="设置" @click="onSettings"
|
||||||
:class="$route.path === '/settings' ? 'rail-bottom active' : 'rail-bottom'">
|
:class="$route.path === '/settings' ? 'rail-bottom active' : 'rail-bottom'">
|
||||||
<Icon name="accounts" class="w-4 h-4" />
|
<Icon name="config" class="w-4 h-4" />
|
||||||
</router-link>
|
</router-link>
|
||||||
</div>
|
</div>
|
||||||
</aside>
|
</aside>
|
||||||
|
|||||||
Reference in New Issue
Block a user