Add more Machine API capabilities (#4203)
This commit is contained in:
Binary file not shown.
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 62 KiB |
Binary file not shown.
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
Binary file not shown.
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 39 KiB |
@ -135,7 +135,9 @@ function CommandArgOptionInput({
|
|||||||
<Combobox.Input
|
<Combobox.Input
|
||||||
id="option-input"
|
id="option-input"
|
||||||
ref={inputRef}
|
ref={inputRef}
|
||||||
onChange={(event) => setQuery(event.target.value)}
|
onChange={(event) =>
|
||||||
|
!event.target.disabled && setQuery(event.target.value)
|
||||||
|
}
|
||||||
className="flex-grow px-2 py-1 border-b border-b-chalkboard-100 dark:border-b-chalkboard-80 !bg-transparent focus:outline-none"
|
className="flex-grow px-2 py-1 border-b border-b-chalkboard-100 dark:border-b-chalkboard-80 !bg-transparent focus:outline-none"
|
||||||
onKeyDown={(event) => {
|
onKeyDown={(event) => {
|
||||||
if (event.metaKey && event.key === 'k')
|
if (event.metaKey && event.key === 'k')
|
||||||
@ -175,9 +177,18 @@ function CommandArgOptionInput({
|
|||||||
<Combobox.Option
|
<Combobox.Option
|
||||||
key={option.name}
|
key={option.name}
|
||||||
value={option}
|
value={option}
|
||||||
|
disabled={option.disabled}
|
||||||
className="flex items-center gap-2 px-4 py-1 first:mt-2 last:mb-2 ui-active:bg-primary/10 dark:ui-active:bg-chalkboard-90"
|
className="flex items-center gap-2 px-4 py-1 first:mt-2 last:mb-2 ui-active:bg-primary/10 dark:ui-active:bg-chalkboard-90"
|
||||||
>
|
>
|
||||||
<p className="flex-grow">{option.name} </p>
|
<p
|
||||||
|
className={`flex-grow ${
|
||||||
|
(option.disabled &&
|
||||||
|
'text-chalkboard-70 dark:text-chalkboard-50 cursor-not-allowed') ||
|
||||||
|
''
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
{option.name}
|
||||||
|
</p>
|
||||||
{option.value === currentOption?.value && (
|
{option.value === currentOption?.value && (
|
||||||
<small className="text-chalkboard-70 dark:text-chalkboard-50">
|
<small className="text-chalkboard-70 dark:text-chalkboard-50">
|
||||||
current
|
current
|
||||||
|
@ -54,12 +54,6 @@ export const NetworkMachineIndicator = ({
|
|||||||
<p className="text-chalkboard-60 dark:text-chalkboard-50 text-xs">
|
<p className="text-chalkboard-60 dark:text-chalkboard-50 text-xs">
|
||||||
{machine.make_model.model}
|
{machine.make_model.model}
|
||||||
</p>
|
</p>
|
||||||
<p className="text-chalkboard-60 dark:text-chalkboard-50 text-xs">
|
|
||||||
{machine.state.state.toUpperCase()}
|
|
||||||
{machine.state.state === 'failed' && machine.state.message
|
|
||||||
? ': ' + machine.state.message
|
|
||||||
: ''}
|
|
||||||
</p>
|
|
||||||
{machine.extra &&
|
{machine.extra &&
|
||||||
machine.extra.type === 'bambu' &&
|
machine.extra.type === 'bambu' &&
|
||||||
machine.extra.nozzle_diameter && (
|
machine.extra.nozzle_diameter && (
|
||||||
@ -67,6 +61,17 @@ export const NetworkMachineIndicator = ({
|
|||||||
Nozzle Diameter: {machine.extra.nozzle_diameter}
|
Nozzle Diameter: {machine.extra.nozzle_diameter}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
|
<p className="text-chalkboard-60 dark:text-chalkboard-50 text-xs">
|
||||||
|
{`Status: ${machine.state.state
|
||||||
|
.charAt(0)
|
||||||
|
.toUpperCase()}${machine.state.state.slice(1)}`}
|
||||||
|
{machine.state.state === 'failed' && machine.state.message
|
||||||
|
? ` (${machine.state.message})`
|
||||||
|
: ''}
|
||||||
|
{machine.state.state === 'running' && machine.progress
|
||||||
|
? ` (${Math.round(machine.progress)}%)`
|
||||||
|
: ''}
|
||||||
|
</p>
|
||||||
</li>
|
</li>
|
||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
|
@ -194,10 +194,24 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
|
|||||||
`${machine.id} (${
|
`${machine.id} (${
|
||||||
machine.make_model.model || machine.make_model.manufacturer
|
machine.make_model.model || machine.make_model.manufacturer
|
||||||
}) (${machine.state.state})` +
|
}) (${machine.state.state})` +
|
||||||
(machine.extra &&
|
(machine.hardware_configuration &&
|
||||||
machine.extra.type === 'bambu' &&
|
machine.hardware_configuration.type !== 'none' &&
|
||||||
machine.extra.nozzle_diameter
|
machine.hardware_configuration.config.nozzle_diameter
|
||||||
? ` - Nozzle Diameter: ${machine.extra.nozzle_diameter}`
|
? ` - Nozzle Diameter: ${machine.hardware_configuration.config.nozzle_diameter}`
|
||||||
|
: '') +
|
||||||
|
(machine.hardware_configuration &&
|
||||||
|
machine.hardware_configuration.type !== 'none' &&
|
||||||
|
machine.hardware_configuration.config.filaments &&
|
||||||
|
machine.hardware_configuration.config.filaments[0]
|
||||||
|
? ` - ${
|
||||||
|
machine.hardware_configuration.config.filaments[0].name
|
||||||
|
} #${
|
||||||
|
machine.hardware_configuration.config &&
|
||||||
|
machine.hardware_configuration.config.filaments[0].color?.slice(
|
||||||
|
0,
|
||||||
|
6
|
||||||
|
)
|
||||||
|
}`
|
||||||
: ''),
|
: ''),
|
||||||
isCurrent: false,
|
isCurrent: false,
|
||||||
disabled: machine.state.state !== 'idle',
|
disabled: machine.state.state !== 'idle',
|
||||||
|
@ -258,5 +258,6 @@ export type CommandArgumentWithName<
|
|||||||
export type CommandArgumentOption<A> = {
|
export type CommandArgumentOption<A> = {
|
||||||
name: string
|
name: string
|
||||||
isCurrent?: boolean
|
isCurrent?: boolean
|
||||||
|
disabled?: boolean
|
||||||
value: A
|
value: A
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user