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

Let Select Provision Template screen use GTL #4509

Merged
merged 17 commits into from
Nov 28, 2018

Conversation

PanSpagetka
Copy link
Contributor

@PanSpagetka PanSpagetka commented Aug 21, 2018

When navigate to Compute -> Cloud -> Instances -> Provision with public images enabled, UI breaks down. It was caused by trying to load and display all Templates in single table. When rewritten using GTL, table is now paginated and lazy loading record for each page.

Links

https://bugzilla.redhat.com/show_bug.cgi?id=1610927
ManageIQ/manageiq#17884 & ManageIQ/manageiq#18217

Screenshot

New screenshot, without checkboxes
screenshot from 2018-11-06 13-47-36

Steps for Testing/QA

You need to run bin/webpack in ui-classic directory

  1. Add an ec2 provider with public images enabled
  2. Go to Compute -> Cloud -> Instances
  3. Select provision an instance

Try more provision screens, to be sure nothing is broken.

Backend PR needs to be merged first

@PanSpagetka
Copy link
Contributor Author

@himdel @karelhala please look at it :)

@PanSpagetka
Copy link
Contributor Author

PanSpagetka commented Aug 23, 2018

@miq-bot add_label gtls
@miq-bot add_label pending core

@miq-bot miq-bot added the gtls label Aug 23, 2018
@miq-bot
Copy link
Member

miq-bot commented Aug 23, 2018

@PanSpagetka Cannot apply the following label because they are not recognized: pending_core

@PanSpagetka PanSpagetka force-pushed the bz-1610927 branch 2 times, most recently from 6499ea6 to 7e13606 Compare August 23, 2018 08:00
@PanSpagetka
Copy link
Contributor Author

@miq-bot add_label pending core

@himdel
Copy link
Contributor

himdel commented Aug 27, 2018

I haven't tested this, pending core, but LGTM. As far as I know, this is the first time we need to select a line in gtl (other than checkboxes).

%tbody
- @vms.each do |row|
- if row.respond_to?(:volume_template?) || row.respond_to?(:volume_snapshot_template?)
= render :partial => "miq_request/pre_prov_volumes_snapshots", :locals => {:row => row}
Copy link
Member

Choose a reason for hiding this comment

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

@PanSpagetka these partials can be removed as well. This was their only usage

Copy link
Member

@romanblanco romanblanco left a comment

Choose a reason for hiding this comment

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

Before:

screenshot_2018-09-20 manageiq instances 1

After:
screenshot_2018-09-20 manageiq instances

@PanSpagetka the checkboxes shouldn't be present in the GTL table

Copy link
Contributor

@karelhala karelhala left a comment

Choose a reason for hiding this comment

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

Looks good! Just don't include the pack if it's namaed *-common.

@@ -7,3 +7,4 @@
:ajax_buttons => true,
:continue_button => true,
:noreset => true})
= javascript_pack_tag "manageiq-ui-classic/toolbar-actions-common"
Copy link
Contributor

Choose a reason for hiding this comment

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

If your pack is named *-common you don't have to import it, it's imported automatically.

@JPrause
Copy link
Member

JPrause commented Oct 11, 2018

@miq-bot add_label blocker

@h-kataria
Copy link
Contributor

@PanSpagetka only a single template or Image is allowed to be selected on Pre-Provisioning screen, so i don't think we need Select All Checkbox on the screen and also need to make sure to enable/disable "Continue" button only when single item is selected.

@JPrause
Copy link
Member

JPrause commented Oct 25, 2018

@PanSpagetka as this for a blocker issue, do you have an update on this PR.

@PanSpagetka
Copy link
Contributor Author

@miq-bot remove_label pending core

@himdel himdel closed this Nov 1, 2018
@himdel himdel reopened this Nov 1, 2018
Copy link
Member

@romanblanco romanblanco left a comment

Choose a reason for hiding this comment

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

ReferenceError: "provisioningListenToRx is not defined" error after clicking the "Provision Instances" button

