Fix nesting with unsorted groups (#4711)

This commit is contained in:
shamoon 2025-02-04 20:45:39 -08:00 committed by GitHub
parent 873c265205
commit cc6fe63d40
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 5 deletions

View File

@ -175,6 +175,9 @@ export async function servicesResponse() {
// this is a nested group, so find the parent group and merge the services // this is a nested group, so find the parent group and merge the services
mergeSubgroups(configuredServices, mergedGroup); mergeSubgroups(configuredServices, mergedGroup);
} else unsortedGroups.push(mergedGroup); } else unsortedGroups.push(mergedGroup);
} else if (configuredGroup.parent) {
// this is a nested group, so find the parent group and merge the services
mergeSubgroups(configuredServices, mergedGroup);
} else { } else {
unsortedGroups.push(mergedGroup); unsortedGroups.push(mergedGroup);
} }

View File

@ -214,7 +214,7 @@ export async function servicesFromKubernetes() {
.then((response) => response.body) .then((response) => response.body)
.catch((error) => { .catch((error) => {
logger.error("Error getting ingresses: %d %s %s", error.statusCode, error.body, error.response); logger.error("Error getting ingresses: %d %s %s", error.statusCode, error.body, error.response);
logger.debug(error); if (error) logger.debug(error);
return null; return null;
}); });
@ -232,7 +232,7 @@ export async function servicesFromKubernetes() {
error.body, error.body,
error.response, error.response,
); );
logger.debug(error); if (error) logger.debug(error);
} }
return []; return [];
@ -249,7 +249,7 @@ export async function servicesFromKubernetes() {
error.body, error.body,
error.response, error.response,
); );
logger.debug(error); if (error) logger.debug(error);
} }
return []; return [];
@ -319,7 +319,7 @@ export async function servicesFromKubernetes() {
constructedService = JSON.parse(substituteEnvironmentVars(JSON.stringify(constructedService))); constructedService = JSON.parse(substituteEnvironmentVars(JSON.stringify(constructedService)));
} catch (e) { } catch (e) {
logger.error("Error attempting k8s environment variable substitution."); logger.error("Error attempting k8s environment variable substitution.");
logger.debug(e); if (e) logger.debug(e);
} }
return constructedService; return constructedService;
@ -703,7 +703,7 @@ export function findGroupByName(groups, name) {
} else if (group.groups) { } else if (group.groups) {
const foundGroup = findGroupByName(group.groups, name); const foundGroup = findGroupByName(group.groups, name);
if (foundGroup) { if (foundGroup) {
foundGroup.parent = group; foundGroup.parent = group.name;
return foundGroup; return foundGroup;
} }
} }