-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(app, robot-server): add protocol receipt toasts and protocol ids…
- Loading branch information
Showing
14 changed files
with
260 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { GET, request } from '../request' | ||
|
||
import type { ResponsePromise } from '../request' | ||
import type { HostConfig } from '../types' | ||
import type { ProtocolsIds } from './types' | ||
|
||
export function getProtocolIds( | ||
config: HostConfig | ||
): ResponsePromise<ProtocolsIds> { | ||
return request<ProtocolsIds>(GET, `/protocols/ids`, null, config) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { UseQueryResult, useQuery } from 'react-query' | ||
import { getProtocolIds } from '@opentrons/api-client' | ||
import { useHost } from '../api' | ||
import type { HostConfig, ProtocolsIds } from '@opentrons/api-client' | ||
import type { UseQueryOptions } from 'react-query' | ||
|
||
const POLLING_INTERVAL = 1000 | ||
|
||
export function useAllProtocolIdsQuery( | ||
options?: UseQueryOptions<ProtocolsIds>, | ||
enablePolling?: boolean | ||
): UseQueryResult<ProtocolsIds | null> { | ||
const host = useHost() | ||
const allOptions: UseQueryOptions<ProtocolsIds> = { | ||
...options, | ||
enabled: host !== null && (enablePolling == null || enablePolling), | ||
refetchInterval: | ||
enablePolling != null | ||
? options?.refetchInterval ?? POLLING_INTERVAL | ||
: false, | ||
} | ||
const query = useQuery<ProtocolsIds>( | ||
[host, 'protocols', 'ids'], | ||
() => getProtocolIds(host as HostConfig).then(response => response.data), | ||
allOptions | ||
) | ||
|
||
return query | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.