[PATCH aggregator] BZ #643162 - Hook selected repo to depend on selected OS in 'new template' page
by Jan Provazník
From: Jan Provaznik <jprovazn(a)redhat.com>
---
src/app/controllers/templates_controller.rb | 10 +++---
src/app/views/templates/_content_selection.haml | 41 ++++++++++++----------
src/app/views/templates/new.haml | 13 +++++++-
3 files changed, 39 insertions(+), 25 deletions(-)
diff --git a/src/app/controllers/templates_controller.rb b/src/app/controllers/templates_controller.rb
index 8d97c05..9f2dded 100644
--- a/src/app/controllers/templates_controller.rb
+++ b/src/app/controllers/templates_controller.rb
@@ -42,7 +42,7 @@ class TemplatesController < ApplicationController
# can't use @template variable - is used by compass (or something other)
@tpl = Template.find_or_create(params[:id])
@repository_manager = RepositoryManager.new
- @groups = @repository_manager.all_groups(params[:repository])
+ @groups = @repository_manager.all_groups
end
def create
@@ -71,7 +71,7 @@ class TemplatesController < ApplicationController
if params[:add_software_form]
@repository_manager = RepositoryManager.new
- @groups = @repository_manager.all_groups_with_tagged_selected_packages((a)tpl.xml.packages, params[:repository])
+ @groups = @repository_manager.all_groups_with_tagged_selected_packages((a)tpl.xml.packages, params[:tpl] ? params[:tpl][:platform] : nil)
render :action => 'add_software_form'
return
end
@@ -82,7 +82,7 @@ class TemplatesController < ApplicationController
redirect_to :action => 'index'
else
@repository_manager = RepositoryManager.new
- @groups = @repository_manager.all_groups(params[:repository])
+ @groups = @repository_manager.all_groups
render :action => 'new'
end
end
@@ -90,7 +90,7 @@ class TemplatesController < ApplicationController
def add_software
@tpl = params[:template_id].to_s.empty? ? Template.new : Template.find(params[:template_id])
@repository_manager = RepositoryManager.new
- @groups = @repository_manager.all_groups(params[:repository])
+ @groups = @repository_manager.all_groups
if params[:add_selected]
params[:groups].to_a.each { |group| @tpl.xml.add_group(group) }
params[:packages].to_a.each { |pkg| @tpl.xml.add_package(pkg) }
@@ -164,7 +164,7 @@ class TemplatesController < ApplicationController
def update_group_or_package(method, *args)
@repository_manager = RepositoryManager.new
- @groups = @repository_manager.all_groups(params[:repository])
+ @groups = @repository_manager.all_groups
@tpl.xml.send(method, *args)
# we save template w/o validation (we can add package before name,... is
# set)
diff --git a/src/app/views/templates/_content_selection.haml b/src/app/views/templates/_content_selection.haml
index 2372a4a..2ec9502 100644
--- a/src/app/views/templates/_content_selection.haml
+++ b/src/app/views/templates/_content_selection.haml
@@ -27,26 +27,29 @@
-#%fieldset.clearfix
-# = submit_tag "Add Selected", :name => "add_selected", :class => "grid_2 alpha", :id => "do_add_software"
-# = submit_tag "Cancel", :name => "cancel", :class => "grid_2", :id => "cancel_add_software"
- %ul.softwaregroups
- - groups = @groups.keys.sort
- - unsorted = groups.delete('unsorted')
- - groups.push('unsorted') if params[:show_unsorted] and unsorted
- - groups.each do |group|
- - group_sel = @groups[group][:selected]
- - group_id = group.gsub(/\s/, '_')
- %li
- = check_box_tag 'groups[]', group, group_sel, :disabled => group_sel, :id => "group_#{group_id}"
- = label_tag "group_#{group_id}", group
- %ul{:class => "packages group_#{group_id}"}
- - pkgs = @groups[group][:packages]
- - pkgs.keys.sort.each do |pkg|
- - pkg_sel = pkgs[pkg][:selected] ? true : false
- - pkg_id = pkg.gsub(/\s/, '_')
- %li
- = check_box_tag 'packages[]', pkg, pkg_sel, :disabled => pkg_sel, :id => "package_#{pkg_id}"
- = label_tag "package_#{pkg_id}", pkg
+ - if @groups.empty?
+ No Packages Found
+ -else
+ %ul.softwaregroups
+ - groups = @groups.keys.sort
+ - unsorted = groups.delete('unsorted')
+ - groups.push('unsorted') if params[:show_unsorted] and unsorted
+ - groups.each do |group|
+ - group_sel = @groups[group][:selected]
+ - group_id = group.gsub(/\s/, '_')
+ %li
+ = check_box_tag 'groups[]', group, group_sel, :disabled => group_sel, :id => "group_#{group_id}"
+ = label_tag "group_#{group_id}", group
+ %ul{:class => "packages group_#{group_id}"}
+ - pkgs = @groups[group][:packages]
+ - pkgs.keys.sort.each do |pkg|
+ - pkg_sel = pkgs[pkg][:selected] ? true : false
+ - pkg_id = pkg.gsub(/\s/, '_')
+ %li
+ = check_box_tag 'packages[]', pkg, pkg_sel, :disabled => pkg_sel, :id => "package_#{pkg_id}"
+ = label_tag "package_#{pkg_id}", pkg
- = link_to "Show unsorted packages", {:action => 'create', :add_software_form => true, :show_unsorted => true, 'tpl[id]' => @tpl.id}, {:id => 'switch_all_link'} unless params[:show_unsorted]
+ = link_to "Show unsorted packages", {:action => 'create', :add_software_form => true, :show_unsorted => true, 'tpl[id]' => @tpl.id}, {:id => 'switch_all_link'} unless params[:show_unsorted]
%fieldset.clearfix
= submit_tag "Add Selected", :name => "add_selected", :class => "grid_2 alpha", :id => "do_add_software"
= submit_tag "Cancel", :name => "cancel", :class => "grid_2", :id => "cancel_add_software"
diff --git a/src/app/views/templates/new.haml b/src/app/views/templates/new.haml
index 42fc85d..065d2c4 100644
--- a/src/app/views/templates/new.haml
+++ b/src/app/views/templates/new.haml
@@ -5,7 +5,11 @@
$submit.click(function(e, show_all) {
var list_url = '#{url_for :action => 'create', :add_software_form => true}';
var list_all_url = '#{url_for :action => 'create', :add_software_form => true, :show_unsorted => true}';
- var list_data = {'tpl[id]': $("input[name='tpl[id]']").val() || '', ajax: true};
+ var list_data = {
+ 'tpl[id]': $("input[name='tpl[id]']").val() || '',
+ ajax: true,
+ 'tpl[platform]': $("select[name='tpl[platform]']").val() || ''
+ };
e.preventDefault();
$(this).hide();
$container.empty().show().addClass('loading');
@@ -43,6 +47,13 @@
});
});
});
+
+ // select correct package repo when we change platform
+ $("select[name='tpl[platform]']").change(function() {
+ if ($submit.is(':hidden')) {
+ $submit.trigger('click');
+ }
+ });
});
.grid_16
--
1.7.2.3
13 years, 8 months
[PATCH aggregator] BZ #643155 - Make OS choices valid on 'create template' page
by Jan Provazník
From: Jan Provaznik <jprovazn(a)redhat.com>
Name, version and architecture combos are joined to single combo.
Architecture was not in BZ request but I believe it's required too.
---
src/app/models/template.rb | 8 +++++---
src/app/views/templates/_basics.haml | 4 +---
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/app/models/template.rb b/src/app/models/template.rb
index 6457f7a..7ad0ff4 100644
--- a/src/app/models/template.rb
+++ b/src/app/models/template.rb
@@ -21,10 +21,12 @@ class Template < ActiveRecord::Base
def update_xml_attributes!(opts = {})
doc = xml
doc.name = opts[:name] if opts[:name]
- doc.platform = opts[:platform] if opts[:platform]
+ if plat = opts[:platform]
+ doc.platform = plat
+ doc.platform_version = platforms[plat]['version'].to_s
+ doc.architecture = platforms[plat]['architecture']
+ end
doc.description = opts[:summary] if opts[:summary]
- doc.platform_version = opts[:platform_version] if opts[:platform_version]
- doc.architecture = opts[:architecture] if opts[:architecture]
save_xml!
end
diff --git a/src/app/views/templates/_basics.haml b/src/app/views/templates/_basics.haml
index 71a71fe..72d2423 100644
--- a/src/app/views/templates/_basics.haml
+++ b/src/app/views/templates/_basics.haml
@@ -13,9 +13,7 @@
%fieldset.clearfix
- default = @tpl.platforms['fedora']
= label :tpl, :platform, 'Platform Choice:', :class => "grid_4 alpha"
- = select :tpl, :platform, @tpl.platforms.map {|id, p| [p['name'], id]}, {:selected => @tpl.platform || 'fedora'}, {:class => 'grid_7'}
- = select :tpl, :platform_version, @tpl.platforms.map {|id, p| p['version'].to_s}.sort.uniq, {:selected => @tpl.platform_version || default['version']}, {:class => 'grid_3'}
- = select :tpl, :architecture, @tpl.platforms.map {|id, p| p['architecture']}.sort.uniq, {:selected => @tpl.architecture || default['architecture']}, {:class => 'grid_2 omega'}
+ = select :tpl, :platform, @tpl.platforms.map {|id, p| ["#{p['name']} #{p['version']} (#{p['architecture']})", id]}, {:selected => @tpl.platform || 'fedora'}, {:class => 'grid_7'}
%fieldset.clearfix
= label_tag :bootable, 'Bootable:', :class => "grid_4 alpha"
.grid_12.omega
--
1.7.2.3
13 years, 8 months
[PATCH aggregator] Fixed bug 642159
by Jan Provazník
From: Jan Provaznik <jprovazn(a)redhat.com>
Display error message when deleting template and no template is selected
---
src/app/controllers/templates_controller.rb | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/app/controllers/templates_controller.rb b/src/app/controllers/templates_controller.rb
index ec31012..8c8466a 100644
--- a/src/app/controllers/templates_controller.rb
+++ b/src/app/controllers/templates_controller.rb
@@ -159,7 +159,9 @@ class TemplatesController < ApplicationController
end
def delete
- Template.destroy(params[:ids].to_a)
+ ids = params[:ids].to_a
+ raise "No Template Selected" if ids.empty?
+ Template.destroy(ids)
redirect_to :action => 'index'
end
@@ -188,7 +190,7 @@ class TemplatesController < ApplicationController
def get_selected_id
ids = params[:ids].to_a
if ids.size != 1
- raise "No template is selected" if ids.empty?
+ raise "No Template Selected" if ids.empty?
raise "You can select only one template" if ids.size > 1
end
return ids.first
--
1.7.2.3
13 years, 8 months
[PATCH cloud engine] BZ641947: Templates: "Times Used" column not clear
by Tomas Sedovic
From: Tomas Sedovic <tsedovic(a)redhat.com>
https://bugzilla.redhat.com/show_bug.cgi?id=641947
The meaning of the "Times Used" column in the Templates page is not defined at
the moment. Dropping it for now.
---
src/app/views/templates/_templates.haml | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/src/app/views/templates/_templates.haml b/src/app/views/templates/_templates.haml
index 6587110..d885efe 100644
--- a/src/app/views/templates/_templates.haml
+++ b/src/app/views/templates/_templates.haml
@@ -5,7 +5,6 @@
{:name => 'VERSION', :sort_attr => 'platform_version'}, |
{:name => 'BOOTABLE', :sortable => false}, |
{:name => 'ARCH', :sort_attr => 'architecture'}, |
- {:name => 'TIMES USED', :sort_attr => 'images_count'}, |
] |
%table
@@ -26,4 +25,3 @@
%td
= image_tag 'blnk.png', :alt => 'yes', :class => "icon yes"
%td= tpl.architecture
- %td= tpl.images.size
--
1.7.2.3
13 years, 8 months
BZ #640257: Add Account issues
by Tomas Sedovic
This patchset fixes the bugs described in:
https://bugzilla.redhat.com/show_bug.cgi?id=640257
As the bug report combines three distinct issues, I decided to split the fix
into three parts to make the eventual commit history more readable.
[PATCH cloud engine 1/3] BZ640257: wrong tooltips in Provider Accounts page
[PATCH cloud engine 2/3] BZ640257: "Reset" button on the Cloud Account page
[PATCH cloud engine 3/3] BZ640257: Required fields in cloud-accounts page
13 years, 8 months
[PATCH cloud engine] BZ #640498: Edit/delete pool issues
by Tomas Sedovic
From: Tomas Sedovic <tsedovic(a)redhat.com>
https://bugzilla.redhat.com/show_bug.cgi?id=640498
https://bugzilla.redhat.com/show_bug.cgi?id=643865
Temporarily disabling the pool delete and edit buttons.
---
src/app/views/pools/index.haml | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/app/views/pools/index.haml b/src/app/views/pools/index.haml
index f713d70..af099c6 100644
--- a/src/app/views/pools/index.haml
+++ b/src/app/views/pools/index.haml
@@ -3,12 +3,17 @@
%dl
%dt
Pools
+ / NOTE the 'edit' and 'delete' buttons are temporarily disabled.
+ / They are replaced by generic <button> tags with no functionality.
+ / Once we suport editing and deleting pools, we should switch it back.
%dd.edit
%span
- = submit_tag "edit", :class => "submit linkbutton"
+ /= submit_tag "edit", :class => "submit linkbutton"
+ %button.submit.linkbutton{ :disabled => 'disabled'} edit
%dd.delete
%span
- = submit_tag "delete", :class => "submit linkbutton"
+ /= submit_tag "delete", :class => "submit linkbutton"
+ %button.submit.linkbutton{ :disabled => 'disabled'} delete
%dd.add
%span
=link_to 'new pool', :action => :new, :class => "button"
--
1.7.2.3
13 years, 8 months
POC - selection model
by Jan Provazník
Hi,
this is first shoot of selection model with similar behaviour as
packagekit. First patch is Mo's rebased patch called "remove template
creation on 'new template form' until it is submitted (rev 3)".
Purpose of this patch is only for testing - if you think that this
behaviour is not suitable for beta1, stop me, please.
Packages are sorted into "metagroups" (metagroup list is taken from
packagekit), packages which are not listed in any metagroup are
accessible through search field. "Collections" is list of groups.
Jan
13 years, 8 months
[PATCH cloud engine] BZ #640301
by Tomas Sedovic
From: Tomas Sedovic <tsedovic(a)redhat.com>
https://bugzilla.redhat.com/show_bug.cgi?id=640301
This allows the users to edit a URL of a provider that's been previously added
to the database.
Note that the backend provider must not change, this is only for cases when
the URL entry point changes. You can't use this to switch from EC2 to
Rackspace, for example.
Since actually swapping the provider backend would require some additional
work and possibly some user intervention, it would be better as separate
feature.
---
src/app/controllers/provider_controller.rb | 29 +++++++++++++++++++++------
src/app/views/provider/_form.haml | 13 ++++++-----
src/app/views/provider/edit.haml | 1 +
3 files changed, 30 insertions(+), 13 deletions(-)
create mode 100644 src/app/views/provider/edit.haml
diff --git a/src/app/controllers/provider_controller.rb b/src/app/controllers/provider_controller.rb
index 189c5cb..da5c9bb 100644
--- a/src/app/controllers/provider_controller.rb
+++ b/src/app/controllers/provider_controller.rb
@@ -57,7 +57,7 @@ class ProviderController < ApplicationController
if params[:test_connection]
test_connection(@provider)
- redirect_to :action => "new", :provider => {:name => @provider.name, :url => @provider.url}
+ render :action => "new"
else
@provider.set_cloud_type!
if @provider.save && @provider.populate_hardware_profiles
@@ -73,16 +73,29 @@ class ProviderController < ApplicationController
def update
require_privilege(Privilege::PROVIDER_MODIFY)
+ @providers = Provider.list_for_user(@current_user, Privilege::PROVIDER_MODIFY)
@provider = Provider.find(:first, :conditions => {:id => params[:provider][:id]})
- @provider.name = params[:provider][:name]
+ previous_cloud_type = @provider.cloud_type
- if @provider.save
- flash[:notice] = "Provider updated."
- redirect_to :action => "show", :id => @provider
- else
+ @provider.update_attributes(params[:provider])
+ if params[:test_connection]
+ test_connection(@provider)
render :action => "edit"
+ else
+ @provider.set_cloud_type!
+ if previous_cloud_type != @provider.cloud_type
+ @provider.errors.add :url, "points to a different provider"
+ end
+
+ if @provider.errors.empty? and @provider.save
+ flash[:notice] = "Provider updated."
+ redirect_to :action => "show", :id => @provider
+ else
+ flash[:notice] = "Cannot update the provider."
+ render :action => "edit"
+ end
+ kick_condor
end
- kick_condor
end
def destroy
@@ -130,10 +143,12 @@ class ProviderController < ApplicationController
end
def test_connection(provider)
+ @provider.errors.clear
if @provider.connect
flash[:notice] = "Successfuly Connected to Provider"
else
flash[:notice] = "Failed to Connect to Provider"
+ @provider.errors.add :url
end
end
diff --git a/src/app/views/provider/_form.haml b/src/app/views/provider/_form.haml
index 50e5c1b..14cd292 100644
--- a/src/app/views/provider/_form.haml
+++ b/src/app/views/provider/_form.haml
@@ -1,12 +1,13 @@
- readonly = controller.action_name == 'show' ? true : false
- new_provider = ['new', 'create'].include? controller.action_name
+- edit_provider = ['edit', 'update'].include? controller.action_name
= render :partial => 'providers'
#details.grid_13
%nav.subsubnav
= render_navigation(:level => 4)
- if new_provider
- form_action = 'create'
- - elsif controller.action_name == 'edit'
+ - elsif edit_provider
- form_action = 'update'
- form_for @provider, :url => {:controller => :provider, :action => form_action}, :class => "dcloud_form" do |f|
%fieldset
@@ -23,12 +24,12 @@
%div.grid_4.omega
= f.error_message_on :url, 'URL '
= f.error_message_on :name, 'Name '
- = f.text_field :name, :title => t('.provider_name'), :value => (@provider.name if @provider), :disabled => ('disabled' if controller.action_name == 'show'), :class => "clear grid_4 alpha"
- = f.text_field :url, :title => t('.provider_url'), :class => 'emailinput', :value => (@provider.url if @provider), :disabled => ('disabled' unless new_provider), :class => "grid_5"
- - if controller.action_name == 'edit'
+ = f.text_field :name, :title => t('.provider_name'), :value => (@provider.name if @provider), :disabled => ('disabled' if readonly), :class => "clear grid_4 alpha"
+ = f.text_field :url, :title => t('.provider_url'), :class => 'emailinput', :value => (@provider.url if @provider), :disabled => ('disabled' if readonly), :class => "grid_5"
+ - if edit_provider:
= f.hidden_field :id, :value => @provider.id
.clear.prefix_4.grid_5.suffix_4.alpha.omega
- - if !Provider.exists?(@provider)
+ - if new_provider or edit_provider
%span
(
%button.linkbutton.nospace{ :type => 'submit', :value => t('.test_connection'), :name => 'test_connection', :id => 'test_connection' }<>
@@ -40,7 +41,7 @@
*
\-
= t('.required_field')
- - if controller.action_name == 'edit'
+ - if edit_provider
%input{ :type => 'submit', :value => t(:save), :name => 'save_provider', :id => 'save_provider' }
- elsif new_provider
%input{ :type => 'submit', :value => t(:add), :name => 'add_provider', :id => 'add_provider' }
diff --git a/src/app/views/provider/edit.haml b/src/app/views/provider/edit.haml
new file mode 100644
index 0000000..c66fabf
--- /dev/null
+++ b/src/app/views/provider/edit.haml
@@ -0,0 +1 @@
+= render :partial => 'form'
--
1.7.2.3
13 years, 8 months
Some placeholder markup as requested by Scott Seago
by Jakub Steiner
applies on next: e175dfbd39fa1a9c0113615404f12faa4b930f7e
[PATCH 1/3] Re-enable Permissions link on the system settings page as per Scott's request.
[PATCH 2/3] Placeholder form for the self service/treatments page (3121) as per Scott's request.
[PATCH 3/3] Placeholder markup for the General Settings page (3190) as per Scott's request.
13 years, 8 months