🐛 fix(driver-manager/sql-editor): 优化驱动代理更新提示和事务提交控件

- 调整 driver-agent revision 为提示性校验,允许旧代理继续安装使用并保留需重装提示

- 精简 SQL 编辑器 DML 事务模式与自动提交档位展示

- 补充旧 revision 安装回归和事务控件断言
This commit is contained in:
Syngnat
2026-06-12 12:57:47 +08:00
parent d1aa06d537
commit 4cc8ab6482
5 changed files with 104 additions and 110 deletions

View File

@@ -3727,9 +3727,12 @@ describe('QueryEditor external SQL save', () => {
expect(transactionSettingsSource).toContain('gn-v2-query-toolbar-transaction-mode-select');
expect(transactionSettingsSource).toContain('gn-v2-query-toolbar-transaction-delay-select');
expect(transactionSettingsSource).toContain('参考 DBeaver');
expect(transactionSettingsSource).toContain("label: '手动提交'");
expect(transactionSettingsSource).toContain("label: '自动提交'");
expect(transactionSettingsSource).toContain("label: '手动'");
expect(transactionSettingsSource).toContain("label: '自动'");
expect(transactionSettingsSource).not.toContain("label: '手动提交'");
expect(transactionSettingsSource).not.toContain("label: '自动提交'");
expect(transactionSettingsSource).toContain("label: '立即'");
expect(transactionSettingsSource).toContain("label: '3s'");
expect(source).toContain('QueryEditorTransactionToolbar');
expect(transactionToolbarSource).toContain("className={isV2Ui ? 'gn-v2-query-transaction-toolbar' : undefined}");
expect(transactionToolbarSource).toContain("'未提交'");
@@ -3738,12 +3741,15 @@ describe('QueryEditor external SQL save', () => {
expect(transactionToolbarSource).toContain("'自动提交中'");
expect(transactionToolbarSource).toContain('onFinish');
expect(toolbarSource).toContain('gn-v2-query-toolbar-action-group');
expect(transactionSettingsSource).toContain('style={isV2Ui ? undefined : { width: 118 }}');
expect(transactionSettingsSource).toContain('style={isV2Ui ? undefined : { width: 78 }}');
expect(transactionSettingsSource).toContain('style={isV2Ui ? undefined : { width: 68 }}');
expect(toolbarSource).toContain('style={isV2Ui ? undefined : { width: 200 }}');
expect(toolbarSource).toContain('style={isV2Ui ? undefined : { width: 170 }}');
expect(css).toContain('body[data-ui-version="v2"] .gn-v2-query-toolbar-selects');
expect(css).toContain('body[data-ui-version="v2"] .gn-v2-query-toolbar-actions');
expect(css).toContain('width: 74px !important;');
expect(css).toContain('width: 62px !important;');
expect(css).toContain('flex: 0 1 auto !important;');
expect(css).toContain('justify-content: flex-start;');
expect(css).toContain('height: 32px !important;');
@@ -3755,8 +3761,6 @@ describe('QueryEditor external SQL save', () => {
expect(css).toContain('width: 140px !important;');
expect(css).toContain('width: 166px !important;');
expect(css).toContain('width: 132px !important;');
expect(css).toContain('width: 118px !important;');
expect(css).toContain('width: 82px !important;');
expect(css).toContain('width: 34px !important;');
expect(css).toContain('@media (max-width: 900px)');

View File

@@ -5,10 +5,10 @@ export type SqlEditorCommitMode = 'manual' | 'auto';
export const SQL_EDITOR_AUTO_COMMIT_DELAY_OPTIONS = [
{ value: 0, label: '立即' },
{ value: 3000, label: '3 秒后' },
{ value: 5000, label: '5 秒后' },
{ value: 10000, label: '10 秒后' },
{ value: 30000, label: '30 秒后' },
{ value: 3000, label: '3s' },
{ value: 5000, label: '5s' },
{ value: 10000, label: '10s' },
{ value: 30000, label: '30s' },
];
type QueryEditorTransactionSettingsProps = {
@@ -30,19 +30,19 @@ const QueryEditorTransactionSettings: React.FC<QueryEditorTransactionSettingsPro
<Tooltip title="参考 DBeaverSQL 编辑器执行 INSERT/UPDATE/DELETE/MERGE/REPLACE 等 DML 时先进入 GoNavi 托管事务;手动提交需要手动提交/回滚,自动提交会在执行成功后自动 COMMIT。">
<Select
className={isV2Ui ? 'gn-v2-query-toolbar-select gn-v2-query-toolbar-transaction-mode-select' : undefined}
style={isV2Ui ? undefined : { width: 118 }}
style={isV2Ui ? undefined : { width: 78 }}
value={commitMode}
onChange={(mode) => onCommitModeChange(mode === 'auto' ? 'auto' : 'manual')}
options={[
{ label: '手动提交', value: 'manual' },
{ label: '自动提交', value: 'auto' },
{ label: '手动', value: 'manual' },
{ label: '自动', value: 'auto' },
]}
/>
</Tooltip>
{commitMode === 'auto' && (
<Select
className={isV2Ui ? 'gn-v2-query-toolbar-select gn-v2-query-toolbar-transaction-delay-select' : undefined}
style={isV2Ui ? undefined : { width: 96 }}
style={isV2Ui ? undefined : { width: 68 }}
value={autoCommitDelayMs}
onChange={(delayMs) => onAutoCommitDelayMsChange(Number(delayMs))}
options={SQL_EDITOR_AUTO_COMMIT_DELAY_OPTIONS}