github.com/turbot/steampipe@v1.7.0-rc.0.0.20240517123944-7cef272d4458/ui/dashboard/src/components/dashboards/inputs/Input/index.tsx (about) 1 import ErrorPanel from "../../Error"; 2 import { getInputComponent } from "../index"; 3 import { InputProperties } from "../types"; 4 import { PanelDefinition } from "../../../../types"; 5 import { registerComponent } from "../../index"; 6 7 export type InputDefinition = PanelDefinition & { 8 properties: InputProperties; 9 }; 10 11 const renderInput = (definition: InputDefinition) => { 12 const { 13 display_type = "select", 14 properties: { unqualified_name: name }, 15 } = definition; 16 const input = getInputComponent(display_type); 17 18 if (!input) { 19 return <ErrorPanel error={`Unknown input type ${display_type}`} />; 20 } 21 22 const Component = input.component; 23 return <Component {...definition} name={name} />; 24 }; 25 26 const RenderInput = (props: InputDefinition) => { 27 return renderInput(props); 28 }; 29 30 registerComponent("input", RenderInput);