From c776d6aca4ed3e979f9aa4c52ba889a1a644f1eb Mon Sep 17 00:00:00 2001 From: zaelgohary Date: Tue, 25 Jun 2024 11:31:03 +0300 Subject: [PATCH] Create VM interface, Fix typos --- packages/playground/src/utils/types.ts | 32 +++++++++++++++++++ .../playground/src/weblets/tf_node_pilot.vue | 7 ++-- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/packages/playground/src/utils/types.ts b/packages/playground/src/utils/types.ts index 881c7398fa..77b4d20c09 100644 --- a/packages/playground/src/utils/types.ts +++ b/packages/playground/src/utils/types.ts @@ -14,3 +14,35 @@ export interface IPublicConfig { gw6?: string; domain?: string; } + +export interface VM { + version: number; + contractId: number; + nodeId: number; + name: string; + created: number; + status: string; + message: string; + flist: string; + publicIP: string; + planetary: string; + myceliumIP: string; + interfaces: { + network: string; + ip: string; + }[]; + capacity: { + cpu: number; + memory: number; + }; + mounts: any[]; + env: { + SSH_KEY: string; + }; + entrypoint: string; + metadata?: any; + description?: any; + rootfs_size: number; + corex: boolean; + gpu: any[]; +} diff --git a/packages/playground/src/weblets/tf_node_pilot.vue b/packages/playground/src/weblets/tf_node_pilot.vue index a3a74f7ed9..eb86d4446c 100644 --- a/packages/playground/src/weblets/tf_node_pilot.vue +++ b/packages/playground/src/weblets/tf_node_pilot.vue @@ -125,7 +125,7 @@ async function deploy() { ? selectionDetails.value.domain.customDomain : subdomain + "." + selectionDetails.value?.domain?.selectedDomain?.publicConfig.domain; - let vm: any; + let vm: VM; try { layout.value?.validateSSH(); @@ -178,8 +178,6 @@ async function deploy() { try { layout.value.setStatus("deploy", "Preparing to deploy gateway..."); - console.log("vm[0]", vm[0]); - await deployGatewayName(grid, selectionDetails.value.domain, { subdomain, ip: vm[0].interfaces[0].ip, @@ -192,7 +190,7 @@ async function deploy() { layout.value.setStatus("deploy", "Rollbacking back due to fail to deploy gateway..."); await rollbackDeployment(grid!, name.value); - layout.value.setStatus("failed", normalizeError(e, "Failed to deploy a Casperlabs instance.")); + layout.value.setStatus("failed", normalizeError(e, "Failed to deploy a Node Pilot instance.")); } } @@ -212,6 +210,7 @@ import type { SelectionDetails } from "../types/nodeSelector"; import { deployGatewayName, getSubdomain, rollbackDeployment } from "../utils/gateway"; import { updateGrid } from "../utils/grid"; import { normalizeError } from "../utils/helpers"; +import { VM } from "../utils/types"; export default { name: "NodePilot",