Skip to content

Conversation

@rafaelweingartner
Copy link
Member

Description

After using the feature introduced by #2486 in production, we felt the need for an improvement in the UI. It is interesting to filter the displayed disk offerings according to the type of storage selected (local/shared) to migrate the volume to.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)

How Has This Been Tested?

Locally

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
    Testing
  • I have added tests to cover my changes.
  • All relevant new and existing integration tests have passed.
  • A full integration testsuite with all test that can run on my environment has passed.

…l selected

After using the feature introduced by apache#2486 in production, we felt the need for an improvement in the UI.  It is interesting to filter the displayed disk offerings according to the type of storage selected (local/shared) to migrate the volume to.
@rafaelweingartner rafaelweingartner force-pushed the filterDiskOfferingMigrateVolumeApi branch from 3e7bf4f to 094a9e3 Compare April 28, 2018 02:23
return array;
}

cloudStack.listDiskOfferings = function(options){
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @rafaelweingartner, This is a great improvement. I came across several places where the same AJAX call(Code) is repeated multiple places. We should put more of this to reduce redundancy. Thanks.

var diskOfferings = undefined;
$.ajax({
url: createURL(listDiskOfferingsUrl),
data: mergedOptions.data,
Copy link
Contributor

Choose a reason for hiding this comment

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

For some calls, we don't pass 'data' in the parameter list. For e.g. [var diskOfferings = cloudStack.listDiskOfferings({listAll: true});]

I think, it would be better if we check the existance of the parameter before assigning.

Copy link
Member Author

Choose a reason for hiding this comment

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

I am not checking the existence of mergedOptions.data before ahe ssignment because the result would be the same. I mean, if mergedOptions.data is undefined, than the object data was not provided. Therefore, the object data in the ajax function will have the value undefined. If I add an IF condition and decide to assign data based on the existence of mergedOptions.data; then, when mergedOptions.data == undefined (I would not assign it), the data object of ajax would also be undefined. The result is the same, and thus there is no reason to add extra code.

Was my explanation clear?

Copy link
Contributor

Choose a reason for hiding this comment

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

@rafaelweingartner, Got it. Thanks.

Copy link
Contributor

@borisstoyanov borisstoyanov left a comment

Choose a reason for hiding this comment

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

LGTM, no need to run integration tests since the changes are in ui/

@rafaelweingartner rafaelweingartner merged commit 883b313 into apache:master May 4, 2018
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