增加 QlPort 环境变量,支持设置服务启动的端口,修复定时任务视图操作符筛选

This commit is contained in:
whyour 2023-09-15 17:57:28 +08:00
parent 748a099087
commit 0511a4af0d
7 changed files with 46 additions and 19 deletions

View File

@ -61,7 +61,12 @@ npm i @whyour/qinglong
# curl -sSL get.docker.com | sh # curl -sSL get.docker.com | sh
docker run -dit \ docker run -dit \
-v $PWD/ql/data:/ql/data \ -v $PWD/ql/data:/ql/data \
# The 5700 after the colon is the default port, if QlPort is set, it needs to be the same as QlPort.
-p 5700:5700 \ -p 5700:5700 \
# Deployment paths are not required and begin and end with a slash, e.g. /test/.
-e QlBaseUrl="/" \
# Deployment port is not required, when using host mode, you can set the port after service startup, default 5700
-e QlPort="5700" \
--name qinglong \ --name qinglong \
--hostname qinglong \ --hostname qinglong \
--restart unless-stopped \ --restart unless-stopped \
@ -88,7 +93,12 @@ docker-compose down
podman run -dit \ podman run -dit \
--network bridge \ --network bridge \
-v $PWD/ql/data:/ql/data \ -v $PWD/ql/data:/ql/data \
# The 5700 after the colon is the default port, if QlPort is set, it needs to be the same as QlPort.
-p 5700:5700 \ -p 5700:5700 \
# Deployment paths are not required and begin and end with a slash, e.g. /test/.
-e QlBaseUrl="/" \
# Deployment port is not required, when using host mode, you can set the port after service startup, default 5700
-e QlPort="5700" \
--name qinglong \ --name qinglong \
--hostname qinglong \ --hostname qinglong \
docker.io/whyour/qinglong:latest docker.io/whyour/qinglong:latest

View File

@ -63,9 +63,12 @@ npm i @whyour/qinglong
# curl -sSL get.docker.com | sh # curl -sSL get.docker.com | sh
docker run -dit \ docker run -dit \
-v $PWD/ql/data:/ql/data \ -v $PWD/ql/data:/ql/data \
# 冒号后面的 5700 为默认端口,如果设置了 QlPort, 需要跟 QlPort 保持一致
-p 5700:5700 \ -p 5700:5700 \
# 部署路径非必须,以斜杠开头和结尾,比如 /test/ # 部署路径非必须,以斜杠开头和结尾,比如 /test/
-e QlBaseUrl="/" \ -e QlBaseUrl="/" \
# 部署端口非必须,当使用 host 模式时,可以设置服务启动后的端口,默认 5700
-e QlPort="5700" \
--name qinglong \ --name qinglong \
--hostname qinglong \ --hostname qinglong \
--restart unless-stopped \ --restart unless-stopped \
@ -92,9 +95,12 @@ docker-compose down
podman run -dit \ podman run -dit \
--network bridge \ --network bridge \
-v $PWD/ql/data:/ql/data \ -v $PWD/ql/data:/ql/data \
# 冒号后面的 5700 为默认端口,如果设置了 QlPort, 需要跟 QlPort 保持一致
-p 5700:5700 \ -p 5700:5700 \
# 部署路径非必须,以斜杠开头和结尾,比如 /test/ # 部署路径非必须,以斜杠开头和结尾,比如 /test/
-e QlBaseUrl="/" \ -e QlBaseUrl="/" \
# 部署端口非必须,当使用 host 模式时,可以设置服务启动后的端口,默认 5700
-e QlPort="5700" \
--name qinglong \ --name qinglong \
--hostname qinglong \ --hostname qinglong \
docker.io/whyour/qinglong:latest docker.io/whyour/qinglong:latest

View File

