From 5108ccb78fae22ebac57207a8ccca73e2f22e298 Mon Sep 17 00:00:00 2001 From: Ethan Look-Potts Date: Mon, 15 Jul 2024 12:08:00 -0400 Subject: [PATCH] APP-5484: add props to disable cards for subtypes (#4194) --- .../components/remote-control-cards.svelte | 202 +++++++++++------- web/frontend/src/main-lib.ts | 3 + 2 files changed, 127 insertions(+), 78 deletions(-) diff --git a/web/frontend/src/components/remote-control-cards.svelte b/web/frontend/src/components/remote-control-cards.svelte index 7c938b24fbb..796be8094ef 100644 --- a/web/frontend/src/components/remote-control-cards.svelte +++ b/web/frontend/src/components/remote-control-cards.svelte @@ -40,6 +40,12 @@ export let supportedAuthTypes: string[] | undefined = []; export let webrtcEnabled: boolean; export let signalingAddress: string; export let overrides: RCOverrides | undefined = undefined; +/* Used in the control tab project to incrementally deliver and conditionally disable showing API subtypes. */ +export let hiddenSubtypes: string[] = []; +export let hideDoCommand = false; +export let hideOperationsSessions = false; + +$: hidden = new Set(hiddenSubtypes); const resourceStatusByName = (resource: commonApi.ResourceName.AsObject) => { return $statuses[resourceNameToString(resource)]; @@ -102,123 +108,163 @@ const getStatus = (
- {#each filterSubtype($components, 'base') as { name } (name)} - - {/each} + {#if !hidden.has('base')} + {#each filterSubtype($components, 'base') as { name } (name)} + + {/each} + {/if} - {#each filterSubtype($services, 'slam') as { name } (name)} - - {/each} + {#if !hidden.has('slam')} + {#each filterSubtype($services, 'slam') as { name } (name)} + + {/each} + {/if} - {#each filterSubtype($components, 'encoder') as { name } (name)} - - {/each} + {#if !hidden.has('encoder')} + {#each filterSubtype($components, 'encoder') as { name } (name)} + + {/each} + {/if} - {#each filterWithStatus($components, $statuses, 'gantry') as gantry (gantry.name)} - - {/each} + {#if !hidden.has('gantry')} + {#each filterWithStatus($components, $statuses, 'gantry') as gantry (gantry.name)} + + {/each} + {/if} - {#each filterSubtype($components, 'movement_sensor') as { name } (name)} - - {/each} + {#if !hidden.has('movement_sensor')} + {#each filterSubtype($components, 'movement_sensor') as { name } (name)} + + {/each} + {/if} - {#each filterSubtype($components, 'power_sensor') as { name } (name)} - - {/each} + {#if !hidden.has('power_sensor')} + {#each filterSubtype($components, 'power_sensor') as { name } (name)} + + {/each} + {/if} - {#each filterSubtype($components, 'arm') as arm (arm.name)} - - {/each} + {#if !hidden.has('arm')} + {#each filterSubtype($components, 'arm') as arm (arm.name)} + + {/each} + {/if} - {#each filterSubtype($components, 'gripper') as { name } (name)} - - {/each} + {#if !hidden.has('gripper')} + {#each filterSubtype($components, 'gripper') as { name } (name)} + + {/each} + {/if} - {#each filterWithStatus($components, $statuses, 'servo') as servo (servo.name)} - - {/each} + {#if !hidden.has('servo')} + {#each filterWithStatus($components, $statuses, 'servo') as servo (servo.name)} + + {/each} + {/if} - {#each filterWithStatus($components, $statuses, 'motor') as motor (motor.name)} - - {/each} + {#if !hidden.has('motor')} + {#each filterWithStatus($components, $statuses, 'motor') as motor (motor.name)} + + {/each} + {/if} - {#each filteredInputControllerList as controller (controller.name)} - - {/each} + {#if !hidden.has('input_controller')} + {#each filteredInputControllerList as controller (controller.name)} + + {/each} + {/if} - {#each filteredWebGamepads as { name } (name)} - - {/each} + {#if !hidden.has('input_controller')} + {#each filteredWebGamepads as { name } (name)} + + {/each} + {/if} - {#each filterWithStatus($components, $statuses, 'board') as board (board.name)} - - {/each} + {#if !hidden.has('board')} + {#each filterWithStatus($components, $statuses, 'board') as board (board.name)} + + {/each} + {/if} - + {#if !hidden.has('camera')} + + {/if} - {#each filterSubtype($services, 'navigation') as { name } (name)} - - {/each} + {#if !hidden.has('navigation')} + {#each filterSubtype($services, 'navigation') as { name } (name)} + + {/each} + {/if} - {#if Object.keys($sensorNames).length > 0} - + {#if !hidden.has('sensors')} + {#if Object.keys($sensorNames).length > 0} + + {/if} {/if} - {#each filterSubtype($components, 'audio_input') as { name } (name)} - - {/each} + {#if !hidden.has('audio_input')} + {#each filterSubtype($components, 'audio_input') as { name } (name)} + + {/each} + {/if} - {#if filterSubtype($services, 'vision').length > 0} - v.name)} /> + {#if !hidden.has('vision')} + {#if filterSubtype($services, 'vision').length > 0} + v.name)} /> + {/if} {/if} - + {#if !hideDoCommand} + + {/if} - + {#if !hideOperationsSessions} + + {/if}
diff --git a/web/frontend/src/main-lib.ts b/web/frontend/src/main-lib.ts index 8acbc304e37..419379fb4bf 100644 --- a/web/frontend/src/main-lib.ts +++ b/web/frontend/src/main-lib.ts @@ -12,5 +12,8 @@ export const createRcApp = ( webrtcEnabled: boolean; signalingAddress: string; overrides?: RCOverrides; + hiddenSubtypes?: string[]; + hideDoCommand?: boolean; + hideOperationsSessions?: boolean; } ) => new RemoteControlCards({ target, props });