Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
Falcon
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Walter Huang
Falcon
Commits
61f9cd7d
Commit
61f9cd7d
authored
Jun 27, 2025
by
Lin Wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: increase the section count field
parent
1dd3947a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
6 deletions
+32
-6
diffNavWithDeepDiff.ts
src/detect_section_selector_masters/diffNavWithDeepDiff.ts
+20
-2
handlePageContent.ts
src/detect_section_selector_masters/handlePageContent.ts
+10
-2
helper.ts
src/detect_section_selector_masters/helper.ts
+2
-2
No files found.
src/detect_section_selector_masters/diffNavWithDeepDiff.ts
View file @
61f9cd7d
...
@@ -24,7 +24,7 @@ const baselinePath = join(srcDir, baselineFile);
...
@@ -24,7 +24,7 @@ const baselinePath = join(srcDir, baselineFile);
const
baselineData
=
JSON
.
parse
(
readFileSync
(
baselinePath
,
'utf-8'
));
const
baselineData
=
JSON
.
parse
(
readFileSync
(
baselinePath
,
'utf-8'
));
// Fields to ignore during diff
// Fields to ignore during diff
const
ignoreFields
=
[
'category'
];
const
ignoreFields
=
[
'category'
,
'subcategory'
,
'id'
,
];
// Get all nav files excluding baseline
// Get all nav files excluding baseline
const
allFiles
=
readdirSync
(
srcDir
).
filter
(
f
=>
f
.
endsWith
(
'_extractNav.json'
)
&&
f
!==
baselineFile
);
const
allFiles
=
readdirSync
(
srcDir
).
filter
(
f
=>
f
.
endsWith
(
'_extractNav.json'
)
&&
f
!==
baselineFile
);
...
@@ -59,12 +59,24 @@ allFiles.forEach(file => {
...
@@ -59,12 +59,24 @@ allFiles.forEach(file => {
// Include category context for troubleshooting
// Include category context for troubleshooting
let
categoryA
:
any
=
'Not Applicable'
;
let
categoryA
:
any
=
'Not Applicable'
;
let
categoryB
:
any
=
'Not Applicable'
;
let
categoryB
:
any
=
'Not Applicable'
;
let
subcategoryA
:
any
=
'Not Applicable'
;
let
subcategoryB
:
any
=
'Not Applicable'
;
let
idA
:
any
=
'Not Applicable'
;
let
idB
:
any
=
'Not Applicable'
;
let
typeA
:
any
=
'Not Applicable'
;
let
typeB
:
any
=
'Not Applicable'
;
if
(
change
.
path
&&
change
.
path
[
0
]
!==
undefined
&&
typeof
change
.
path
[
0
]
===
'number'
)
{
if
(
change
.
path
&&
change
.
path
[
0
]
!==
undefined
&&
typeof
change
.
path
[
0
]
===
'number'
)
{
const
idx
=
change
.
path
[
0
]
as
number
;
const
idx
=
change
.
path
[
0
]
as
number
;
const
entryA
=
baselineData
[
idx
]
||
{};
const
entryA
=
baselineData
[
idx
]
||
{};
const
entryB
=
otherData
[
idx
]
||
{};
const
entryB
=
otherData
[
idx
]
||
{};
categoryA
=
entryA
.
category
||
'Not Applicable'
;
categoryA
=
entryA
.
category
||
'Not Applicable'
;
categoryB
=
entryB
.
category
||
'Not Applicable'
;
categoryB
=
entryB
.
category
||
'Not Applicable'
;
subcategoryA
=
entryA
.
subcategory
||
'Not Applicable'
;
subcategoryB
=
entryB
.
subcategory
||
'Not Applicable'
;
idA
=
entryA
.
id
||
'Not Applicable'
;
idB
=
entryB
.
id
||
'Not Applicable'
;
typeA
=
entryA
.
type
||
'Not Applicable'
;
typeB
=
entryB
.
type
||
'Not Applicable'
;
}
}
return
{
return
{
[
`更改类型:
${
selectedLanguages
[
diffBaselineId
]}
vs
${
selectedLanguages
[
otherId
]}
`
]:
type
,
[
`更改类型:
${
selectedLanguages
[
diffBaselineId
]}
vs
${
selectedLanguages
[
otherId
]}
`
]:
type
,
...
@@ -72,7 +84,13 @@ allFiles.forEach(file => {
...
@@ -72,7 +84,13 @@ allFiles.forEach(file => {
[
`模版值:
${
selectedLanguages
[
diffBaselineId
]}
`
]:
oldV
||
'Not Applicable'
,
[
`模版值:
${
selectedLanguages
[
diffBaselineId
]}
`
]:
oldV
||
'Not Applicable'
,
[
`模版值:
${
selectedLanguages
[
otherId
]}
`
]:
newV
||
'Not Applicable'
,
[
`模版值:
${
selectedLanguages
[
otherId
]}
`
]:
newV
||
'Not Applicable'
,
[
`category:
${
selectedLanguages
[
diffBaselineId
]}
`
]:
categoryA
,
[
`category:
${
selectedLanguages
[
diffBaselineId
]}
`
]:
categoryA
,
[
`category:
${
selectedLanguages
[
otherId
]}
`
]:
categoryB
[
`category:
${
selectedLanguages
[
otherId
]}
`
]:
categoryB
,
[
`subcategory:
${
selectedLanguages
[
diffBaselineId
]}
`
]:
subcategoryA
,
[
`subcategory:
${
selectedLanguages
[
otherId
]}
`
]:
subcategoryB
,
[
`type:
${
selectedLanguages
[
diffBaselineId
]}
`
]:
typeA
,
[
`type:
${
selectedLanguages
[
otherId
]}
`
]:
typeB
,
[
`id:
${
selectedLanguages
[
diffBaselineId
]}
`
]:
idA
,
[
`id:
${
selectedLanguages
[
otherId
]}
`
]:
idB
,
};
};
});
});
...
...
src/detect_section_selector_masters/handlePageContent.ts
View file @
61f9cd7d
...
@@ -544,7 +544,7 @@ export function mainParse(jsonData) {
...
@@ -544,7 +544,7 @@ export function mainParse(jsonData) {
const
themePreColors
=
jsonData
.
customColors
?.
themePreColors
||
[];
const
themePreColors
=
jsonData
.
customColors
?.
themePreColors
||
[];
const
result
=
[];
const
result
=
[];
// 生成导航信息
// 生成导航信息
cons
t
navigationInfo
=
getNavigationInfo
(
jsonData
.
navigation
.
items
);
le
t
navigationInfo
=
getNavigationInfo
(
jsonData
.
navigation
.
items
);
const
navLinks
=
jsonData
.
navigation
.
items
.
reduce
((
pre
,
cur
)
=>
{
const
navLinks
=
jsonData
.
navigation
.
items
.
reduce
((
pre
,
cur
)
=>
{
if
(
cur
.
items
)
{
if
(
cur
.
items
)
{
...
@@ -562,10 +562,18 @@ export function mainParse(jsonData) {
...
@@ -562,10 +562,18 @@ export function mainParse(jsonData) {
// 遍历 pages 数组,并将 category 合并到 page 对象中
// 遍历 pages 数组,并将 category 合并到 page 对象中
const
pages
=
navLinks
.
flatMap
((
item
)
=>
{
const
pages
=
navLinks
.
flatMap
((
item
)
=>
{
const
page
=
jsonData
.
pages
.
find
((
page
)
=>
page
.
uid
===
item
.
id
);
const
page
=
jsonData
.
pages
.
find
((
page
)
=>
page
.
uid
===
item
.
id
);
// 如果找到对应页面,则附加 category 字段并返回,否则跳过
return
page
?
[{
...
page
,
category
:
item
.
category
}]
:
[];
return
page
?
[{
...
page
,
category
:
item
.
category
}]
:
[];
})
})
// add sections count to navigationInfo based on pages
navigationInfo
.
forEach
(
entry
=>
{
if
(
entry
.
type
===
'page'
)
{
const
pageObj
=
pages
.
find
(
p
=>
p
.
uid
?.
toString
()
===
entry
.
id
?.
toString
());
entry
.
subcategory
=
pageObj
?.
title
||
''
;
entry
.
sections_count
=
pageObj
?.
sections
?.
length
||
0
;
}
});
if
(
Array
.
isArray
(
pages
))
{
if
(
Array
.
isArray
(
pages
))
{
pages
.
forEach
((
page
,
pageIndex
)
=>
{
pages
.
forEach
((
page
,
pageIndex
)
=>
{
// 遍历 sections 数组
// 遍历 sections 数组
...
...
src/detect_section_selector_masters/helper.ts
View file @
61f9cd7d
...
@@ -14,8 +14,8 @@ export const getNavigationInfo = (items, pathArr: string[] = []) => {
...
@@ -14,8 +14,8 @@ export const getNavigationInfo = (items, pathArr: string[] = []) => {
navigationResult
.
push
({
navigationResult
.
push
({
patch
:
currentPathArr
.
join
(
"."
),
patch
:
currentPathArr
.
join
(
"."
),
type
:
type
,
type
:
type
,
category
,
id
:
item
.
id
||
null
,
dropdown_count
:
itemsCount
,
...(
type
===
"dropdown"
?
{
dropdown_count
:
itemsCount
,
category
}
:
{})
,
});
});
// 递归处理 dropdown
// 递归处理 dropdown
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment