mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-04-21 00:40:01 +02:00
updates addNotification type hints in components
This commit is contained in:
parent
914997cc6b
commit
613b1dd6a4
@ -3,6 +3,7 @@ import { runMethod } from '../socket';
|
|||||||
import { InputGroup, Form, Button } from 'react-bootstrap';
|
import { InputGroup, Form, Button } from 'react-bootstrap';
|
||||||
import { DocStringComponent } from './DocStringComponent';
|
import { DocStringComponent } from './DocStringComponent';
|
||||||
import { getIdFromFullAccessPath } from '../utils/stringUtils';
|
import { getIdFromFullAccessPath } from '../utils/stringUtils';
|
||||||
|
import { LevelName } from './NotificationsComponent';
|
||||||
|
|
||||||
interface AsyncMethodProps {
|
interface AsyncMethodProps {
|
||||||
name: string;
|
name: string;
|
||||||
@ -11,7 +12,7 @@ interface AsyncMethodProps {
|
|||||||
value: Record<string, string>;
|
value: Record<string, string>;
|
||||||
docString?: string;
|
docString?: string;
|
||||||
hideOutput?: boolean;
|
hideOutput?: boolean;
|
||||||
addNotification: (message: string) => void;
|
addNotification: (message: string, levelname?: LevelName) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const AsyncMethodComponent = React.memo((props: AsyncMethodProps) => {
|
export const AsyncMethodComponent = React.memo((props: AsyncMethodProps) => {
|
||||||
|
@ -3,6 +3,7 @@ import { ToggleButton } from 'react-bootstrap';
|
|||||||
import { setAttribute } from '../socket';
|
import { setAttribute } from '../socket';
|
||||||
import { DocStringComponent } from './DocStringComponent';
|
import { DocStringComponent } from './DocStringComponent';
|
||||||
import { getIdFromFullAccessPath } from '../utils/stringUtils';
|
import { getIdFromFullAccessPath } from '../utils/stringUtils';
|
||||||
|
import { LevelName } from './NotificationsComponent';
|
||||||
|
|
||||||
interface ButtonComponentProps {
|
interface ButtonComponentProps {
|
||||||
name: string;
|
name: string;
|
||||||
@ -11,7 +12,7 @@ interface ButtonComponentProps {
|
|||||||
readOnly: boolean;
|
readOnly: boolean;
|
||||||
docString: string;
|
docString: string;
|
||||||
mapping?: [string, string]; // Enforce a tuple of two strings
|
mapping?: [string, string]; // Enforce a tuple of two strings
|
||||||
addNotification: (message: string) => void;
|
addNotification: (message: string, levelname?: LevelName) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ButtonComponent = React.memo((props: ButtonComponentProps) => {
|
export const ButtonComponent = React.memo((props: ButtonComponentProps) => {
|
||||||
|
@ -3,6 +3,7 @@ import { InputGroup, Form, Row, Col } from 'react-bootstrap';
|
|||||||
import { setAttribute } from '../socket';
|
import { setAttribute } from '../socket';
|
||||||
import { DocStringComponent } from './DocStringComponent';
|
import { DocStringComponent } from './DocStringComponent';
|
||||||
import { getIdFromFullAccessPath } from '../utils/stringUtils';
|
import { getIdFromFullAccessPath } from '../utils/stringUtils';
|
||||||
|
import { LevelName } from './NotificationsComponent';
|
||||||
|
|
||||||
interface ColouredEnumComponentProps {
|
interface ColouredEnumComponentProps {
|
||||||
name: string;
|
name: string;
|
||||||
@ -11,7 +12,7 @@ interface ColouredEnumComponentProps {
|
|||||||
docString?: string;
|
docString?: string;
|
||||||
readOnly: boolean;
|
readOnly: boolean;
|
||||||
enumDict: Record<string, string>;
|
enumDict: Record<string, string>;
|
||||||
addNotification: (message: string) => void;
|
addNotification: (message: string, levelname?: LevelName) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ColouredEnumComponent = React.memo((props: ColouredEnumComponentProps) => {
|
export const ColouredEnumComponent = React.memo((props: ColouredEnumComponentProps) => {
|
||||||
|
@ -4,13 +4,14 @@ import { Card, Collapse } from 'react-bootstrap';
|
|||||||
import { ChevronDown, ChevronRight } from 'react-bootstrap-icons';
|
import { ChevronDown, ChevronRight } from 'react-bootstrap-icons';
|
||||||
import { Attribute, GenericComponent } from './GenericComponent';
|
import { Attribute, GenericComponent } from './GenericComponent';
|
||||||
import { getIdFromFullAccessPath } from '../utils/stringUtils';
|
import { getIdFromFullAccessPath } from '../utils/stringUtils';
|
||||||
|
import { LevelName } from './NotificationsComponent';
|
||||||
|
|
||||||
type DataServiceProps = {
|
type DataServiceProps = {
|
||||||
name: string;
|
name: string;
|
||||||
props: DataServiceJSON;
|
props: DataServiceJSON;
|
||||||
parentPath?: string;
|
parentPath?: string;
|
||||||
isInstantUpdate: boolean;
|
isInstantUpdate: boolean;
|
||||||
addNotification: (message: string) => void;
|
addNotification: (message: string, levelname?: LevelName) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type DataServiceJSON = Record<string, Attribute>;
|
export type DataServiceJSON = Record<string, Attribute>;
|
||||||
|
@ -2,6 +2,7 @@ import React, { useEffect, useRef } from 'react';
|
|||||||
import { InputGroup, Form, Row, Col } from 'react-bootstrap';
|
import { InputGroup, Form, Row, Col } from 'react-bootstrap';
|
||||||
import { setAttribute } from '../socket';
|
import { setAttribute } from '../socket';
|
||||||
import { DocStringComponent } from './DocStringComponent';
|
import { DocStringComponent } from './DocStringComponent';
|
||||||
|
import { LevelName } from './NotificationsComponent';
|
||||||
|
|
||||||
interface EnumComponentProps {
|
interface EnumComponentProps {
|
||||||
name: string;
|
name: string;
|
||||||
@ -9,7 +10,7 @@ interface EnumComponentProps {
|
|||||||
value: string;
|
value: string;
|
||||||
docString?: string;
|
docString?: string;
|
||||||
enumDict: Record<string, string>;
|
enumDict: Record<string, string>;
|
||||||
addNotification: (message: string) => void;
|
addNotification: (message: string, levelname?: LevelName) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const EnumComponent = React.memo((props: EnumComponentProps) => {
|
export const EnumComponent = React.memo((props: EnumComponentProps) => {
|
||||||
|
@ -10,6 +10,7 @@ import { ListComponent } from './ListComponent';
|
|||||||
import { DataServiceComponent, DataServiceJSON } from './DataServiceComponent';
|
import { DataServiceComponent, DataServiceJSON } from './DataServiceComponent';
|
||||||
import { ImageComponent } from './ImageComponent';
|
import { ImageComponent } from './ImageComponent';
|
||||||
import { ColouredEnumComponent } from './ColouredEnumComponent';
|
import { ColouredEnumComponent } from './ColouredEnumComponent';
|
||||||
|
import { LevelName } from './NotificationsComponent';
|
||||||
|
|
||||||
type AttributeType =
|
type AttributeType =
|
||||||
| 'str'
|
| 'str'
|
||||||
@ -40,7 +41,7 @@ type GenericComponentProps = {
|
|||||||
name: string;
|
name: string;
|
||||||
parentPath: string;
|
parentPath: string;
|
||||||
isInstantUpdate: boolean;
|
isInstantUpdate: boolean;
|
||||||
addNotification: (message: string) => void;
|
addNotification: (message: string, levelname?: LevelName) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const GenericComponent = React.memo(
|
export const GenericComponent = React.memo(
|
||||||
|
@ -3,6 +3,7 @@ import { Card, Collapse, Image } from 'react-bootstrap';
|
|||||||
import { DocStringComponent } from './DocStringComponent';
|
import { DocStringComponent } from './DocStringComponent';
|
||||||
import { ChevronDown, ChevronRight } from 'react-bootstrap-icons';
|
import { ChevronDown, ChevronRight } from 'react-bootstrap-icons';
|
||||||
import { getIdFromFullAccessPath } from '../utils/stringUtils';
|
import { getIdFromFullAccessPath } from '../utils/stringUtils';
|
||||||
|
import { LevelName } from './NotificationsComponent';
|
||||||
|
|
||||||
interface ImageComponentProps {
|
interface ImageComponentProps {
|
||||||
name: string;
|
name: string;
|
||||||
@ -11,7 +12,7 @@ interface ImageComponentProps {
|
|||||||
readOnly: boolean;
|
readOnly: boolean;
|
||||||
docString: string;
|
docString: string;
|
||||||
format: string;
|
format: string;
|
||||||
addNotification: (message: string) => void;
|
addNotification: (message: string, levelname?: LevelName) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ImageComponent = React.memo((props: ImageComponentProps) => {
|
export const ImageComponent = React.memo((props: ImageComponentProps) => {
|
||||||
|
@ -2,6 +2,7 @@ import React, { useEffect, useRef } from 'react';
|
|||||||
import { DocStringComponent } from './DocStringComponent';
|
import { DocStringComponent } from './DocStringComponent';
|
||||||
import { Attribute, GenericComponent } from './GenericComponent';
|
import { Attribute, GenericComponent } from './GenericComponent';
|
||||||
import { getIdFromFullAccessPath } from '../utils/stringUtils';
|
import { getIdFromFullAccessPath } from '../utils/stringUtils';
|
||||||
|
import { LevelName } from './NotificationsComponent';
|
||||||
|
|
||||||
interface ListComponentProps {
|
interface ListComponentProps {
|
||||||
name: string;
|
name: string;
|
||||||
@ -9,7 +10,7 @@ interface ListComponentProps {
|
|||||||
value: Attribute[];
|
value: Attribute[];
|
||||||
docString: string;
|
docString: string;
|
||||||
isInstantUpdate: boolean;
|
isInstantUpdate: boolean;
|
||||||
addNotification: (message: string) => void;
|
addNotification: (message: string, levelname?: LevelName) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ListComponent = React.memo((props: ListComponentProps) => {
|
export const ListComponent = React.memo((props: ListComponentProps) => {
|
||||||
|
@ -3,6 +3,7 @@ import { runMethod } from '../socket';
|
|||||||
import { Button, InputGroup, Form, Collapse } from 'react-bootstrap';
|
import { Button, InputGroup, Form, Collapse } from 'react-bootstrap';
|
||||||
import { DocStringComponent } from './DocStringComponent';
|
import { DocStringComponent } from './DocStringComponent';
|
||||||
import { getIdFromFullAccessPath } from '../utils/stringUtils';
|
import { getIdFromFullAccessPath } from '../utils/stringUtils';
|
||||||
|
import { LevelName } from './NotificationsComponent';
|
||||||
|
|
||||||
interface MethodProps {
|
interface MethodProps {
|
||||||
name: string;
|
name: string;
|
||||||
@ -10,7 +11,7 @@ interface MethodProps {
|
|||||||
parameters: Record<string, string>;
|
parameters: Record<string, string>;
|
||||||
docString?: string;
|
docString?: string;
|
||||||
hideOutput?: boolean;
|
hideOutput?: boolean;
|
||||||
addNotification: (message: string) => void;
|
addNotification: (message: string, levelname?: LevelName) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const MethodComponent = React.memo((props: MethodProps) => {
|
export const MethodComponent = React.memo((props: MethodProps) => {
|
||||||
|
@ -4,6 +4,7 @@ import { setAttribute } from '../socket';
|
|||||||
import { DocStringComponent } from './DocStringComponent';
|
import { DocStringComponent } from './DocStringComponent';
|
||||||
import '../App.css';
|
import '../App.css';
|
||||||
import { getIdFromFullAccessPath } from '../utils/stringUtils';
|
import { getIdFromFullAccessPath } from '../utils/stringUtils';
|
||||||
|
import { LevelName } from './NotificationsComponent';
|
||||||
|
|
||||||
// TODO: add button functionality
|
// TODO: add button functionality
|
||||||
|
|
||||||
@ -23,7 +24,7 @@ interface NumberComponentProps {
|
|||||||
value: number,
|
value: number,
|
||||||
callback?: (ack: unknown) => void
|
callback?: (ack: unknown) => void
|
||||||
) => void;
|
) => void;
|
||||||
addNotification: (message: string) => void;
|
addNotification: (message: string, levelname?: LevelName) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: highlight the digit that is being changed by setting both selectionStart and
|
// TODO: highlight the digit that is being changed by setting both selectionStart and
|
||||||
|
@ -5,6 +5,7 @@ import { DocStringComponent } from './DocStringComponent';
|
|||||||
import { Slider } from '@mui/material';
|
import { Slider } from '@mui/material';
|
||||||
import { NumberComponent } from './NumberComponent';
|
import { NumberComponent } from './NumberComponent';
|
||||||
import { getIdFromFullAccessPath } from '../utils/stringUtils';
|
import { getIdFromFullAccessPath } from '../utils/stringUtils';
|
||||||
|
import { LevelName } from './NotificationsComponent';
|
||||||
|
|
||||||
interface SliderComponentProps {
|
interface SliderComponentProps {
|
||||||
name: string;
|
name: string;
|
||||||
@ -16,7 +17,7 @@ interface SliderComponentProps {
|
|||||||
docString: string;
|
docString: string;
|
||||||
stepSize: number;
|
stepSize: number;
|
||||||
isInstantUpdate: boolean;
|
isInstantUpdate: boolean;
|
||||||
addNotification: (message: string) => void;
|
addNotification: (message: string, levelname?: LevelName) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const SliderComponent = React.memo((props: SliderComponentProps) => {
|
export const SliderComponent = React.memo((props: SliderComponentProps) => {
|
||||||
|
@ -4,6 +4,7 @@ import { setAttribute } from '../socket';
|
|||||||
import { DocStringComponent } from './DocStringComponent';
|
import { DocStringComponent } from './DocStringComponent';
|
||||||
import '../App.css';
|
import '../App.css';
|
||||||
import { getIdFromFullAccessPath } from '../utils/stringUtils';
|
import { getIdFromFullAccessPath } from '../utils/stringUtils';
|
||||||
|
import { LevelName } from './NotificationsComponent';
|
||||||
|
|
||||||
// TODO: add button functionality
|
// TODO: add button functionality
|
||||||
|
|
||||||
@ -14,7 +15,7 @@ interface StringComponentProps {
|
|||||||
readOnly: boolean;
|
readOnly: boolean;
|
||||||
docString: string;
|
docString: string;
|
||||||
isInstantUpdate: boolean;
|
isInstantUpdate: boolean;
|
||||||
addNotification: (message: string) => void;
|
addNotification: (message: string, levelname?: LevelName) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const StringComponent = React.memo((props: StringComponentProps) => {
|
export const StringComponent = React.memo((props: StringComponentProps) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user