@PanSpagetka PanSpagetka closed this Nov 5, 2018
@PanSpagetka PanSpagetka reopened this Nov 5, 2018
@himdel
Copy link
Contributor

himdel commented Nov 5, 2018

@PanSpagetka you probably need this for the JS specs to pass:

diff --git a/spec/javascripts/support/jasmine.yml b/spec/javascripts/support/jasmine.yml
index 83de8be4d..86757641a 100644
--- a/spec/javascripts/support/jasmine.yml
+++ b/spec/javascripts/support/jasmine.yml
@@ -23,6 +23,7 @@ src_files:
 - __spec__/helpers/toolbar.js
 - packs/manageiq-ui-classic/application-common.js
 - packs/manageiq-ui-classic/toolbar-actions-common.js
+- packs/manageiq-ui-classic/provisioning-actions-common.js
 
 # stylesheets
 #

Not sure what's happening with ruby specs..

%w(auth_key_pair_cloud availability_zone cloud_tenant ems_cloud host_aggregate orchestration_stack vm_cloud).include?(request.parameters[:controller])
'ProvisionCloudTemplates.yaml'
elsif request.parameters[:template_klass] == 'infra' ||
%w(ems_cluster ems_infra host resource_pool storage vm_infra)
Copy link
Contributor

Choose a reason for hiding this comment

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

missing include?(something)

@miq-bot
Copy link
Member

miq-bot commented Nov 27, 2018

Some comments on commits PanSpagetka/manageiq-ui-classic@0491563~...b6a0e6f

spec/controllers/vm_cloud_controller_spec.rb

  • ⚠️ - 177 - Detected expect_any_instance_of. This RSpec method is highly discouraged, please only use when absolutely necessary.

@miq-bot
Copy link
Member

miq-bot commented Nov 27, 2018

Checked commits PanSpagetka/manageiq-ui-classic@0491563~...b6a0e6f with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
10 files checked, 1 offense detected

**

  • 💣 💥 🔥 🚒 - Linter/Haml - Linter::Haml STDERR:
warning: parser/current is loading parser/ruby23, which recognizes
warning: 2.3.6-compliant syntax, but you are running 2.3.3.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.

%w(auth_key_pair_cloud availability_zone cloud_tenant ems_cloud host_aggregate orchestration_stack vm_cloud).include?(request.parameters[:controller])
'ProvisionCloudTemplates.yaml'
elsif request.parameters[:template_klass] == 'infra' ||
%w(ems_cluster ems_infra host resource_pool storage vm_infra).include?(request.parameters[:controller])
Copy link
Contributor

Choose a reason for hiding this comment

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

one of these lines is badly indented, either 1067 or 1070 ;)

sendDataWithRx({
type: 'GTL_CLICKED',
actionType: this.initObject.additionalOptions.custom_action.type,
payload: { item: item, action: this.initObject.additionalOptions.custom_action }});
Copy link
Contributor

@himdel himdel Nov 28, 2018

Choose a reason for hiding this comment

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

eslint should complain here, should be

sendDataWithRx({
  type: 'GTL_CLICKED',
  actionType: this.initObject.additionalOptions.custom_action.type,
  payload: {
    item: item,
    action: this.initObject.additionalOptions.custom_action,
  },
});

EDIT: #5003

var selectedItem = _.find(this.gtlData.rows, {long_id: item.long_id});
selectedItem.selected = true;
this.$window.sendDataWithRx({rowSelect: selectedItem});
ManageIQ.gridChecks = [];
Copy link
Contributor

@himdel himdel Nov 28, 2018

Choose a reason for hiding this comment

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

extra space before []

EDIT: #5003

@@ -173,6 +173,22 @@
expect(response.status).to eq(200)
end

it 'renders gtl when open pre provision screen' do
Copy link
Contributor

Choose a reason for hiding this comment

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

we should probably have a similar test in vm_infra

@himdel
Copy link
Contributor

himdel commented Nov 28, 2018

