Skip to content

Commit

Permalink
Merge pull request #588 from chat2db/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Chat2DB-Pro authored Oct 17, 2023
2 parents b6a357f + 077cddf commit e6cc037
Show file tree
Hide file tree
Showing 18 changed files with 94 additions and 18 deletions.
29 changes: 26 additions & 3 deletions chat2db-client/src/assets/font/demo_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ <h1 class="logo"><a href="https://www.iconfont.cn/" title="iconfont 首页" targ
<div class="content unicode" style="display: block;">
<ul class="icon_lists dib-box">

<li class="dib">
<span class="icon iconfont">&#xe653;</span>
<div class="name">导入</div>
<div class="code-name">&amp;#xe653;</div>
</li>

<li class="dib">
<span class="icon iconfont">&#xe652;</span>
<div class="name">终止</div>
Expand Down Expand Up @@ -1032,9 +1038,9 @@ <h3 id="-font-face">第一步:拷贝项目下面生成的 <code>@font-face</co
<pre><code class="language-css"
>@font-face {
font-family: 'iconfont';
src: url('iconfont.woff2?t=1697513439813') format('woff2'),
url('iconfont.woff?t=1697513439813') format('woff'),
url('iconfont.ttf?t=1697513439813') format('truetype');
src: url('iconfont.woff2?t=1697535832665') format('woff2'),
url('iconfont.woff?t=1697535832665') format('woff'),
url('iconfont.ttf?t=1697535832665') format('truetype');
}
</code></pre>
<h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3>
Expand All @@ -1060,6 +1066,15 @@ <h3 id="-">第三步:挑选相应图标并获取字体编码,应用于页面
<div class="content font-class">
<ul class="icon_lists dib-box">

<li class="dib">
<span class="icon iconfont icon-daoru"></span>
<div class="name">
导入
</div>
<div class="code-name">.icon-daoru
</div>
</li>

<li class="dib">
<span class="icon iconfont icon-zhongzhi"></span>
<div class="name">
Expand Down Expand Up @@ -2527,6 +2542,14 @@ <h3 id="-">第二步:挑选相应图标并获取类名,应用于页面:</h
<div class="content symbol">
<ul class="icon_lists dib-box">

<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-daoru"></use>
</svg>
<div class="name">导入</div>
<div class="code-name">#icon-daoru</div>
</li>

<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-zhongzhi"></use>
Expand Down
10 changes: 7 additions & 3 deletions chat2db-client/src/assets/font/iconfont.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@font-face {
font-family: "iconfont"; /* Project id 3633546 */
src: url('iconfont.woff2?t=1697513439813') format('woff2'),
url('iconfont.woff?t=1697513439813') format('woff'),
url('iconfont.ttf?t=1697513439813') format('truetype');
src: url('iconfont.woff2?t=1697535832665') format('woff2'),
url('iconfont.woff?t=1697535832665') format('woff'),
url('iconfont.ttf?t=1697535832665') format('truetype');
}

.iconfont {
Expand All @@ -13,6 +13,10 @@
-moz-osx-font-smoothing: grayscale;
}

.icon-daoru:before {
content: "\e653";
}

