[PATCH conductor] BZ 773027 Added partial of image's UUIDs
Imre Farkas
ifarkas at redhat.com
Fri Feb 10 10:29:53 UTC 2012
On 02/09/2012 05:21 PM, jzigmund at redhat.com wrote:
> From: Jozef Zigmund<jzigmund at redhat.com>
>
> Added partial of image's uuids in deployable#show.
>
> https://bugzilla.redhat.com/show_bug.cgi?id=773027
> ---
> src/app/controllers/deployables_controller.rb | 1 +
> src/app/helpers/deployables_helper.rb | 9 -----
> src/app/stylesheets/custom.scss | 9 +++++
> src/app/views/deployables/_image_uuids.html.haml | 9 +++++
> src/app/views/deployables/show.html.haml | 43 +++++++++++++++++-----
> src/config/locales/en.yml | 8 +++--
> 6 files changed, 57 insertions(+), 22 deletions(-)
> create mode 100644 src/app/views/deployables/_image_uuids.html.haml
>
> diff --git a/src/app/controllers/deployables_controller.rb b/src/app/controllers/deployables_controller.rb
> index cf5c6b0..9fd93fe 100644
> --- a/src/app/controllers/deployables_controller.rb
> +++ b/src/app/controllers/deployables_controller.rb
> @@ -14,6 +14,7 @@
> # limitations under the License.
> #
> require 'uri'
> +require 'pry'
Despite pry rocks :) it has nothing to do with the patch, please delete
this line.
>
> class DeployablesController< ApplicationController
> before_filter :require_user
> diff --git a/src/app/helpers/deployables_helper.rb b/src/app/helpers/deployables_helper.rb
> index d0bc108..d97eaef 100644
> --- a/src/app/helpers/deployables_helper.rb
> +++ b/src/app/helpers/deployables_helper.rb
> @@ -16,13 +16,4 @@ module DeployablesHelper
> def deployable_ready?
> false
> end
> -
> - def parse_images_hash_details(index, hash)
> - return "N/A" unless hash
> - result = ""
> - result += (hash[index][0].nil? ? t(".image_uuid", :uuid => t(".n_a")) : t(".image_uuid", :uuid => "#{hash[index][0]}"))
> - result += (hash[index][1].nil? ? t(".latest_build_uuid", :uuid => t(".n_a")) : t(".latest_build_uuid", :uuid => "#{hash[index][1]}"))
> - result += (hash[index][2].nil? ? t(".target_images_uuids", :uuid => t(".n_a")) : t(".target_images_uuids", :uuid => "#{hash[index][2]}"))
> - result
> - end
> end
> diff --git a/src/app/stylesheets/custom.scss b/src/app/stylesheets/custom.scss
> index bcc5d90..b42a60f 100644
> --- a/src/app/stylesheets/custom.scss
> +++ b/src/app/stylesheets/custom.scss
> @@ -97,6 +97,15 @@
> display: none;
> }
>
> +table.light_table tbody {
> + tr.collapsed {
> + display: none;
> + }
> +
> + ul li {
> + list-style-type: none;
> + }
> +}
>
> .launch-time-params h2 {
> font-size: 16px;
> diff --git a/src/app/views/deployables/_image_uuids.html.haml b/src/app/views/deployables/_image_uuids.html.haml
> new file mode 100644
> index 0000000..9ee8972
> --- /dev/null
> +++ b/src/app/views/deployables/_image_uuids.html.haml
> @@ -0,0 +1,9 @@
> +%li
> + %strong="#{t("deployables.show.image_uuid")}"
> + ="#{(@images_hash_details[index][0].nil? ? t('deployables.show.n_a') : @images_hash_details[index][0])}"
> +%li
> + %strong="#{t("deployables.show.latest_build_uuid")}"
> + ="#{(@images_hash_details[index][1].nil? ? t("deployables.show.n_a") : @images_hash_details[index][1])}"
> +%li
> + %strong="#{t("deployables.show.target_images_uuids")}"
> + ="#{(@images_hash_details[index][2].nil? ? t("deployables.show.n_a") : @images_hash_details[index][2])}"
Using array of hashes could make it more readable because accessing the
image_uuid / latest_build_uuid / target_images_uuids properties via a
position in an array is not self-explanatory.
> \ No newline at end of file
> diff --git a/src/app/views/deployables/show.html.haml b/src/app/views/deployables/show.html.haml
> index 69c95e9..772536f 100644
> --- a/src/app/views/deployables/show.html.haml
> +++ b/src/app/views/deployables/show.html.haml
> @@ -29,17 +29,29 @@
> %th.align-center=t'.hdd'
> %th.align-center=t'.ram'
> %th.align-center=t'.arch'
> - %tbody
> - - @images_details.each_with_index do |assembly, index|
> - %tr
> - %td.status= image_valid?(assembly)
> + %th=t(".uuids")
> + %tbody
> + - @images_details.each_with_index do |assembly, index|
> + %tr
> + %td.status= image_valid?(assembly)
> + %td
> + %strong=assembly[:name]
> + %td.align-center=assembly[:images_count]
> + %td=assembly[:hwp_name]
> + %td.align-center=assembly[:hwp_hdd]
> + %td.align-center=assembly[:hwp_ram]
> + %td.align-center=assembly[:hwp_arch]
> + %td.align-center
> + - if @images_hash_details.nil?
> + = t(".n_a")
> + - else
> + %a.control{:href => '#'}=t(".show_hide_uuids")
> + - unless @images_hash_details.nil?
> + %tr.collapsed
> %td
> - %strong{:title => "#{parse_images_hash_details(index, @images_hash_details)}"}=assembly[:name]
> - %td.align-center=assembly[:images_count]
> - %td=assembly[:hwp_name]
> - %td.align-center=assembly[:hwp_hdd]
> - %td.align-center=assembly[:hwp_ram]
> - %td.align-center=assembly[:hwp_arch]
> + %td{:colspan => 7}
> + %ul
> + = render :partial => "image_uuids", :locals => {:index => index}
>
> %section.admin-content-section
> - if @missing_images.empty?
> @@ -107,6 +119,17 @@
> .content
> = render :partial => 'permissions/permissions'
>
> +:javascript
> + $(document).ready(function() {
> + $('table.light_table tbody tr').map(function(){
> + var this_row = this;
> + $(this).find('a.control').click(function(){
> + $(this_row).next().toggleClass('collapsed');
> + return false;
> + });
> + });
> + });
> +
> %script#deployableBuildsTemplate{ :type => 'text/x-jquery-tmpl' }
> :plain
> {{each(provider_type, results) build_results}}
> diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
> index 822962d..9757a44 100644
> --- a/src/config/locales/en.yml
> +++ b/src/config/locales/en.yml
> @@ -863,10 +863,12 @@ en:
> pushed: "All Images are pushed and recent."
> build_missing: "Build missing"
> push_missing: "Push missing"
> - image_uuid: "Image UUID: %{uuid}\n"
> - latest_build_uuid: "Latest Build UUID: %{uuid}\n"
> - target_images_uuids: "Target Images UUIDs: %{uuid}\n"
> + image_uuid: "Image UUID"
> + latest_build_uuid: "Latest Build UUID"
> + target_images_uuids: "Target Images UUIDs"
> n_a: "N/A"
> + uuids: "UUIDs"
> + show_hide_uuids: "Show/Hide"
> form:
> choose_xml: Choose Deployable XML file
> catalog: Catalog
ACK, with 2 inline notes
More information about the aeolus-devel
mailing list