Skip to content

Commit

Permalink
修复定时任务搜索api
Browse files Browse the repository at this point in the history
  • Loading branch information
whyour committed Sep 1, 2022
1 parent 7516acb commit b9253c8
Show file tree
Hide file tree
Showing 13 changed files with 65 additions and 70 deletions.
8 changes: 6 additions & 2 deletions README-en.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ https://podman.io/getting-started/installation
```bash
podman run -dit \
--network bridge \
-v $PWD/ql:/ql/data \
-v $PWD/ql/data:/ql/data \
-p 5700:5700 \
--name qinglong \
--hostname qinglong \
Expand Down Expand Up @@ -96,7 +96,7 @@ systemctl restart docker

```bash
docker run -dit \
-v $PWD/ql:/ql/data \
-v $PWD/ql/data:/ql/data \
-p 5700:5700 \
--name qinglong \
--hostname qinglong \
Expand Down Expand Up @@ -124,6 +124,10 @@ docker-compose up -d
docker-compose down
```

3. access

Open your browser and visit http://{ip}:5700

## Use

1. built-in commands
Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ https://podman.io/getting-started/installation
```bash
podman run -dit \
--network bridge \
-v $PWD/ql:/ql/data \
-v $PWD/ql/data:/ql/data \
-p 5700:5700 \
--name qinglong \
--hostname qinglong \
Expand Down Expand Up @@ -97,7 +97,7 @@ systemctl restart docker

```bash
docker run -dit \
-v $PWD/ql:/ql/data \
-v $PWD/ql/data:/ql/data \
-p 5700:5700 \
--name qinglong \
--hostname qinglong \
Expand Down Expand Up @@ -125,6 +125,10 @@ docker-compose up -d
docker-compose down
```

3. 访问

打开你的浏览器,访问 http://{ip}:5700

## 使用

1. 内置命令
Expand Down
35 changes: 11 additions & 24 deletions back/api/cron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,30 +100,17 @@ export default (app: Router) => {
},
);

route.get(
'/',
celebrate({
query: Joi.object({
searchText: Joi.string().required().allow(''),
page: Joi.string().required(),
size: Joi.string().required(),
sortField: Joi.string().optional(),
sortType: Joi.string().optional(),
t: Joi.string().required(),
}),
}),
async (req: Request, res: Response, next: NextFunction) => {
const logger: Logger = Container.get('logger');
try {
const cronService = Container.get(CronService);
const data = await cronService.crontabs(req.query as any);
return res.send({ code: 200, data });
} catch (e) {
logger.error('🔥 error: %o', e);
return next(e);
}
},
);
route.get('/', async (req: Request, res: Response, next: NextFunction) => {
const logger: Logger = Container.get('logger');
try {
const cronService = Container.get(CronService);
const data = await cronService.crontabs(req.query as any);
return res.send({ code: 200, data });
} catch (e) {
logger.error('🔥 error: %o', e);
return next(e);
}
});

