[PATCH conductor 4/4] 3322 - Added deployment's history tab

Jan Provaznik jprovazn at redhat.com
Tue May 22 10:28:38 UTC 2012


On 05/21/2012 09:49 PM, Matt Wagner wrote:
> On Mon, May 21, 2012 at 03:49:26PM +0200, jprovazn at redhat.com wrote:
>> From: Jan Provaznik<jprovazn at redhat.com>
>>
>> https://www.aeolusproject.org/redmine/issues/3322
>> ---
>>   src/app/controllers/deployments_controller.rb     |   12 ++++++++++--
>>   src/app/views/deployments/_history.html.haml      |    4 ++++
>>   src/features/deployment.feature                   |   10 ++++++++++
>>   src/features/step_definitions/deployment_steps.rb |    9 +++++++++
>>   4 files changed, 33 insertions(+), 2 deletions(-)
>>   create mode 100644 src/app/views/deployments/_history.html.haml
>>
>> diff --git a/src/app/controllers/deployments_controller.rb b/src/app/controllers/deployments_controller.rb
>> index 169b1b6..38be20a 100644
>> --- a/src/app/controllers/deployments_controller.rb
>> +++ b/src/app/controllers/deployments_controller.rb
>> @@ -182,12 +182,20 @@ class DeploymentsController<  ApplicationController
>>                                          params[:page], PER_PAGE)
>>       end
>>       #TODO add links to real data for history, services
>> -    @tabs = [{:name =>  t('instances.instances.other'), :view =>  @view, :id =>  'instances', :count =>  @deployment.instances.count, :pretty_view_toggle =>  'enabled'},
>> -             {:name =>  t('properties'), :view =>  'properties', :id =>  'properties', :pretty_view_toggle =>  'disabled'}
>> +    @tabs = [{:name =>  t('instances.instances.other'), :view =>  @view,
>> +               :id =>  'instances', :count =>  @deployment.instances.count,
>> +               :pretty_view_toggle =>  'enabled'},
>> +             {:name =>  t('properties'), :view =>  'properties',
>> +               :id =>  'properties', :pretty_view_toggle =>  'disabled'},
>> +             {:name =>  t('history'), :view =>  'history', :id =>  'history',
>> +               :pretty_view_toggle =>  'disabled'},
>>       ]
>>       add_permissions_tab(@deployment)
>>       details_tab_name = params[:details_tab].blank? ? 'instances' : params[:details_tab]
>>       @details_tab = @tabs.find {|t| t[:id] == details_tab_name} || @tabs.first[:name].downcase
>> +    if @details_tab[:id] == 'history'
>> +      @events = @deployment.events
>> +    end
>>       if params[:details_tab]
>>         @view = @details_tab[:view]
>>       end
>> diff --git a/src/app/views/deployments/_history.html.haml b/src/app/views/deployments/_history.html.haml
>> new file mode 100644
>> index 0000000..ca2ae5c
>> --- /dev/null
>> +++ b/src/app/views/deployments/_history.html.haml
>> @@ -0,0 +1,4 @@
>> +%ol
>> +  - @events.each do |event|
>> +    %li
>> +      = "#{event.event_time.strftime('%d-%b-%Y %H:%M:%S')}: #{event.summary}"
>
> There's nothing semantically wrong here, but (no offense!) it looks
> really ugly in my browser. I don't think we have any styles for %ol at
> all.
>
> I readily confess to having contributed several fixes with "This is
> unstyled, but we can fix that later" comments, but they still lurk in
> the app in full ugliness, so it's probably not the best practice.
>
> -- Matt
>

After discussing this with Jirka, I've just added a class 'listing' to 
the 'ol' div. This css class will be defined in upcoming Jirka's patch.

>
>> diff --git a/src/features/deployment.feature b/src/features/deployment.feature
>> index a058d78..a5ebf73 100644
>> --- a/src/features/deployment.feature
>> +++ b/src/features/deployment.feature
>> @@ -156,6 +156,16 @@ Feature: Manage Deployments
>>       When I follow "details_instances"
>>       Then I should see "testdeployment"
>>
>> +  Scenario: Show deployment history
>> +    Given there is a deployment named "testdeployment" belonging to "testdeployable" owned by "testuser"
>> +    And deployement "testdeployment" has associated event "testevent"
>> +    When I am on the deployments page
>> +    And I follow "testdeployment"
>> +    And I should see "testdeployment"
>> +    And I follow "History"
>> +    Then I should see "testdeployment"
>> +    And I should see "testevent"
>> +
>>     Scenario: Delete a deployment
>>       Given there is a deployment named "testdeployment" belonging to "testdeployable" owned by "testuser"
>>       And I am on the pools page
>> diff --git a/src/features/step_definitions/deployment_steps.rb b/src/features/step_definitions/deployment_steps.rb
>> index 0640d9d..4ebab17 100644
>> --- a/src/features/step_definitions/deployment_steps.rb
>> +++ b/src/features/step_definitions/deployment_steps.rb
>> @@ -77,3 +77,12 @@ end
>>   When /^I stop "([^"]*)" deployment$/ do |arg1|
>>     visit multi_stop_deployments_url('deployments_selected[]' =>  Deployment.find_by_name(arg1).id)
>>   end
>> +
>> +Given /^deployement "([^"]*)" has associated event "([^"]*)"$/ do |arg1, arg2|
>> +  depl = Deployment.find_by_name(arg1)
>> +  depl.events<<  Event.create(
>> +    :source =>  depl,
>> +    :event_time =>  DateTime.now,
>> +    :summary =>  arg2
>> +  )
>> +end
>> --
>> 1.7.7.6
>>




More information about the aeolus-devel mailing list