Skip to content
Open
Changes from 1 commit
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
15 changes: 15 additions & 0 deletions packages/grid_client/src/high_level/twinDeploymentHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,11 @@ class TwinDeploymentHandler {
events.emit("logs", `Check the name contract for the workload with name: ${workload.name}`);
const extrinsic = await this.createNameContract(workload.data["name"]);
nameExtrinsics.push(extrinsic);
} else if (workload.type === WorkloadTypes.gatewayfqdnproxy) {
events.emit("logs", `Check the name contract for the FQDN workload with name: ${workload.name}`);
const contractName = workload.name.replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
const extrinsic = await this.createNameContract(contractName);
nameExtrinsics.push(extrinsic);
}
}
const extrinsic = await this.tfclient.contracts.createNode({
Expand All @@ -492,6 +497,11 @@ class TwinDeploymentHandler {
events.emit("logs", `Check the name contract for the workload with name: ${workload.name}`);
const extrinsic = await this.createNameContract(workload.data["name"]);
nameExtrinsics.push(extrinsic);
} else if (workload.type === WorkloadTypes.gatewayfqdnproxy) {
events.emit("logs", `Check the name contract for the FQDN workload with name: ${workload.name}`);
const contractName = workload.name.replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i suggest having this logic in a function and reusing it
to avoid code redundancy, andit will be easier to maintain

const extrinsic = await this.createNameContract(contractName);
nameExtrinsics.push(extrinsic);
}
}
const old_contract = await this.tfclient.contracts.get({ id: twinDeployment.deployment.contract_id });
Expand All @@ -510,6 +520,11 @@ class TwinDeploymentHandler {
events.emit("logs", `Check the name contract for the workload with name: ${workload.name}`);
const extrinsic = await this.deleteNameContract(workload.data["name"]);
if (extrinsic) deletedExtrinsics.push(extrinsic);
} else if (workload.type === WorkloadTypes.gatewayfqdnproxy) {
events.emit("logs", `Check the name contract for the FQDN workload with name: ${workload.name}`);
const contractName = workload.name.replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
const extrinsic = await this.deleteNameContract(contractName);
if (extrinsic) deletedExtrinsics.push(extrinsic);
}
}
const extrinsic = await this.tfclient.contracts.cancel({ id: twinDeployment.deployment.contract_id });
Expand Down