Move dashboard UI select option types to input types and re-use for combo select option #3244.

This commit is contained in:
Mike Burgess
2023-03-17 13:28:50 +00:00
parent 2035ac3859
commit 4a00befd65
5 changed files with 10 additions and 17 deletions

View File

@@ -2,7 +2,7 @@ import CreatableSelect from "react-select/creatable";
import useSelectInputStyles from "../common/useSelectInputStyles";
import useSelectInputValues from "../common/useSelectInputValues";
import { DashboardActions, DashboardDataModeLive } from "../../../../types";
import { InputProps } from "../types";
import { InputProps, SelectOption } from "../types";
import {
MultiValueLabelWithTags,
OptionWithTags,
@@ -11,11 +11,6 @@ import {
import { useDashboard } from "../../../../hooks/useDashboard";
import { useEffect, useState } from "react";
export type SelectOption = {
label: string;
value: string;
};
type SelectInputProps = InputProps & {
multi?: boolean;
name: string;

View File

@@ -2,7 +2,7 @@ import Select from "react-select";
import useSelectInputStyles from "../common/useSelectInputStyles";
import useSelectInputValues from "../common/useSelectInputValues";
import { DashboardActions, DashboardDataModeLive } from "../../../../types";
import { InputProps } from "../types";
import { InputProps, SelectOption } from "../types";
import {
MultiValueLabelWithTags,
OptionWithTags,
@@ -11,12 +11,6 @@ import {
import { useDashboard } from "../../../../hooks/useDashboard";
import { useEffect, useState } from "react";
export type SelectOption = {
label: string;
value: string | null;
tags?: object;
};
type SelectInputProps = InputProps & {
multi?: boolean;
name: string;

View File

@@ -2,8 +2,7 @@ import useSelectInputValues from "./useSelectInputValues";
import { DashboardRunState } from "../../../../types";
import { LeafNodeData } from "../../common";
import { renderHook } from "@testing-library/react";
import { SelectInputOption } from "../types";
import { SelectOption } from "../SelectInput";
import { SelectInputOption, SelectOption } from "../types";
const options = [
{

View File

@@ -1,8 +1,7 @@
import { DashboardRunState } from "../../../../types";
import { getColumn } from "../../../../utils/data";
import { LeafNodeData } from "../../common";
import { SelectInputOption } from "../types";
import { SelectOption } from "../SelectInput";
import { SelectInputOption, SelectOption } from "../types";
import { useMemo } from "react";
const useSelectInputValues = (

View File

@@ -6,6 +6,12 @@ export type BaseInputProps = PanelDefinition &
BasePrimitiveProps &
ExecutablePrimitiveProps;
export type SelectOption = {
label: string;
value: string | null;
tags?: object;
};
export type SelectInputOption = {
name: string;
label?: string;