@ -12,7 +12,7 @@ map $http_upgrade $connection_upgrade {
} }
server { server {
listen 5700; IPV4_CONFIG
IPV6_CONFIG IPV6_CONFIG
ssl_session_timeout 5m; ssl_session_timeout 5m;

View File

@ -69,6 +69,7 @@ import_config() {
[[ -f $file_env ]] && . $file_env [[ -f $file_env ]] && . $file_env
ql_base_url=${QlBaseUrl:-"/"} ql_base_url=${QlBaseUrl:-"/"}
ql_port=${QlPort:-"5700"}
command_timeout_time=${CommandTimeoutTime:-""} command_timeout_time=${CommandTimeoutTime:-""}
proxy_url=${ProxyUrl:-""} proxy_url=${ProxyUrl:-""}
file_extensions=${RepoFileExtensions:-"js py"} file_extensions=${RepoFileExtensions:-"js py"}
@ -416,12 +417,15 @@ init_nginx() {
sed -i "s,QL_BASE_URL_LOCATION,${location_url},g" /etc/nginx/conf.d/front.conf sed -i "s,QL_BASE_URL_LOCATION,${location_url},g" /etc/nginx/conf.d/front.conf
sed -i "s,QL_BASE_URL,${ql_base_url},g" /etc/nginx/conf.d/front.conf sed -i "s,QL_BASE_URL,${ql_base_url},g" /etc/nginx/conf.d/front.conf
ipv6=$(ip a | grep inet6) local ipv6=$(ip a | grep inet6)
ipv6Str="" local ipv6Str=""
if [[ $ipv6 ]]; then if [[ $ipv6 ]]; then
ipv6Str="listen [::]:5700 ipv6only=on;" ipv6Str="listen [::]:${ql_port} ipv6only=on;"
fi fi
local ipv4Str="listen ${ql_port};"
sed -i "s,IPV6_CONFIG,${ipv6Str},g" /etc/nginx/conf.d/front.conf sed -i "s,IPV6_CONFIG,${ipv6Str},g" /etc/nginx/conf.d/front.conf
sed -i "s,IPV4_CONFIG,${ipv4Str},g" /etc/nginx/conf.d/front.conf
} }
handle_task_before() { handle_task_before() {

View File

@ -452,5 +452,6 @@
"系统日志": "System Logs", "系统日志": "System Logs",
"主题": "Theme", "主题": "Theme",
"语言": "Language", "语言": "Language",
"中...": "ing..." "中...": "ing...",
"请选择操作符": "Please select operator"
} }

View File

@ -452,5 +452,6 @@
"系统日志": "系统日志", "系统日志": "系统日志",
"主题": "主题", "主题": "主题",
"语言": "语言", "语言": "语言",
"中...": "中..." "中...": "中...",
"请选择操作符": "请选择操作符"
} }

View File

@ -107,20 +107,25 @@ const ViewCreateModal = ({
} }
form.setFieldsValue( form.setFieldsValue(
view || { view || {
filters: [{ property: 'command', operation: 'Reg' }], filters: [{ property: 'command' }],
}, },
); );
}, [view, visible]); }, [view, visible]);
const operationElement = ( const OperationElement = ({ name }: { name: number }) => {
<Select style={{ width: 120 }}> const property = form.getFieldValue(['filters', name, 'property']);
{OPERATIONS.map((x) => ( return (
<Select.Option key={x.name} value={x.value}> <Select style={{ width: 120 }}>
{x.name} {OPERATIONS.filter((x) =>
</Select.Option> STATUS_MAP[property as 'status' | 'sub_id'] ? x.type === 'select' : x,
))} ).map((x) => (
</Select> <Select.Option key={x.name} value={x.value}>
); {x.name}
</Select.Option>
))}
</Select>
);
};
const propertyElement = (props: any, style: React.CSSProperties = {}) => { const propertyElement = (props: any, style: React.CSSProperties = {}) => {
return ( return (
@ -135,7 +140,7 @@ const ViewCreateModal = ({
}; };
const typeElement = ( const typeElement = (
<Select style={{ width: 80 }}> <Select style={{ width: 80 }} placeholder={intl.get('请选择操作符')}>
{SORTTYPES.map((x) => ( {SORTTYPES.map((x) => (
<Select.Option key={x.name} value={x.value}> <Select.Option key={x.name} value={x.value}>
{x.name} {x.name}
@ -256,9 +261,9 @@ const ViewCreateModal = ({
<Form.Item <Form.Item
{...restField} {...restField}
name={[name, 'operation']} name={[name, 'operation']}
rules={[{ required: true }]} rules={[{ required: true, message: intl.get('请选择操作符') }]}
> >
{operationElement} <OperationElement name={name} />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
{...restField} {...restField}