[PATCH conductor] BZ790816 Instance details page - tabbed sections
Jirka Tomasek
jtomasek at redhat.com
Wed Feb 15 14:05:56 UTC 2012
Will resend with tiny change in a few minutes.
Jirka
On 02/15/2012 02:59 PM, jtomasek at redhat.com wrote:
> From: Jiri Tomasek<jtomasek at redhat.com>
>
> ---
> src/app/controllers/instances_controller.rb | 11 ++-
> src/app/views/instances/_history.html.haml | 14 +---
> src/app/views/instances/_parameters.haml | 24 +++---
> src/app/views/instances/_properties.html.haml | 109 ++++++++++++-------------
> src/app/views/instances/show.html.haml | 18 ++++-
> src/config/locales/en.yml | 2 +-
> src/features/instance.feature | 4 +-
> 7 files changed, 93 insertions(+), 89 deletions(-)
>
> diff --git a/src/app/controllers/instances_controller.rb b/src/app/controllers/instances_controller.rb
> index 7af1669..a44e7be 100644
> --- a/src/app/controllers/instances_controller.rb
> +++ b/src/app/controllers/instances_controller.rb
> @@ -39,17 +39,22 @@ class InstancesController< ApplicationController
>
> def show
> load_instances
> - @tab_captions = [t('instances.tab_captions.properties'), t('instances.tab_captions.history'), t('instances.tab_captions.permissions')]
> - @details_tab = params[:details_tab].blank? ? 'properties' : params[:details_tab]
> save_breadcrumb(instance_path(@instance), @instance.name)
> @events = @instance.events.descending_by_created_at.paginate(:page => params[:page] || 1)
> + @view = params[:details_tab].blank? ? 'properties' : params[:details_tab]
> + @tabs = [
> + {:name => t('properties'), :view => @view, :id => 'properties'},
> + {:name => t('instances.parameters.config_parameters'), :view => 'parameters', :id => 'parameters'},
> + {:name => t('history'), :view => 'history', :id => 'history'}
> + ]
> + @details_tab = @tabs.find {|t| t[:view] == @view}
> respond_to do |format|
> format.html { render :action => 'show'}
> format.js do
> if params.delete :details_pane
> render :partial => 'layouts/details_pane' and return
> end
> - render :partial => @details_tab and return
> + render :partial => @details_tab[:view] and return
> end
> format.json { render :json => @instance }
> end
> diff --git a/src/app/views/instances/_history.html.haml b/src/app/views/instances/_history.html.haml
> index 60f09e5..ca2ae5c 100644
> --- a/src/app/views/instances/_history.html.haml
> +++ b/src/app/views/instances/_history.html.haml
> @@ -1,10 +1,4 @@
> -%div.instance_details
> - %h3
> - = t 'instances.history.history_for'
> - = @instance.name
> - %ol
> - - @events.each do |event|
> - %li
> - = "#{event.event_time.strftime('%d-%b-%Y %H:%M:%S')}: #{event.summary}"
> -
> - = will_paginate @events
> +%ol
> + - @events.each do |event|
> + %li
> + = "#{event.event_time.strftime('%d-%b-%Y %H:%M:%S')}: #{event.summary}"
> diff --git a/src/app/views/instances/_parameters.haml b/src/app/views/instances/_parameters.haml
> index 7ed7d31..022b5bc 100644
> --- a/src/app/views/instances/_parameters.haml
> +++ b/src/app/views/instances/_parameters.haml
> @@ -1,14 +1,10 @@
> -%div.instance_details
> - %h3
> - = t 'instances.parameters.config_parameters_for'
> - = @instance.name
> - %ul
> - - if @instance.instance_parameters.empty?
> - %li= t("instances.parameters.none")
> - - else
> - - @instance.instance_parameters.each do |parameter|
> - %li
> - = parameter.service
> - = parameter.name
> - = parameter.type
> - = parameter.value
> +%ul
> + - if @instance.instance_parameters.empty?
> + %li= t("instances.parameters.none")
> + - else
> + - @instance.instance_parameters.each do |parameter|
> + %li
> + = parameter.service
> + = parameter.name
> + = parameter.type
> + = parameter.value
> diff --git a/src/app/views/instances/_properties.html.haml b/src/app/views/instances/_properties.html.haml
> index 8b0951b..817ee8f 100644
> --- a/src/app/views/instances/_properties.html.haml
> +++ b/src/app/views/instances/_properties.html.haml
> @@ -1,56 +1,53 @@
> -%div.instance_details
> - %h3
> - = t 'instances.properties.properties_for'
> - = @instance.name
> - %ul
> - %li
> - = label_tag :name, t('instances.properties.name')
> - %span= @instance.name
> - %li
> - = label_tag :status, t('instances.properties.status')
> - %span= @instance.state
> - %li
> - = label_tag :public_addresses, t('instances.properties.public_addresses')
> - %span= @instance.public_addresses
> - %li
> - = label_tag :private_addresses, t('instances.properties.private_adresses')
> - %span= @instance.private_addresses
> - = label_tag :assembly, t('instances.properties.assembly')
> - %span= @instance.assembly_xml.name
> - %li
> - = label_tag :provider, t('instances.properties.provider')
> - %span= @instance.provider_account.provider.name if @instance.provider_account
> - %li
> - = label_tag :architecture, t('instances.properties.architecture')
> - %span= @instance.hardware_profile.architecture.value
> - %li
> - = label_tag :memory, t('instances.properties.memory')
> - %span= @instance.hardware_profile.memory.value
> - %li
> - = label_tag :storage, t('instances.properties.storage')
> - %span= @instance.hardware_profile.storage.value
> - %li
> - = label_tag :instantiation_time, t('instances.properties.instantiation_time')
> - %span= @instance.created_at.strftime("%d-%b-%Y %H:%M:%S")
> - %li
> - = label_tag :current_alerts, t('instances.properties.current_alerts')
> - %span= 0
> - = label_tag :console_connection, t('instances.properties.console_connection')
> - %span= t('instances.properties.via_ssh')
> - - if @instance.instance_key
> - %li
> - = label_tag :instance_key, t('instances.properties.ssh_key')
> - %span= link_to t('instances.properties.download'), key_instance_path(@instance), :id =>'download_ssh_key'
> - %li
> - = label_tag :instance_key_name, t('instances.properties.ssh_key_name')
> - = @instance.instance_key.name
> - %li
> - = label_tag :owner, t('instances.properties.owner')
> - %span= "#{@instance.owner.first_name} #{@instance.owner.last_name}"
> - %li
> - = label_tag :shared_to, t('instances.properties.shared_to')
> - %span= t('instances.properties.n_a')
> - - if @instance.state == Instance::STATE_ERROR
> - %li
> - = label_tag :error, t('instances.properties.error')
> - %span= @instance.last_error
> +%ul
> + %li
> + = label_tag :name, t('instances.properties.name')
> + %span= @instance.name
> + %li
> + = label_tag :status, t('instances.properties.status')
> + %span= @instance.state
> + %li
> + = label_tag :public_addresses, t('instances.properties.public_addresses')
> + %span= @instance.public_addresses
> + %li
> + = label_tag :private_addresses, t('instances.properties.private_adresses')
> + %span= @instance.private_addresses
> + = label_tag :assembly, t('instances.properties.assembly')
> + %span= @instance.assembly_xml.name
> + %li
> + = label_tag :provider, t('instances.properties.provider')
> + %span= @instance.provider_account.provider.name if @instance.provider_account
> + %li
> + = label_tag :architecture, t('instances.properties.architecture')
> + %span= @instance.hardware_profile.architecture.value
> + %li
> + = label_tag :memory, t('instances.properties.memory')
> + %span= @instance.hardware_profile.memory.value
> + %li
> + = label_tag :storage, t('instances.properties.storage')
> + %span= @instance.hardware_profile.storage.value
> + %li
> + = label_tag :instantiation_time, t('instances.properties.instantiation_time')
> + %span= @instance.created_at.strftime("%d-%b-%Y %H:%M:%S")
> + %li
> + = label_tag :current_alerts, t('instances.properties.current_alerts')
> + %span= 0
> + %li
> + = label_tag :console_connection, t('instances.properties.console_connection')
> + %span= t('instances.properties.via_ssh')
> + - if @instance.instance_key
> + %li
> + = label_tag :instance_key, t('instances.properties.ssh_key')
> + %span= link_to t('instances.properties.download'), key_instance_path(@instance), :id =>'download_ssh_key'
> + %li
> + = label_tag :instance_key_name, t('instances.properties.ssh_key_name')
> + = @instance.instance_key.name
> + %li
> + = label_tag :owner, t('instances.properties.owner')
> + %span= "#{@instance.owner.first_name} #{@instance.owner.last_name}"
> + %li
> + = label_tag :shared_to, t('instances.properties.shared_to')
> + %span= t('instances.properties.n_a')
> + - if @instance.state == Instance::STATE_ERROR
> + %li
> + = label_tag :error, t('instances.properties.error')
> + %span= @instance.last_error
> diff --git a/src/app/views/instances/show.html.haml b/src/app/views/instances/show.html.haml
> index 882abac..633e89f 100644
> --- a/src/app/views/instances/show.html.haml
> +++ b/src/app/views/instances/show.html.haml
> @@ -1,4 +1,16 @@
> = render :partial => 'layouts/nav_history'
> -= render :partial => 'properties'
> -= render :partial => 'parameters'
> -= render :partial => 'history'
> +%header.page-header
> + %h1.deployments
> + = @instance.name
> + .corner
> +
> +%section.content-section
> + %header#tab-container-1
> + %nav.faceted
> + %ul#tab-container-1-nav
> + - @tabs.each do |tab|
> + %li
> + %a{ :href => url_for(:details_tab => tab[:id]), :id => "details_#{tab[:id]}", :class => "#{'active' if @details_tab[:id] == tab[:id]}" }
> + = tab[:name]
> + .content.instance_details#tab
> + = render :partial => @view
> diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
> index fbacbc0..037734c 100644
> --- a/src/config/locales/en.yml
> +++ b/src/config/locales/en.yml
> @@ -313,7 +313,7 @@ en:
> history:
> history_for: "History for: "
> parameters:
> - config_parameters_for: Config Parameters for
> + config_parameters: Config Parameters
> none: None
> permissions:
> permissions_for: Permissions for
> diff --git a/src/features/instance.feature b/src/features/instance.feature
> index 997a6ed..1d91333 100644
> --- a/src/features/instance.feature
> +++ b/src/features/instance.feature
> @@ -140,7 +140,7 @@ Feature: Manage Instances
> And there is a "mock1" instance
> And I am on the the instances page
> When I follow "mock1"
> - Then I should see "Properties for mock1"
> + Then I should see "Properties"
>
> Scenario: Edit an instance name
> Given there is a "Tomct" instance
> @@ -197,7 +197,7 @@ Feature: Manage Instances
> Scenario: Show instance history
> Given a mock running instance exists
> And I am viewing the mock instance detail
> - Then I should see "History for"
> + And I follow "details_history"
> Then I should see "created"
>
> Scenario: Filter Instances
More information about the aeolus-devel
mailing list