From 1296982e67fb43f1d01f6d822b105eab59670750 Mon Sep 17 00:00:00 2001 From: Matthew Morley Date: Sun, 15 Oct 2023 09:13:15 -0400 Subject: [PATCH 1/4] Remove empty tab groups --- photon-client/src/components/dashboard/ConfigOptions.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/photon-client/src/components/dashboard/ConfigOptions.vue b/photon-client/src/components/dashboard/ConfigOptions.vue index 33a17ebe14..815a2cdc0e 100644 --- a/photon-client/src/components/dashboard/ConfigOptions.vue +++ b/photon-client/src/components/dashboard/ConfigOptions.vue @@ -104,7 +104,7 @@ const tabGroups = computed(() => { const isAprilTag = useCameraSettingsStore().currentWebsocketPipelineType === WebsocketPipelineType.AprilTag; const isAruco = useCameraSettingsStore().currentWebsocketPipelineType === WebsocketPipelineType.Aruco; - return getTabGroups().map((tabGroup) => + var ret = getTabGroups().map((tabGroup) => tabGroup.filter( (tabConfig) => !(!allow3d && tabConfig.tabName === "3D") && //Filter out 3D tab any time 3D isn't calibrated @@ -115,6 +115,9 @@ const tabGroups = computed(() => { !(!isAruco && tabConfig.tabName === "Aruco") //Filter out aruco unless we actually are doing Aruco ) ); + // remove empty tab groups + ret = ret.filter((it) => it.length); + return ret; }); onBeforeUpdate(() => { From 3ebad51f7dc236029690a1bcc7b53750cb6f2c0f Mon Sep 17 00:00:00 2001 From: Matthew Morley Date: Sun, 15 Oct 2023 12:52:31 -0400 Subject: [PATCH 2/4] Chain list comprehension --- .../components/dashboard/ConfigOptions.vue | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/photon-client/src/components/dashboard/ConfigOptions.vue b/photon-client/src/components/dashboard/ConfigOptions.vue index 815a2cdc0e..8063149b88 100644 --- a/photon-client/src/components/dashboard/ConfigOptions.vue +++ b/photon-client/src/components/dashboard/ConfigOptions.vue @@ -104,19 +104,19 @@ const tabGroups = computed(() => { const isAprilTag = useCameraSettingsStore().currentWebsocketPipelineType === WebsocketPipelineType.AprilTag; const isAruco = useCameraSettingsStore().currentWebsocketPipelineType === WebsocketPipelineType.Aruco; - var ret = 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 + var ret = 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 + ) ) - ); - // remove empty tab groups - ret = ret.filter((it) => it.length); + .filter((it) => it.length); return ret; }); From a7919ade41cebddb2a54949b9e6923449b53b8a7 Mon Sep 17 00:00:00 2001 From: Matthew Morley Date: Sun, 15 Oct 2023 14:55:04 -0400 Subject: [PATCH 3/4] Further condense --- photon-client/src/components/dashboard/ConfigOptions.vue | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/photon-client/src/components/dashboard/ConfigOptions.vue b/photon-client/src/components/dashboard/ConfigOptions.vue index 8063149b88..fb808a24e9 100644 --- a/photon-client/src/components/dashboard/ConfigOptions.vue +++ b/photon-client/src/components/dashboard/ConfigOptions.vue @@ -104,7 +104,7 @@ const tabGroups = computed(() => { const isAprilTag = useCameraSettingsStore().currentWebsocketPipelineType === WebsocketPipelineType.AprilTag; const isAruco = useCameraSettingsStore().currentWebsocketPipelineType === WebsocketPipelineType.Aruco; - var ret = getTabGroups() + return getTabGroups() .map((tabGroup) => tabGroup.filter( (tabConfig) => @@ -117,7 +117,6 @@ const tabGroups = computed(() => { ) ) .filter((it) => it.length); - return ret; }); onBeforeUpdate(() => { From 18634192997d51c24ebf310594a76e7b6e4d3334 Mon Sep 17 00:00:00 2001 From: Sriman Achanta <68172138+srimanachanta@users.noreply.github.com> Date: Sun, 15 Oct 2023 15:01:20 -0400 Subject: [PATCH 4/4] add comment --- photon-client/src/components/dashboard/ConfigOptions.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/photon-client/src/components/dashboard/ConfigOptions.vue b/photon-client/src/components/dashboard/ConfigOptions.vue index fb808a24e9..6ed0156f9f 100644 --- a/photon-client/src/components/dashboard/ConfigOptions.vue +++ b/photon-client/src/components/dashboard/ConfigOptions.vue @@ -116,7 +116,7 @@ const tabGroups = computed(() => { !(!isAruco && tabConfig.tabName === "Aruco") //Filter out aruco unless we actually are doing Aruco ) ) - .filter((it) => it.length); + .filter((it) => it.length); // Remove empty tab groups }); onBeforeUpdate(() => {