diff --git a/packages/playground/src/components/node_selector/TfAutoNodeSelector.vue b/packages/playground/src/components/node_selector/TfAutoNodeSelector.vue index abd4e6f3e9..be17914bca 100644 --- a/packages/playground/src/components/node_selector/TfAutoNodeSelector.vue +++ b/packages/playground/src/components/node_selector/TfAutoNodeSelector.vue @@ -148,8 +148,8 @@ import { RequestError } from "@threefold/types"; import type AwaitLock from "await-lock"; import equals from "lodash/fp/equals.js"; import { computed, nextTick, onMounted, onUnmounted, type PropType, ref } from "vue"; -// eslint-disable-next-line @typescript-eslint/no-unused-vars -import type { VCard } from "vuetify/components/VCard"; + +import { normalizeError } from "@/utils/helpers"; import { useAsync, usePagination, useWatchDeep } from "../../hooks"; import { ValidatorStatus } from "../../hooks/form_validator"; @@ -167,7 +167,6 @@ import { validateRentContract, } from "../../utils/nodeSelector"; import TfNodeDetailsCard from "./TfNodeDetailsCard.vue"; - export default { name: "TfAutoNodeSelector", components: { TfNodeDetailsCard }, @@ -299,14 +298,29 @@ export default { const nodeInputValidateTask = useAsync( async node => { - if (node && node?.rentContractId !== 0) { - const { state } = await gridStore.grid.contracts.get({ - id: node?.rentContractId, - }); - if (state.gracePeriod) { - return false; + try { + if (node && node.rentContractId !== 0) { + const { state } = await gridStore.grid.contracts.get({ + id: node?.rentContractId, + }); + if (state.gracePeriod) { + const err = `You can't deploy on node ${node.nodeId}, its rent contract is in grace period.`; + await new Promise((_, reject) => { + setTimeout(() => { + reject(Error(err)); + }, 2000); + }); + console.error(err); + } } + } catch (error) { + const err = normalizeError( + error, + "Something went wrong while checking status of the node. Please check your connection and try again.", + ); + throw err; } + const nodeCapacityValid = await checkNodeCapacityPool(gridStore, node, props.filters); const rentContractValid = props.filters.dedicated ? await validateRentContract(gridStore, node) : true; diff --git a/packages/playground/src/utils/nodeSelector.ts b/packages/playground/src/utils/nodeSelector.ts index 1a87bacf80..1229bc1457 100644 --- a/packages/playground/src/utils/nodeSelector.ts +++ b/packages/playground/src/utils/nodeSelector.ts @@ -19,7 +19,6 @@ import type { SelectionDetailsFilters, SelectionDetailsFiltersValidators, } from "../types/nodeSelector"; -import { createCustomToast, ToastType } from "./custom_toast"; import { normalizeError } from "./helpers"; export interface GetLocationsConfig { @@ -229,10 +228,13 @@ export async function validateRentContract( id: node.rentContractId, }); if (contractInfo.state.gracePeriod) { - createCustomToast( - `You can't deploy on node ${node.nodeId}, its rent contract is in grace period.`, - ToastType.danger, - ); + const err = `You can't deploy on node ${node.nodeId}, its rent contract is in grace period.`; + await new Promise((_, reject) => { + setTimeout(() => { + reject(Error(err)); + }, 2000); + }); + console.error(err); } }