mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-04-20 00:10:03 +02:00
updates types
This commit is contained in:
parent
f0384b817c
commit
1c029e301b
@ -8,9 +8,9 @@ import {
|
|||||||
LevelName
|
LevelName
|
||||||
} from './components/NotificationsComponent';
|
} from './components/NotificationsComponent';
|
||||||
import { ConnectionToast } from './components/ConnectionToast';
|
import { ConnectionToast } from './components/ConnectionToast';
|
||||||
import { SerializedValue, setNestedValueByPath, State } from './utils/stateUtils';
|
import { setNestedValueByPath, State } from './utils/stateUtils';
|
||||||
import { WebSettingsContext, WebSetting } from './WebSettings';
|
import { WebSettingsContext, WebSetting } from './WebSettings';
|
||||||
import { Attribute, GenericComponent } from './components/GenericComponent';
|
import { SerializedValue, GenericComponent } from './components/GenericComponent';
|
||||||
|
|
||||||
type Action =
|
type Action =
|
||||||
| { type: 'SET_DATA'; data: State }
|
| { type: 'SET_DATA'; data: State }
|
||||||
@ -187,7 +187,7 @@ const App = () => {
|
|||||||
<GenericComponent
|
<GenericComponent
|
||||||
name=""
|
name=""
|
||||||
parentPath=""
|
parentPath=""
|
||||||
attribute={state as Attribute}
|
attribute={state as SerializedValue}
|
||||||
isInstantUpdate={isInstantUpdate}
|
isInstantUpdate={isInstantUpdate}
|
||||||
addNotification={addNotification}
|
addNotification={addNotification}
|
||||||
/>
|
/>
|
||||||
|
@ -28,8 +28,8 @@ type AttributeType =
|
|||||||
| 'Image'
|
| 'Image'
|
||||||
| 'ColouredEnum';
|
| 'ColouredEnum';
|
||||||
|
|
||||||
type ValueType = boolean | string | number | object;
|
type ValueType = boolean | string | number | Record<string, unknown>;
|
||||||
export type Attribute = {
|
export type SerializedValue = {
|
||||||
type: AttributeType;
|
type: AttributeType;
|
||||||
value?: ValueType | ValueType[];
|
value?: ValueType | ValueType[];
|
||||||
readonly: boolean;
|
readonly: boolean;
|
||||||
@ -39,7 +39,7 @@ export type Attribute = {
|
|||||||
enum?: Record<string, string>;
|
enum?: Record<string, string>;
|
||||||
};
|
};
|
||||||
type GenericComponentProps = {
|
type GenericComponentProps = {
|
||||||
attribute: Attribute;
|
attribute: SerializedValue;
|
||||||
name: string;
|
name: string;
|
||||||
parentPath: string;
|
parentPath: string;
|
||||||
isInstantUpdate: boolean;
|
isInstantUpdate: boolean;
|
||||||
@ -177,7 +177,7 @@ export const GenericComponent = React.memo(
|
|||||||
return (
|
return (
|
||||||
<ListComponent
|
<ListComponent
|
||||||
name={name}
|
name={name}
|
||||||
value={attribute.value as Attribute[]}
|
value={attribute.value as SerializedValue[]}
|
||||||
docString={attribute.doc}
|
docString={attribute.doc}
|
||||||
parentPath={parentPath}
|
parentPath={parentPath}
|
||||||
isInstantUpdate={isInstantUpdate}
|
isInstantUpdate={isInstantUpdate}
|
||||||
|
@ -5,11 +5,12 @@ 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';
|
import { LevelName } from './NotificationsComponent';
|
||||||
|
import { GenericComponent, SerializedValue } from './GenericComponent';
|
||||||
|
|
||||||
type MethodProps = {
|
type MethodProps = {
|
||||||
name: string;
|
name: string;
|
||||||
parentPath: string;
|
parentPath: string;
|
||||||
parameters: Record<string, string>;
|
parameters: Record<string, SerializedValue>;
|
||||||
docString?: string;
|
docString?: string;
|
||||||
hideOutput?: boolean;
|
hideOutput?: boolean;
|
||||||
addNotification: (message: string, levelname?: LevelName) => void;
|
addNotification: (message: string, levelname?: LevelName) => void;
|
||||||
|
@ -1,11 +1,5 @@
|
|||||||
export interface SerializedValue {
|
import { SerializedValue } from '../components/GenericComponent';
|
||||||
type: string;
|
|
||||||
value: Record<string, unknown> | Array<Record<string, unknown>>;
|
|
||||||
readonly: boolean;
|
|
||||||
doc: string | null;
|
|
||||||
async?: boolean;
|
|
||||||
parameters?: unknown;
|
|
||||||
}
|
|
||||||
export type State = {
|
export type State = {
|
||||||
type: string;
|
type: string;
|
||||||
value: Record<string, SerializedValue> | null;
|
value: Record<string, SerializedValue> | null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user