mirror of
https://github.com/whyour/qinglong.git
synced 2026-12-01 01:39:52 +08:00
日志管理支持删除日志文件和目录
This commit is contained in:
1 parent
25b03d4345
commit
dfc706e16d
6 files changed
+136
-27
No files matched your search
+6
-1
@@ -244,7 +244,7 @@ export function exportJson(name: string, data: string) {
|
||||
|
||||
export function depthFirstSearch<
|
||||
T extends Record<string, any> & { children?: T[] },
|
||||
>(children: T[], condition: (column: T) => boolean, item: T) {
|
||||
>(children: T[], condition: (column: T) => boolean, item?: T) {
|
||||
const c = [...children];
|
||||
const keys = [];
|
||||
|
||||
@@ -252,6 +252,11 @@ export function depthFirstSearch<
|
||||
if (!cls) return;
|
||||
for (let i = 0; i < cls?.length; i++) {
|
||||
if (condition(cls[i])) {
|
||||
if (!item) {
|
||||
cls.splice(i, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
if (cls[i].children) {
|
||||
cls[i].children!.unshift(item);
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user