mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-16 15:12:26 +00:00
[improvement][project] supersonic 0.6.0 version update (#16)
Co-authored-by: lexluo <lexluo@tencent.com>
This commit is contained in:
@@ -329,8 +329,8 @@ export const getFormattedValueData = (value: number | string, remainZero?: boole
|
||||
value >= 100000000
|
||||
? NumericUnit.OneHundredMillion
|
||||
: value >= 10000
|
||||
? NumericUnit.EnTenThousand
|
||||
: NumericUnit.None;
|
||||
? NumericUnit.EnTenThousand
|
||||
: NumericUnit.None;
|
||||
|
||||
let formattedValue = formatByUnit(value, unit);
|
||||
formattedValue = formatByDecimalPlaces(
|
||||
@@ -388,3 +388,37 @@ export function getLeafList(flatNodes: any[]): any[] {
|
||||
const leafNodes = getLeafNodes(treeNodes);
|
||||
return leafNodes;
|
||||
}
|
||||
|
||||
export function traverseRoutes(routes, env: string, result: any[] = []) {
|
||||
if (!Array.isArray(routes)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
for (let i = 0; i < routes.length; i++) {
|
||||
const route = routes[i];
|
||||
|
||||
if (
|
||||
(route.envEnableList &&
|
||||
(route.envEnableList.includes(env) || route.envEnableList.length === 0)) ||
|
||||
!route.envEnableList
|
||||
) {
|
||||
result.push(route);
|
||||
}
|
||||
|
||||
if (route.envRedirect) {
|
||||
route.redirect = route.envRedirect[env];
|
||||
}
|
||||
|
||||
if (route.routes) {
|
||||
const filteredRoutes = traverseRoutes(route.routes, env);
|
||||
|
||||
if (Array.isArray(filteredRoutes) && filteredRoutes.length > 0) {
|
||||
result.push({
|
||||
...route,
|
||||
routes: filteredRoutes,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user