Compare commits

...

10 Commits

Author SHA1 Message Date
whyour a266425348 修复拷贝deps 2021-11-13 22:05:54 +08:00
whyour 6dbe02e321 修复dep目录 2021-11-13 21:54:45 +08:00
whyour 39979879c9 更新版本 v2.10.7 2021-11-13 21:21:35 +08:00
whyour ba3f604a5c 修复bot安装依赖判断 2021-11-13 20:58:27 +08:00
whyour 9572582401 修改拷贝依赖 2021-11-13 19:05:34 +08:00
whyour 2bcef0ba75 修复脚本管理搜索 2021-11-13 17:42:06 +08:00
whyour 31cd7c4007 外部依赖改为系统直接分发通知文件js和py版 2021-11-13 17:21:27 +08:00
whyour 1c4c1799b0 修复环境变量表格样式 2021-11-13 16:44:21 +08:00
whyour 2d558df15e 修复schedule服务 2021-11-13 12:34:49 +08:00
whyour 7b769da4e2 修复脚本管理树结构 2021-11-13 11:14:43 +08:00
10 changed files with 77 additions and 41 deletions
+1 -1
View File
@@ -43,7 +43,7 @@ export default (app: Router) => {
children.push({
title: childFile,
value: childFile,
key: childFile,
key: `${fileOrDir}-${childFile}`,
mtime: statObj.mtimeMs,
parent: fileOrDir,
});
+5 -2
View File
@@ -44,8 +44,11 @@ const run = async () => {
};
app
.listen(config.cronPort, () => {
run();
.listen(config.cronPort, async () => {
await require('./loaders/sentry').default({ expressApp: app });
await require('./loaders/db').default();
await run();
Logger.info(`
################################################
🛡️ Schedule listening on port: ${config.cronPort} 🛡️
+1 -1
View File
@@ -31,7 +31,7 @@ cp -f "$repo_path/jbot/requirements.txt" "$dir_root"
cd $dir_root
cat requirements.txt | while read LREAD
do
if test ! -z "$(pip3 show "${LREAD%%=*}" 1>/dev/null)"; then
if [[ ! $(pip3 show "${LREAD%%=*}" 2>/dev/null) ]]; then
pip3 --default-timeout=100 install ${LREAD}
fi
done
+2
View File
@@ -10,6 +10,7 @@ dir_repo=$dir_root/repo
dir_raw=$dir_root/raw
dir_log=$dir_root/log
dir_db=$dir_root/db
dir_dep=$dir_root/deps
dir_list_tmp=$dir_log/.tmp
dir_code=$dir_log/code
dir_update_log=$dir_log/update
@@ -154,6 +155,7 @@ fix_config() {
make_dir $dir_repo
make_dir $dir_raw
make_dir $dir_update_log
make_dir $dir_dep
if [[ ! -s $file_config_user ]]; then
echo -e "复制一份 $file_config_sample$file_config_user,随后请按注释编辑你的配置文件:$file_config_user\n"
+3 -3
View File
@@ -106,7 +106,7 @@ run_normal() {
cd $dir_scripts
local relative_path="${first_param%/*}"
if [[ ! -z ${relative_path} ]]; then
if [[ ! -z ${relative_path} ]] && [[ ${first_param} =~ "/" ]]; then
cd ${relative_path}
first_param=${first_param/$relative_path\//}
fi
@@ -174,7 +174,7 @@ run_concurrent() {
cd $dir_scripts
local relative_path="${first_param%/*}"
if [[ ! -z ${relative_path} ]]; then
if [[ ! -z ${relative_path} ]] && [[ ${first_param} =~ "/" ]]; then
cd ${relative_path}
first_param=${first_param/$relative_path\//}
fi
@@ -248,7 +248,7 @@ run_designated() {
cd $dir_scripts
local relative_path="${file_param%/*}"
if [[ ! -z ${relative_path} ]]; then
if [[ ! -z ${relative_path} ]] && [[ ${file_param} =~ "/" ]]; then
cd ${relative_path}
file_param=${file_param/$relative_path\//}
fi
+9 -9
View File
@@ -391,16 +391,11 @@ gen_list_repo() {
if [[ $blackword ]]; then
files=$(echo "$files" | egrep -v $blackword)
fi
if [[ $dependence ]]; then
cd ${dir_scripts}
depInScripts=$(eval $cmd | sed 's/^..//' | egrep -v $uniq_path | egrep $dependence)
for dep in ${depInScripts}; do
file_path=$(dirname $dep)
[[ ! $file_path =~ "/" ]] && file_path=""
make_dir "${dir_scripts}/${uniq_path}/${file_path#*/}"
cp -f $dep "${dir_scripts}/${uniq_path}/${file_path#*/}"
done
cp -f $file_notify_js "${dir_scripts}/${uniq_path}"
cp -f $file_notify_py "${dir_scripts}/${uniq_path}"
if [[ $dependence ]]; then
cd ${repo_path}
results=$(eval $cmd | sed 's/^..//' | egrep $dependence)
for _file in ${results}; do
@@ -409,6 +404,11 @@ gen_list_repo() {
cp -f $_file "${dir_scripts}/${uniq_path}/${file_path}"
done
fi
if [[ -d $dir_dep ]]; then
cp $dir_dep/* "${dir_scripts}/${uniq_path}" &>/dev/null
fi
for file in ${files}; do
filename=$(basename $file)
cp -f $file "$dir_scripts/${uniq_path}/${filename}"
+17 -9
View File
@@ -118,13 +118,17 @@ const Env = ({ headerStyle, isPhone, theme }: any) => {
dataIndex: 'value',
key: 'value',
align: 'center' as const,
width: '44%',
width: '35%',
ellipsis: {
showTitle: false,
},
render: (text: string, record: any) => {
return (
<Tooltip placement="topLeft" title={text}>
<Tooltip
placement="topLeft"
title={text}
trigger={['hover', 'click']}
>
<span>{text}</span>
</Tooltip>
);
@@ -141,19 +145,23 @@ const Env = ({ headerStyle, isPhone, theme }: any) => {
dataIndex: 'timestamp',
key: 'timestamp',
align: 'center' as const,
width: 164,
width: 165,
ellipsis: {
showTitle: false,
},
render: (text: string, record: any) => {
const language = navigator.language || navigator.languages[0];
const date = new Date(text)
.toLocaleString(language, {
hour12: false,
})
.replace(' 24:', ' 00:')
.toLocaleString(language, {
hour12: false,
})
.replace(' 24:', ' 00:');
return (
<Tooltip placement="topLeft" title={date}>
<Tooltip
placement="topLeft"
title={date}
trigger={['hover', 'click']}
>
<span>{date}</span>
</Tooltip>
);
@@ -528,7 +536,7 @@ const Env = ({ headerStyle, isPhone, theme }: any) => {
dataSource={value}
rowKey="_id"
size="middle"
scroll={{ x: 768, y: tableScrollHeight }}
scroll={{ x: 1000, y: tableScrollHeight }}
components={components}
loading={loading}
onRow={(record: any, index: number) => {
+7 -4
View File
@@ -16,7 +16,6 @@ function getFilterData(keyword: string, data: any) {
data.forEach((item: any) => {
if (item.title.toLocaleLowerCase().includes(keyword)) {
tree.push(item);
expandedKeys.push(...item.children.map((x: any) => x.key));
} else {
const children: any[] = [];
(item.children || []).forEach((subItem: any) => {
@@ -29,7 +28,7 @@ function getFilterData(keyword: string, data: any) {
...item,
children,
});
expandedKeys.push(...children.map((x) => x.key));
expandedKeys.push(item.key);
}
}
});
@@ -47,6 +46,7 @@ const Log = ({ headerStyle, isPhone, theme }: any) => {
const [loading, setLoading] = useState(false);
const [height, setHeight] = useState<number>();
const treeDom = useRef<any>();
const [expandedKeys, setExpandedKeys] = useState<string[]>([]);
const getLogs = () => {
setLoading(true);
@@ -100,8 +100,12 @@ const Log = ({ headerStyle, isPhone, theme }: any) => {
const onSearch = useCallback(
(e) => {
const keyword = e.target.value;
const { tree } = getFilterData(keyword.toLocaleLowerCase(), data);
const { tree, expandedKeys } = getFilterData(
keyword.toLocaleLowerCase(),
data,
);
setFilterData(tree);
setExpandedKeys(expandedKeys);
},
[data, setFilterData],
);
@@ -127,7 +131,6 @@ const Log = ({ headerStyle, isPhone, theme }: any) => {
treeData={data}
placeholder="请选择日志文件"
showSearch
key="value"
onSelect={onSelect}
/>,
]
+23 -4
View File
@@ -35,16 +35,31 @@ import EditScriptNameModal from './editNameModal';
const { Text } = Typography;
function getFilterData(keyword: string, data: any) {
const expandedKeys: string[] = [];
if (keyword) {
const tree: any = [];
data.forEach((item: any) => {
if (item.title.toLocaleLowerCase().includes(keyword)) {
tree.push(item);
} else {
const children: any[] = [];
(item.children || []).forEach((subItem: any) => {
if (subItem.title.toLocaleLowerCase().includes(keyword)) {
children.push(subItem);
}
});
if (children.length > 0) {
tree.push({
...item,
children,
});
expandedKeys.push(item.key);
}
}
});
return { tree };
return { tree, expandedKeys };
}
return { tree: data };
return { tree: data, expandedKeys };
}
const LangMap: any = {
@@ -70,6 +85,7 @@ const Script = ({ headerStyle, isPhone, theme }: any) => {
const editorRef = useRef<any>(null);
const [isAddFileModalVisible, setIsAddFileModalVisible] = useState(false);
const [currentNode, setCurrentNode] = useState<any>();
const [expandedKeys, setExpandedKeys] = useState<string[]>([]);
const getScripts = () => {
setLoading(true);
@@ -132,7 +148,11 @@ const Script = ({ headerStyle, isPhone, theme }: any) => {
(e) => {
const keyword = e.target.value;
setSearchValue(keyword);
const { tree } = getFilterData(keyword.toLocaleLowerCase(), data);
const { tree, expandedKeys } = getFilterData(
keyword.toLocaleLowerCase(),
data,
);
setExpandedKeys(expandedKeys);
setFilterData(tree);
},
[data, setFilterData],
@@ -323,7 +343,6 @@ const Script = ({ headerStyle, isPhone, theme }: any) => {
treeData={data}
placeholder="请选择脚本文件"
showSearch
key="value"
onSelect={onSelect}
/>,
<Dropdown overlay={menu} trigger={['click']}>
+9 -8
View File
@@ -1,9 +1,10 @@
export const version = '2.10.6';
export const changeLogLink = 'https://t.me/jiao_long/225';
export const changeLog = `2.10.6 版本说明
1. 增加各版本自动打包workflow,感谢 https://github.com/fzls PR
2. 环境变量添加更新时间,感谢 https://github.com/miniers PR
3. 修复脚本管理结构
4. 修复定时匹配规则
5. 修复检查更新
export const version = '2.10.7';
export const changeLogLink = 'https://t.me/jiao_long/226';
export const changeLog = `2.10.7 版本说明
1. repo命令默认给仓库添加sendNotify依赖
2. 增加 /ql/deps 目录,此目录下的依赖文件会覆盖系统默认和仓库内的依赖文件
3. 修复脚本管理列表及搜索
4. 修复环境变量手机端列表样式
5. 修复秒级定时任务服务
6. 修复bot启动命令
`;