Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: manual selection validation #3504

Draft
wants to merge 1 commit into
base: development
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
:key="modelValue?.rentedByTwinId"
flat
:node="modelValue || placeholderNode"
@update:node="$emit('update:model-value', $event as any)"
@update:node="
validationTask.run(nodeId);
$emit('update:model-value', $event as any);
"
:status="
validationTask.loading
? 'Pending'
Expand Down Expand Up @@ -53,7 +56,7 @@

<script lang="ts">
import type { NodeInfo } from "@threefold/grid_client";
import type { Farm } from "@threefold/gridproxy_client";
import { type Farm, 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,9 +143,18 @@ export default {
}

switch (true) {
case node.status === "down":
case node.status === NodeStatus.Down:
throw `Node ${nodeId} is down`;

case node.status === NodeStatus.Standby:
throw `Node ${nodeId} is standby`;

case props.filters.dedicated && !node.rented:
throw `Node ${nodeId} is Dedicated, but you have to reserve it first.`;

case node.dedicated && !node.rented:
throw `Node ${nodeId} is dedicated node; you have to reserve it first.`;

case props.filters.certified && node.certificationType.toLowerCase() !== "certified":
throw `Node ${nodeId} is not Certified`;

Expand Down
Loading