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 contracts types update #3456

Merged
merged 1 commit into from
Sep 25, 2024
Merged

Fix contracts types update #3456

merged 1 commit into from
Sep 25, 2024

Conversation

0oM4R
Copy link
Contributor

@0oM4R 0oM4R commented Sep 25, 2024

fix project name to be dedicated to the passed module name

Description

what was the issue ?
In deployment list, all contracts got overwritten to be of type vm
The cause : while migrating machines of type FullVM from old playground, we are setting moduleName to FullVm.

module.moduleName = "Fullvm"; // Load old deployments that deployed with `Fullvm` type.

but this module name is not exist on moduleNames enum,
then while listing the contracts we map the passed module name to the moduleNames enum, so the result is undefined,
const moduleName = modulesNames[this.moduleName];

and call list function with type undefine
let contracts = await this.tfClient.contracts.listMyNodeContracts({
graphqlURL: this.config.graphqlURL,
type: moduleName,
projectName: moduleName === "network" ? "" : this.projectName,
});

so in this case all contract on that project name got listed as the listing function checks for the passed type which is in this case undefined so we are listing all the contracts on this project name
if (options.type) {
// eslint-disable-next-line no-useless-escape
filterQuery += `{ deploymentData_contains: \"\\\"type\\\":\\\"${options.type}\\\"\" },`;
}

so the expected to list the contracts with type FullVm then change its type to vm but now we are listing all contracts on the project name then overwrite its type to be vm

Changes

add nullish coalescing operator to make sure the module name never got undefined if it failed to map

Related Issues

Tested Scenarios

  • deployed vm, wait for it to got listed in the deployment list, check the network contract type
  • use grid.networks.list to list my contracts

Documentation PR

For UI changes, Please provide the Documetation PR on info_grid

Checklist

  • Tests included
  • Build pass
  • Documentation
  • Code format and docstrings
  • Screenshots/Video attached (needed for UI changes)

fix project name to be dedicated to the passed module name
zaelgohary
zaelgohary previously approved these changes Sep 25, 2024
Copy link
Contributor

@zaelgohary zaelgohary left a comment

Choose a reason for hiding this comment

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

Works fine.

image

@zaelgohary zaelgohary dismissed their stale review September 25, 2024 10:19

Found an issue

Copy link
Contributor

@zaelgohary zaelgohary left a comment

Choose a reason for hiding this comment

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

I deployed a Gitea instance and it's still shown as VM.

image

@0oM4R
Copy link
Contributor Author

0oM4R commented Sep 25, 2024

I deployed a Gitea instance and it's still shown as VM.

image

sorry my mistake added the wrong issue, the issue will be fixed on #3423

Copy link
Contributor

@zaelgohary zaelgohary left a comment

Choose a reason for hiding this comment

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

Tested deleting a deployment and its network deleted as well. Good job, @0oM4R!

@0oM4R 0oM4R merged commit c573f1a into development Sep 25, 2024
9 checks passed
@0oM4R 0oM4R added this to the 2.6.0 milestone Sep 25, 2024
@Mahmoud-Emad Mahmoud-Emad deleted the development_fix_migration branch September 26, 2024 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants