Skip to content

Sort list of templates, serviceOfferings, diskOfferings etc in the deploy VM wizard - #3336

Merged
yadvr merged 3 commits into
apache:masterfrom
smlshn:ui-sorted-templates-in-vmwizard
Jul 4, 2019
Merged

Sort list of templates, serviceOfferings, diskOfferings etc in the deploy VM wizard#3336
yadvr merged 3 commits into
apache:masterfrom
smlshn:ui-sorted-templates-in-vmwizard

Conversation

@smlshn

@smlshn smlshn commented May 17, 2019

Copy link
Copy Markdown
Contributor

Description

Adds functionality to sort the data that is available on each in the deploy VM wizard's step by their suitable fields i.e

  • templates by name
  • serviceOfferings by cpuspeed
  • diskOfferings by disksize
  • affinityGroups by name
  • sshkeyPairs by name
  • network:
    • vpcs by name
    • networkOfferings by name

Fixes: #3050

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)

Screenshots (if appropriate):

  • sorted compute offerings

Screen Shot 2019-05-18 at 02 24 53

  • sorted disk offerings

Screen Shot 2019-05-18 at 02 24 58

  • sorted networks

Screen Shot 2019-05-18 at 02 25 09

How Has This Been Tested?

Run client
Instances > Add Instance
See previous non sorted data in the browser's console
After sort function run see sorted data in the browser's console
See sorted results in the deploy VM wizard as well

…ps, sshkeyPairs, vpcs, networkOfferings in the deploy VM wizard
@ustcweizhou

Copy link
Copy Markdown
Contributor

LGTM

@anuragaw anuragaw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This overrides the order in which we set the "sort_key" param is used by backend to return a pre-configured list of entities. That is not desirable.

For templates we don't support sort_key on backend yet and hence we need to sort alphabetically for the time being.

CC/ @rhtyd , @rafaelweingartner , @borisstoyanov

@smlshn

smlshn commented May 26, 2019

Copy link
Copy Markdown
Contributor Author

This overrides the order in which we set the "sort_key" param is used by backend to return a pre-configured list of entities. That is not desirable.

For templates we don't support sort_key on backend yet and hence we need to sort alphabetically for the time being.

CC/ @rhtyd , @rafaelweingartner , @borisstoyanov

Actually I think that might be more efficient however in Templates view table there is a column that "Order". Order function does not work right now but if I add sort functionality which sort every result by name, than this might be misleading. One may think it is done in purpose.

Beside, the change is not only about sorting the templates in Create VM screen. diskOfferings, vmtemplates etc all need to be sorted as well.
Screen Shot 2019-05-26 at 22 00 30

@yadvr yadvr added this to the 4.13.0.0 milestone May 27, 2019
@yadvr

yadvr commented May 27, 2019

Copy link
Copy Markdown
Member

Some resources have a sort order defined, it's not right to enforce general alphabetical order.

@yadvr

yadvr commented May 27, 2019

Copy link
Copy Markdown
Member

@anuragaw can you advise which resources are sortable from backend (i..e have a sort order), for rest this PR can be used.

@anuragaw

anuragaw commented Jun 19, 2019

Copy link
Copy Markdown
Contributor

apologies - lost track of this due to misconfigured github notification, and will update the list of resources before end of day tomorrow. Alternately one can search for "sortKey" API Param in updateXXX API calls to find an exhaustive list of resources that support this custom sorting.

@yadvr
yadvr changed the base branch from 4.11 to master June 20, 2019 17:46
@anuragaw

Copy link
Copy Markdown
Contributor

I am afraid most of the entities targetted in the PR description have their own sortkey fields now in code after some recent PRs EXCEPT below-

  1. affinityGroups
  2. ISOs
  3. sshkeyPairs by name
  4. network: vpcs by name & networkOfferings by name

@yadvr yadvr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@smlshn there were other PRs that implement a sortOrder feature for various entities, can you fix your PR to only sort for the following resources:

  • affinityGroups by name
  • sshkeyPairs by name
  • network: vpcs by name, networkOfferings by name

@yadvr yadvr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sort order enforced only for
affinityGroups by name
sshkeyPairs by name
network: vpcs by name, networkOfferings by name

@yadvr

yadvr commented Jul 3, 2019

Copy link
Copy Markdown
Member

Ping @anuragaw @shwstppr can you review and test this. Thanks.

@shwstppr shwstppr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. Tested locally, working for desired entities.

@anuragaw anuragaw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One possible removal.

Comment thread ui/scripts/ui-custom/instanceWizard.js Outdated

$vpcSelect.val(-1);

sortArrayByKey(args.data.networkOfferings, 'name');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Network offerings also has a support for sort_key param in database. We should not sort this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I had missed this earlier in my list. Apologies for that.

@anuragaw anuragaw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM but had minor suggestion.

@yadvr
yadvr merged commit f3aa147 into apache:master Jul 4, 2019
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.

Sort list of templates in the deploy VM wizard

6 participants