route.post(
'/',
Expand Down
4 changes: 2 additions & 2 deletions back/services/cron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@ export default class CronService {
}

public async crontabs(params?: {
searchText: string;
searchValue: string;
page: string;
size: string;
sortField: string;
sortType: string;
}): Promise<{ data: Crontab[]; total: number }> {
const searchText = params?.searchText;
const searchText = params?.searchValue;
const page = Number(params?.page || '0');
const size = Number(params?.size || '0');
const sortField = params?.sortField || '';
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ echo -e "======================1. 检测配置文件========================\n"
make_dir /etc/nginx/conf.d
make_dir /run/nginx
cp -fv $nginx_conf /etc/nginx/nginx.conf
cp -fv $nginx_app_conf /etc/nginx/conf.d/front.conf
envsubst '${qlBaseUrl}' < $nginx_app_conf > /etc/nginx/conf.d/front.conf
pm2 l &>/dev/null
echo

Expand Down
30 changes: 15 additions & 15 deletions docker/front.conf
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
upstream api {
upstream baseApi {
server 0.0.0.0:5600;
}

upstream public {
upstream publicApi {
server 0.0.0.0:5400;
}

map $http_upgrade $connection_upgrade {
map $http_upgrade $connection_upgrade {
default keep-alive;
'websocket' upgrade;
}
Expand All @@ -16,42 +16,42 @@ server {
root /ql/static/dist;
ssl_session_timeout 5m;

location /api/public {
location ${ql_base_url}api/public {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://public;
proxy_pass http://publicApi/api/public/;
}

location /api {
location ${ql_base_url}api {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://api;
proxy_pass http://baseApi/api/;

proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}

location /open {
location ${ql_base_url}open {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://api;
proxy_pass http://baseApi/open/;
}

gzip on;
gzip_static on;
gzip_static on;
gzip_types text/plain application/json application/javascript application/x-javascript text/css application/xml text/javascript;
gzip_proxied any;
gzip_proxied any;
gzip_vary on;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.0;
gzip_http_version 1.0;

location / {
index index.html index.htm;
try_files $uri $uri/ /index.html;
location ${ql_base_url} {
index index.html index.htm;
try_files $uri $uri/ ${ql_base_url}index.html;
}

location ~ .*\.(html)$ {
Expand Down
38 changes: 19 additions & 19 deletions docker/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,41 @@ error_log /var/log/nginx/error.log warn;
include /etc/nginx/modules/*.conf;

events {
worker_connections 1024;
worker_connections 1024;
}

http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
include /etc/nginx/mime.types;
default_type application/octet-stream;

server_tokens off;
server_tokens off;

client_max_body_size 20m;
client_body_buffer_size 20m;
client_max_body_size 20m;
client_body_buffer_size 20m;

keepalive_timeout 65;
keepalive_timeout 65;

sendfile on;
sendfile on;

tcp_nodelay on;
tcp_nodelay on;

ssl_prefer_server_ciphers on;
ssl_prefer_server_ciphers on;

ssl_session_cache shared:SSL:2m;
ssl_session_cache shared:SSL:2m;

gzip on;
gzip_static on;
gzip on;
gzip_static on;
gzip_types text/plain application/json application/javascript application/x-javascript text/css application/xml text/javascript;
gzip_proxied any;
gzip_proxied any;
gzip_vary on;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.0;

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;
include /etc/nginx/conf.d/*.conf;
access_log /var/log/nginx/access.log main;
include /etc/nginx/conf.d/*.conf;
}
2 changes: 1 addition & 1 deletion shell/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ copy_dep() {

echo -e "---> 2. 复制nginx配置文件\n"
cp -fv $nginx_conf /etc/nginx/nginx.conf
cp -fv $nginx_app_conf /etc/nginx/conf.d/front.conf
envsubst '${qlBaseUrl}' < $nginx_app_conf > /etc/nginx/conf.d/front.conf
echo -e "---> 配置文件复制完成\n"
}

Expand Down
1 change: 1 addition & 0 deletions shell/share.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ import_config() {
[[ -f $file_config_user ]] && . $file_config_user
[[ -f $file_env ]] && . $file_env

ql_base_url=${QlBaseUrl:-"/"}
command_timeout_time=${CommandTimeoutTime:-"1h"}
proxy_url=${ProxyUrl:-""}
file_extensions=${RepoFileExtensions:-"js py"}
Expand Down
2 changes: 1 addition & 1 deletion src/layouts/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@
}

.ant-layout-sider {
border-right: 1px solid rgba(0, 0, 0, 0.06);
border-right: 1px solid rgba(0, 0, 0, 0.06) !important;
}

.ant-pro-sider-logo {
Expand Down
1 change: 0 additions & 1 deletion src/pages/crontab/detail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ const CronDetailModal = ({
wordWrap: 'on',
}}
onMount={(editor, monaco) => {
console.log(monaco);
editorRef.current = editor;
}}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/crontab/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ const Crontab = ({ headerStyle, isPhone, theme }: any) => {
const getCrons = () => {
setLoading(true);
const { page, size, sorter } = pageConf;
let url = `${config.apiPrefix}crons?searchText=${searchText}&page=${page}&size=${size}`;
let url = `${config.apiPrefix}crons?searchValue=${searchText}&page=${page}&size=${size}`;
if (sorter && sorter.field) {
url += `&sortField=${sorter.field}&sortType=${
sorter.order === 'ascend' ? 'ASC' : 'DESC'
Expand Down
2 changes: 1 addition & 1 deletion src/pages/crontab/viewManageModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ const ViewManageModal = ({
);

useEffect(() => {
getCronViews();
// getCronViews();
}, []);

return (
Expand Down

0 comments on commit b9253c8

Please sign in to comment.