diff --git a/packages/api-client/lib/index.ts b/packages/api-client/lib/index.ts index 20c9d8594..423ecb6ac 100644 --- a/packages/api-client/lib/index.ts +++ b/packages/api-client/lib/index.ts @@ -4,6 +4,7 @@ import { Alert, BeaconState, BuildingMap, + DeliveryAlert, DispenserState, DoorState, FleetState, @@ -103,6 +104,10 @@ export class SioClient { subscribeAlerts(listener: Listener): Subscription { return this.subscribe(`/alerts`, listener); } + + subscribeDeliveryAlerts(listener: Listener): Subscription { + return this.subscribe('/delivery_alerts', listener); + } } export * from './openapi'; diff --git a/packages/api-client/lib/openapi/api.ts b/packages/api-client/lib/openapi/api.ts index 4927e1838..1497477dc 100644 --- a/packages/api-client/lib/openapi/api.ts +++ b/packages/api-client/lib/openapi/api.ts @@ -10526,7 +10526,9 @@ export const TasksApiAxiosParamCreator = function (configuration?: Configuration * @param {string | null} [assignedTo] comma separated list of assigned robot names * @param {string | null} [status] comma separated list of statuses * @param {string | null} [label] comma separated list of labels, each item must be in the form <key>=<value>, multiple items will filter tasks with all the labels - * @param {string} [timeBetween] The period of request time to fetch, in unix millis. This must be a comma separated string, \'X,Y\' to fetch between X millis and Y millis inclusive. Example: \"1000,2000\" - Fetches logs between unix millis 1000 and 2000. + * @param {string} [requestTimeBetween] The period of request time to fetch, in unix millis. This must be a comma separated string, \'X,Y\' to fetch between X millis and Y millis inclusive. Example: \"1000,2000\" - Fetches logs between unix millis 1000 and 2000. + * @param {string} [startTimeBetween] The period of start time to fetch, in unix millis. This must be a comma separated string, \'X,Y\' to fetch between X millis and Y millis inclusive. Example: \"1000,2000\" - Fetches logs between unix millis 1000 and 2000. + * @param {string} [finishTimeBetween] The period of finish time to fetch, in unix millis. This must be a comma separated string, \'X,Y\' to fetch between X millis and Y millis inclusive. Example: \"1000,2000\" - Fetches logs between unix millis 1000 and 2000. * @param {number | null} [limit] defaults to 100 * @param {number | null} [offset] defaults to 0 * @param {string | null} [orderBy] common separated list of fields to order by, prefix with \'-\' to sort descendingly. @@ -10541,7 +10543,9 @@ export const TasksApiAxiosParamCreator = function (configuration?: Configuration assignedTo?: string | null, status?: string | null, label?: string | null, - timeBetween?: string, + requestTimeBetween?: string, + startTimeBetween?: string, + finishTimeBetween?: string, limit?: number | null, offset?: number | null, orderBy?: string | null, @@ -10584,8 +10588,16 @@ export const TasksApiAxiosParamCreator = function (configuration?: Configuration localVarQueryParameter['label'] = label; } - if (timeBetween !== undefined) { - localVarQueryParameter['time_between'] = timeBetween; + if (requestTimeBetween !== undefined) { + localVarQueryParameter['request_time_between'] = requestTimeBetween; + } + + if (startTimeBetween !== undefined) { + localVarQueryParameter['start_time_between'] = startTimeBetween; + } + + if (finishTimeBetween !== undefined) { + localVarQueryParameter['finish_time_between'] = finishTimeBetween; } if (limit !== undefined) { @@ -11473,7 +11485,9 @@ export const TasksApiFp = function (configuration?: Configuration) { * @param {string | null} [assignedTo] comma separated list of assigned robot names * @param {string | null} [status] comma separated list of statuses * @param {string | null} [label] comma separated list of labels, each item must be in the form <key>=<value>, multiple items will filter tasks with all the labels - * @param {string} [timeBetween] The period of request time to fetch, in unix millis. This must be a comma separated string, \'X,Y\' to fetch between X millis and Y millis inclusive. Example: \"1000,2000\" - Fetches logs between unix millis 1000 and 2000. + * @param {string} [requestTimeBetween] The period of request time to fetch, in unix millis. This must be a comma separated string, \'X,Y\' to fetch between X millis and Y millis inclusive. Example: \"1000,2000\" - Fetches logs between unix millis 1000 and 2000. + * @param {string} [startTimeBetween] The period of start time to fetch, in unix millis. This must be a comma separated string, \'X,Y\' to fetch between X millis and Y millis inclusive. Example: \"1000,2000\" - Fetches logs between unix millis 1000 and 2000. + * @param {string} [finishTimeBetween] The period of finish time to fetch, in unix millis. This must be a comma separated string, \'X,Y\' to fetch between X millis and Y millis inclusive. Example: \"1000,2000\" - Fetches logs between unix millis 1000 and 2000. * @param {number | null} [limit] defaults to 100 * @param {number | null} [offset] defaults to 0 * @param {string | null} [orderBy] common separated list of fields to order by, prefix with \'-\' to sort descendingly. @@ -11488,7 +11502,9 @@ export const TasksApiFp = function (configuration?: Configuration) { assignedTo?: string | null, status?: string | null, label?: string | null, - timeBetween?: string, + requestTimeBetween?: string, + startTimeBetween?: string, + finishTimeBetween?: string, limit?: number | null, offset?: number | null, orderBy?: string | null, @@ -11502,7 +11518,9 @@ export const TasksApiFp = function (configuration?: Configuration) { assignedTo, status, label, - timeBetween, + requestTimeBetween, + startTimeBetween, + finishTimeBetween, limit, offset, orderBy, @@ -12013,7 +12031,9 @@ export const TasksApiFactory = function ( * @param {string | null} [assignedTo] comma separated list of assigned robot names * @param {string | null} [status] comma separated list of statuses * @param {string | null} [label] comma separated list of labels, each item must be in the form <key>=<value>, multiple items will filter tasks with all the labels - * @param {string} [timeBetween] The period of request time to fetch, in unix millis. This must be a comma separated string, \'X,Y\' to fetch between X millis and Y millis inclusive. Example: \"1000,2000\" - Fetches logs between unix millis 1000 and 2000. + * @param {string} [requestTimeBetween] The period of request time to fetch, in unix millis. This must be a comma separated string, \'X,Y\' to fetch between X millis and Y millis inclusive. Example: \"1000,2000\" - Fetches logs between unix millis 1000 and 2000. + * @param {string} [startTimeBetween] The period of start time to fetch, in unix millis. This must be a comma separated string, \'X,Y\' to fetch between X millis and Y millis inclusive. Example: \"1000,2000\" - Fetches logs between unix millis 1000 and 2000. + * @param {string} [finishTimeBetween] The period of finish time to fetch, in unix millis. This must be a comma separated string, \'X,Y\' to fetch between X millis and Y millis inclusive. Example: \"1000,2000\" - Fetches logs between unix millis 1000 and 2000. * @param {number | null} [limit] defaults to 100 * @param {number | null} [offset] defaults to 0 * @param {string | null} [orderBy] common separated list of fields to order by, prefix with \'-\' to sort descendingly. @@ -12028,7 +12048,9 @@ export const TasksApiFactory = function ( assignedTo?: string | null, status?: string | null, label?: string | null, - timeBetween?: string, + requestTimeBetween?: string, + startTimeBetween?: string, + finishTimeBetween?: string, limit?: number | null, offset?: number | null, orderBy?: string | null, @@ -12043,7 +12065,9 @@ export const TasksApiFactory = function ( assignedTo, status, label, - timeBetween, + requestTimeBetween, + startTimeBetween, + finishTimeBetween, limit, offset, orderBy, @@ -12578,7 +12602,9 @@ export class TasksApi extends BaseAPI { * @param {string | null} [assignedTo] comma separated list of assigned robot names * @param {string | null} [status] comma separated list of statuses * @param {string | null} [label] comma separated list of labels, each item must be in the form <key>=<value>, multiple items will filter tasks with all the labels - * @param {string} [timeBetween] The period of request time to fetch, in unix millis. This must be a comma separated string, \'X,Y\' to fetch between X millis and Y millis inclusive. Example: \"1000,2000\" - Fetches logs between unix millis 1000 and 2000. + * @param {string} [requestTimeBetween] The period of request time to fetch, in unix millis. This must be a comma separated string, \'X,Y\' to fetch between X millis and Y millis inclusive. Example: \"1000,2000\" - Fetches logs between unix millis 1000 and 2000. + * @param {string} [startTimeBetween] The period of start time to fetch, in unix millis. This must be a comma separated string, \'X,Y\' to fetch between X millis and Y millis inclusive. Example: \"1000,2000\" - Fetches logs between unix millis 1000 and 2000. + * @param {string} [finishTimeBetween] The period of finish time to fetch, in unix millis. This must be a comma separated string, \'X,Y\' to fetch between X millis and Y millis inclusive. Example: \"1000,2000\" - Fetches logs between unix millis 1000 and 2000. * @param {number | null} [limit] defaults to 100 * @param {number | null} [offset] defaults to 0 * @param {string | null} [orderBy] common separated list of fields to order by, prefix with \'-\' to sort descendingly. @@ -12594,7 +12620,9 @@ export class TasksApi extends BaseAPI { assignedTo?: string | null, status?: string | null, label?: string | null, - timeBetween?: string, + requestTimeBetween?: string, + startTimeBetween?: string, + finishTimeBetween?: string, limit?: number | null, offset?: number | null, orderBy?: string | null, @@ -12609,7 +12637,9 @@ export class TasksApi extends BaseAPI { assignedTo, status, label, - timeBetween, + requestTimeBetween, + startTimeBetween, + finishTimeBetween, limit, offset, orderBy, diff --git a/packages/api-client/lib/version.ts b/packages/api-client/lib/version.ts index 6343c89da..22214fd96 100644 --- a/packages/api-client/lib/version.ts +++ b/packages/api-client/lib/version.ts @@ -1,5 +1,5 @@ // THIS FILE IS GENERATED export const version = { - rmfServer: 'c9b81b6abf171879765e02019942d41919359d58', + rmfServer: '13db0e386c955fb5ba140f91d27b595875088579', openapiGenerator: '', }; diff --git a/packages/api-client/schema/index.ts b/packages/api-client/schema/index.ts index 3fe5f2ad7..51a773bd4 100644 --- a/packages/api-client/schema/index.ts +++ b/packages/api-client/schema/index.ts @@ -886,18 +886,44 @@ export default { 'comma separated list of labels, each item must be in the form =, multiple items will filter tasks with all the labels', }, { - name: 'time_between', + name: 'request_time_between', in: 'query', required: false, schema: { type: 'string', description: '\n The period of request time to fetch, in unix millis.\n\n This must be a comma separated string, \'X,Y\' to fetch between X millis and Y millis inclusive.\n\n Example:\n "1000,2000" - Fetches logs between unix millis 1000 and 2000.\n ', - title: 'Time Between', + title: 'Request Time Between', }, description: '\n The period of request time to fetch, in unix millis.\n\n This must be a comma separated string, \'X,Y\' to fetch between X millis and Y millis inclusive.\n\n Example:\n "1000,2000" - Fetches logs between unix millis 1000 and 2000.\n ', }, + { + name: 'start_time_between', + in: 'query', + required: false, + schema: { + type: 'string', + description: + '\n The period of start time to fetch, in unix millis.\n\n This must be a comma separated string, \'X,Y\' to fetch between X millis and Y millis inclusive.\n\n Example:\n "1000,2000" - Fetches logs between unix millis 1000 and 2000.\n ', + title: 'Start Time Between', + }, + description: + '\n The period of start time to fetch, in unix millis.\n\n This must be a comma separated string, \'X,Y\' to fetch between X millis and Y millis inclusive.\n\n Example:\n "1000,2000" - Fetches logs between unix millis 1000 and 2000.\n ', + }, + { + name: 'finish_time_between', + in: 'query', + required: false, + schema: { + type: 'string', + description: + '\n The period of finish time to fetch, in unix millis.\n\n This must be a comma separated string, \'X,Y\' to fetch between X millis and Y millis inclusive.\n\n Example:\n "1000,2000" - Fetches logs between unix millis 1000 and 2000.\n ', + title: 'Finish Time Between', + }, + description: + '\n The period of finish time to fetch, in unix millis.\n\n This must be a comma separated string, \'X,Y\' to fetch between X millis and Y millis inclusive.\n\n Example:\n "1000,2000" - Fetches logs between unix millis 1000 and 2000.\n ', + }, { name: 'limit', in: 'query', diff --git a/packages/api-server/api_server/dependencies.py b/packages/api-server/api_server/dependencies.py index 6510ea8ea..cafe7ea9a 100644 --- a/packages/api-server/api_server/dependencies.py +++ b/packages/api-server/api_server/dependencies.py @@ -47,8 +47,8 @@ def between_query( return period -def time_between_query( - time_between: str = Query( +def request_time_between_query( + request_time_between: str = Query( None, description=""" The period of request time to fetch, in unix millis. @@ -61,16 +61,78 @@ def time_between_query( ), now: int = Depends(ros_time.now), ) -> tuple[datetime, datetime] | None: - if time_between is None: + if request_time_between is None: return None - if time_between.startswith("-"): + if request_time_between.startswith("-"): # Cap at 0 millis period = ( datetime.fromtimestamp(0), datetime.fromtimestamp(now / 1000), ) else: - parts = time_between.split(",") + parts = request_time_between.split(",") + period = ( + datetime.fromtimestamp(int(parts[0]) / 1000), + datetime.fromtimestamp(int(parts[1]) / 1000), + ) + return period + + +def start_time_between_query( + start_time_between: str = Query( + None, + description=""" + The period of start time to fetch, in unix millis. + + This must be a comma separated string, 'X,Y' to fetch between X millis and Y millis inclusive. + + Example: + "1000,2000" - Fetches logs between unix millis 1000 and 2000. + """, + ), + now: int = Depends(ros_time.now), +) -> tuple[datetime, datetime] | None: + if start_time_between is None: + return None + if start_time_between.startswith("-"): + # Cap at 0 millis + period = ( + datetime.fromtimestamp(0), + datetime.fromtimestamp(now / 1000), + ) + else: + parts = start_time_between.split(",") + period = ( + datetime.fromtimestamp(int(parts[0]) / 1000), + datetime.fromtimestamp(int(parts[1]) / 1000), + ) + return period + + +def finish_time_between_query( + finish_time_between: str = Query( + None, + description=""" + The period of finish time to fetch, in unix millis. + + This must be a comma separated string, 'X,Y' to fetch between X millis and Y millis inclusive. + + Example: + "1000,2000" - Fetches logs between unix millis 1000 and 2000. + """, + ), + now: int = Depends(ros_time.now), +) -> tuple[datetime, datetime] | None: + if finish_time_between is None: + return None + if finish_time_between.startswith("-"): + # Cap at 0 millis + period = ( + datetime.fromtimestamp(0), + datetime.fromtimestamp(now / 1000), + ) + else: + parts = finish_time_between.split(",") period = ( datetime.fromtimestamp(int(parts[0]) / 1000), datetime.fromtimestamp(int(parts[1]) / 1000), diff --git a/packages/api-server/api_server/routes/tasks/tasks.py b/packages/api-server/api_server/routes/tasks/tasks.py index 79cb6c22e..af8fce552 100644 --- a/packages/api-server/api_server/routes/tasks/tasks.py +++ b/packages/api-server/api_server/routes/tasks/tasks.py @@ -5,7 +5,13 @@ from reactivex import operators as rxops from api_server import models as mdl -from api_server.dependencies import between_query, pagination_query, time_between_query +from api_server.dependencies import ( + between_query, + finish_time_between_query, + pagination_query, + request_time_between_query, + start_time_between_query, +) from api_server.fast_io import FastIORouter, SubscriptionRequest from api_server.logging import LoggerAdapter, default_logger, get_logger from api_server.repositories import RmfRepository, TaskRepository @@ -72,7 +78,7 @@ async def query_task_states( str | None, Query(description="comma separated list of task categories") ] = None, request_time_between: Annotated[ - tuple[datetime, datetime] | None, Depends(time_between_query) + tuple[datetime, datetime] | None, Depends(request_time_between_query) ] = None, requester: Annotated[ str | None, Query(description="comma separated list of requester names") @@ -82,10 +88,10 @@ async def query_task_states( Query(description="comma separated list of assigned robot names"), ] = None, start_time_between: Annotated[ - tuple[datetime, datetime] | None, Depends(time_between_query) + tuple[datetime, datetime] | None, Depends(start_time_between_query) ] = None, finish_time_between: Annotated[ - tuple[datetime, datetime] | None, Depends(time_between_query) + tuple[datetime, datetime] | None, Depends(finish_time_between_query) ] = None, status: Annotated[ str | None, Query(description="comma separated list of statuses") diff --git a/packages/dashboard/src/components/appbar.tsx b/packages/dashboard/src/components/appbar.tsx index 6bc669b5e..b48b0525f 100644 --- a/packages/dashboard/src/components/appbar.tsx +++ b/packages/dashboard/src/components/appbar.tsx @@ -60,7 +60,6 @@ import { } from './app-contexts'; import { AppEvents } from './app-events'; import { RmfAppContext } from './rmf-app'; -import { parseTasksFile } from './tasks/utils'; import { Subscription } from 'rxjs'; import { formatDistance } from 'date-fns'; import { styled } from '@mui/system'; @@ -264,37 +263,6 @@ export const AppBar = React.memo(({ extraToolbarItems }: AppBarProps): React.Rea [rmf], ); - const uploadFileInputRef = React.useRef(null); - const tasksFromFile = (): Promise => { - return new Promise((res) => { - const fileInputEl = uploadFileInputRef.current; - if (!fileInputEl) { - return []; - } - let taskFiles: TaskRequest[]; - const listener = async () => { - try { - if (!fileInputEl.files || fileInputEl.files.length === 0) { - return res([]); - } - try { - taskFiles = parseTasksFile(await fileInputEl.files[0].text()); - } catch (err) { - showAlert('error', (err as Error).message, 5000); - return res([]); - } - // only submit tasks when all tasks are error free - return res(taskFiles); - } finally { - fileInputEl.removeEventListener('input', listener); - fileInputEl.value = ''; - } - }; - fileInputEl.addEventListener('input', listener); - fileInputEl.click(); - }); - }; - //#region 'Favorite Task' React.useEffect(() => { if (!rmf) { @@ -626,7 +594,6 @@ export const AppBar = React.memo(({ extraToolbarItems }: AppBarProps): React.Rea submitTasks={submitTasks} submitFavoriteTask={submitFavoriteTask} deleteFavoriteTask={deleteFavoriteTask} - tasksFromFile={tasksFromFile} onSuccess={() => { console.log('Dispatch task requested'); setOpenCreateTaskForm(false); diff --git a/packages/dashboard/src/components/tasks/tasks-app.tsx b/packages/dashboard/src/components/tasks/tasks-app.tsx index ae9812988..f32645986 100644 --- a/packages/dashboard/src/components/tasks/tasks-app.tsx +++ b/packages/dashboard/src/components/tasks/tasks-app.tsx @@ -13,7 +13,7 @@ import { Tooltip, useMediaQuery, } from '@mui/material'; -import { TaskRequest, TaskState } from 'api-client'; +import { TaskRequest, TaskStateInput as TaskState } from 'api-client'; import React from 'react'; import { FilterFields, @@ -191,8 +191,8 @@ export const TasksApp = React.memo( filterColumn && filterColumn === 'id_' ? filterValue : undefined, filterColumn && filterColumn === 'category' ? filterValue : undefined, filterColumn && filterColumn === 'requester' ? filterValue : undefined, - filterColumn && filterColumn === 'label=pickup' ? filterValue : undefined, - filterColumn && filterColumn === 'label=destination' ? filterValue : undefined, + // filterColumn && filterColumn === 'label=pickup' ? filterValue : undefined, + // filterColumn && filterColumn === 'label=destination' ? filterValue : undefined, filterColumn && filterColumn === 'assigned_to' ? filterValue : undefined, filterColumn && filterColumn === 'status' ? filterValue : undefined, undefined, @@ -263,8 +263,6 @@ export const TasksApp = React.memo( undefined, undefined, undefined, - undefined, - undefined, `${currentMillis - oneMonthMillis},${currentMillis}`, undefined, QueryLimit, diff --git a/packages/dashboard/src/components/tasks/utils.ts b/packages/dashboard/src/components/tasks/utils.ts index a1b290671..b3376cc52 100644 --- a/packages/dashboard/src/components/tasks/utils.ts +++ b/packages/dashboard/src/components/tasks/utils.ts @@ -1,20 +1,5 @@ import { PostScheduledTaskRequest, TaskRequest, TaskStateOutput as TaskState } from 'api-client'; -import { ajv, getTaskBookingLabelFromTaskState, Schedule } from 'react-components'; -import schema from 'api-client/dist/schema'; - -export function parseTasksFile(contents: string): TaskRequest[] { - const obj = JSON.parse(contents) as unknown[]; - if (!Array.isArray(obj)) { - throw new Error('Expected an array of tasks'); - } - - const errIdx = obj.findIndex((req) => !ajv.validate(schema.components.schemas.TaskRequest, req)); - if (errIdx !== -1) { - const errors = ajv.errors!; - throw new Error(`Validation error on item ${errIdx + 1}: ${errors[0].message}`); - } - return obj; -} +import { getTaskBookingLabelFromTaskState, Schedule } from 'react-components'; export function exportCsvFull(timestamp: Date, allTasks: TaskState[]) { const columnSeparator = ';'; diff --git a/packages/dashboard/src/components/tests/appbar.test.tsx b/packages/dashboard/src/components/tests/appbar.test.tsx index cf24994d3..1ef132b63 100644 --- a/packages/dashboard/src/components/tests/appbar.test.tsx +++ b/packages/dashboard/src/components/tests/appbar.test.tsx @@ -1,5 +1,4 @@ import { waitFor } from '@testing-library/react'; -import { act } from '@testing-library/react-hooks'; import userEvent from '@testing-library/user-event'; import React from 'react'; import { StubAuthenticator, UserProfile, UserProfileContext } from 'rmf-auth'; @@ -16,6 +15,7 @@ import { import AppBar from '../appbar'; import { render } from '../tests/test-utils'; import { makeMockAppController } from './mock-app-controller'; +import { TaskResourceManager } from '../../managers/resource-manager-tasks'; describe('AppBar', () => { let appController: AppController; @@ -85,8 +85,17 @@ describe('AppBar', () => { test('uses headerLogo from logo resources manager', async () => { const robotResourcesMgr = new RobotResourceManager({}); const logoResourcesMgr = new LogoResourceManager({}); + const taskResourceMgr = new TaskResourceManager([]); logoResourcesMgr.getHeaderLogoPath = () => Promise.resolve('/test-logo.png'); - const resourceMgr: ResourceManager = { robots: robotResourcesMgr, logos: logoResourcesMgr }; + const resourceMgr: ResourceManager = { + robots: robotResourcesMgr, + logos: logoResourcesMgr, + tasks: taskResourceMgr, + helpLink: 'testHelpLink', + reportIssue: 'testReportIssue', + defaultZoom: 5, + defaultRobotZoom: 50, + }; const root = render( diff --git a/packages/dashboard/src/components/three-fiber/door-three.tsx b/packages/dashboard/src/components/three-fiber/door-three.tsx index 476535343..e16317df9 100644 --- a/packages/dashboard/src/components/three-fiber/door-three.tsx +++ b/packages/dashboard/src/components/three-fiber/door-three.tsx @@ -1,26 +1,28 @@ import { ThreeEvent } from '@react-three/fiber'; +import { Mesh } from 'three'; import { DoorState, Lift, LiftState } from 'api-client'; import React from 'react'; import { DoorThreeMaker } from 'react-components'; -import { DoorMode, Door as DoorModel } from 'rmf-models'; +import { Door as RmfDoor } from 'rmf-models/ros/rmf_building_map_msgs/msg'; +import { DoorMode as RmfDoorMode } from 'rmf-models/ros/rmf_door_msgs/msg'; import { throttleTime } from 'rxjs'; import { RmfAppContext } from '../rmf-app'; interface DoorProps { - door: DoorModel; + door: RmfDoor; opacity: number; height: number; elevation: number; lift?: Lift; - onDoorClick?: (ev: ThreeEvent, door: DoorModel) => void; + onDoorClick?: (ev: ThreeEvent, door: RmfDoor) => void; } -function toDoorMode(liftState: LiftState): DoorMode { +function toDoorMode(liftState: LiftState): RmfDoorMode { return { value: liftState.door_state }; } export const Door = React.memo(({ ...doorProps }: DoorProps): JSX.Element => { - const ref = React.useRef(null!); + const ref = React.useRef(null!); const { door, lift, onDoorClick } = doorProps; const rmf = React.useContext(RmfAppContext); const [doorState, setDoorState] = React.useState(null); @@ -48,13 +50,13 @@ export const Door = React.memo(({ ...doorProps }: DoorProps): JSX.Element => { doorStateValue = toDoorMode(liftState).value; } switch (doorStateValue) { - case DoorMode.MODE_CLOSED: + case RmfDoorMode.MODE_CLOSED: setColor('red'); return; - case DoorMode.MODE_MOVING: + case RmfDoorMode.MODE_MOVING: setColor('orange'); return; - case DoorMode.MODE_OPEN: + case RmfDoorMode.MODE_OPEN: default: setColor('green'); return; diff --git a/packages/dashboard/src/components/three-fiber/layer-control.test.tsx b/packages/dashboard/src/components/three-fiber/layer-control.test.tsx index 3dceffdcf..d04312165 100644 --- a/packages/dashboard/src/components/three-fiber/layer-control.test.tsx +++ b/packages/dashboard/src/components/three-fiber/layer-control.test.tsx @@ -348,6 +348,7 @@ describe('LayersController', () => { ]; const onChangeMock = jest.fn(); + const handleFullViewMock = jest.fn(); const handleZoomInMock = jest.fn(); const handleZoomOutMock = jest.fn(); @@ -363,6 +364,7 @@ describe('LayersController', () => { onChange={onChangeMock} levels={levels} currentLevel={levels[0]} + handleFullView={handleFullViewMock} handleZoomIn={handleZoomInMock} handleZoomOut={handleZoomOutMock} />, diff --git a/packages/dashboard/src/components/utils.ts b/packages/dashboard/src/components/utils.ts index ac280c665..db1ec7bda 100644 --- a/packages/dashboard/src/components/utils.ts +++ b/packages/dashboard/src/components/utils.ts @@ -1,5 +1,6 @@ import { AxiosError } from 'axios'; export function getApiErrorMessage(error: unknown): string { - return (error as AxiosError).response?.data.detail || ''; + const body = (error as AxiosError).response?.data as any; + return typeof body === 'object' && body.detail ? body.detail : ''; } diff --git a/packages/dashboard/src/managers/tests/resource-manager-robots.test.ts b/packages/dashboard/src/managers/tests/resource-manager-robots.test.ts index 4405350bb..7a846d097 100644 --- a/packages/dashboard/src/managers/tests/resource-manager-robots.test.ts +++ b/packages/dashboard/src/managers/tests/resource-manager-robots.test.ts @@ -47,6 +47,7 @@ describe('The correct operation of the getIconPath method of the RobotResourceMa icons: { testFleet: '', }, + scale: 0.4, places: {}, }; const icon = await manager.getIconPath('testFleet'); @@ -62,6 +63,7 @@ describe('The correct operation of the getIconPath method of the RobotResourceMa testFleet: '/fleet', testModel: '/model', }, + scale: 0.4, places: {}, }; const icon = await manager.getIconPath('testFleet', 'testModel'); diff --git a/packages/react-components/lib/tasks/create-task.stories.tsx b/packages/react-components/lib/tasks/create-task.stories.tsx index d1a1802f3..263f602ff 100644 --- a/packages/react-components/lib/tasks/create-task.stories.tsx +++ b/packages/react-components/lib/tasks/create-task.stories.tsx @@ -9,16 +9,8 @@ export default { component: CreateTaskForm, } satisfies Meta; -function makeTasks(): TaskRequest[] { - const tasks: TaskRequest[] = []; - for (let i = 0; i < 100; i++) { - tasks.push(makeTaskRequest()); - } - return tasks; -} - export const CreateTask: StoryFn = (args) => { - return ; + return ; }; CreateTask.args = { diff --git a/packages/react-components/lib/tasks/create-task.tsx b/packages/react-components/lib/tasks/create-task.tsx index d3d83630a..4e2a62a67 100644 --- a/packages/react-components/lib/tasks/create-task.tsx +++ b/packages/react-components/lib/tasks/create-task.tsx @@ -301,7 +301,6 @@ export interface CreateTaskFormProps // requestTask is provided only when editing a schedule requestTask?: TaskRequest; submitTasks?(tasks: TaskRequest[], schedule: Schedule | null): Promise; - tasksFromFile?(): Promise | TaskRequest[]; onSuccess?(tasks: TaskRequest[]): void; onFail?(error: Error, tasks: TaskRequest[]): void; onSuccessFavoriteTask?(message: string, favoriteTask: TaskFavorite): void; @@ -332,7 +331,6 @@ export function CreateTaskForm({ scheduleToEdit, requestTask, submitTasks, - tasksFromFile, onClose, onSuccess, onFail,