-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Milvus-doc-bot
authored and
Milvus-doc-bot
committed
Nov 26, 2024
1 parent
15b5c24
commit 9b14603
Showing
113 changed files
with
18,758 additions
and
13,992 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
const fs = require('fs'); | ||
const { | ||
join | ||
} = require('path'); | ||
|
||
const formatMenuStructure = list => { | ||
const newList = list.map(v => { | ||
const { | ||
id, | ||
title, | ||
isMenu = false, | ||
outLink = '', | ||
order = 0, | ||
label1, | ||
label2, | ||
label3, | ||
} = v; | ||
|
||
const parentId = label3 || label2 || label1 || ''; | ||
const parentIds = [label1, label2, label3].filter(v => !!v); | ||
const level = [label1, label2, label3].filter(v => !!v).length + 1; | ||
|
||
const baseInfo = { | ||
id: id, | ||
label: title, | ||
} | ||
|
||
if (isMenu) { | ||
baseInfo.isMenu = true; | ||
} | ||
|
||
if (outLink) { | ||
baseInfo.externalLink = outLink; | ||
} | ||
|
||
return { | ||
...baseInfo, | ||
parentId, | ||
parentIds, | ||
level, | ||
order, | ||
children: [], | ||
}; | ||
}); | ||
|
||
newList.sort((x, y) => y.level - x.level); | ||
|
||
const resultList = newList.slice(); | ||
|
||
newList.forEach(v => { | ||
const { | ||
parentId | ||
} = v; | ||
const parentIndex = resultList.findIndex(v => v.id === parentId); | ||
if (parentIndex !== -1) { | ||
|
||
let childInfo = { | ||
label: v.label, | ||
id: v.id, | ||
|
||
// href: v.href, | ||
// parentId: parentId, | ||
// parentIds: v.parentIds, | ||
// level: v.level, | ||
order: v.order, | ||
|
||
} | ||
|
||
if(v.isMenu){ | ||
childInfo.isMenu = true; | ||
} | ||
|
||
if(v.externalLink){ | ||
childInfo.externalLink = v.externalLink | ||
} | ||
|
||
childInfo.children = v.children; | ||
|
||
resultList[parentIndex].children.push(childInfo); | ||
} | ||
}); | ||
|
||
return resultList.filter(v => v.level === 1).map(v => ({ | ||
label: v.label, | ||
id: v.id, | ||
isMenu: v.isMenu, | ||
externalLink: v.externalLink, | ||
// href: v.href, | ||
// parentId: parentId, | ||
// parentIds: v.parentIds, | ||
// level: v.level, | ||
order: v.order, | ||
children: v.children, | ||
})); | ||
}; | ||
|
||
const formatMenu = () => { | ||
|
||
|
||
const menuPath = join(__dirname, 'site/en/menuStructure/en.json') | ||
|
||
const menu = fs.readFileSync(menuPath, 'utf-8'); | ||
const newMenuStructure = formatMenuStructure(JSON.parse(menu).menuList); | ||
|
||
fs.writeFileSync(menuPath, JSON.stringify(newMenuStructure)); | ||
}; | ||
formatMenu(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.