Remove fixed row height settings from usage request details

This commit is contained in:
lzt404 committed 2026-10-08 18:36:58 +08:00
1 parent 259389f2b2
commit 065a2071ee
6 files changed
+4 -194

No files matched your search

-4
View File
@@ -786,10 +786,6 @@ export const jaOverrides = {
'usage.events.dragHint': 'ヘッダーの境界をドラッグして列幅を調整',
'usage.events.columnSettings': '表示設定',
'usage.events.columnSettingsDescription': 'リクエスト詳細に表示する列を選択します。',
'usage.events.rowHeight.title': 'レコードの行高を固定',
'usage.events.rowHeight.description': 'すべてのレコードを同じ高さにします。オフにすると内容に合わせて調整します。',
'usage.events.rowHeight.fixed': '行高',
'usage.events.rowHeight.dragHint': 'スライダーをドラッグして調整',
'usage.events.columnsSelected': '{total} 列中 {selected} 列を選択',
'usage.events.selectAllColumns': 'すべて選択',
'usage.events.applyColumns': '適用',
-4
View File
@@ -774,10 +774,6 @@ export const en: Record<MessageKey, string> = {
'usage.events.dragHint': 'Drag column header borders to resize',
'usage.events.columnSettings': 'Display Settings',
'usage.events.columnSettingsDescription': 'Choose which columns appear in request details.',
'usage.events.rowHeight.title': 'Fixed row height',
'usage.events.rowHeight.description': 'Use one height for every record; turn it off to fit content automatically.',
'usage.events.rowHeight.fixed': 'Row height',
'usage.events.rowHeight.dragHint': 'Drag the slider to adjust',
'usage.events.columnsSelected': '{selected} of {total} columns selected',
'usage.events.selectAllColumns': 'Select All',
'usage.events.applyColumns': 'Apply',
-4
View File
@@ -773,10 +773,6 @@ export const zhCN = {
'usage.events.dragHint': '可拖动表头边线调整每列宽度',
'usage.events.columnSettings': '显示设置',
'usage.events.columnSettingsDescription': '选择请求明细中需要显示的列。',
'usage.events.rowHeight.title': '固定记录行高',
'usage.events.rowHeight.description': '开启后每条记录使用统一高度;关闭时根据内容自动适应。',
'usage.events.rowHeight.fixed': '行高',
'usage.events.rowHeight.dragHint': '拖动滑块调整高度',
'usage.events.columnsSelected': '已选择 {selected} / {total} 列',
'usage.events.selectAllColumns': '选择全部',
'usage.events.applyColumns': '应用',
+1 -9
View File
@@ -128,21 +128,13 @@
}
.usage-request-log .usage-events-table td {
height: 68px;
height: auto;
padding: 9px 8px;
background: var(--usage-log-surface);
color: var(--usage-log-text);
line-height: 1.45;
}
.usage-request-log.usage-row-height-auto .usage-events-table td {
height: auto;
}
.usage-request-log.usage-row-height-fixed .usage-events-table td {
height: var(--usage-row-height, 68px);
}
.usage-request-log .usage-events-table tbody tr:hover td {
background: var(--usage-log-hover) !important;
}
+3 -68
View File
@@ -1,5 +1,5 @@
import { usagePreferences } from '../services/usagePreferences';
import { useEffect, useRef, useState, type KeyboardEvent, type CSSProperties } from 'react';
import { useEffect, useRef, useState, type KeyboardEvent } from 'react';
import { invoke } from '@tauri-apps/api/core';
import { save } from '@tauri-apps/plugin-dialog';
import { ArrowDown, ArrowUp, Brain, ChevronLeft, ChevronRight, Columns3, Database, DatabaseZap, Download, RotateCcw, TriangleAlert, X } from 'lucide-react';
@@ -116,26 +116,8 @@ const EVENT_COL_WIDTHS_STORAGE_KEY = 'cpa-gui.usage-events-col-widths.v4';
const LEGACY_EVENT_COL_WIDTHS_STORAGE_KEY = 'cpa-gui.usage-events-col-widths.v3';
const EVENT_VISIBLE_COLS_STORAGE_KEY = 'cpa-gui.usage-events-visible-cols.v6';
const LEGACY_EVENT_VISIBLE_COLS_STORAGE_KEY = 'cpa-gui.usage-events-visible-cols.v5';
const EVENT_ROW_HEIGHT_ENABLED_STORAGE_KEY = 'cpa-gui.usage-events-row-height-enabled.v1';
const EVENT_ROW_HEIGHT_STORAGE_KEY = 'cpa-gui.usage-events-row-height.v1';
const DEFAULT_EVENT_ROW_HEIGHT = 68;
const MIN_EVENT_ROW_HEIGHT = 48;
const MAX_EVENT_ROW_HEIGHT = 140;
const getAllEventColumnKeys = () => EVENT_COLUMNS.map((column) => column.key);
const clampEventRowHeight = (value: number) => Math.min(
MAX_EVENT_ROW_HEIGHT,
Math.max(MIN_EVENT_ROW_HEIGHT, Math.round(value)),
);
const getInitialRowHeightEnabled = () => usagePreferences.getItem(EVENT_ROW_HEIGHT_ENABLED_STORAGE_KEY) === 'true';
const getInitialRowHeight = () => {
const value = Number(usagePreferences.getItem(EVENT_ROW_HEIGHT_STORAGE_KEY));
return Number.isFinite(value) ? clampEventRowHeight(value) : DEFAULT_EVENT_ROW_HEIGHT;
};
export const getInitialVisibleColumns = (): EventColumnKey[] => {
try {
const currentRaw = usagePreferences.getItem(EVENT_VISIBLE_COLS_STORAGE_KEY);
@@ -497,8 +479,6 @@ export function EventsView({
const [columnSettingsOpen, setColumnSettingsOpen] = useState(false);
const [draftVisibleColumnKeys, setDraftVisibleColumnKeys] = useState<EventColumnKey[]>(visibleColumnKeys);
const [resizingCol, setResizingCol] = useState<EventColumnKey | null>(null);
const [fixedRowHeight, setFixedRowHeight] = useState(getInitialRowHeightEnabled);
const [rowHeight, setRowHeight] = useState(getInitialRowHeight);
const [exporting, setExporting] = useState(false);
const columnDialogRef = useDialogFocusTrap<HTMLElement>({
@@ -562,17 +542,6 @@ export function EventsView({
setDraftVisibleColumnKeys(getAllEventColumnKeys());
};
const updateFixedRowHeight = (enabled: boolean) => {
setFixedRowHeight(enabled);
usagePreferences.setItem(EVENT_ROW_HEIGHT_ENABLED_STORAGE_KEY, String(enabled));
};
const updateRowHeight = (value: number) => {
const next = clampEventRowHeight(value);
setRowHeight(next);
usagePreferences.setItem(EVENT_ROW_HEIGHT_STORAGE_KEY, String(next));
};
const resetSingleColumn = (key: EventColumnKey, e: React.MouseEvent) => {
e.preventDefault();
e.stopPropagation();
@@ -716,12 +685,12 @@ export function EventsView({
};
return (
<section className={`panel usage-events-panel usage-request-log${isCompactDefault ? ' usage-events-compact' : ''}${fixedRowHeight ? ' usage-row-height-fixed' : ' usage-row-height-auto'}`} aria-label={t('usage.events.title')} aria-busy={loading}>
<section className={`panel usage-events-panel usage-request-log${isCompactDefault ? ' usage-events-compact' : ''}`} aria-label={t('usage.events.title')} aria-busy={loading}>
{loading && events.items.length === 0 ? <div className="usage-empty" role="status"><Database size={20} aria-hidden="true" /><span>{t('usage.loading')}</span></div> : events.items.length ? (
<div ref={tableWrapRef} className="usage-table-wrap" tabIndex={0} role="region" aria-label={t('usage.events.title')}>
<table
className="usage-events-table"
style={{ width: `${totalTableWidth}px`, '--usage-row-height': `${rowHeight}px` } as CSSProperties}
style={{ width: `${totalTableWidth}px` }}
>
<colgroup>
{visibleColumns.map((col) => (
@@ -871,40 +840,6 @@ export function EventsView({
<p className="usage-column-dialog-description">
{t('usage.events.columnSettingsDescription')}
</p>
<section className="usage-row-height-settings" aria-labelledby="usage-row-height-title">
<div className="usage-row-height-heading">
<div>
<strong id="usage-row-height-title">{t('usage.events.rowHeight.title')}</strong>
<span>{t('usage.events.rowHeight.description')}</span>
</div>
<button
type="button"
className={`usage-settings-switch${fixedRowHeight ? ' active' : ''}`}
role="switch"
aria-checked={fixedRowHeight}
onClick={() => updateFixedRowHeight(!fixedRowHeight)}
>
<span aria-hidden="true" />
<span>{fixedRowHeight ? t('common.enabled') : t('common.disabled')}</span>
</button>
</div>
<div className="usage-row-height-control">
<label htmlFor="usage-row-height-range">{t('usage.events.rowHeight.fixed')}</label>
<input
id="usage-row-height-range"
type="range"
min={MIN_EVENT_ROW_HEIGHT}
max={MAX_EVENT_ROW_HEIGHT}
step="1"
value={rowHeight}
disabled={!fixedRowHeight}
onChange={(event) => updateRowHeight(Number(event.currentTarget.value))}
aria-label={t('usage.events.rowHeight.fixed')}
/>
<output htmlFor="usage-row-height-range">{rowHeight}px</output>
<span className="usage-row-height-hint">{t('usage.events.rowHeight.dragHint')}</span>
</div>
</section>
<div className="usage-column-options">
{EVENT_COLUMNS.map((column) => {
const checked = draftVisibleColumnKeys.includes(column.key);
-105
View File
@@ -9623,97 +9623,6 @@ textarea:focus-visible {
line-height: 1.5;
}
.usage-row-height-settings {
display: grid;
gap: 12px;
margin: 0 0 16px;
padding: 14px 16px;
border: 1px solid var(--border-color);
border-radius: 10px;
background: var(--bg-tertiary);
}
.usage-row-height-heading,
.usage-row-height-control {
display: flex;
align-items: center;
gap: 12px;
}
.usage-row-height-heading {
justify-content: space-between;
}
.usage-row-height-heading > div {
display: grid;
gap: 3px;
}
.usage-row-height-heading strong,
.usage-row-height-control label {
color: var(--text-primary);
font-size: var(--font-size-body);
font-weight: var(--font-weight-semibold);
}
.usage-row-height-heading span,
.usage-row-height-hint {
color: var(--text-secondary);
font-size: var(--font-size-caption);
}
.usage-settings-switch {
display: inline-flex;
align-items: center;
gap: 7px;
border: 0;
background: transparent;
color: var(--text-secondary);
font-size: var(--font-size-caption);
cursor: pointer;
}
.usage-settings-switch > span:first-child {
position: relative;
width: 34px;
height: 20px;
border-radius: 999px;
background: var(--border-primary);
transition: background .15s ease;
}
.usage-settings-switch > span:first-child::after {
position: absolute;
top: 3px;
left: 3px;
width: 14px;
height: 14px;
border-radius: 50%;
background: #fff;
content: '';
transition: transform .15s ease;
}
.usage-settings-switch.active > span:first-child { background: var(--ui-accent); }
.usage-settings-switch.active > span:first-child::after { transform: translateX(14px); }
.usage-row-height-control {
flex-wrap: wrap;
}
.usage-row-height-control input[type='range'] {
flex: 1 1 180px;
accent-color: var(--ui-accent);
}
.usage-row-height-control output {
min-width: 42px;
color: var(--text-primary);
font-variant-numeric: tabular-nums;
font-size: var(--font-size-caption);
text-align: right;
}
.usage-column-options {
display: grid;
min-height: 0;
@@ -10109,20 +10018,6 @@ body.table-col-resizing * {
grid-template-columns: 1fr;
}
.usage-row-height-heading {
align-items: flex-start;
flex-direction: column;
}
.usage-row-height-control {
align-items: flex-start;
flex-direction: column;
}
.usage-row-height-control input[type='range'] {
width: 100%;
}
.usage-column-dialog-footer {
align-items: stretch;
flex-direction: column;