Skip to content

Commit 7a311e6

Browse files
committed
fix search UI for datasources
1 parent cc3e96a commit 7a311e6

File tree

1 file changed

+25
-26
lines changed

1 file changed

+25
-26
lines changed

client/packages/lowcoder/src/pages/setting/environments/components/DataSourcesTab.tsx

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useState, useEffect } from 'react';
2-
import { Card, Button, Divider, Alert, message, Table, Tag, Input, Space, Tooltip, Row, Col } from 'antd';
2+
import { Card, Button, Divider, Alert, message, Table, Tag, Input, Space, Tooltip, Row, Col, Avatar } from 'antd';
33
import {
44
SyncOutlined,
55
CloudUploadOutlined,
@@ -15,7 +15,7 @@ import Title from 'antd/lib/typography/Title';
1515
import { Environment } from '../types/environment.types';
1616
import { DataSource } from '../types/datasource.types';
1717
import { getMergedWorkspaceDataSources } from '../services/datasources.service';
18-
import { Switch, Spin, Empty, Avatar } from 'antd';
18+
import { Switch, Spin, Empty } from 'antd';
1919
import { ManagedObjectType, setManagedObject, unsetManagedObject } from '../services/managed-objects.service';
2020
import { useDeployModal } from '../context/DeployModalContext';
2121
import { dataSourcesConfig } from '../config/data-sources.config';
@@ -362,29 +362,6 @@ const DataSourcesTab: React.FC<DataSourcesTabProps> = ({ environment, workspaceI
362362
</Col>
363363
</Row>
364364

365-
{/* Update the search and filter bar */}
366-
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 20 }}>
367-
<Search
368-
placeholder="Search data sources by name or ID"
369-
allowClear
370-
onSearch={value => setSearchText(value)}
371-
onChange={e => setSearchText(e.target.value)}
372-
style={{ width: 300 }}
373-
size="large"
374-
/>
375-
<Button
376-
onClick={() => setShowManagedOnly(!showManagedOnly)}
377-
type="default"
378-
icon={<FilterOutlined />}
379-
style={{
380-
marginLeft: '8px',
381-
backgroundColor: showManagedOnly ? '#1890ff' : 'white',
382-
color: showManagedOnly ? 'white' : '#1890ff',
383-
borderColor: '#1890ff'
384-
}}
385-
/>
386-
</div>
387-
388365
{/* Content */}
389366
<Card
390367
style={{
@@ -403,7 +380,29 @@ const DataSourcesTab: React.FC<DataSourcesTabProps> = ({ environment, workspaceI
403380
/>
404381
) : (
405382
<>
406-
{/* Search Bar */}
383+
{/* Search and Filter Bar */}
384+
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 20 }}>
385+
<Search
386+
placeholder="Search data sources by name or ID"
387+
allowClear
388+
onSearch={value => setSearchText(value)}
389+
onChange={e => setSearchText(e.target.value)}
390+
style={{ width: 300 }}
391+
size="large"
392+
/>
393+
<Button
394+
onClick={() => setShowManagedOnly(!showManagedOnly)}
395+
type="default"
396+
icon={<FilterOutlined />}
397+
style={{
398+
marginLeft: '8px',
399+
backgroundColor: showManagedOnly ? '#1890ff' : 'white',
400+
color: showManagedOnly ? 'white' : '#1890ff',
401+
borderColor: '#1890ff'
402+
}}
403+
/>
404+
</div>
405+
407406
{searchText && displayedDataSources.length !== dataSources.length && (
408407
<div style={{ marginTop: 8, color: '#8c8c8c' }}>
409408
Showing {displayedDataSources.length} of {dataSources.length} data sources

0 commit comments

Comments
 (0)