Skip to content

Commit

Permalink
Feat optimize (#66)
Browse files Browse the repository at this point in the history
* feat: #55 delete project and collect

* fix: #32 web terminal prefix

* docs: #13

* fix: #65 sequelize pool for mysql

---------

Co-authored-by: liuyi <liuyi@dtstack.com>
  • Loading branch information
liuxy0551 and liuyi committed Jul 12, 2023
1 parent 55bc87e commit f854bb9
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 9 deletions.
2 changes: 2 additions & 0 deletions app/middleware/proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ module.exports = async function httpproxy(ctx, next) {
pathRewrite:{
[`^/proxy/${serverId}`]:''
},
timeout: 33000,
proxyTimeout: 36000,
changeOrigin: true
}))(ctx,next)
}
Expand Down
2 changes: 1 addition & 1 deletion app/utils/articleSubscription.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const getGithubTrendingFromJueJin = async (id, groupName, siteName, topicName, t
}
}

// github trending from Serverless
// github trending from Serverless,目前使用的是该方法
const getGithubTrendingFromServerless = async (id, groupName, siteName, topicName, topicUrl, webHook, app) => {
try {
const pageSize = app.config.articleSubscription.pageSize
Expand Down
17 changes: 16 additions & 1 deletion app/web/pages/proxyServer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class ProxyServer extends React.PureComponent<any, any> {
})
}
getProxyServerList = (checked?: boolean) => {
const { mainTableParams } = this.state;
const { mainTableParams, collectTagList } = this.state;
this.setState({
mainTableLoading: true
});
Expand All @@ -114,6 +114,18 @@ class ProxyServer extends React.PureComponent<any, any> {
if (data?.data?.length === 1) {
this.handleTableExpandChange(true, data.data[0])
}

// 项目被删除,但是收藏还在,这种历史数据的兼容处理。再次点击收藏的项目时去除该收藏的项目
if (!data?.data?.length && mainTableParams.projectId !== undefined) {
localStorage.setItem('collection-tags', JSON.stringify(collectTagList.filter(item => item.id !== mainTableParams.projectId)));
this.getCollectTagList();
this.setState({
mainTableParams: {
...mainTableParams,
projectId: undefined
}
}, this.getProxyServerList);
}
}
}).finally(() => {
this.setState({
Expand Down Expand Up @@ -239,6 +251,7 @@ class ProxyServer extends React.PureComponent<any, any> {
});
}
handleProxyServerDelete = (row: any) => {
const { collectTagList } = this.state;
const { id, name } = row;
confirm({
title: '确认',
Expand All @@ -250,6 +263,8 @@ class ProxyServer extends React.PureComponent<any, any> {
const { success } = response;
if (success) {
Message.success('代理服务删除成功');
localStorage.setItem('collection-tags', JSON.stringify(collectTagList.filter(item => item.id !== id)));
this.getCollectTagList();
this.getProxyServerList();
}
});
Expand Down
2 changes: 1 addition & 1 deletion app/web/pages/webTerminal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ const WebTerminal: React.FC = (props: any) => {
const cursorOffSetLength = getCursorOffsetLength(totalOffsetLength - currentOffsetLength, '\x1b[D')
terminal.write( '\x1b[?K' + `${key}${inputText.slice(currentOffsetLength - prefix.length)}`) // 在当前的坐标写上 key 和坐标后面的字符
terminal.write(cursorOffSetLength) // 移动停留在当前位置的光标
inputText = inputText.slice(0, currentOffsetLength) + key + inputText.slice(totalOffsetLength - currentOffsetLength)
inputText = inputText.slice(0, currentOffsetLength - prefix.length) + key + inputText.slice(currentOffsetLength - prefix.length)
}
})
}
Expand Down
8 changes: 4 additions & 4 deletions config/config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ module.exports = () => {
password: password || '',
// 设置连接池
pool: {
max: 10, //最大连接个数
min: 0,
acquire: 30000, // 从连接池获取连接的最长等待时间(毫秒)
idle: 10000 // 连接池中空闲连接的最长存活时间(毫秒)
max: 140, //最大连接个数
min: 50,
acquire: 40000, // 从连接池获取连接的最长等待时间(毫秒)
idle: 15000 // 连接池中空闲连接的最长存活时间(毫秒)
}
}
]
Expand Down
4 changes: 2 additions & 2 deletions docs/docsify/zh-cn/guide/配置中心.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@

## 编辑配置

点击编辑文件,修改当前文件配置。
点击编辑文件,修改当前文件配置,点击右上角的应用按钮即可生效

![配置详情](../../imgs/config_detail.png)
![配置详情](../../imgs/config_detail.png)

0 comments on commit f854bb9

Please sign in to comment.