From 67d8680a329bfa3fc031331bf376b97ce3dd4b0c Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 15 Oct 2023 15:11:23 -0400 Subject: [PATCH] Remove empty tab groups in UI (#948) * Remove empty tab groups * Chain list comprehension * Further condense * add comment --------- Co-authored-by: Sriman Achanta <68172138+srimanachanta@users.noreply.github.com> --- .../components/dashboard/ConfigOptions.vue | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/photon-client/src/components/dashboard/ConfigOptions.vue b/photon-client/src/components/dashboard/ConfigOptions.vue index 33a17ebe14..6ed0156f9f 100644 --- a/photon-client/src/components/dashboard/ConfigOptions.vue +++ b/photon-client/src/components/dashboard/ConfigOptions.vue @@ -104,17 +104,19 @@ const tabGroups = computed(() => { const isAprilTag = useCameraSettingsStore().currentWebsocketPipelineType === WebsocketPipelineType.AprilTag; const isAruco = useCameraSettingsStore().currentWebsocketPipelineType === WebsocketPipelineType.Aruco; - return getTabGroups().map((tabGroup) => - tabGroup.filter( - (tabConfig) => - !(!allow3d && tabConfig.tabName === "3D") && //Filter out 3D tab any time 3D isn't calibrated - !((!allow3d || isAprilTag || isAruco) && tabConfig.tabName === "PnP") && //Filter out the PnP config tab if 3D isn't available, or we're doing AprilTags - !((isAprilTag || isAruco) && tabConfig.tabName === "Threshold") && //Filter out threshold tab if we're doing AprilTags - !((isAprilTag || isAruco) && tabConfig.tabName === "Contours") && //Filter out contours if we're doing AprilTags - !(!isAprilTag && tabConfig.tabName === "AprilTag") && //Filter out apriltag unless we actually are doing AprilTags - !(!isAruco && tabConfig.tabName === "Aruco") //Filter out aruco unless we actually are doing Aruco + return getTabGroups() + .map((tabGroup) => + tabGroup.filter( + (tabConfig) => + !(!allow3d && tabConfig.tabName === "3D") && //Filter out 3D tab any time 3D isn't calibrated + !((!allow3d || isAprilTag || isAruco) && tabConfig.tabName === "PnP") && //Filter out the PnP config tab if 3D isn't available, or we're doing AprilTags + !((isAprilTag || isAruco) && tabConfig.tabName === "Threshold") && //Filter out threshold tab if we're doing AprilTags + !((isAprilTag || isAruco) && tabConfig.tabName === "Contours") && //Filter out contours if we're doing AprilTags + !(!isAprilTag && tabConfig.tabName === "AprilTag") && //Filter out apriltag unless we actually are doing AprilTags + !(!isAruco && tabConfig.tabName === "Aruco") //Filter out aruco unless we actually are doing Aruco + ) ) - ); + .filter((it) => it.length); // Remove empty tab groups }); onBeforeUpdate(() => {