On Monday 03 October 2011 14:40:05 Jiri Tomasek wrote:
---
.../controllers/provider_accounts_controller.rb | 10 +++++-----
src/app/controllers/providers_controller.rb | 18
++++++------------ src/app/stylesheets/layout.scss |
1 -
src/app/views/provider_accounts/edit.haml | 8 +-------
src/app/views/provider_accounts/new.haml | 2 +-
src/app/views/provider_accounts/show.haml | 7 ++-----
src/app/views/providers/edit.haml | 9 ++-------
src/features/provider_account.feature | 6 ++----
src/features/support/paths.rb | 2 +-
9 files changed, 20 insertions(+), 43 deletions(-)
diff --git a/src/app/controllers/provider_accounts_controller.rb
b/src/app/controllers/provider_accounts_controller.rb index
b3f6394..d36717a 100644
--- a/src/app/controllers/provider_accounts_controller.rb
+++ b/src/app/controllers/provider_accounts_controller.rb
@@ -88,7 +88,7 @@ class ProviderAccountsController < ApplicationController
@provider_account.assign_owner_roles(current_user)
@provider_account.populate_realms
flash[:notice] = t('provider_accounts.index.account_added', :list
=> @provider_account.name, :count => 1) - redirect_to
edit_provider_path(@provider, :view => 'filter', :details_tab =>
'connectivity') + redirect_to edit_provider_path(@provider,
:details_tab => 'accounts') else
flash[:error] = "Cannot add the provider account."
render :action => 'new' and return
@@ -121,7 +121,7 @@ class ProviderAccountsController <
ApplicationController
@provider_account.quota.set_maximum_running_instances(limit)
if @provider_account.update_attributes(params[:provider_account])
flash[:notice] = "Provider Account updated!"
- redirect_to edit_provider_path(@provider, :view => 'filter',
:details_tab => 'connectivity') + redirect_to
edit_provider_path(@provider, :details_tab => 'accounts') else
flash[:error] = "Provider Account wasn't updated!"
render :action => :edit
@@ -136,14 +136,14 @@ class ProviderAccountsController <
ApplicationController else
flash[:error] = "Provider account was not deleted!"
end
- redirect_to edit_provider_path(@provider, :view => 'filter',
:details_tab => 'connectivity') + redirect_to
edit_provider_path(@provider, :details_tab => 'accounts') end
def multi_destroy
@provider = Provider.find(params[:provider_id])
if params[:accounts_selected].blank?
flash[:warning] = "You must select some accounts first."
- redirect_to edit_provider_path(@provider, :view => 'filter',
:details_tab => 'connectivity') and return + redirect_to
edit_provider_path(@provider, :details_tab => 'accounts') and return end
succeeded = []
@@ -163,7 +163,7 @@ class ProviderAccountsController <
ApplicationController unless failed.empty?
flash[:error] = t 'provider_accounts.index.account_not_deleted',
:count => failed.length, :list => failed.join(', ') end
- redirect_to edit_provider_path(@provider, :view => 'filter',
:details_tab => 'connectivity') + redirect_to
edit_provider_path(@provider, :details_tab => 'accounts') end
def set_selected_provider
diff --git a/src/app/controllers/providers_controller.rb
b/src/app/controllers/providers_controller.rb index 9f8e466..e5e0442
100644
--- a/src/app/controllers/providers_controller.rb
+++ b/src/app/controllers/providers_controller.rb
@@ -115,6 +115,7 @@ class ProvidersController < ApplicationController
if !(a)provider.connect
flash.now[:warning] = "Failed to connect to Provider"
load_provider_tabs
+ @alerts = provider_alerts(@provider)
I'm not sure why do you set this @alerts on this place.
render :action => "edit"
else
if @provider.errors.empty? and @provider.save
@@ -123,6 +124,7 @@ class ProvidersController < ApplicationController
else
flash[:warning] = "Cannot update the provider."
load_provider_tabs
+ @alerts = provider_alerts(@provider)
The same here, w/ one difference that validation errors are displayed in
_error_messages partial, that is displaying above the form.
render :action => 'edit'
end
end
@@ -185,25 +187,17 @@ class ProvidersController < ApplicationController
end
def load_provider_tabs
- @view = filter_view? ? 'provider_accounts/list' : 'edit' unless
params[:details_tab] - if params[:details_tab] == 'connectivity'
- @view = filter_view? ? 'provider_accounts/list' : 'edit'
- elsif params[:details_tab] == 'realms'
- @view = 'realms/list'
- #elsif params[:details_tab] == 'roles'
- # @view = filter_view? ? 'permissions/list' : 'permissions/list'
- end
-
@realms = @provider.all_associated_frontend_realms
#TODO add links to real data for history,properties,permissions
- @tabs = [{:name => 'Connectivity', :view => @view, :id =>
'connectivity', :count => @provider.provider_accounts.count}, -
{:name => 'Realms', :view => @view, :id => 'realms', :count
=>
@realms.count}, + @tabs = [{:name => 'Connectivity', :view =>
'edit',
:id => 'connectivity', :count => @provider.provider_accounts.count}, +
{:name => 'Accounts', :view => 'provider_accounts/list',
:id =>
'accounts', :count => @provider.provider_accounts.count}, +
{:name => 'Realms', :view => 'realms/list', :id =>
'realms', :count =>
@realms.count}, #{:name => 'Roles & Permissions', :view => @view, :id
=>
'roles', :count => @provider.permissions.count}, ]
details_tab_name = params[:details_tab].blank? ? 'connectivity' :
params[:details_tab] @details_tab = @tabs.find {|t| t[:id] ==
details_tab_name} || @tabs.first[:name].downcase
- @provider_accounts = @provider.provider_accounts if @details_tab[:id]
== 'connectivity' + @provider_accounts = @provider.provider_accounts if
@details_tab[:id] == 'accounts' #@permissions = @provider.permissions if
@details_tab[:id] == 'roles'
@view = @details_tab[:view]
diff --git a/src/app/stylesheets/layout.scss
b/src/app/stylesheets/layout.scss index b2724b9..b88ff89 100644
--- a/src/app/stylesheets/layout.scss
+++ b/src/app/stylesheets/layout.scss
@@ -1588,7 +1588,6 @@ section.admin-content-section{
/* nav */
nav.faceted{
float: right;
- margin-right: 100px;
ul{ list-style: none; display: inline-block; font-family:
$font-family-primary; } li{ display: inline-block; margin-bottom: 1px; }
li + li{ margin-left: 40px; }
diff --git a/src/app/views/provider_accounts/edit.haml
b/src/app/views/provider_accounts/edit.haml index 71d15ee..318cb3f 100644
--- a/src/app/views/provider_accounts/edit.haml
+++ b/src/app/views/provider_accounts/edit.haml
@@ -5,17 +5,11 @@
= @provider_account.name
#obj_actions
Return to:
- = link_to "Cloud Providers", edit_provider_path(@provider, :view =>
'filter', :details_tab => 'connectivity'), :class =>
'rounded-link' + =
link_to "Cloud Providers", edit_provider_path(@provider, :details_tab =>
'accounts'), :class => 'rounded-link'
%section.admin-content-section
%header
%h2.settings Settings
- .section-controls
- #obj_actions.button-container
- .button-group
- %span.view-toggle
- = link_to "", provider_provider_account_path(@provider,
@provider_account), :class => "view-toggle pretty", :title =>
"Provider
Account Detail" - = link_to "",
edit_provider_provider_account_path(@provider, @provider_account), :class
=> "view-toggle filter active", :title => "Edit Provider
Account"
.content
- unless @providers.empty?
diff --git a/src/app/views/provider_accounts/new.haml
b/src/app/views/provider_accounts/new.haml index 0ce42f8..565d771 100644
--- a/src/app/views/provider_accounts/new.haml
+++ b/src/app/views/provider_accounts/new.haml
@@ -3,7 +3,7 @@
%h1 New Provider Account
#obj_actions
Return to:
- = link_to "Cloud Providers", edit_provider_path(@provider, :view =>
'filter', :details_tab => 'connectivity'), :class =>
'rounded-link' + =
link_to "Cloud Providers", edit_provider_path(@provider, :details_tab =>
'accounts'), :class => 'rounded-link'
%section.admin-content-section.provider_accounts
.content
diff --git a/src/app/views/provider_accounts/show.haml
b/src/app/views/provider_accounts/show.haml index 0079b43..22eb568 100644
--- a/src/app/views/provider_accounts/show.haml
+++ b/src/app/views/provider_accounts/show.haml
@@ -5,17 +5,14 @@
= @provider_account.name
#obj_actions
Return to:
- = link_to "Cloud Providers", edit_provider_path(@provider, :view =>
'filter', :details_tab => 'connectivity'), :class =>
'rounded-link' + =
link_to "Cloud Providers", edit_provider_path(@provider, :details_tab =>
'accounts'), :class => 'rounded-link'
%section.admin-content-section
%header
%h2 Properties
.section-controls
#obj_actions.button-container
- .button-group
- %span.view-toggle
- = link_to "", provider_provider_account_path(@provider,
@provider_account), :class => "view-toggle pretty active", :title =>
"Provider Account Detail" - = link_to "",
edit_provider_provider_account_path(@provider, @provider_account), :class
=> "view-toggle filter", :title => "Edit Provider Account" +
=
link_to "Edit", edit_provider_provider_account_path(@provider,
@provider_account), :class => "button pill", :title => "Edit
Provider
Account"
.content
= render :partial => 'properties'
diff --git a/src/app/views/providers/edit.haml
b/src/app/views/providers/edit.haml index 6491e2c..dc0b56e 100644
--- a/src/app/views/providers/edit.haml
+++ b/src/app/views/providers/edit.haml
@@ -35,13 +35,8 @@
= tab[:name]
-if tab[:count]
%span.label.badge.count.dark=tab[:count]
- .section-controls
- #obj_actions.button-container
- .button-group
- = pretty_filter_toggle(edit_provider_path(@provider, :view =>
'pretty', :details_tab => @details_tab[:id]),
edit_provider_path(@provider, :view => 'filter', :details_tab =>
@details_tab[:id])) - .content.collapsible.toggle-view.pools#tab
- %ul.deployable-cards
- = render :partial => @view
+ .content#tab
+ = render :partial => @view
- else
%section.admin-content-section
%header.align-center
diff --git a/src/features/provider_account.feature
b/src/features/provider_account.feature index c0ad0ba..58f1e9e 100644
--- a/src/features/provider_account.feature
+++ b/src/features/provider_account.feature
@@ -10,8 +10,7 @@ Feature: Manage Provider Accounts
Scenario: List provider accounts for provider
Given I am on the homepage
And there is a provider named "testprovider"
- When I go to the testprovider's edit provider page
- And I follow "filter_view"
+ When I go to the testprovider's provider accounts page
Then I should see "New Account"
And there should be no provider accounts
@@ -98,8 +97,7 @@ Feature: Manage Provider Accounts
When I follow "Edit"
And I fill in "provider_account[label]" with
"testaccount_updated"
And I press "Save"
- Then I should see "testaccount_updated"
- And I should see "Provider Account updated!" within ".flashes"
+ Then I should see "Provider Account updated!" within ".flashes"
Scenario: Edit a existing Provider Account with invalid credentials
Given there is a provider named "testprovider"
diff --git a/src/features/support/paths.rb b/src/features/support/paths.rb
index a849956..bbeea10 100644
--- a/src/features/support/paths.rb
+++ b/src/features/support/paths.rb
@@ -48,7 +48,7 @@ module NavigationHelpers
edit_provider_path(Provider.find_by_name($1))
when /^the (.*)'s provider accounts page$/
- edit_provider_path(Provider.find_by_name($1), :view => 'filter',
:details_tab => 'connectivity') +
edit_provider_path(Provider.find_by_name($1), :details_tab => 'accounts')
when /the settings page/
settings_path
NACK.
Some inline note, other issue is bug -> You can reproduce it according these
steps:
1. You're on 'Cloud Probiders' page
2. Delete name of provider and click to button 'Save Changes'
3. Then you cannot switch between tabs in 'Settings' part of page 'Cloud
Providers', err is about bad links on tabs.
--
Jozef Zigmund