mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-08-22 08:53:46 +08:00
🐛 fix(data-import): 约束导入目标下拉框宽度 (#774)
- 限制连接、数据库和目标表选择器不超出目标卡片 - 保留长名称单行省略并适配单双列布局 - 新增目标选择器宽度约束回归测试
This commit is contained in:
@@ -177,6 +177,20 @@ describe('DataImportWorkbench', () => {
|
||||
expect(mocks.dbGetTables).toHaveBeenCalledWith(expect.anything(), 'app');
|
||||
});
|
||||
|
||||
it('keeps every target selector within the import target card', async () => {
|
||||
const renderer = await renderWorkbench();
|
||||
|
||||
['connection', 'database', 'table'].forEach((field) => {
|
||||
expect(renderer.root.findByProps({
|
||||
'data-import-target-field': field,
|
||||
}).props.style).toEqual({
|
||||
width: '100%',
|
||||
minWidth: 0,
|
||||
maxWidth: '100%',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('filters every SQL import protection from database mode connections', async () => {
|
||||
const primaryConnection = mocks.storeState.connections[0];
|
||||
mocks.storeState.connections = [
|
||||
|
||||
@@ -33,6 +33,12 @@ import './DataImportWorkbench.css';
|
||||
|
||||
const { Text, Title } = Typography;
|
||||
|
||||
const targetSelectStyle: React.CSSProperties = {
|
||||
width: '100%',
|
||||
minWidth: 0,
|
||||
maxWidth: '100%',
|
||||
};
|
||||
|
||||
type SelectOption = {
|
||||
value: string;
|
||||
label: React.ReactNode;
|
||||
@@ -520,6 +526,7 @@ const DataImportWorkbench: React.FC<{ tab: TabData }> = ({ tab }) => {
|
||||
<Text type="secondary">{t('data_import.workbench.label.connection')}</Text>
|
||||
<Select
|
||||
data-import-target-field="connection"
|
||||
style={targetSelectStyle}
|
||||
value={selectedConnectionId || undefined}
|
||||
options={connectionOptions}
|
||||
placeholder={t('data_import.workbench.placeholder.select_connection')}
|
||||
@@ -538,6 +545,7 @@ const DataImportWorkbench: React.FC<{ tab: TabData }> = ({ tab }) => {
|
||||
</Text>
|
||||
<Select
|
||||
data-import-target-field="database"
|
||||
style={targetSelectStyle}
|
||||
value={selectedDbName || undefined}
|
||||
options={databaseOptions}
|
||||
placeholder={loadingDatabases
|
||||
@@ -559,6 +567,7 @@ const DataImportWorkbench: React.FC<{ tab: TabData }> = ({ tab }) => {
|
||||
<Text type="secondary">{t('data_import.workbench.label.table')}</Text>
|
||||
<Select
|
||||
data-import-target-field="table"
|
||||
style={targetSelectStyle}
|
||||
value={selectedTableName || undefined}
|
||||
options={tableOptions}
|
||||
placeholder={!selectedDbName
|
||||
|
||||
Reference in New Issue
Block a user