Skip to content

Add more status options#96

Closed
JooNiv wants to merge 7 commits intomasterfrom
master
Closed

Add more status options#96
JooNiv wants to merge 7 commits intomasterfrom
master

Conversation

@JooNiv
Copy link
Member

@JooNiv JooNiv commented Feb 25, 2026

  • Add more status options
    • In addition to healthcheck also get and display status from device info e.g "booked" or "paused"
      • If fetching status from device info fails just display the status from healthcheck
  • Move api base url to src/config.js for quality of life 😄

@JooNiv JooNiv requested a review from Modupef February 25, 2026 11:57
<p className="pb-2"><strong>Basis gates:</strong> {deviceData.basis}</p>
<p className="pb-2"><strong>Topology:</strong> {deviceData.topology}</p>
</div>
const status_options = ["offline", "online", "healthy", "unknown"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In what cases would the device be healthy and not online? Or what do these different status represent?

Copy link
Collaborator

@Modupef Modupef Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe :["offline", "online", "maintenance", "booked", "unknown"] instead?

const isOnline = props.health;
const { onClick, ...rest } = props

const status_options = ["offline", "online", "healthy", "unknown"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as the comment above

const { bookingData: bookingData } = useBookings(`${API_BASE_URL}/bookings`)
const qcs = Array.isArray(props["quantum-computers"]) ? props["quantum-computers"] : [];
const qcsKey = useMemo(
() => qcs.map(d => d?.device_id?.toLowerCase()).filter(Boolean).sort().join('|'),
Copy link
Collaborator

@Modupef Modupef Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is d in this case? Maybe device or dev instead of d. It's clearer


qcs.forEach((device) => {
const id = device.device_id.toLowerCase();
fetch(`${API_BASE_URL}/device/${id}`)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why fetch for each. why not fetch everything and the filter based on the id?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fetching separately because the backend currently has no endpoint for fetching all the devices. Would probably be smart to add one tho

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's pretty easy to add since we are fetching the list once and then filtering on the backend. We can just add a route to return all or update the controller to return all if no device id is given, otherwise return info for the given device

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup

const handleCardClick = (qc) => {
setModalProps({ ...qc, devicesWithStatus });

const add_device_status = devicesWithStatus.map(d => d.device_id.toLowerCase() === qc.device_id.toLowerCase() ? { ...d, device_status: device_status_list?.[qc.device_id.toLowerCase()] || "unknown" } : d);
Copy link
Collaborator

@Modupef Modupef Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also maybe dev or device instead of d? dev for example immediately communicates that the variable is a device. e.g using var instead of using v

);
})
.catch(() => {
if (cancelled) return;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this catch block trying to do?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be redundant now. Lefover from testing and problems with the useEffect running infinitely

@Modupef
Copy link
Collaborator

Modupef commented Feb 27, 2026

Will be replaced with new updates

@Modupef Modupef closed this Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants