Bug 1564259 - [RFE] Saving a Schedule on Widgets of two different types with the same title does not work
Summary: [RFE] Saving a Schedule on Widgets of two different types with the same title...
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: UI - OPS
Version: 5.9.0
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: GA
: cfme-future
Assignee: Oleg Barenboim
QA Contact: Dave Johnson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-04-05 19:44 UTC by David Luong
Modified: 2021-09-09 13:37 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-01-24 21:29:28 UTC
Category: Bug
Cloudforms Team: CFME Core
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description David Luong 2018-04-05 19:44:09 UTC
Description of problem:
When creating 2 different types of widgets (chart and report), the user can create the widgets with the same title.  However, if you try to save the schedule on the widgets, the schedule does not save, and reports the problem:

  No timer is attached to this Widget, its contents will not be updated. 
  Edit this Widget to configure a timer.

Version-Release number of selected component (if applicable):
5.9

How reproducible:
100%

Steps to Reproduce:
1. Create 2 different types of widgets with same name
2. Save schedule on widgets
3. Schedule doesn't save

Actual results:
Cannot schedule widgets with same name

" No timer is attached to this Widget, its contents will not be updated. 
  Edit this Widget to configure a timer."

Expected results:
Able to save widgets regardless of same name

Additional info:
When going into the rails console, they can confirm the issue:

SET THE WIDGET TITLE WE WANT TO SEARCH FOR
==================================
[root@ip-10-212-31-48 vmdb]# bin/rails c
Loading production environment (Rails 5.0.6)
irb(main):001:0> widget_title = " - Top CPU Offenders by Node Non Prod"
=> "- Top CPU Offenders by Node Non Prod"

GRAB THE WIDGET OBJECT WITH find_by_title (returns only 1 object)
WE GET AN OBJECT THAT DOES HAVE AN MiqSchedule ATTACHED
=============================================
irb(main):002:0> widget_object = MiqWidget.find_by_title(widget_title)
PostgreSQLAdapter#log_after_checkout, connection_pool: size: 5, connections: 1, in use: 1, waiting_in_queue: 0
=> #<MiqWidget id: 10000000000024, guid: "5dc79ca8-9164-4052-af83-2cbf12cefd46", description: "Top CPU Offenders by Node Non Prod", title: " - Top CPU Offenders by Node Non Prod", content_type: "report", options: {:row_count=>5, :col_order=>["resource_name", "cpu_usage_rate_average__avg", "cpu_usage_rate_average__max", "v_derived_cpu_total_cores_used__avg"]}, visibility: {:roles=>["_ALL_"]}, user_id: nil, resource_id: 10000000000151, resource_type: "MiqReport", miq_schedule_id: 10000000000024, enabled: true, read_only: false, created_at: "2018-04-03 22:06:09", updated_at: "2018-04-05 18:25:44", last_generated_content_on: "2018-04-05 18:25:44", miq_task_id: 10000000000935>
irb(main):003:0> widget_object.miq_schedule
=> #<MiqSchedule id: 10000000000024, name: " - Top CPU Offenders by Node Non Prod", description: "Top CPU Offenders by Node Non Prod", sched_action: {:method=>"generate_widget"}, filter: #<MiqExpression:0x000000026cafc8 @exp={"="=>{"field"=>"MiqWidget-id", "value"=>10000000000024}}, @context_type=nil>, towhat: "MiqWidget", run_at: {:start_time=>2018-04-04 21:35:00 UTC, :tz=>"UTC", :interval=>{:unit=>"hourly", :value=>1}}, enabled: true, userid: "system", prod_default: "system", last_run_on: "2018-04-04 20:10:12", created_on: "2018-04-03 22:06:09", updated_at: "2018-04-04 21:28:19", miq_search_id: nil, zone_id: 10000000000002, adhoc: nil, file_depot_id: nil>

NOTICE THAT WE HAVE 2 WIDGETS WITH THE SAME TITLE
======================================
irb(main):004:0> widget_object = MiqWidget.where(:title => widget_title).length
=> 2

GRAB THE OTHER WIDGET OBJECT AND NOTICE IT DOES NOT HAVE AN MiqSchedule ATTACHED
==============================================
irb(main):005:0> widget_object = MiqWidget.where(:title => widget_title).last
=> #<MiqWidget id: 10000000000038, guid: "7a1bfcbc-fe2e-43ea-930e-14bd5c70cb51", description: " - Top CPU Offenders by Node Non Prod", title: " - Top CPU Offenders by Node Non Prod", content_type: "chart", options: {}, visibility: {:roles=>["_ALL_"]}, user_id: nil, resource_id: 10000000000156, resource_type: "MiqReport", miq_schedule_id: nil, enabled: true, read_only: false, created_at: "2018-04-05 18:33:22", updated_at: "2018-04-05 18:33:22", last_generated_content_on: nil, miq_task_id: nil>
irb(main):006:0> widget_object.miq_schedule
=> nil


Note You need to log in before you can comment on or make changes to this bug.