Testing in UI:

  • vm_infra

    • Compute > Infra > VMs, Lifecycle > Provision
    • sorting works on all fields
    • paging works
    • seeing the same templates
    • seeing the same columns
    • same values (different format for memory, was 1GB, now 1,073,741,824)
  • vm_cloud

    • Compute > Cloud > Instances, Lifecycle > Provision
    • sorting works on all fields
    • paging works
    • hide deprecated works
    • seeing the same images
    • seeing the same columns
    • but different values (slightly, see comment below)

Nested lists:

auth_key_pair_cloud - redirects to /miq_request/pre_prov?template_klass=cloud 👍
availability_zone - redirects to /miq_request/pre_prov?template_klass=cloud 👍
cloud_tenant - redirects to /miq_request/pre_prov?template_klass=cloud 👍
ems_cloud - redirects to /miq_request/pre_prov?template_klass=cloud 👍
host_aggregate - redirects to /miq_request/pre_prov?template_klass=cloud 👍
orchestration_stack - redirects to /miq_request/pre_prov?template_klass=cloud 👍

ems_cluster - redirects to /miq_request/pre_prov?template_klass=infra 👍
ems_infra - redirects to /miq_request/pre_prov?template_klass=infra 👍
host - redirects to /miq_request/pre_prov?template_klass=infra 👍
resource_pool - redirects to /miq_request/pre_prov?template_klass=infra 👍
storage - redirects to /miq_request/pre_prov?template_klass=infra 👍

@himdel
Copy link
Contributor

himdel commented Nov 28, 2018

The different values for cloud:

name, type, OS, platform, provider - always match

cpu - there used to be a distinction between 0 and N/A, now it's 0 in both cases (but not sure how meaningful that distinction is in the first place)

memory - the same as cpu, plus when it was not N/A, you'd get "0 bytes", not 0.

disk size - N/A now looks as ""

deprecated - was "false", "N/A" or "true", now it's "", "N/A" or "true" (so false becomes an empty string)

snapshot - N/A becomes 0

tenant - N/A becomes ""


I have no idea what the 0 vs "" vs N/A distinction really means (how is a template with 0 memory different from a template with N/A memory), and it doesn't seem documened, so maybe those differences don't matter.

The one that does look like a bug is that "false" to "" change in deprecated, any chance that can be fixed?

@himdel
Copy link
Contributor

himdel commented Nov 28, 2018

Another change is that sorting is now case-insensitive (so "CentOS Atomic" goes after "centos-6" now, and not before), but that matches all the other screens 👍

@himdel
Copy link
Contributor

himdel commented Nov 28, 2018

Ok, so with ManageIQ/manageiq#18237, I'm not seeing anything surprising anymore 👍

The memory format change seems inevitable, as I'm not aware of a way to sort by the field numerically but present in in a human-readable form with the current GTL implementation. We can probably fix that later if desired.

(In the miq_request screen, there is no hide deprecated button, even when template_klass=cloud. But thats also present on master.)

@himdel
Copy link
Contributor

himdel commented Nov 28, 2018

OK, looks like there are no more reasons to hold off merging :).

@himdel himdel merged commit 3b71ea1 into ManageIQ:master Nov 28, 2018
@himdel himdel added this to the Sprint 100 Ending Dec 3, 2018 milestone Nov 28, 2018
simaishi pushed a commit that referenced this pull request Nov 28, 2018
Let Select Provision Template screen use GTL

(cherry picked from commit 3b71ea1)

https://bugzilla.redhat.com/show_bug.cgi?id=1610927
@simaishi
Copy link
Contributor

Hammer backport details:

$ git log -1
commit 1e43eb18b956e15c717407a363dfc029a8dab979
Author: Martin Hradil <himdel@seznam.cz>
Date:   Wed Nov 28 15:18:50 2018 +0100

    Merge pull request #4509 from PanSpagetka/bz-1610927
    
    Let Select Provision Template screen use GTL
    
    (cherry picked from commit 3b71ea1e57c239245b43200a733e2fda4f357717)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1610927

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.

9 participants