.icon-zhongzhi:before {
content: "\e652";
}
Expand Down
2 changes: 1 addition & 1 deletion chat2db-client/src/assets/font/iconfont.js

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions chat2db-client/src/assets/font/iconfont.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
"css_prefix_text": "icon-",
"description": "",
"glyphs": [
{
"icon_id": "11399566",
"name": "导入",
"font_class": "daoru",
"unicode": "e653",
"unicode_decimal": 58963
},
{
"icon_id": "10933419",
"name": "终止",
Expand Down
Binary file modified chat2db-client/src/assets/font/iconfont.ttf
Binary file not shown.
Binary file modified chat2db-client/src/assets/font/iconfont.woff
Binary file not shown.
Binary file modified chat2db-client/src/assets/font/iconfont.woff2
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,14 @@ const IncludeCol = forwardRef((props: IProps, ref: ForwardedRef<IIncludeColRef>)
<Form.Item name="ascOrDesc" style={{ margin: 0 }}>
<Select
options={[
{ label: 'ASC', value: 'A' },
{ label: 'DESC', value: 'D' },
{ label: 'ASC', value: 'ASC' },
{ label: 'DESC', value: 'DESC' },
]}
/>
</Form.Item>
) : (
<div className={styles.editableCell} onClick={() => edit(record)}>
{text === 'A' ? 'ASC' : text === 'D' ? 'DESC' : null}
{text}
</div>
);
},
Expand Down
12 changes: 9 additions & 3 deletions chat2db-client/src/components/Iconfont/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,15 @@ if (__ENV__ === 'local') {
/* 在线链接服务仅供平台体验和调试使用,平台不承诺服务的稳定性,企业客户需下载字体包自行发布使用并做好备份。 */
@font-face {
font-family: 'iconfont'; /* Project id 3633546 */
src: url('//at.alicdn.com/t/c/font_3633546_xwv1edd4b7n.woff2?t=1697513390352') format('woff2'),
url('//at.alicdn.com/t/c/font_3633546_xwv1edd4b7n.woff?t=1697513390352') format('woff'),
url('//at.alicdn.com/t/c/font_3633546_xwv1edd4b7n.ttf?t=1697513390352') format('truetype');
<<<<<<< HEAD
src: url('//at.alicdn.com/t/c/font_3633546_rvjmcxfylgi.woff2?t=1697537287397') format('woff2'),
url('//at.alicdn.com/t/c/font_3633546_rvjmcxfylgi.woff?t=1697537287397') format('woff'),
url('//at.alicdn.com/t/c/font_3633546_rvjmcxfylgi.ttf?t=1697537287397') format('truetype');
=======
src: url('//at.alicdn.com/t/c/font_3633546_1ru1h66minc.woff2?t=1697535684560') format('woff2'),
url('//at.alicdn.com/t/c/font_3633546_1ru1h66minc.woff?t=1697535684560') format('woff'),
url('//at.alicdn.com/t/c/font_3633546_1ru1h66minc.ttf?t=1697535684560') format('truetype');
>>>>>>> 47e1fa96cc17300c23606f878647745724f5b7a3
}
`;
const style = document.createElement('style');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ export default function TableBox(props: ITableProps) {
[styles.disableBar]: !updateData.length,
})}
>
<Iconfont code="&#xe651;" />
<Iconfont code="&#xe654;" />
</div>
</Popover>
<Popover content={i18n('editTableData.tips.submit')} trigger="hover">
Expand Down
1 change: 1 addition & 0 deletions chat2db-client/src/i18n/en-us/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export default {
'connection.title.connections': 'Connections',
'connection.title.createConnection': 'New Connection',
'connection.title.editConnection': 'Edit Connection',
'connection.title.importConnection': 'Import Connection',
'connection.label.name': 'name',
'connection.label.host': 'host',
'connection.label.authentication': 'authentication',
Expand Down
3 changes: 2 additions & 1 deletion chat2db-client/src/i18n/zh-cn/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export default {
'connection.title.connections': '连接',
'connection.title.createConnection': '创建数据源',
'connection.title.editConnection': '修改数据源',
'connection.title.importConnection': '导入数据源',
'connection.label.name': '名称',
'connection.label.host': '主机',
'connection.label.authentication': '身份验证',
Expand Down Expand Up @@ -29,4 +30,4 @@ export default {
'connection.label.shared': '共享',
'connection.button.createConnection': '创建连接',
'connection.tips.noConnection': '您当前还没有创建任何连接',
}
};
12 changes: 11 additions & 1 deletion chat2db-client/src/pages/main/connection/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,17 @@ function Connections(props: IProps) {
);
})}
<Button key="importBtn" className={styles.databaseItem} onClick={() => setIsFileUploadModalOpen(true)}>
导入链接
<div className={styles.databaseItemMain}>
<div className={styles.databaseItemLeft}>
<div className={styles.logoBox}>
<Iconfont code="&#xe653;" />
</div>
{i18n('connection.title.importConnection')}
</div>
<div className={styles.databaseItemRight}>
<Iconfont code="&#xe631;" />
</div>
</div>
</Button>
</div>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,12 @@ private TableIndexColumn getTableIndexColumn(ResultSet resultSet) throws SQLExce
tableIndexColumn.setCollation(resultSet.getString("Collation"));
tableIndexColumn.setCardinality(resultSet.getLong("Cardinality"));
tableIndexColumn.setSubPart(resultSet.getLong("Sub_part"));
tableIndexColumn.setAscOrDesc(resultSet.getString("Collation"));
String collation = resultSet.getString("Collation");
if ("a".equalsIgnoreCase(collation)) {
tableIndexColumn.setAscOrDesc("ASC");
} else if ("d".equalsIgnoreCase(collation)) {
tableIndexColumn.setAscOrDesc("DESC");
}
return tableIndexColumn;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package ai.chat2db.server.domain.core.impl;

import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
Expand All @@ -22,7 +23,9 @@
import ai.chat2db.server.tools.common.util.ContextUtils;
import ai.chat2db.server.tools.common.util.EasySqlUtils;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
Expand Down Expand Up @@ -67,6 +70,7 @@ public PageResult<OperationLog> queryPage(OperationLogPageQueryParam param) {
Integer offset = param.getPageSize();
Page<OperationLogDO> page = new Page<>(start, offset);
page.setOptimizeCountSql(false);
page.setOrders(Arrays.asList(OrderItem.desc("gmt_create")));
IPage<OperationLogDO> executedDdlDOIPage = operationLogMapper.selectPage(page, queryWrapper);
List<OperationLog> executedDdlDTOS = operationLogConverter.do2dto(executedDdlDOIPage.getRecords());
if (CollectionUtils.isEmpty(executedDdlDTOS)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ public class EmbeddingController extends ChatController {
@GetMapping("/white/check")
public DataResult<Boolean> checkInWhite(WhiteListRequest request) {
request.setWhiteType(WhiteListTypeEnum.VECTOR.getCode());
if (StringUtils.isBlank(request.getApiKey())) {
return DataResult.of(false);
}
return gatewayClientService.checkInWhite(request);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import ai.chat2db.spi.model.TableColumn;
import ai.chat2db.spi.model.TableIndex;
import com.fasterxml.jackson.annotation.JsonAlias;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
Expand Down Expand Up @@ -40,6 +41,17 @@ public class TableRequest {
private List<TableIndex> indexList;


/**
* 空间名
*/
private String schemaName;

/**
* 数据库名
*/
private String databaseName;


private String engine;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public Connection getConnection(ConnectInfo connectInfo) {
}
connectInfo.setSession(session);
connectInfo.setConnection(connection);
if (StringUtils.isNotBlank(connectInfo.getDatabaseName())) {
if (StringUtils.isNotBlank(connectInfo.getDatabaseName()) || StringUtils.isNotBlank(connectInfo.getSchemaName())) {
connectDatabase(connection, connectInfo.getDatabaseName());
}
return connection;
Expand Down

0 comments on commit e6cc037

Please sign in to comment.