[PATCH 1/2] Add a loadmask for adding packages.
by Jakub Steiner
diff --git a/src/app/views/templates/new.haml b/src/app/views/templates/new.haml
index cb236c6..669babb 100644
--- a/src/app/views/templates/new.haml
+++ b/src/app/views/templates/new.haml
@@ -72,8 +72,10 @@
}
});
Aggregator.hook_selected_packages = function() {
- $('#do_add_software').click(function(e) {
+ $('#do_add_software').live('click', function(e) {
e.preventDefault();
+ var $button = $(this).clone();
+ var label = "<span id='do_add_software' class='loading fl'>Adding Packages</span>";
var url = '#{url_for :action => 'managed_content'}';
var new_pkgs = $("input:checked[name='packages[]']").map(function() {return $(this).val()}).get();
var old_pkgs = $("input:hidden[name='packages[]']").map(function() {return $(this).val()}).get()
@@ -85,11 +87,13 @@
'collections': $("input:hidden[name=collections]").val(),
'template_id' : '#{(a)id.nil? ? nil : @id}'
};
+ $(this).replaceWith(label);
$('#managed_content').load(url, data, function(){
$("input:checked[name='groups[]']").attr('disabled', 'disabled');
$("input:checked[name='packages[]']").attr('disabled', 'disabled');
$('#add_software_button').show();
$('.dropdown').hide();
+ $('#do_add_software').replaceWith($button);
});
});
$('#cancel_add_software').click(function(e) {
--
1.7.2.3
13 years, 7 months
[PATCH cloud engine 1/3] BZ640257: wrong tooltips in Provider Accounts page
by Tomas Sedovic
From: Tomas Sedovic <tsedovic(a)redhat.com>
https://bugzilla.redhat.com/show_bug.cgi?id=640257
The "EC2 Access Key" and "Secret Acces Key" fields had an untintelligible
`title` attribute because the i18n engine was looking for a dictionary fields
that were missing.
---
src/app/views/provider/accounts.haml | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/app/views/provider/accounts.haml b/src/app/views/provider/accounts.haml
index 87d85f1..8a8c36a 100644
--- a/src/app/views/provider/accounts.haml
+++ b/src/app/views/provider/accounts.haml
@@ -31,8 +31,8 @@
- disabled = 'disabled' unless has_account_modify?(@provider)
- cloud_account_id = "cloud_accounts[#{acct.id}]"
= text_field cloud_account_id, :label, :title => t('.account_name'), :value => acct.label, :disabled => disabled, :class => "grid_4 alpha"
- = text_field cloud_account_id, :username, :title => t('.access_key'), :value => acct.username, :disabled => disabled, :class => "grid_3"
- = password_field cloud_account_id, :password, :title => t('.secret_access_key'), :disabled => disabled, :class => "grid_3"
+ = text_field cloud_account_id, :username, :title => t('.user_name'), :value => acct.username, :disabled => disabled, :class => "grid_3"
+ = password_field cloud_account_id, :password, :title => t('.password'), :disabled => disabled, :class => "grid_3"
= error_message_on :maximum_running_instances, 'Maximum Running Instances '
= text_field "quota[#{acct.id}]", :maximum_running_instances, :title => t('.quota_instances'), :value => (acct.quota.maximum_running_instances.nil? ? "unlimited" : acct.quota.maximum_running_instances), :disabled => disabled, :id => "quota_instances#{acct.id}", :class => "grid_3 omega"
%fieldset.nomargin.clearfix
@@ -85,8 +85,8 @@
%span.required *
%fieldset.nomargin.clearfix
= text_field :cloud_account, :label, :title => t('.account_name'), :class => "grid_4 alpha"
- = text_field :cloud_account, :username, :title => t('.access_key'), :class => "grid_3"
- = password_field :cloud_account, :password, :title => t('.secret_access_key'), :class => "grid_3"
+ = text_field :cloud_account, :username, :title => t('.user_name'), :class => "grid_3"
+ = password_field :cloud_account, :password, :title => t('.password'), :class => "grid_3"
= text_field "quota", :maximum_running_instances, :title => t('.quota_instances'), :value => "unlimited",:id => "quota_instances", :class => "grid_3 omega"
%fieldset.nomargin.clearfix
.grid_3.prefix_10.alpha.omega
--
1.7.2.3
13 years, 7 months
[PATCH cloud engine 1/3] BZ640257: wrong tooltips in Provider Accounts page
by Tomas Sedovic
From: Tomas Sedovic <tsedovic(a)redhat.com>
https://bugzilla.redhat.com/show_bug.cgi?id=640257
The "EC2 Access Key" and "Secret Acces Key" fields had an untintelligible
`title` attribute because the i18n engine was looking for a dictionary fields
that were missing.
---
src/app/views/provider/accounts.haml | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/app/views/provider/accounts.haml b/src/app/views/provider/accounts.haml
index 87d85f1..8a8c36a 100644
--- a/src/app/views/provider/accounts.haml
+++ b/src/app/views/provider/accounts.haml
@@ -31,8 +31,8 @@
- disabled = 'disabled' unless has_account_modify?(@provider)
- cloud_account_id = "cloud_accounts[#{acct.id}]"
= text_field cloud_account_id, :label, :title => t('.account_name'), :value => acct.label, :disabled => disabled, :class => "grid_4 alpha"
- = text_field cloud_account_id, :username, :title => t('.access_key'), :value => acct.username, :disabled => disabled, :class => "grid_3"
- = password_field cloud_account_id, :password, :title => t('.secret_access_key'), :disabled => disabled, :class => "grid_3"
+ = text_field cloud_account_id, :username, :title => t('.user_name'), :value => acct.username, :disabled => disabled, :class => "grid_3"
+ = password_field cloud_account_id, :password, :title => t('.password'), :disabled => disabled, :class => "grid_3"
= error_message_on :maximum_running_instances, 'Maximum Running Instances '
= text_field "quota[#{acct.id}]", :maximum_running_instances, :title => t('.quota_instances'), :value => (acct.quota.maximum_running_instances.nil? ? "unlimited" : acct.quota.maximum_running_instances), :disabled => disabled, :id => "quota_instances#{acct.id}", :class => "grid_3 omega"
%fieldset.nomargin.clearfix
@@ -85,8 +85,8 @@
%span.required *
%fieldset.nomargin.clearfix
= text_field :cloud_account, :label, :title => t('.account_name'), :class => "grid_4 alpha"
- = text_field :cloud_account, :username, :title => t('.access_key'), :class => "grid_3"
- = password_field :cloud_account, :password, :title => t('.secret_access_key'), :class => "grid_3"
+ = text_field :cloud_account, :username, :title => t('.user_name'), :class => "grid_3"
+ = password_field :cloud_account, :password, :title => t('.password'), :class => "grid_3"
= text_field "quota", :maximum_running_instances, :title => t('.quota_instances'), :value => "unlimited",:id => "quota_instances", :class => "grid_3 omega"
%fieldset.nomargin.clearfix
.grid_3.prefix_10.alpha.omega
--
1.7.2.3
13 years, 7 months
[PATCH] Initial styling of selected packages as an inline list, inspired by suse studio.
by Jakub Steiner
- removed all the line noise. Using whitespace as a separator.
- bug: removing a packae seems to remove all
- restructured the styling to be in the #build context
- use links for package names and include a hidden field so the package selection is actually stored.
- Use .live() for package removal and dropdowns
- readd functionality - Add all packages if the collection checkbox is checked.
- show package details when clicking on a name. Always shown when nojavascript
applies on next: 1e487e84813b219464b85765d06696177641f1fa
---
src/app/stylesheets/_base.scss | 18 +++
src/app/stylesheets/aggregator.scss | 140 ++++++++++++++++--------
src/app/views/templates/_managed_content.haml | 24 ++--
src/app/views/templates/content_selection.haml | 10 ++-
src/app/views/templates/new.haml | 43 ++++++--
src/public/javascripts/application.js | 25 ++++
6 files changed, 192 insertions(+), 68 deletions(-)
diff --git a/src/app/stylesheets/_base.scss b/src/app/stylesheets/_base.scss
index 07c9d77..3ac43c6 100644
--- a/src/app/stylesheets/_base.scss
+++ b/src/app/stylesheets/_base.scss
@@ -34,6 +34,24 @@ $badcl: #cb292b;
-webkit-border-radius: $radius;
}
+ @mixin border-radius-top($radius) {
+ border-top-right-radius: $radius;
+ border-top-left-radius: $radius;
+ -moz-border-radius-topright: $radius;
+ -moz-border-radius-topleft: $radius;
+ -webkit-border-top-right-radius: $radius;
+ -webkit-border-top-left-radius: $radius;
+ }
+
+ @mixin border-radius-bottom($radius) {
+ border-bottom-right-radius: $radius;
+ border-bottom-left-radius: $radius;
+ -moz-border-radius-bottomright: $radius;
+ -moz-border-radius-bottomleft: $radius;
+ -webkit-border-bottom-right-radius: $radius;
+ -webkit-border-bottom-left-radius: $radius;
+ }
+
@mixin box-shadow($x,$y,$blur,$color) {
box-shadow: $x $y $blur $color;
-moz-box-shadow: $x $y $blur $color;
diff --git a/src/app/stylesheets/aggregator.scss b/src/app/stylesheets/aggregator.scss
index 6d0a070..2056b52 100644
--- a/src/app/stylesheets/aggregator.scss
+++ b/src/app/stylesheets/aggregator.scss
@@ -182,7 +182,7 @@ h2 { font-size: 130%; }
h3 {
font-size: 120%;
&.gap {
- margin-top: 3em;
+ margin: 3em 0 1em;
}
}
h4 {
@@ -430,48 +430,6 @@ input[type='submit'].icon {
}
}
-.packagegroupsidebar {
- display: block;
- text-align: right;
- font-size: 120%;
- li {
- display: block;
- margin: 0;
- }
- .icon {
- text-transform: capitalize;
- }
-}
- #collections {
- margin: 0 0 1em;
- font-weight: bold;
- }
-
-.metagrouppackages {
- display: block;
- &>li {
- display: block;
- text-transform: uppercase;
- margin: 0 2em 2em 0; padding: 0;
- label {
- cursor: pointer;
- }
- ul {
- @include column-count(3);
- display: block;
- text-transform: none;
- font-size: 95%;
- li {
- display: block;
- margin: 0 0 0 4px;
- text-transform: capitalize;
- label {
- font-weight: normal;
- }
- }
- }
- }
-}
.searchedpackages, .collections {
display: block;
@@ -857,6 +815,7 @@ li.operation>ul, li.administration>ul, li.build>ul, li.runtime>ul {
}
#content {
+ position: relative;
margin-top: 2em;
margin-bottom: 60px;
overflow: hidden;
@@ -1172,12 +1131,101 @@ a.iconbutton {
display: inline-block;
padding: 6px 0 6px 24px;
}
+ .packagewrap {
+ position: relative;
+ float: left;
+ padding: 4px 22px 4px 4px;
+ margin: 2px;
+ @include border-radius(4px);
+ .remove_package {
+ position: absolute;
+ width: 16px; height: 16px;
+ top: 50%; right: 4px;
+ border: none;
+ background: url(../../images/icons/action-icons.png) no-repeat -32px 0 !important;
+ text-indent: -200em;
+ padding: 0; margin: -8px 0;
+ @include border-radius(2px);
+ &:hover {
+ @include no-box-shadow();
+ background: lighten($dcprimary,10%) url(../../images/icons/action-icons.png) no-repeat -32px 0 !important;
+ }
+ }
+ .packagename {
+ cursor: pointer;
+ &:hover {
+ color: white;
+ }
+ }
+ &.selected {
+ color: white;
+ background-color: $dcprimary;
+ .packagename {
+ color: white;
+ }
+ }
+ &:hover {
+ color: white;
+ background-color: $dcprimary;
+ .packagename {
+ color: white;
+ }
+ }
+ }
- .packagename {
- opacity: 1;
- color: #000;
+ .packagegroupsidebar {
+ display: block;
+ text-align: right;
+ font-size: 120%;
+ li {
+ display: block;
+ margin: 0;
+ }
+ .icon {
+ text-transform: capitalize;
+ }
+ }
+ #collections {
+ margin: 0 0 1em;
+ font-weight: bold;
+ }
+
+ .metagrouppackages {
+ display: block;
+ &>li {
+ display: block;
+ text-transform: uppercase;
+ margin: 0 2em 2em 0; padding: 0;
+ label {
+ cursor: pointer;
+ }
+ ul {
+ @include column-count(3);
+ display: block;
+ text-transform: none;
+ font-size: 95%;
+ li {
+ display: block;
+ margin: 0 0 0 4px;
+ text-transform: capitalize;
+ label {
+ font-weight: normal;
+ }
+ }
+ }
+ }
}
}
+ #dropdown {
+ position: absolute;
+ background-color: white;
+ border: 1px solid $dcprimary;
+ @include border-radius-bottom(4px);
+ padding: 1em;
+ display: none;
+ z-index: 2;
+ font-size: 95%;
+ }
/* IE and other horror browser workarounds */
diff --git a/src/app/views/templates/_managed_content.haml b/src/app/views/templates/_managed_content.haml
index 0657ff1..86b076f 100644
--- a/src/app/views/templates/_managed_content.haml
+++ b/src/app/views/templates/_managed_content.haml
@@ -1,20 +1,20 @@
#selected_packages
%h3.gap Managed Content to Bundle
- %hr
- %label.header.alpha.prefix_2.grid_7 Name:
- %label.header.omega.grid_2.suffix_5 Repository:
- %label.grid_2.alpha.clear Managed:
- .grid_14.omega
+ .grid_16.alpha.omega
- if @selected_packages.empty?
No selected packages
- else
- repos = @repository_manager.repositories_hash
- @selected_packages.sort.each do |pkg|
- pkg_group = @groups.keys.find {|g| @groups[g][:packages][pkg]}
- %fieldset.clearfix
- = text_field_tag 'packages[]', pkg, :id => "package_#{pkg}", :class => "alpha grid_7 packagename"
- .grid_2= (pkg_group and repo = repos[@groups[pkg_group][:repository_id]]) ? repo.name.to_s : ' '
- .grid_5.omega
- %button{:type => 'button', :disabled => 'disabled'} Config
- %button{:type => 'button', :disabled => 'disabled'} Metadata
- = submit_tag "Remove", :name => "remove_package_#{pkg}", :id => "remove_package_#{pkg}", :class => 'remove_package'
+ .packagewrap
+ %a.packagename{:id => "package_#{pkg}"}=pkg
+ = hidden_field_tag 'packages[]', pkg, :id => "package_#{pkg}"
+ = submit_tag "Remove", :name => "remove_package_#{pkg}", :id => "remove_package_#{pkg}", :class => 'remove_package'
+ .dropdown
+ %section
+ Repository:
+ %label= (pkg_group and repo = repos[@groups[pkg_group][:repository_id]]) ? repo.name.to_s : ' '
+ %fieldset.nomargin
+ %button{:disabled => true} Browse
+ %button{:disabled => true} Config
diff --git a/src/app/views/templates/content_selection.haml b/src/app/views/templates/content_selection.haml
index e5961fe..31fd6f4 100644
--- a/src/app/views/templates/content_selection.haml
+++ b/src/app/views/templates/content_selection.haml
@@ -11,13 +11,21 @@
var url = '#{url_for :action => 'dispatch', :id => @id}';
$('#metagrouppackages, ').load(url, data, function() {
Aggregator.hook_selected_packages();
+ //select all packages in collection
+ $(".softwaregroups").click(function() {
+ if ($(this).attr("checked") === true) {
+ $(this).parent().siblings("ul").find("input[type='checkbox']").attr("checked","checked");
+ } else {
+ $(this).parent().siblings("ul").find("input[type='checkbox']").removeAttr("checked");
+ }
+ });
});
});
Aggregator.hook_selected_packages();
});
.grid_16
- %h3 Managed Content Selection
+ %h4 Managed Content Selection
- form_tag :action => "dispatch" do
- unless @embed
diff --git a/src/app/views/templates/new.haml b/src/app/views/templates/new.haml
index 3d16f4f..bef3bf8 100644
--- a/src/app/views/templates/new.haml
+++ b/src/app/views/templates/new.haml
@@ -35,7 +35,32 @@
});
});
});
- $('.remove_package').click(function() { $(this).parent().parent().remove(); });
+ //removing packages from the list
+ $('.remove_package').live('click', function (e) {
+ e.preventDefault();
+ $(this).parent().hide(300, function () {
+ $(this).remove();
+ });
+ });
+ //displaying extended package info and actions
+ $('.dropdown').hide();
+ $('.packagename').live('click', function () {
+ var dropdowncontent = $(this).siblings('.dropdown').html(),
+ $dropdown = $("#dropdown");
+ $('.packagewrap').removeClass('selected');
+ $(this).parent().addClass('selected');
+ $dropdown.empty().html(dropdowncontent).css({
+ 'top': $(this).positionAncestor('#content').top + 17,
+ 'left': $(this).positionAncestor('#content').left - 4
+ }).show();
+ });
+ //catch #content clicks and hide the #dropdown if it's not within it
+ $("#content").click(function (e) {
+ if(!e.target.id === 'dropdown' || !$(e.target).closest("#dropdown").length) {
+ $("#dropdown").hide();
+ $('.packagewrap').removeClass('selected');
+ }
+ });
// select correct package repo when we change platform
$("select[name='tpl[platform]']").change(function() {
if ($submit.is(':hidden')) {
@@ -47,7 +72,7 @@
e.preventDefault();
var url = '#{url_for :action => 'managed_content'}';
var new_pkgs = $("input:checked[name='packages[]']").map(function() {return $(this).val()}).get();
- var old_pkgs = $("input:text[name='packages[]']").map(function() {return $(this).val()}).get()
+ var old_pkgs = $("input:hidden[name='packages[]']").map(function() {return $(this).val()}).get()
var cached_pkgs = $("input:hidden[name='cached_packages[]']").map(function() {return $(this).val()}).get()
var data = {
'selected_packages[]': old_pkgs.concat(new_pkgs.concat(cached_pkgs)),
@@ -58,17 +83,19 @@
$('#managed_content').load(url, data, function(){
//$('#package_selection_list').empty().show();
$('#add_software_button').show();
- $('.remove_package').click(function() { $(this).parent().parent().remove(); });
+ $('.dropdown').hide();
});
});
$('#cancel_add_software').click(function(e) {
e.preventDefault();
$('#package_selection_list').hide();
$('#add_software_button').show();
+ $('.dropdown').hide();
});
}
});
+#dropdown
.grid_16
%h2 Template
- form_for @tpl, :url => { :action => "dispatch" } do
@@ -78,7 +105,6 @@
= render :partial => 'basics'
%h3.disabled.gap Local Content to Bundle
- %hr
%fieldset.clearfix
= label_tag :local_bundle_name, 'Local:', :class => "disabled grid_2 alpha"
= text_field_tag 'local_bundle_name[]', 'Bundle Name', :disabled => true, :class => "grid_8"
@@ -104,13 +130,12 @@
= render :partial => 'managed_content'
.clearfix
- .grid_14.alpha.prefix_2
+ .grid_16.alpha.omega
= submit_tag "Add Software", :name => "add_software_form", :id => "add_software_button", :class => "iconbutton"
#package_selection_list{:style => 'display: none'}
- %h3.gap.clear Preboot Configuration
- %hr
+ %h3.clear.gap Preboot Configuration
%fieldset.clearfix
.grid_4.alpha
= radio_button_tag :configure_via_script, 'no', :disabled => true
@@ -122,5 +147,5 @@
= label_tag :configure_via_script, 'Configure Via Script'
= file_field_tag 'script_file', :disabled => true, :class => 'grid_12 omega'
- = submit_tag "Save", :name => "save", :class => "dialogbutton"
- = submit_tag "Cancel", :name => "cancel", :class => "dialogbutton"
+ = submit_tag "Save", :name => "save", :class => "formbutton"
+ = submit_tag "Cancel", :name => "cancel", :class => "formbutton"
diff --git a/src/public/javascripts/application.js b/src/public/javascripts/application.js
index 57bfa35..50edbe4 100644
--- a/src/public/javascripts/application.js
+++ b/src/public/javascripts/application.js
@@ -112,6 +112,31 @@ var Aggregator = {
}
});
};
+ $.fn.positionAncestor = function(selector) {
+ var left = 0;
+ var top = 0;
+ this.each(function(index, element) {
+ // check if current element has an ancestor matching a selector
+ // and that ancestor is positioned
+ var $ancestor = $(this).closest(selector);
+ if ($ancestor.length && $ancestor.css("position") !== "static") {
+ var $child = $(this);
+ var childMarginEdgeLeft = $child.offset().left - parseInt($child.css("marginLeft"), 10);
+ var childMarginEdgeTop = $child.offset().top - parseInt($child.css("marginTop"), 10);
+ var ancestorPaddingEdgeLeft = $ancestor.offset().left + parseInt($ancestor.css("borderLeftWidth"), 10);
+ var ancestorPaddingEdgeTop = $ancestor.offset().top + parseInt($ancestor.css("borderTopWidth"), 10);
+ left = childMarginEdgeLeft - ancestorPaddingEdgeLeft;
+ top = childMarginEdgeTop - ancestorPaddingEdgeTop;
+ // we have found the ancestor and computed the position
+ // stop iterating
+ return false;
+ }
+ });
+ return {
+ left: left,
+ top: top
+ }
+};
})(jQuery);
/* Aggregator JS */
--
1.7.2.3
13 years, 7 months
[PATCH aggregator] BZ #643147 - minor enhancements
by Jan Provazník
From: Jan Provaznik <jprovazn(a)redhat.com>
- loadmasking for ajax requests, still TODO: css for pagination buttons and "add
selected" button
- when user clacks on "add software", collections list is preselected instead of
"no group selected" message
- fixed adding of group except individual packages
- hidden "add software" button when "cancel" button is clicked
---
src/app/controllers/templates_controller.rb | 22 +++++++++++++---------
src/app/stylesheets/aggregator.scss | 9 +++++++++
src/app/views/templates/_collections.haml | 4 +++-
src/app/views/templates/_metagroup_packages.haml | 2 +-
src/app/views/templates/_searched_packages.haml | 2 ++
src/app/views/templates/content_selection.haml | 12 +++++++++++-
src/app/views/templates/new.haml | 9 +++++++--
7 files changed, 46 insertions(+), 14 deletions(-)
diff --git a/src/app/controllers/templates_controller.rb b/src/app/controllers/templates_controller.rb
index 4fe34bb..1573167 100644
--- a/src/app/controllers/templates_controller.rb
+++ b/src/app/controllers/templates_controller.rb
@@ -132,6 +132,8 @@ class TemplatesController < ApplicationController
else
@metagroup_packages = @repository_manager.metagroup_packages_with_tagged_selected_packages(@metagroup, @packages, params[:repository] || @tpl.platform)
end
+ else
+ @collections = @repository_manager.all_groups_with_tagged_selected_packages(@packages, params[:repository] || @tpl.platform)
end
if request.xhr?
if @metagroup_packages
@@ -140,7 +142,7 @@ class TemplatesController < ApplicationController
if @searched_packages
render :partial => 'searched_packages' and return
end
- if @collections
+ if @collections and @metagroup
render :partial => 'collections' and return
end
end
@@ -264,14 +266,16 @@ add account on <a href=\"#{url_for :controller => 'provider', \
@selected_packages = []
end
- [:selected_groups, :groups].each do |pg|
- if params[pg]
- params[pg].each { |grp|
- fg = @groups.find { |gk, gv| gk == grp }
- fg[1][:packages].each { |pk, pv|
- @selected_packages << pk
- } unless fg.nil?
- }
+ if params[:collections].to_s == 'true' or not request.xhr?
+ [:selected_groups, :groups].each do |pg|
+ if params[pg]
+ params[pg].each { |grp|
+ fg = @groups.find { |gk, gv| gk == grp }
+ fg[1][:packages].each { |pk, pv|
+ @selected_packages << pk
+ } unless fg.nil?
+ }
+ end
end
end
diff --git a/src/app/stylesheets/aggregator.scss b/src/app/stylesheets/aggregator.scss
index 6d0a070..c2b95e7 100644
--- a/src/app/stylesheets/aggregator.scss
+++ b/src/app/stylesheets/aggregator.scss
@@ -1167,6 +1167,15 @@ a.iconbutton {
margin: 0;
}
}
+
+ #metagrouppackages {
+ &.loading {
+ display: block;
+ height: 100px;
+ background: url(../../images/spinner.gif) no-repeat center center;
+ }
+ }
+
span.loading {
background: url(../../images/spinner.gif) no-repeat center left;
display: inline-block;
diff --git a/src/app/views/templates/_collections.haml b/src/app/views/templates/_collections.haml
index 96ddcad..4623f6f 100644
--- a/src/app/views/templates/_collections.haml
+++ b/src/app/views/templates/_collections.haml
@@ -1,7 +1,9 @@
+= hidden_field_tag :collections, true
+
%ul.collections
- @collections.keys.sort.each do |id|
%li
- selected = @collections[id][:selected] ? true : false
- = check_box_tag 'groups[]', id, selected, {:disabled => selected, :id => "group_#{id}"}
+ = check_box_tag 'groups[]', id, selected, {:disabled => selected, :id => "group_#{id}", :class => "#{selected ? 'selected' : ''}"}
= label_tag "group_#{id}", @collections[id][:name]
= render :partial => 'addbuttons'
diff --git a/src/app/views/templates/_metagroup_packages.haml b/src/app/views/templates/_metagroup_packages.haml
index 9c0e2d4..07642b1 100644
--- a/src/app/views/templates/_metagroup_packages.haml
+++ b/src/app/views/templates/_metagroup_packages.haml
@@ -8,7 +8,7 @@
%li
- selected = !@metagroup_packages[group][:selected].nil?
%h5
- = check_box_tag 'groups[]', group, selected, {:disabled => selected, :id => "group_#{group}", :class => 'softwaregroups'}
+ = check_box_tag 'groups[]', group, selected, {:disabled => selected, :id => "group_#{group}", :class => "softwaregroups #{selected ? 'selected' : ''}"}
= label_tag "group_#{group}", group
%ul
- @metagroup_packages[group][:packages].each do |pkg|
diff --git a/src/app/views/templates/_searched_packages.haml b/src/app/views/templates/_searched_packages.haml
index d0eb770..0894cb5 100644
--- a/src/app/views/templates/_searched_packages.haml
+++ b/src/app/views/templates/_searched_packages.haml
@@ -15,7 +15,9 @@
'page': $(this).val(),
'repository': $("select[name='tpl[platform]']").val()
};
+ $('#metagrouppackages').empty().addClass('loading');
$('#metagrouppackages').load(url, data, function() {
+ $('#metagrouppackages').removeClass('loading');
Aggregator.hook_selected_packages();
})
});
diff --git a/src/app/views/templates/content_selection.haml b/src/app/views/templates/content_selection.haml
index e5961fe..f1499ae 100644
--- a/src/app/views/templates/content_selection.haml
+++ b/src/app/views/templates/content_selection.haml
@@ -9,8 +9,18 @@
'packages[]': $("input:text[name='packages[]']").map(function() {return $(this).val()}).get()
};
var url = '#{url_for :action => 'dispatch', :id => @id}';
- $('#metagrouppackages, ').load(url, data, function() {
+ $metagrouppackages.empty().addClass('loading');
+ $metagrouppackages.load(url, data, function() {
+ $metagrouppackages.removeClass('loading');
Aggregator.hook_selected_packages();
+ //select all packages in collection
+ $(".softwaregroups").click(function() {
+ if ($(this).attr("checked") === true) {
+ $(this).parent().siblings("ul").find("input[type='checkbox']").attr("checked","checked");
+ } else {
+ $(this).parent().siblings("ul").find("input[type='checkbox']").removeAttr("checked");
+ }
+ });
});
});
Aggregator.hook_selected_packages();
diff --git a/src/app/views/templates/new.haml b/src/app/views/templates/new.haml
index 3d16f4f..eada010 100644
--- a/src/app/views/templates/new.haml
+++ b/src/app/views/templates/new.haml
@@ -31,7 +31,11 @@
'repository': $("select[name='tpl[platform]']").val()
};
var url = '#{url_for :action => 'dispatch', :id => @id}';
- $('#metagrouppackages').load(url, data);
+ $('#metagrouppackages').empty().addClass('loading');
+ $('#metagrouppackages').load(url, data, function() {
+ $('#metagrouppackages').removeClass('loading');
+ Aggregator.hook_selected_packages();
+ });
});
});
});
@@ -53,11 +57,12 @@
'selected_packages[]': old_pkgs.concat(new_pkgs.concat(cached_pkgs)),
'selected_groups[]': $("input:checked[name='groups[]']").map(function() {return $(this).val()}).get(),
'cached_packages[]': $("input:text[name='cached[]']").map(function() {return $(this).val()}).get(),
+ 'collections': $("input:hidden[name=collections]").val(),
'template_id' : '#{(a)id.nil? ? nil : @id}'
};
$('#managed_content').load(url, data, function(){
//$('#package_selection_list').empty().show();
- $('#add_software_button').show();
+ //$('#add_software_button').show();
$('.remove_package').click(function() { $(this).parent().parent().remove(); });
});
});
--
1.7.2.3
13 years, 7 months
[PATCH aggregator] BZ #643147 - minor enhancements
by Jan Provazník
From: Jan Provaznik <jprovazn(a)redhat.com>
loadmask, minor bug fixes
---
src/app/controllers/templates_controller.rb | 22 +++++++++++++---------
src/app/stylesheets/aggregator.scss | 9 +++++++++
src/app/views/templates/_collections.haml | 4 +++-
src/app/views/templates/_metagroup_packages.haml | 2 +-
src/app/views/templates/_searched_packages.haml | 2 ++
src/app/views/templates/content_selection.haml | 12 +++++++++++-
src/app/views/templates/new.haml | 8 ++++++--
7 files changed, 45 insertions(+), 14 deletions(-)
diff --git a/src/app/controllers/templates_controller.rb b/src/app/controllers/templates_controller.rb
index 4fe34bb..1573167 100644
--- a/src/app/controllers/templates_controller.rb
+++ b/src/app/controllers/templates_controller.rb
@@ -132,6 +132,8 @@ class TemplatesController < ApplicationController
else
@metagroup_packages = @repository_manager.metagroup_packages_with_tagged_selected_packages(@metagroup, @packages, params[:repository] || @tpl.platform)
end
+ else
+ @collections = @repository_manager.all_groups_with_tagged_selected_packages(@packages, params[:repository] || @tpl.platform)
end
if request.xhr?
if @metagroup_packages
@@ -140,7 +142,7 @@ class TemplatesController < ApplicationController
if @searched_packages
render :partial => 'searched_packages' and return
end
- if @collections
+ if @collections and @metagroup
render :partial => 'collections' and return
end
end
@@ -264,14 +266,16 @@ add account on <a href=\"#{url_for :controller => 'provider', \
@selected_packages = []
end
- [:selected_groups, :groups].each do |pg|
- if params[pg]
- params[pg].each { |grp|
- fg = @groups.find { |gk, gv| gk == grp }
- fg[1][:packages].each { |pk, pv|
- @selected_packages << pk
- } unless fg.nil?
- }
+ if params[:collections].to_s == 'true' or not request.xhr?
+ [:selected_groups, :groups].each do |pg|
+ if params[pg]
+ params[pg].each { |grp|
+ fg = @groups.find { |gk, gv| gk == grp }
+ fg[1][:packages].each { |pk, pv|
+ @selected_packages << pk
+ } unless fg.nil?
+ }
+ end
end
end
diff --git a/src/app/stylesheets/aggregator.scss b/src/app/stylesheets/aggregator.scss
index 6d0a070..c2b95e7 100644
--- a/src/app/stylesheets/aggregator.scss
+++ b/src/app/stylesheets/aggregator.scss
@@ -1167,6 +1167,15 @@ a.iconbutton {
margin: 0;
}
}
+
+ #metagrouppackages {
+ &.loading {
+ display: block;
+ height: 100px;
+ background: url(../../images/spinner.gif) no-repeat center center;
+ }
+ }
+
span.loading {
background: url(../../images/spinner.gif) no-repeat center left;
display: inline-block;
diff --git a/src/app/views/templates/_collections.haml b/src/app/views/templates/_collections.haml
index 96ddcad..4623f6f 100644
--- a/src/app/views/templates/_collections.haml
+++ b/src/app/views/templates/_collections.haml
@@ -1,7 +1,9 @@
+= hidden_field_tag :collections, true
+
%ul.collections
- @collections.keys.sort.each do |id|
%li
- selected = @collections[id][:selected] ? true : false
- = check_box_tag 'groups[]', id, selected, {:disabled => selected, :id => "group_#{id}"}
+ = check_box_tag 'groups[]', id, selected, {:disabled => selected, :id => "group_#{id}", :class => "#{selected ? 'selected' : ''}"}
= label_tag "group_#{id}", @collections[id][:name]
= render :partial => 'addbuttons'
diff --git a/src/app/views/templates/_metagroup_packages.haml b/src/app/views/templates/_metagroup_packages.haml
index 9c0e2d4..07642b1 100644
--- a/src/app/views/templates/_metagroup_packages.haml
+++ b/src/app/views/templates/_metagroup_packages.haml
@@ -8,7 +8,7 @@
%li
- selected = !@metagroup_packages[group][:selected].nil?
%h5
- = check_box_tag 'groups[]', group, selected, {:disabled => selected, :id => "group_#{group}", :class => 'softwaregroups'}
+ = check_box_tag 'groups[]', group, selected, {:disabled => selected, :id => "group_#{group}", :class => "softwaregroups #{selected ? 'selected' : ''}"}
= label_tag "group_#{group}", group
%ul
- @metagroup_packages[group][:packages].each do |pkg|
diff --git a/src/app/views/templates/_searched_packages.haml b/src/app/views/templates/_searched_packages.haml
index d0eb770..0894cb5 100644
--- a/src/app/views/templates/_searched_packages.haml
+++ b/src/app/views/templates/_searched_packages.haml
@@ -15,7 +15,9 @@
'page': $(this).val(),
'repository': $("select[name='tpl[platform]']").val()
};
+ $('#metagrouppackages').empty().addClass('loading');
$('#metagrouppackages').load(url, data, function() {
+ $('#metagrouppackages').removeClass('loading');
Aggregator.hook_selected_packages();
})
});
diff --git a/src/app/views/templates/content_selection.haml b/src/app/views/templates/content_selection.haml
index e5961fe..f1499ae 100644
--- a/src/app/views/templates/content_selection.haml
+++ b/src/app/views/templates/content_selection.haml
@@ -9,8 +9,18 @@
'packages[]': $("input:text[name='packages[]']").map(function() {return $(this).val()}).get()
};
var url = '#{url_for :action => 'dispatch', :id => @id}';
- $('#metagrouppackages, ').load(url, data, function() {
+ $metagrouppackages.empty().addClass('loading');
+ $metagrouppackages.load(url, data, function() {
+ $metagrouppackages.removeClass('loading');
Aggregator.hook_selected_packages();
+ //select all packages in collection
+ $(".softwaregroups").click(function() {
+ if ($(this).attr("checked") === true) {
+ $(this).parent().siblings("ul").find("input[type='checkbox']").attr("checked","checked");
+ } else {
+ $(this).parent().siblings("ul").find("input[type='checkbox']").removeAttr("checked");
+ }
+ });
});
});
Aggregator.hook_selected_packages();
diff --git a/src/app/views/templates/new.haml b/src/app/views/templates/new.haml
index 3d16f4f..7628f64 100644
--- a/src/app/views/templates/new.haml
+++ b/src/app/views/templates/new.haml
@@ -31,7 +31,10 @@
'repository': $("select[name='tpl[platform]']").val()
};
var url = '#{url_for :action => 'dispatch', :id => @id}';
- $('#metagrouppackages').load(url, data);
+ $('#metagrouppackages').empty().addClass('loading');
+ $('#metagrouppackages').load(url, data, function() {
+ $('#metagrouppackages').removeClass('loading');
+ });
});
});
});
@@ -53,11 +56,12 @@
'selected_packages[]': old_pkgs.concat(new_pkgs.concat(cached_pkgs)),
'selected_groups[]': $("input:checked[name='groups[]']").map(function() {return $(this).val()}).get(),
'cached_packages[]': $("input:text[name='cached[]']").map(function() {return $(this).val()}).get(),
+ 'collections': $("input:hidden[name=collections]").val(),
'template_id' : '#{(a)id.nil? ? nil : @id}'
};
$('#managed_content').load(url, data, function(){
//$('#package_selection_list').empty().show();
- $('#add_software_button').show();
+ //$('#add_software_button').show();
$('.remove_package').click(function() { $(this).parent().parent().remove(); });
});
});
--
1.7.2.3
13 years, 7 months
[PATCH cloud engine] BZ #645390: 'multi-select from list' problems
by Tomas Sedovic
From: Tomas Sedovic <tsedovic(a)redhat.com>
https://bugzilla.redhat.com/show_bug.cgi?id=645390
This replaces the checkboxes to radiobuttons in the list of Users, Pools,
Instances and Deployables.
---
src/app/controllers/templates_controller.rb | 21 +++++++++++++++++----
src/app/views/instance/index.haml | 2 +-
src/app/views/pools/index.haml | 6 ++++--
src/app/views/templates/_templates.haml | 2 +-
src/app/views/users/index.haml | 4 ++--
5 files changed, 25 insertions(+), 10 deletions(-)
diff --git a/src/app/controllers/templates_controller.rb b/src/app/controllers/templates_controller.rb
index 4fe34bb..9b696e5 100644
--- a/src/app/controllers/templates_controller.rb
+++ b/src/app/controllers/templates_controller.rb
@@ -30,9 +30,19 @@ class TemplatesController < ApplicationController
elsif params[:delete]
redirect_to :action => 'delete', :ids => params[:ids].to_a
elsif params[:edit]
- redirect_to :action => 'new', :id => get_selected_id
+ begin
+ redirect_to :action => 'new', :id => get_selected_id
+ rescue
+ flash[:notice] = "No template selected"
+ redirect_to :action => 'index'
+ end
elsif params[:build]
- redirect_to :action => 'build_form', 'template_id' => get_selected_id
+ begin
+ redirect_to :action => 'build_form', 'template_id' => get_selected_id
+ rescue
+ flash[:notice] = "No template selected"
+ redirect_to :action => 'index'
+ end
else
raise "Unknown action"
end
@@ -218,8 +228,11 @@ add account on <a href=\"#{url_for :controller => 'provider', \
def delete
ids = params[:ids].to_a
- raise "No Template Selected" if ids.empty?
- Template.destroy(ids)
+ if ids.empty?
+ flash[:notice] = "No Template Selected"
+ else
+ Template.destroy(ids)
+ end
redirect_to :action => 'index'
end
diff --git a/src/app/views/instance/index.haml b/src/app/views/instance/index.haml
index 258f512..8024a2f 100644
--- a/src/app/views/instance/index.haml
+++ b/src/app/views/instance/index.haml
@@ -117,7 +117,7 @@
- else
- instances.each do |inst|
%tr
- %td= check_box_tag 'id[]', inst.id
+ %td= radio_button_tag 'id[]', inst.id
%td= inst.state
%td= inst.name
%td= inst.hardware_profile.name
diff --git a/src/app/views/pools/index.haml b/src/app/views/pools/index.haml
index 81a6b5f..61cec18 100644
--- a/src/app/views/pools/index.haml
+++ b/src/app/views/pools/index.haml
@@ -26,7 +26,7 @@
%tr
%td
- is_first_pool = (pool == @pools.first)
- %input{:checked => is_first_pool, :name => "pool_checkbox", :type => "checkbox", :value => pool.id, :id => "pool_checkbox_#{pool.id}" }
+ %input{:checked => is_first_pool, :name => "pool_checkbox", :type => "radio", :value => pool.id, :id => "pool_checkbox_#{pool.id}" }
= pool.name
%td
=((pool.quota.maximum_running_instances || 0)/100)*pool.quota.total_instances
@@ -38,5 +38,7 @@
:javascript
$(document).ready(function () {
- $("input[type='checkbox']").buttonSensitivity().change();
+ /* NOTE: once we support bulk actions on multiple pools selected at once,
+ uncomment this line:
+ $("input[type='checkbox']").buttonSensitivity().change(); */
});
diff --git a/src/app/views/templates/_templates.haml b/src/app/views/templates/_templates.haml
index d885efe..54dc222 100644
--- a/src/app/views/templates/_templates.haml
+++ b/src/app/views/templates/_templates.haml
@@ -16,7 +16,7 @@
- else
- @templates.each do |tpl|
%tr
- %td= check_box_tag 'ids[]', tpl.id
+ %td= radio_button_tag 'ids[]', tpl.id
%td
= image_tag "blnk.png", :alt => tpl.platform, :class => "icon platform #{tpl.platform}"
= tpl.name
diff --git a/src/app/views/users/index.haml b/src/app/views/users/index.haml
index 3643ba4..111375f 100644
--- a/src/app/views/users/index.haml
+++ b/src/app/views/users/index.haml
@@ -29,7 +29,7 @@
-(a)users.each do |user|
%tr
%td
- %input{:name => "user_checkbox", :type => "checkbox", :value => user.id, :id => "user_checkbox_#{user.id}" }
+ %input{:name => "user_checkbox", :type => "radio", :value => user.id, :id => "user_checkbox_#{user.id}" }
%td= link_to user.login, {:action => "edit", :id => user.id}
%td= user.last_name
%td= user.first_name
@@ -39,5 +39,5 @@
:javascript
$(document).ready(function () {
- $("input[type='checkbox']").buttonSensitivity().change();
+ //$("input[type='checkbox']").buttonSensitivity().change();
});
--
1.7.2.3
13 years, 7 months