Skip to content

Commit

Permalink
keep widgets while cloning dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
yrudman committed Jun 20, 2019
1 parent dbd6f04 commit b8042fb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/models/miq_widget_set.rb
Expand Up @@ -79,6 +79,7 @@ def self.copy_dashboard(source_widget_set, destination_name, destination_descrip
:description => destination_description,
:owner_type => "MiqGroup",
:set_type => source_widget_set.set_type,
:set_data => source_widget_set.set_data,
:owner_id => assign_to_group.id)
end

Expand Down
7 changes: 7 additions & 0 deletions spec/models/miq_widget_set_spec.rb
Expand Up @@ -157,5 +157,12 @@
dashboard = MiqWidgetSet.copy_dashboard(@ws_group, name, tab)
expect(MiqWidgetSet.find_by(:owner_id => group.id, :name => name)).to eq dashboard
end

it "keeps the same set of widgets and dashboard's settings" do
set_data = {:col1 => [1], :col2 => [2], :col3 => [], :locked => false, :reset_upon_login => false, :last_group_db_updated => Time.now.utc}
@ws_group.update(:set_data => set_data)
new_dashboard = MiqWidgetSet.copy_dashboard(@ws_group, name, tab)
expect(new_dashboard.set_data).to eq set_data
end
end
end

0 comments on commit b8042fb

Please sign in to comment.