diff --git a/packages/grid_client/scripts/single_vm_zos4.ts b/packages/grid_client/scripts/single_vm_zos4.ts index 69162e9ca7..20f2ce3ca7 100644 --- a/packages/grid_client/scripts/single_vm_zos4.ts +++ b/packages/grid_client/scripts/single_vm_zos4.ts @@ -47,7 +47,7 @@ async function main() { ip_range: "10.249.0.0/16", myceliumSeeds: [ { - nodeId: 168, + nodeId: vmNode, /** * ### Mycelium Network Seed: * - The `seed` is an optional field used to provide a specific seed for the Mycelium network. diff --git a/packages/grid_client/src/helpers/types.ts b/packages/grid_client/src/helpers/types.ts index 509c3a039d..03e06b3d9b 100644 --- a/packages/grid_client/src/helpers/types.ts +++ b/packages/grid_client/src/helpers/types.ts @@ -1,4 +1,4 @@ -import { PublicIPResult, ResultStates } from "../zos"; +import { PublicIPResult, ResultStates, WorkloadTypes } from "../zos"; interface NetworkInterface { /** The network identifier */ @@ -44,12 +44,29 @@ interface ExtendedMountData extends Partial { // Union type for the mount data type MountData = BaseMountData | ExtendedMountData; - +enum Features { + ipv4 = "ipv4", + ip = "ip", + mycelium = "mycelium", + wireguard = "wireguard", + yggdrasil = "yggdrasil", + gatewayfqdnproxy = "gateway-fqdn-proxy", + gatewaynameproxy = "gateway-name-proxy", + zmachine = "zmachine", + zmount = "zmount", + volume = "volume", + network = "network", + zdb = "zdb", + qsfs = "qsfs", + zlogs = "zlogs", + networklight = "network-light", + zmachinelight = "zmachine-light", +} interface ZmachineData { /** The version of the workload */ version: number; /** The type of the workload */ - type: string; + type: WorkloadTypes; /** The contract ID associated with the workload */ contractId: number; /** The node ID where the workload is deployed */ @@ -114,4 +131,4 @@ interface GatewayDeploymentData { description: string; } -export { ZmachineData, VM, ExtendedMountData, GatewayDeploymentData }; +export { ZmachineData, VM, ExtendedMountData, GatewayDeploymentData, Features }; diff --git a/packages/grid_client/src/high_level/base.ts b/packages/grid_client/src/high_level/base.ts index ab430f023a..513a056049 100644 --- a/packages/grid_client/src/high_level/base.ts +++ b/packages/grid_client/src/high_level/base.ts @@ -63,13 +63,13 @@ class HighLevelBase { } const toRemoveZlogs = deployment.workloads.filter(item => { - const x = item.type === WorkloadTypes.zlogs; - const y = + const zlog = item.type === WorkloadTypes.zlogs; + const workloadtypename = (item.data as any)[type === WorkloadTypes.zmachine ? "zmachine" : "zmachine-light"] === workload.name; - return x && y; + return zlog && workloadtypename; }); - names.push(...toRemoveZlogs.map(x => x.name)); + names.push(...toRemoveZlogs.map(zlog => zlog.name)); if (type === WorkloadTypes.zmachine) { names.push(workload.data["network"].public_ip); @@ -107,7 +107,6 @@ class HighLevelBase { const deletedIps: string[] = []; const deploymentFactory = new DeploymentFactory(this.config); let network: Network | ZNetworkLight | null = null; - let deletedIp; let contract_id; let numberOfIps; @@ -124,7 +123,7 @@ class HighLevelBase { } const machineIp = workload.data["network"].interfaces[0].ip; events.emit("logs", `Deleting ip: ${machineIp} from node: ${node_id}, network ${network.name}`); - deletedIp = network.deleteReservedIp(node_id, machineIp); + const deletedIp = network.deleteReservedIp(node_id, machineIp); if (remainingWorkloads.length === 0) { twinDeployments.push(new TwinDeployment(deployment, Operations.delete, 0, 0, "", network)); } diff --git a/packages/grid_client/src/primitives/networklight.ts b/packages/grid_client/src/primitives/networklight.ts index c54e41f5db..19fa7bb526 100644 --- a/packages/grid_client/src/primitives/networklight.ts +++ b/packages/grid_client/src/primitives/networklight.ts @@ -40,12 +40,11 @@ class ZNetworkLight { static newContracts: GqlNodeContract[] = []; static deletedContracts: number[] = []; rmb: RMB; - wireguardConfig: string; tfClient: TFClient; constructor(public name: string, public ipRange: string, public config: GridClientConfig) { - if (Addr(ipRange).prefix !== 24) { - this.ipRange = Addr(ipRange).mask(24); + if (Addr(ipRange).prefix !== 16) { + this.ipRange = Addr(ipRange).mask(16); this.ipRange = this.ipRange.toString(); } if (!this.isPrivateIP(ipRange)) { diff --git a/packages/grid_client/src/primitives/nodes.ts b/packages/grid_client/src/primitives/nodes.ts index c9f8e84d6a..5e5b91dc9c 100644 --- a/packages/grid_client/src/primitives/nodes.ts +++ b/packages/grid_client/src/primitives/nodes.ts @@ -8,7 +8,7 @@ import urlJoin from "url-join"; import { RMB } from "../clients"; import { Graphql } from "../clients/graphql/client"; -import { formatErrorMessage } from "../helpers"; +import { Features, formatErrorMessage } from "../helpers"; import { send, sendWithFullResponse } from "../helpers/requests"; import { convertObjectToQueryString } from "../helpers/utils"; import { FarmFilterOptions, FilterOptions, MachineModel, NodeStatus } from "../modules/models"; @@ -342,21 +342,21 @@ class Nodes { * @returns A string array representing the node's features. */ getFeaturesFromFilters(options: FilterOptions = {}): string[] { - const features: string[] = []; + const features: string[] = options.features || []; if (options.publicIPs) { - features.push(WorkloadTypes.ipv4); + features.push(Features.ipv4); } if (options.hasIPv6) { - features.push(WorkloadTypes.ip); + features.push(Features.ip); } if (options.wireguard) { - features.push("wireguard"); + features.push(Features.wireguard); } if (options.mycelium) { - features.push("mycelium"); + features.push(Features.mycelium); } if (options.planetary) { - features.push("yggdrasil"); + features.push(Features.yggdrasil); } if (options.gateway) { diff --git a/packages/playground/src/components/manage_gateway_dialog.vue b/packages/playground/src/components/manage_gateway_dialog.vue index c6b71566db..3337b87a01 100644 --- a/packages/playground/src/components/manage_gateway_dialog.vue +++ b/packages/playground/src/components/manage_gateway_dialog.vue @@ -68,8 +68,7 @@ {{ item.name }} - Manage - Domains +