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

Add textual summary for orchestration_stack on the service summary page #12954

Conversation

lgalis
Copy link
Contributor

@lgalis lgalis commented Dec 1, 2016

Depends on #13089

Handle empty orchestration stack link in the service summary page.
A service for RHOS can contain an empty orchestration stack. This PR changes the summary page for the service to handle this.

Links

https://bugzilla.redhat.com/show_bug.cgi?id=1394485

Steps for Testing

1.Create a Service for RHOS using a non-existing stack name
2.The link for the stack in the service's summary page is invalid - this PR removes the link

Before:
screenshot from 2016-12-07 16-07-38

After:

screenshot from 2016-12-07 16-02-49

@lgalis
Copy link
Contributor Author

lgalis commented Dec 1, 2016

@miq-bot add_label wip, ui, bug

@lgalis lgalis force-pushed the orchestration_stack_detail_in_service_summary_page branch 6 times, most recently from 49c0ad9 to 5394138 Compare December 7, 2016 21:16
@lgalis
Copy link
Contributor Author

lgalis commented Dec 7, 2016

@miq-bot remove_label wip

@lgalis lgalis changed the title [WIP] Add textual summary for orchestration_stack on the service summary page Add textual summary for orchestration_stack on the service summary page Dec 7, 2016
@miq-bot miq-bot removed the wip label Dec 7, 2016
@martinpovolny
Copy link
Member

@lgalis : I have to confess that I don't like the place where this is being fixed.

Could we solve this using a decorator?

@himdel, what do you think?

expect(textual_orchestration_stack).to eq(@os_cloud)
end

it 'contains the link to the associated stack' do
Copy link
Contributor

Choose a reason for hiding this comment

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

the description is the same for both cases, can you add cloud & infra to the descriptions so that they differ please?

@martinpovolny
Copy link
Member

Ok, looking around, it's probably ok to do it this way.

But the specs look strange. @skateman : can you, pls, tell how to fix the specs here?

@himdel
Copy link
Contributor

himdel commented Dec 8, 2016

Could we solve this using a decorator?

It feels weird that a non-nil orchestration stack is returned in the first place.

But assuming that's the correct behaviour, yup, decorators would be perfect for the job :). But.. it would be the first textual-summary-related use of decorators in miq, so not sure if now..


subject { textual_orchestration_stack }
it 'contains the link to the associated stack' do
@os_cloud = FactoryGirl.create(:orchestration_stack_cloud, :name => "cloudstack1")
Copy link
Member

Choose a reason for hiding this comment

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

Using instance variables here doesn't make any sens, could you export this to let blocks combined with contexts. Something like this:

subject { FactoryGirl.create(cloud, :name => name) }
context "openstack-cloud" do
  let(:cloud) { :orchestration_stack_cloud }
  let(:name) { 'cloudstack1' }
  it 'contains the link to the associated stack' do
    # expect(subject...)
  end
end
context "openstack-infra" do
  let(:cloud) { :orchestration_stack_openstack_infra }
  let(:name) { 'infrastack1' }  
  it 'contains the link to the associated stack' do
    # expect(subject...)
  end
end
# ...

@lgalis lgalis force-pushed the orchestration_stack_detail_in_service_summary_page branch from 5394138 to e5d00bb Compare December 12, 2016 23:10
if ost && !ost.id.present?
{
:label => _("Orchestration Stack"),
:image => "orchestration_stack",
Copy link
Contributor

Choose a reason for hiding this comment

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

@lgalis the format of the images in textual summaries will change with #13089 .. so depending on which gets merged first, you may need to do :image => "100/orchestration_stack.png"

@lgalis lgalis force-pushed the orchestration_stack_detail_in_service_summary_page branch from e5d00bb to 82337cd Compare December 13, 2016 15:12
@lgalis
Copy link
Contributor Author

lgalis commented Dec 13, 2016

@himdel - thanks - I modified the image and edit a note in the description of this PR that it depends on #13089

end

subject { textual_orchestration_stack }
it 'contains the link to the associated stack' do
Copy link
Member

Choose a reason for hiding this comment

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

Why are you using the same it twice in the same context? Please create a nested-context for both cases.

let(:os_infra) { FactoryGirl.create(:orchestration_stack_openstack_infra, :name => "infrastack1") }

before do
login_as @user = FactoryGirl.create(:user)
Copy link
Member

Choose a reason for hiding this comment

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

Unused instance variable @user

@@ -0,0 +1,30 @@
describe ServiceHelper::TextualSummary do
context ".textual_orchestration_stack" do
Copy link
Member

Choose a reason for hiding this comment

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

here you want describe instead of context

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@skateman - I have changed it - but I do not really agree - context is an alias of describe - and usually - describe wraps the user story, and context the individual scenario. We, as a team -can decide on a set of guidelines for how we mark our specs.

subject { textual_orchestration_stack }
it 'contains the link to the associated stack' do
@record = FactoryGirl.create(:service)
allow(@record).to receive(:orchestration_stack).and_return(os_cloud)
Copy link
Member

Choose a reason for hiding this comment

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

you don't need instance variables here using record is fine

Copy link
Contributor Author

@lgalis lgalis Dec 13, 2016

Choose a reason for hiding this comment

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

@skateman - the instance variable is actually needed - textual summary uses @record

@lgalis lgalis force-pushed the orchestration_stack_detail_in_service_summary_page branch from 82337cd to e435886 Compare December 13, 2016 16:19
@lgalis lgalis force-pushed the orchestration_stack_detail_in_service_summary_page branch from e435886 to 063b72f Compare December 13, 2016 16:24
@miq-bot
Copy link
Member

miq-bot commented Dec 13, 2016

Checked commits lgalis/manageiq@367b2a6~...063b72f with ruby 2.2.5, rubocop 0.37.2, and haml-lint 0.16.1
2 files checked, 0 offenses detected
Everything looks good. 🍰

@skateman
Copy link
Member

skateman commented Dec 13, 2016 via email

@dclarizio dclarizio merged commit 9f4bfb1 into ManageIQ:master Dec 20, 2016
@dclarizio dclarizio added this to the Sprint 51 Ending Jan 2, 2017 milestone Dec 20, 2016
@lgalis lgalis deleted the orchestration_stack_detail_in_service_summary_page branch January 6, 2017 18:46
@simaishi
Copy link
Contributor

@lgalis #13089 that this PR depends on is marked as euwe/no. Do you need to create Euwe specific PR?

@himdel
Copy link
Contributor

himdel commented Jan 10, 2017

if it helps, the difference will be

-        :image => "100/orchestration_stack.png",
+        :image => "orchestration_stack",

simaishi pushed a commit that referenced this pull request Jan 11, 2017
…ervice_summary_page

Add textual summary for orchestration_stack on the service summary page
(cherry picked from commit 9f4bfb1)

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

Euwe backport details (fixed image path):

$ git log -1
commit 548b54fe8ed453008e0b1163e60e723e6a263681
Author: Dan Clarizio <dclarizi@redhat.com>
Date:   Tue Dec 20 07:48:40 2016 -0800

    Merge pull request #12954 from lgalis/orchestration_stack_detail_in_service_summary_page
    
    Add textual summary for orchestration_stack on the service summary page
    (cherry picked from commit 9f4bfb1dd2eecd5e8cc49eb87e07ce5525ccccb6)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1411373

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.

7 participants