Skip to content

Commit

Permalink
standby node err msgs & toast (#3769)
Browse files Browse the repository at this point in the history
* add error messages based on standby node reserve, add toast on standby node reserve

* use nodestatus enum
  • Loading branch information
amiraabouhadid authored Dec 29, 2024
1 parent 3765111 commit 1706aff
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

<script lang="ts">
import type { NodeInfo } from "@threefold/grid_client";
import type { Farm } from "@threefold/gridproxy_client";
import { type Farm, type NodeStats, NodeStatus } from "@threefold/gridproxy_client";
import type AwaitLock from "await-lock";
import isInt from "validator/lib/isInt";
import { onUnmounted, type PropType, ref, watch } from "vue";
Expand Down Expand Up @@ -140,8 +140,13 @@ export default {
}
switch (true) {
case node.status === "down":
case node.status === NodeStatus.Down:
throw `Node ${nodeId} is down`;
case node.status === NodeStatus.Standby && node.rentedByTwinId !== gridStore.client.twinId:
throw `You must reserve node ${nodeId} in order to be able to deploy on it`;
case node.status === NodeStatus.Standby && node.rentedByTwinId === gridStore.client.twinId:
throw `Please wait until node ${nodeId} status is up`;
case props.filters.certified && node.certificationType.toLowerCase() !== "certified":
throw `Node ${nodeId} is not Certified`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ export default {
createCustomToast("Transaction Submitted", ToastType.info);
await grid?.nodes.reserve({ nodeId: +props.node.nodeId });
createCustomToast(`Transaction succeeded node ${props.node.nodeId} Reserved`, ToastType.success);
if (props.node.status === "standby") {
createCustomToast(`It might take a while for node ${props.node.nodeId} status to be up`, ToastType.warning);
}
notifyDelaying();
disableButton.value = true;
setTimeout(() => {
Expand Down

0 comments on commit 1706aff

Please sign in to comment.