deltacloud puppet recipe and installer revamp (rev 2)
by Mo Morsi
This patchset greatly revamps the deltacloud puppet recipe and installer/uninstaller
to clean up a plethora of things and to make it a more state based solution, bringing
it inline with the standard puppet methodology.
13 years, 4 months
[PATCH aeolus 1/2] Added Tests for new UI, admin, hardware profiles
by Martyn Taylor
From: Martyn Taylor <mtaylor(a)redhat.com>
---
src/features/hardware_profile.feature | 51 ++++++++++++++++++++
.../step_definitions/hardware_profile_steps.rb | 22 ++++++++
2 files changed, 73 insertions(+), 0 deletions(-)
create mode 100644 src/features/hardware_profile.feature
create mode 100644 src/features/step_definitions/hardware_profile_steps.rb
diff --git a/src/features/hardware_profile.feature b/src/features/hardware_profile.feature
new file mode 100644
index 0000000..6f1cc81
--- /dev/null
+++ b/src/features/hardware_profile.feature
@@ -0,0 +1,51 @@
+Feature: Manage Pools
+ In order to manage my cloud infrastructure
+ As an admin
+ I want to manage Hardware Profiles
+
+ Background:
+ Given I am an authorised user
+ And I am logged in
+ And I am using new UI
+
+ Scenario: View front end hardware profiles
+ Given there are the following aggregator hardware profiles:
+ | name | memory | cpu |storage | architecture |
+ | m1-small | 1740 | 2 | 160 | i386 |
+ | m1-large | 4096 | 4 | 850 | x86_64 |
+ | m1-xlarge | 8192 | 8 | 1690 | x86_64 |
+ And I am on the the hardware profiles page
+ Then I should see the following:
+ | Hardware Profile Name | Memory | Virtual CPU | Storage | Architecture |
+ | m1-small | 1740 | 2 | 160 | i386 |
+ | m1-large | 4096 | 4 | 850 | x86_64 |
+ | m1-xlarge | 8192 | 8 | 1690 | x86_64 |
+
+ Scenario: View a Hardware Profiles Properties
+ Given there are the following aggregator hardware profiles:
+ | name | memory | cpu |storage | architecture |
+ | m1-small | 1740 | 2 | 160 | i386 |
+ | m1-large | 4096 | 4 | 850 | x86_64 |
+ | m1-xlarge | 8192 | 8 | 1690 | x86_64 |
+ And I am on the the hardware profiles page
+ When I follow "m1-small"
+ Then I should see the following:
+ | Name | Kind | Range First | Range Last | Enum Entries | Default Value | Unit |
+ | memory | fixed | n/a | n/a | n/a | 1740 | MB |
+ | cpu | fixed | n/a | n/a | n/a | 2 | count |
+ | storage | fixed | n/a | n/a | n/a | 160 | GB |
+ | architecture | fixed | n/a | n/a | n/a | i386 | label |
+
+ Scenario: View a Front End Hardware Profiles Matching Provider Hardware Profiles
+ Given there are the following aggregator hardware profiles:
+ | name | memory | cpu |storage | architecture |
+ | m1-small | 1740 | 2 | 160 | i386 |
+ And the Hardare Profile "m1-small" has the following Provider Hardware Profiles:
+ | name | memory | cpu |storage | architecture |
+ | m1-small | 1740 | 2 | 160 | i386 |
+ And I am on the hardware profiles page
+ When I follow "m1-small"
+ And I follow "Matching Provider Hardware Profiles"
+ Then I should see the following:
+ | Name | Memory | CPU | Storage | Architecture |
+ | m1-small | 1740 | 2 | 160 | i386 |
\ No newline at end of file
diff --git a/src/features/step_definitions/hardware_profile_steps.rb b/src/features/step_definitions/hardware_profile_steps.rb
new file mode 100644
index 0000000..d29d136
--- /dev/null
+++ b/src/features/step_definitions/hardware_profile_steps.rb
@@ -0,0 +1,22 @@
+Given /^there are the following aggregator hardware profiles:$/ do |table|
+ table.hashes.each do |hash|
+ create_hwp(hash)
+ end
+end
+
+Given /^the Hardare Profile "([^"]*)" has the following Provider Hardware Profiles:$/ do |name, table|
+ provider = Factory :mock_provider
+ front_end_hwp = HardwareProfile.find_by_name(name)
+ back_end_hwps = table.hashes.collect { |hash| create_hwp(hash, provider) }
+
+ front_end_hwp.provider_hardware_profiles = back_end_hwps
+ front_end_hwp.save!
+end
+
+def create_hwp(hash, provider=nil)
+ memory = Factory(:mock_hwp1_memory, :value => hash[:memory])
+ storage = Factory(:mock_hwp1_storage, :value => hash[:storage])
+ cpu = Factory(:mock_hwp1_cpu, :value => hash[:cpu])
+ arch = Factory(:mock_hwp1_arch, :value => hash[:architecture])
+ Factory(:mock_hwp1, :name => hash[:name], :memory => memory, :cpu => cpu, :storage => storage, :architecture => arch, :provider => provider)
+end
\ No newline at end of file
--
1.7.2.3
13 years, 4 months
[PATCH aggregator] Fix for new UI for Users base on Tomas's template
by lmartinc@redhat.com
From: Ladislav Martincik <lmartinc(a)redhat.com>
---
src/app/controllers/admin/users_controller.rb | 13 +++
src/app/views/admin/users/_list.haml | 2 -
src/app/views/admin/users/_properties.haml | 98 ++++++++++++++++++++++++
src/app/views/admin/users/show.haml | 99 -------------------------
src/config/environment.rb | 2 +-
src/features/user.feature | 3 +-
6 files changed, 114 insertions(+), 103 deletions(-)
create mode 100644 src/app/views/admin/users/_properties.haml
delete mode 100644 src/app/views/admin/users/show.haml
diff --git a/src/app/controllers/admin/users_controller.rb b/src/app/controllers/admin/users_controller.rb
index 65b1ce6..0e854a9 100644
--- a/src/app/controllers/admin/users_controller.rb
+++ b/src/app/controllers/admin/users_controller.rb
@@ -35,6 +35,19 @@ class Admin::UsersController < ApplicationController
def show
@user = User.find_by_id(params[:id]) || current_user
@quota_resources = @user.quota.quota_resources
+
+ @url_params = params.clone
+ @tab_captions = ['Properties']
+ @details_tab = params[:details_tab].blank? ? 'properties' : params[:details_tab]
+ respond_to do |format|
+ format.js do
+ if @url_params.delete :details_pane
+ render :partial => 'layouts/details_pane' and return
+ end
+ render :partial => @details_tab
+ end
+ format.html { render :partial => @details_tab }
+ end
end
def edit
diff --git a/src/app/views/admin/users/_list.haml b/src/app/views/admin/users/_list.haml
index ff62782..6a544ed 100644
--- a/src/app/views/admin/users/_list.haml
+++ b/src/app/views/admin/users/_list.haml
@@ -14,7 +14,6 @@
=link_to "Quota", admin_users_url(:sort_by => "quota")
%span (Instances)
%th= link_to "e-mail", admin_users_url(:sort_by => "email")
- %th
-(a)users.each do |user|
%tr
%td
@@ -25,7 +24,6 @@
%td= sprintf("%.2f", user.quota.percentage_used)
%td= Quota.no_limit(user.quota.maximum_running_instances) ? "Unlimited" : user.quota.maximum_running_instances
%td= user.email
- %td= link_to "edit", edit_admin_user_path(user)
:javascript
$(document).ready(function () {
diff --git a/src/app/views/admin/users/_properties.haml b/src/app/views/admin/users/_properties.haml
new file mode 100644
index 0000000..fc8af9c
--- /dev/null
+++ b/src/app/views/admin/users/_properties.haml
@@ -0,0 +1,98 @@
+.grid_13
+ %h2 #{(a)user.first_name} #{(a)user.last_name} (#{(a)user.login})
+
+ = link_to 'Edit', edit_admin_user_path(@user), :class => 'button'
+
+ %table
+ %thead
+ %tr
+ %th.show
+ Personal Details
+ %th.show
+ %tbody
+ %tr
+ %td
+ %label Username
+ %td
+ = @user.login
+ %tr
+ %td
+ %label First Name
+ %td
+ = @user.first_name
+ %tr
+ %td
+ %label Last Name
+ %td
+ = @user.last_name
+ %tr
+ %td
+ %label e-mail
+ %td
+ = @user.email
+
+ %table
+ %thead
+ %tr
+ %th.show
+ Quota Status
+ %th.show
+ %tbody
+ %tr
+ %td
+ %label Maximum
+ %td
+ = @quota_resources["running_instances"].max
+ %tr
+ %td
+ %label Used
+ %td
+ = @quota_resources["running_instances"].used
+ %tr
+ %td
+ %label Availabe
+ %td
+ = @quota_resources["running_instances"].available
+
+ %table
+ %thead
+ %tr
+ %th.show
+ Login Information
+ %th.show
+ %tbody
+ %tr
+ %td
+ %label Current Login IP
+ %td
+ = @user.current_login_ip
+ %tr
+ %td
+ %label Current Login at
+ %td
+ = @user.current_login_at
+ %tr
+ %td
+ %label Last Login IP
+ %td
+ = @user.last_login_ip
+ %tr
+ %td
+ %label Last Login at
+ %td
+ = @user.last_login_at
+ %tr
+ %td
+ %label Login Count
+ %td
+ = @user.login_count
+ %tr
+ %td
+ %label Failed Login Count
+ %td
+ = @user.login_count
+ %tr
+ %td
+ %label Last Request at
+ %td
+ = @user.last_request_at
diff --git a/src/app/views/admin/users/show.haml b/src/app/views/admin/users/show.haml
deleted file mode 100644
index c5cca96..0000000
--- a/src/app/views/admin/users/show.haml
+++ /dev/null
@@ -1,99 +0,0 @@
--content_for :list do
- = render :partial => 'list'
--content_for :details do
- .grid_13
- %h2 #{(a)user.first_name} #{(a)user.last_name} (#{(a)user.login})
-
- %table
- %thead
- %tr
- %th.show
- Personal Details
- %th.show
- %tbody
- %tr
- %td
- %label Username
- %td
- = @user.login
- %tr
- %td
- %label First Name
- %td
- = @user.first_name
- %tr
- %td
- %label Last Name
- %td
- = @user.last_name
- %tr
- %td
- %label e-mail
- %td
- = @user.email
-
- %table
- %thead
- %tr
- %th.show
- Quota Status
- %th.show
- %tbody
- %tr
- %td
- %label Maximum
- %td
- = @quota_resources["running_instances"].max
- %tr
- %td
- %label Used
- %td
- = @quota_resources["running_instances"].used
- %tr
- %td
- %label Availabe
- %td
- = @quota_resources["running_instances"].available
-
- %table
- %thead
- %tr
- %th.show
- Login Information
- %th.show
- %tbody
- %tr
- %td
- %label Current Login IP
- %td
- = @user.current_login_ip
- %tr
- %td
- %label Current Login at
- %td
- = @user.current_login_at
- %tr
- %td
- %label Last Login IP
- %td
- = @user.last_login_ip
- %tr
- %td
- %label Last Login at
- %td
- = @user.last_login_at
- %tr
- %td
- %label Login Count
- %td
- = @user.login_count
- %tr
- %td
- %label Failed Login Count
- %td
- = @user.login_count
- %tr
- %td
- %label Last Request at
- %td
- = @user.last_request_at
diff --git a/src/config/environment.rb b/src/config/environment.rb
index 09ec85b..6b21c42 100644
--- a/src/config/environment.rb
+++ b/src/config/environment.rb
@@ -51,7 +51,7 @@ Rails::Initializer.run do |config|
config.gem "compass-960-plugin", :lib => "ninesixty"
config.gem "simple-navigation"
config.gem "typhoeus"
- config.gem "rb-inotify"
+ #config.gem "rb-inotify"
config.gem 'rack-restful_submit', :version => '1.1.2'
config.middleware.swap Rack::MethodOverride, 'Rack::RestfulSubmit'
diff --git a/src/features/user.feature b/src/features/user.feature
index 2160ed1..89dd7d5 100644
--- a/src/features/user.feature
+++ b/src/features/user.feature
@@ -12,7 +12,8 @@ Feature: Manage Users
Scenario: Change the password
Given I am on the admin users page
And there is a user "testuser"
- When I follow "edit"
+ When I follow "testuser"
+ And I follow "Edit"
Then I should see "Editing User:"
When I fill in "user[password]" with "new password"
And I fill in "user[password_confirmation]" with ""
--
1.7.3.2
13 years, 4 months
Setting up Dev environment with Building + Mock Builds
by Martyn Taylor
Since this wasn't obvious, I thought I would document the process for setting up a dev environment with Image building + Mock builds
1. Install, Configure and Run: DeltaCloud All DC Services (RPMs)
2. Stop 'deltacloud-image_builder_service' and 'deltacloud-aggregator'
- `sudo /etc/init.d/deltacloud-image_builder_service stop`
- `sudo /etc/init.d/deltacloud-aggregator stop`
3. In /etc/httpd/conf.d/deltacloud-aggregator.conf - comment out Alias and ProxyPass as shown below:
NameVirtualHost *:80
<VirtualHost *:80>
ErrorLog /etc/httpd/logs/error_log
TransferLog /etc/httpd/logs/access_log
LogLevel warn
ProxyRequests Off
#Alias /deltacloud/stylesheets "/usr/share/deltacloud-aggregator/public/stylesheets"
#Alias /deltacloud/images "/usr/share/deltacloud-aggregator/public/images"
#Alias /deltacloud/errors "/usr/share/deltacloud-aggregator/public/"
#ProxyPass /deltacloud/images !
#ProxyPass /deltacloud/stylesheets !
#ProxyPass /deltacloud/errors !
ProxyPass /deltacloud http://localhost:3000/deltacloud
ProxyPassReverse /deltacloud http://localhost:3000/deltacloud
#ProxyPassReverse /deltacloud/images !
#ProxyPassReverse /deltacloud/stylesheets !
#ProxyPassReverse /deltacloud/errors !
</VirtualHost>
4. Uncomment #mock and #name: Mock from <dev_branch>/src/config/image_descriptor_targets.yml
5. Start Image Builder Service from <dev_branch>/src
- sudo ./image_builder_service/image_builder_service
6. Start DeltaCloud CE, from <dev_branch>/src
- `./script/server --path=/deltacloud`
In case of errors, check log: /var/log/deltacloud-aggregator/image_builder_service.log
13 years, 4 months
[PATCH aggregator] BZ #649473 - Instance: name too long throws PGError
by Mo Morsi
Actually caused by the instance.condor_job_id field being too
short. This expands this field (so long as condor can handle
a job id of this length)
---
src/app/models/instance.rb | 1 +
...20101203162334_expand_instance_condor_job_id.rb | 26 ++++++++++++++++++++
src/spec/models/instance_spec.rb | 7 +++++
3 files changed, 34 insertions(+), 0 deletions(-)
create mode 100644 src/db/migrate/20101203162334_expand_instance_condor_job_id.rb
diff --git a/src/app/models/instance.rb b/src/app/models/instance.rb
index 22069e2..e3d65bc 100644
--- a/src/app/models/instance.rb
+++ b/src/app/models/instance.rb
@@ -47,6 +47,7 @@ class Instance < ActiveRecord::Base
validates_presence_of :name
validates_uniqueness_of :name, :scope => :pool_id
validates_length_of :name, :maximum => 1024
+ validates_length_of :condor_job_id, :maximum => 2048, :unless => Proc.new { |i| i.condor_job_id.nil? }
STATE_NEW = "new"
STATE_PENDING = "pending"
diff --git a/src/db/migrate/20101203162334_expand_instance_condor_job_id.rb b/src/db/migrate/20101203162334_expand_instance_condor_job_id.rb
new file mode 100644
index 0000000..7ea1002
--- /dev/null
+++ b/src/db/migrate/20101203162334_expand_instance_condor_job_id.rb
@@ -0,0 +1,26 @@
+# Copyright (C) 2010 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA. A copy of the GNU General Public License is
+# also available at http://www.gnu.org/copyleft/gpl.html.
+
+class ExpandInstanceCondorJobId < ActiveRecord::Migration
+ def self.up
+ change_column :instances, :condor_job_id, :string, :limit => 2048
+ end
+
+ def self.down
+ change_column :instances, :condor_job_id, :string
+ end
+end
diff --git a/src/spec/models/instance_spec.rb b/src/spec/models/instance_spec.rb
index ee9cbaf..36c2839 100644
--- a/src/spec/models/instance_spec.rb
+++ b/src/spec/models/instance_spec.rb
@@ -42,6 +42,13 @@ describe Instance do
end
+ it "should have a condor_job_id of reasonable length" do
+ @instance.condor_job_id = 'x'*2049
+ @instance.should_not be_valid
+ @instance.condor_job_id = 'x'*2048
+ @instance.should be_valid
+ end
+
it "should have unique name" do
@instance.save!
second_instance = Factory.build(:instance,
--
1.7.2.3
13 years, 4 months
[PATCH aeolus] Add the Administration -> Provider Accounts page
by Tomas Sedovic
From: Tomas Sedovic <tsedovic(a)redhat.com>
---
.../admin/provider_accounts_controller.rb | 126 ++++++++++++++++++++
src/app/controllers/cloud_accounts_controller.rb | 4 +-
.../admin/provider_accounts/_credentials.haml | 3 +
src/app/views/admin/provider_accounts/_form.haml | 52 ++++++++
.../views/admin/provider_accounts/_history.haml | 3 +
src/app/views/admin/provider_accounts/_list.haml | 18 +++
.../admin/provider_accounts/_permissions.haml | 3 +
.../views/admin/provider_accounts/_properties.haml | 5 +
src/app/views/admin/provider_accounts/edit.haml | 13 ++
src/app/views/admin/provider_accounts/index.haml | 3 +-
src/app/views/admin/provider_accounts/new.haml | 16 +++
src/app/views/admin/provider_accounts/show.haml | 5 +
src/config/routes.rb | 3 +-
13 files changed, 250 insertions(+), 4 deletions(-)
create mode 100644 src/app/views/admin/provider_accounts/_credentials.haml
create mode 100644 src/app/views/admin/provider_accounts/_form.haml
create mode 100644 src/app/views/admin/provider_accounts/_history.haml
create mode 100644 src/app/views/admin/provider_accounts/_list.haml
create mode 100644 src/app/views/admin/provider_accounts/_permissions.haml
create mode 100644 src/app/views/admin/provider_accounts/_properties.haml
create mode 100644 src/app/views/admin/provider_accounts/edit.haml
create mode 100644 src/app/views/admin/provider_accounts/new.haml
create mode 100644 src/app/views/admin/provider_accounts/show.haml
diff --git a/src/app/controllers/admin/provider_accounts_controller.rb b/src/app/controllers/admin/provider_accounts_controller.rb
index dda74ae..25ed002 100644
--- a/src/app/controllers/admin/provider_accounts_controller.rb
+++ b/src/app/controllers/admin/provider_accounts_controller.rb
@@ -1,6 +1,132 @@
class Admin::ProviderAccountsController < ApplicationController
before_filter :require_user
+ before_filter :load_accounts, :only => [:index, :show]
def index
end
+
+ def show
+ @tab_captions = ['Properties', 'Credentials', 'History', 'Permissions']
+ @account = CloudAccount.find(params[:id])
+ @details_tab = params[:details_tab].blank? ? 'properties' : params[:details_tab]
+
+ if params.delete :test_account
+ test_account(@account)
+ render :action => 'show' and return
+ end
+
+ respond_to do |format|
+ format.js do
+ if @url_params.delete :details_pane
+ render :partial => 'layouts/details_pane' and return
+ end
+ render :partial => @details_tab and return
+ end
+ format.html { render :action => 'show'}
+ end
+ end
+
+ def new
+ @cloud_account = CloudAccount.new
+ @quota = Quota.new
+ @providers = Provider.all
+ end
+
+ def create
+ @provider = Provider.find(params[:provider_id])
+ require_privilege(Privilege::ACCOUNT_MODIFY, @provider)
+
+ @providers = Provider.all
+ @cloud_account = CloudAccount.new(params[:cloud_account])
+ @cloud_account.provider = @provider
+ @cloud_account.quota = @quota = Quota.new
+
+ if params.delete :test_account
+ test_account(@cloud_account)
+ render :action => 'new' and return
+ end
+
+ limit = params[:quota][:maximum_running_instances] if params[:quota]
+ @cloud_account.quota.set_maximum_running_instances(limit)
+
+ if @cloud_account.invalid?
+ if not @cloud_account.valid_credentials?
+ flash.now[:error] = "The entered credential information is incorrect"
+ elsif @cloud_account.errors.on(:username)
+ flash.now[:error] = "The access key '#{params[:cloud_account][:username]}' has already been taken."
+ else
+ flash.now[:error] = "You must fill in all the required fields"
+ end
+ render :action => 'new' and return
+ end
+
+ @cloud_account.zones << Zone.default
+ @cloud_account.save!
+ if @cloud_account.populate_realms
+ flash[:notice] = "Provider account added."
+ end
+ redirect_to admin_provider_account_path(@cloud_account)
+ kick_condor
+ end
+
+ def edit
+ @cloud_account = CloudAccount.find(params[:id])
+ @quota = @cloud_account.quota
+ @provider = @cloud_account.provider
+ require_privilege(Privilege::ACCOUNT_MODIFY,@provider)
+ end
+
+ def update
+ @cloud_account = CloudAccount.find(params[:id])
+ @provider = @cloud_account.provider
+ require_privilege(Privilege::ACCOUNT_MODIFY, @provider)
+ @quota = @cloud_account.quota
+
+ if params.delete :test_account
+ test_account(@cloud_account)
+ render :action => 'new' and return
+ end
+
+ limit = params[:quota][:maximum_running_instances] if params[:quota]
+ @cloud_account.quota.set_maximum_running_instances(limit)
+ if @cloud_account.update_attributes(params[:cloud_account])
+ flash[:notice] = "Cloud Account updated!"
+ redirect_to admin_provider_account_path(@cloud_account)
+ else
+ render :action => :edit
+ end
+ end
+
+ def multi_destroy
+ if (not params[:accounts_selected]) or (params[:accounts_selected].length == 0)
+ flash[:notice] = "You must select some accounts first."
+ else
+ CloudAccount.destroy(params[:accounts_selected])
+ end
+ redirect_to admin_provider_accounts_url
+ end
+
+ protected
+
+ def test_account(account)
+ if account.valid_credentials?
+ flash.now[:notice] = "Test Connection Success: Valid Account Details"
+ else
+ flash.now[:error] = "Test Connection Failed: Invalid Account Details"
+ end
+ rescue
+ flash.now[:error] = "Test Connection Failed: Could not connect to provider"
+ end
+
+ def load_accounts
+ @header = [
+ { :name => "Name", :sort_attr => :name },
+ { :name => "Username", :sort_attr => :username},
+ ]
+ @accounts = CloudAccount.paginate(:all,
+ :page => params[:page] || 1,
+ :order => (params[:order_field] || 'label') +' '+ (params[:order_dir] || 'asc')
+ )
+ @url_params = params
+ end
end
diff --git a/src/app/controllers/cloud_accounts_controller.rb b/src/app/controllers/cloud_accounts_controller.rb
index ae0a224..d21d532 100644
--- a/src/app/controllers/cloud_accounts_controller.rb
+++ b/src/app/controllers/cloud_accounts_controller.rb
@@ -48,9 +48,9 @@ class CloudAccountsController < ApplicationController
@cloud_account.provider = @provider
@cloud_account.quota = @quota = Quota.new
- if params[:test_account]
+ if params.delete :test_account
test_account(@cloud_account)
- render :action => 'new' and return
+ redirect_to admin_provider_account_path(@cloud_account) and return
end
limit = params[:quota][:maximum_running_instances] if params[:quota]
diff --git a/src/app/views/admin/provider_accounts/_credentials.haml b/src/app/views/admin/provider_accounts/_credentials.haml
new file mode 100644
index 0000000..9d31c8d
--- /dev/null
+++ b/src/app/views/admin/provider_accounts/_credentials.haml
@@ -0,0 +1,3 @@
+%h3
+ Credentials for
+ = @account.name
diff --git a/src/app/views/admin/provider_accounts/_form.haml b/src/app/views/admin/provider_accounts/_form.haml
new file mode 100644
index 0000000..853d348
--- /dev/null
+++ b/src/app/views/admin/provider_accounts/_form.haml
@@ -0,0 +1,52 @@
+= error_messages_for 'cloud_account'
+%fieldset.clearfix.nomargin
+ %label.grid_4.la.alpha
+ = t('cloud_accounts.form.account_name')
+ %span.required *
+ %label.grid_3.la
+ = t('cloud_accounts.form.user_name')
+ %span.required *
+ %label.grid_3.la
+ = t('cloud_accounts.form.password')
+ %span.required *
+ %label.grid_3.la.omega
+ = t('cloud_accounts.form.quota_instances')
+ %span.required *
+%fieldset.nomargin.clearfix
+ = f.text_field :label, :title => t('cloud_accounts.form.account_name'), :class => "grid_4 alpha"
+ = f.text_field :username, :title => t('cloud_accounts.form.user_name'), :class => "grid_3"
+ = f.password_field :password, :title => t('cloud_accounts.form.password'), :class => "grid_3"
+ = text_field "quota", :maximum_running_instances, :title => t('cloud_accounts.form.quota_instances'), :value => @quota.maximum_running_instances || "unlimited", :id => "quota_instances", :class => "grid_3 omega"
+%fieldset.nomargin.clearfix
+ .grid_3.prefix_10.alpha.omega
+ (
+ %button.linkbutton.nospace{ :type => 'button', :onclick => "set_unlimited_quota(\"quota_instances\");" }<>
+ = t('cloud_accounts.form.unlimited_quota')
+ )
+%fieldset.clearfix.nomargin
+ %label.grid_4.la.alpha
+ = t('cloud_accounts.form.account_number')
+ %span.required *
+ %label.grid_3.la
+ = t('cloud_accounts.form.account_private_cert')
+ %span.required *
+ %label.grid_3.la
+ = t('cloud_accounts.form.account_public_cert')
+ %span.required *
+ .grid_3.omega
+%fieldset.clearfix.nomargin
+ = f.text_field :account_number, :title => t('cloud_accounts.form.account_number'), :class => "grid_4 alpha"
+ .grid_3
+ = f.file_field :x509_cert_priv_file, :title => t('cloud_accounts.form.account_private_cert')
+ .grid_3
+ = f.file_field :x509_cert_pub_file, :title => t('cloud_accounts.form.account_public_cert')
+ .grid_3.omega
+ (
+ %button.linkbutton.nospace{ :type => 'submit', :value => t('cloud_accounts.form.test_account'), :name => 'test_account', :id => 'test_account' }<>
+ = t('cloud_accounts.form.test_account')
+ )
+
+:javascript
+ function set_unlimited_quota(elem_id) {
+ $("#" + elem_id)[0].value = "unlimited";
+ }
diff --git a/src/app/views/admin/provider_accounts/_history.haml b/src/app/views/admin/provider_accounts/_history.haml
new file mode 100644
index 0000000..429320a
--- /dev/null
+++ b/src/app/views/admin/provider_accounts/_history.haml
@@ -0,0 +1,3 @@
+%h3
+ History for
+ = @account.name
diff --git a/src/app/views/admin/provider_accounts/_list.haml b/src/app/views/admin/provider_accounts/_list.haml
new file mode 100644
index 0000000..17c982f
--- /dev/null
+++ b/src/app/views/admin/provider_accounts/_list.haml
@@ -0,0 +1,18 @@
+- form_tag do
+ = link_to "New Account", new_admin_provider_account_path, :class => 'button'
+ = restful_submit_tag "Delete", "delete", multi_destroy_admin_provider_accounts_path, 'DELETE'
+ %p
+ Select:
+ = link_to "All", @url_params.merge(:select => 'all')
+ %span> ,
+ = link_to "None", @url_params.merge(:select => 'none')
+ %table
+ = sortable_table_header @header
+ - @accounts.each do |account|
+ %tr
+ %td
+ - selected = @url_params[:select] == 'all'
+ %input{:name => 'accounts_selected[]', :type => 'checkbox', :value => account.id, :id => "account_checkbox_#{account.id}", :checked => selected }
+ = link_to account.name, admin_provider_account_path(account)
+ %td
+ =account.username
diff --git a/src/app/views/admin/provider_accounts/_permissions.haml b/src/app/views/admin/provider_accounts/_permissions.haml
new file mode 100644
index 0000000..92ad7a5
--- /dev/null
+++ b/src/app/views/admin/provider_accounts/_permissions.haml
@@ -0,0 +1,3 @@
+%h3
+ Permissions for
+ = @account.name
diff --git a/src/app/views/admin/provider_accounts/_properties.haml b/src/app/views/admin/provider_accounts/_properties.haml
new file mode 100644
index 0000000..6371968
--- /dev/null
+++ b/src/app/views/admin/provider_accounts/_properties.haml
@@ -0,0 +1,5 @@
+%h3
+ Properties for
+ = @account.name
+= link_to "Edit", edit_admin_provider_account_path(@account), { :class => 'button' }
+= link_to "Test", admin_provider_account_path(@account, {:test_account => true}), { :class => 'button' }
diff --git a/src/app/views/admin/provider_accounts/edit.haml b/src/app/views/admin/provider_accounts/edit.haml
new file mode 100644
index 0000000..9a55d84
--- /dev/null
+++ b/src/app/views/admin/provider_accounts/edit.haml
@@ -0,0 +1,13 @@
+#details.grid_13
+ %h2
+ = t('cloud_accounts.edit.edit_provider_account')
+ - form_for @cloud_account, :url => admin_provider_account_path, :html => { :method => :put, :multipart => true } do |f|
+ = render :partial => 'form', :locals => { :f => f }
+ %fieldset.clearfix
+ .grid_13.alpha.omega
+ = submit_tag t(:edit), :class => "ra nomargin dialogbutton"
+ %section
+ %p.requirement
+ %span.required *
+ \-
+ = t('cloud_accounts.edit.required_field')
diff --git a/src/app/views/admin/provider_accounts/index.haml b/src/app/views/admin/provider_accounts/index.haml
index 72c0ee2..62ccbc6 100644
--- a/src/app/views/admin/provider_accounts/index.haml
+++ b/src/app/views/admin/provider_accounts/index.haml
@@ -1 +1,2 @@
-admin/provider_accounts/index.haml
+- content_for :list do
+ = render :partial => 'list'
diff --git a/src/app/views/admin/provider_accounts/new.haml b/src/app/views/admin/provider_accounts/new.haml
new file mode 100644
index 0000000..e567bce
--- /dev/null
+++ b/src/app/views/admin/provider_accounts/new.haml
@@ -0,0 +1,16 @@
+#details.grid_13
+ %h2
+ = t('cloud_accounts.new.new_provider_account')
+ - form_for @cloud_account, :url => admin_provider_accounts_path, :html => { :multipart => true } do |f|
+ %label{ :for => :provider_id }
+ Provider
+ = select_tag :provider_id, options_for_select((a)providers.map{ |p| [p.name, p.id] })
+ = render :partial => 'form', :locals => { :f => f }
+ %fieldset.clearfix
+ .grid_13.alpha.omega
+ = submit_tag t(:add), :class => "ra nomargin dialogbutton"
+ %section
+ %p.requirement
+ %span.required *
+ \-
+ = t('cloud_accounts.new.required_field')
diff --git a/src/app/views/admin/provider_accounts/show.haml b/src/app/views/admin/provider_accounts/show.haml
new file mode 100644
index 0000000..05eeedd
--- /dev/null
+++ b/src/app/views/admin/provider_accounts/show.haml
@@ -0,0 +1,5 @@
+- content_for :list do
+ = render :partial => 'list'
+
+- content_for :details do
+ = render :partial => 'layouts/details_pane'
diff --git a/src/config/routes.rb b/src/config/routes.rb
index 99af504..3344058 100644
--- a/src/config/routes.rb
+++ b/src/config/routes.rb
@@ -44,8 +44,9 @@ ActionController::Routing::Routes.draw do |map|
map.connect '/set_layout', :controller => 'application', :action => 'set_layout'
map.namespace 'admin' do |r|
- r.resources :hardware_profiles, :pool_families, :providers, :provider_accounts, :realms, :roles, :settings
+ r.resources :hardware_profiles, :pool_families, :providers, :realms, :roles, :settings
r.resources :users, :collection => { :multi_destroy => :delete }
+ r.resources :provider_accounts, :collection => { :multi_destroy => :delete }
end
map.resources :pools
--
1.7.3.3
13 years, 4 months
[PATCH aeolus] Add the Administration/Providers pages
by jzigmund@redhat.com
From: Jozef Zigmund <jzigmund(a)redhat.com>
---
src/app/controllers/admin/providers_controller.rb | 113 ++++++++++++++++++++
src/app/views/admin/providers/_form.haml | 14 +++
src/app/views/admin/providers/_list.haml | 19 ++++
src/app/views/admin/providers/_properties.haml | 4 +
src/app/views/admin/providers/edit.haml | 7 ++
src/app/views/admin/providers/index.haml | 3 +-
src/app/views/admin/providers/new.haml | 3 +
src/app/views/admin/providers/show.haml | 5 +
src/config/routes.rb | 3 +-
9 files changed, 169 insertions(+), 2 deletions(-)
create mode 100644 src/app/views/admin/providers/_form.haml
create mode 100644 src/app/views/admin/providers/_history.haml
create mode 100644 src/app/views/admin/providers/_hw_profiles.haml
create mode 100644 src/app/views/admin/providers/_list.haml
create mode 100644 src/app/views/admin/providers/_permissions.haml
create mode 100644 src/app/views/admin/providers/_properties.haml
create mode 100644 src/app/views/admin/providers/_provider_accounts.haml
create mode 100644 src/app/views/admin/providers/_realms.haml
create mode 100644 src/app/views/admin/providers/_services.haml
create mode 100644 src/app/views/admin/providers/edit.haml
create mode 100644 src/app/views/admin/providers/new.haml
create mode 100644 src/app/views/admin/providers/show.haml
diff --git a/src/app/controllers/admin/providers_controller.rb b/src/app/controllers/admin/providers_controller.rb
index 80a7f28..1836061 100644
--- a/src/app/controllers/admin/providers_controller.rb
+++ b/src/app/controllers/admin/providers_controller.rb
@@ -1,6 +1,119 @@
class Admin::ProvidersController < ApplicationController
before_filter :require_user
+ before_filter :load_providers, :only => [:index, :show]
+
+require 'ruby-debug'
def index
end
+
+ def new
+ require_privilege(Privilege::PROVIDER_MODIFY)
+ @provider = Provider.new
+ kick_condor
+ end
+
+ def edit
+ @provider = Provider.find_by_id(params[:id])
+ require_privilege(Privilege::PROVIDER_MODIFY, @provider)
+ end
+
+ def show
+ @provider = Provider.find(params[:id])
+ @url_params = params.clone
+ @tab_captions = ['Properties', 'HW Profiles', 'Realms', 'Provider Accounts', 'Services','History','Permissions']
+ @details_tab = params[:details_tab].blank? ? 'properties' : params[:details_tab]
+ respond_to do |format|
+ format.js do
+ if @url_params.delete :details_pane
+ render :partial => 'layouts/details_pane' and return
+ end
+ render :partial => @details_tab and return
+ end
+ format.html { render :action => 'show'}
+ end
+ end
+
+ def create
+ require_privilege(Privilege::PROVIDER_MODIFY)
+ @provider = Provider.new(params[:provider])
+ if params[:test_connection]
+ test_connection(@provider)
+ render :action => 'new'
+ else
+ @provider.set_cloud_type!
+ if @provider.save && @provider.populate_hardware_profiles
+ flash[:notice] = "Provider added."
+ redirect_to admin_providers_path
+ else
+ flash[:notice] = "Cannot add the provider."
+ render :action => "new"
+ end
+ kick_condor
+ end
+ end
+
+ def update
+ require_privilege(Privilege::PROVIDER_MODIFY)
+ @provider = Provider.find_by_id(params[:id])
+ previous_cloud_type = @provider.cloud_type
+ @provider.update_attributes(params[:provider])
+ if params[:test_connection]
+ test_connection(@provider)
+ render :action => 'edit'
+ else
+ @provider.set_cloud_type!
+ if previous_cloud_type != @provider.cloud_type
+ @provider.errors.add :url, "points to a different provider"
+ end
+
+ if @provider.errors.empty? and @provider.save
+ flash[:notice] = "Provider updated."
+ redirect_to admin_providers_path
+ else
+ flash[:notice] = "Cannot update the provider."
+ render :action => 'edit'
+ end
+ kick_condor
+ end
+ end
+
+ def multi_destroy
+ #debugger
+ Provider.destroy(params[:provider_selected])
+ redirect_to admin_providers_url
+ end
+
+ def test_connection(provider)
+ #@provider = Provider.find_by_id(params[:id])
+ #if @provider.nil?
+ # @provider = Provider.new(params[:provider])
+ #else
+ # @provider.attributes = params[:provider]
+ #end
+ @provider.errors.clear
+ if @provider.connect
+ flash[:notice] = "Successfuly Connected to Provider"
+ else
+ flash[:notice] = "Failed to Connect to Provider"
+ @provider.errors.add :url
+ end
+
+ #if ['new', 'edit'].include? params[:a]
+ # action = params[:a]
+ #end
+
+ #render :action => (action || 'new')
+ end
+
+
+ protected
+
+ def load_providers
+ @header = [{ :name => "Provider name", :sort_attr => :name },
+ { :name => "Provider URL", :sort_attr => :name }
+ ]
+ @providers = Provider.list_for_user(@current_user, Privilege::PROVIDER_VIEW)
+ @url_params = params.clone
+ end
end
diff --git a/src/app/views/admin/providers/_form.haml b/src/app/views/admin/providers/_form.haml
new file mode 100644
index 0000000..fe8c9ca
--- /dev/null
+++ b/src/app/views/admin/providers/_form.haml
@@ -0,0 +1,14 @@
+= form.error_message_on :name, 'Name'
+= form.error_message_on :url, 'URL'
+%fieldset.clear
+ = form.label :name,'Provider name :'
+ = form.text_field :name, :title => 'provider_name', :value => @provider.name, :class => "clear grid_4 alpha"
+%fieldset.clear
+ = form.label :url, 'Provider URL :'
+ = form.text_field :url, :title => 'provider_url', :value => @provider.url, :class => "grid_5"
+ (
+ %button.linkbutton.nospace{ :type => 'submit', :value => t('.test_connection'), :name => 'test_connection', :id => 'test_connection' }
+ Test connection
+ )
+ %fieldset.clear
+ = form.submit "Save", :class => "submit formbutton"
diff --git a/src/app/views/admin/providers/_history.haml b/src/app/views/admin/providers/_history.haml
new file mode 100644
index 0000000..e69de29
diff --git a/src/app/views/admin/providers/_hw_profiles.haml b/src/app/views/admin/providers/_hw_profiles.haml
new file mode 100644
index 0000000..e69de29
diff --git a/src/app/views/admin/providers/_list.haml b/src/app/views/admin/providers/_list.haml
new file mode 100644
index 0000000..0735340
--- /dev/null
+++ b/src/app/views/admin/providers/_list.haml
@@ -0,0 +1,19 @@
+- form_tag do
+ = link_to "Create", new_admin_provider_url, :class => "button"
+ = restful_submit_tag "Delete", 'destroy', multi_destroy_admin_providers_path, 'DELETE', :id => 'delete_button'
+
+ %p
+ Select:
+ = link_to "All", @url_params.merge(:select => 'all')
+ %span> ,
+ = link_to "None", @url_params.merge(:select => 'none')
+
+ %table#providers_table
+ = sortable_table_header @header
+ -(a)providers.each do |provider|
+ %tr
+ %td
+ - selected = @url_params[:select] == 'all'
+ %input{:name => "provider_selected[]", :type => "checkbox", :value => provider.id, :id => "provider_checkbox_#{provider.id}" }
+ = link_to provider.name, admin_provider_path(provider)
+ %td= provider.url
diff --git a/src/app/views/admin/providers/_permissions.haml b/src/app/views/admin/providers/_permissions.haml
new file mode 100644
index 0000000..e69de29
diff --git a/src/app/views/admin/providers/_properties.haml b/src/app/views/admin/providers/_properties.haml
new file mode 100644
index 0000000..163401e
--- /dev/null
+++ b/src/app/views/admin/providers/_properties.haml
@@ -0,0 +1,4 @@
+%h3
+ Properties for
+ = @provider.name
+= link_to "Edit", edit_admin_provider_path(@provider), {:class => 'button'}
diff --git a/src/app/views/admin/providers/_provider_accounts.haml b/src/app/views/admin/providers/_provider_accounts.haml
new file mode 100644
index 0000000..e69de29
diff --git a/src/app/views/admin/providers/_realms.haml b/src/app/views/admin/providers/_realms.haml
new file mode 100644
index 0000000..e69de29
diff --git a/src/app/views/admin/providers/_services.haml b/src/app/views/admin/providers/_services.haml
new file mode 100644
index 0000000..e69de29
diff --git a/src/app/views/admin/providers/edit.haml b/src/app/views/admin/providers/edit.haml
new file mode 100644
index 0000000..66864e9
--- /dev/null
+++ b/src/app/views/admin/providers/edit.haml
@@ -0,0 +1,7 @@
+%h3
+ Editing
+ = @provider.name
+ Provider
+
+-form_for @provider, :url => admin_provider_path(@provider), :html => { :method => :put } do |f|
+ = render :partial => 'form', :locals => { :form => f, :cancel_path => admin_providers_path }
diff --git a/src/app/views/admin/providers/index.haml b/src/app/views/admin/providers/index.haml
index 589bac8..62ccbc6 100644
--- a/src/app/views/admin/providers/index.haml
+++ b/src/app/views/admin/providers/index.haml
@@ -1 +1,2 @@
-admin/providers/index.haml
+- content_for :list do
+ = render :partial => 'list'
diff --git a/src/app/views/admin/providers/new.haml b/src/app/views/admin/providers/new.haml
new file mode 100644
index 0000000..516fdb3
--- /dev/null
+++ b/src/app/views/admin/providers/new.haml
@@ -0,0 +1,3 @@
+%h2 Create a new Provider
+- form_for @provider, :url => admin_providers_path do |f|
+ = render :partial => "form", :locals => { :form => f, :cancel_path => admin_providers_path }
diff --git a/src/app/views/admin/providers/show.haml b/src/app/views/admin/providers/show.haml
new file mode 100644
index 0000000..0c36221
--- /dev/null
+++ b/src/app/views/admin/providers/show.haml
@@ -0,0 +1,5 @@
+- content_for 'list' do
+ = render :partial => 'list'
+
+- content_for 'details' do
+ = render :partial => 'layouts/details_pane'
diff --git a/src/config/routes.rb b/src/config/routes.rb
index 99af504..2a50133 100644
--- a/src/config/routes.rb
+++ b/src/config/routes.rb
@@ -44,7 +44,8 @@ ActionController::Routing::Routes.draw do |map|
map.connect '/set_layout', :controller => 'application', :action => 'set_layout'
map.namespace 'admin' do |r|
- r.resources :hardware_profiles, :pool_families, :providers, :provider_accounts, :realms, :roles, :settings
+ r.resources :hardware_profiles, :pool_families, :provider_accounts, :realms, :roles, :settings
+ r.resources :providers, :collection => { :multi_destroy => :delete }
r.resources :users, :collection => { :multi_destroy => :delete }
end
--
1.7.2.3
13 years, 4 months
deltacloud puppet recipe and installer revamp
by Mo Morsi
This patchset greatly revamps the deltacloud puppet recipe and installer/uninstaller
to clean up a plethora of things and to make it a more state based solution, bringing
it inline with the standard puppet methodology.
13 years, 4 months
[PATCH aeolus] Add the Administration -> Provider Accounts page
by Tomas Sedovic
From: Tomas Sedovic <tsedovic(a)redhat.com>
This is for the new UI. Most of the old functionality is there except for the
account deletion.
---
.../admin/provider_accounts_controller.rb | 91 ++++++++++++++++++++
.../admin/provider_accounts/_credentials.haml | 3 +
src/app/views/admin/provider_accounts/_form.haml | 52 +++++++++++
.../views/admin/provider_accounts/_history.haml | 3 +
src/app/views/admin/provider_accounts/_list.haml | 18 ++++
.../admin/provider_accounts/_permissions.haml | 3 +
.../views/admin/provider_accounts/_properties.haml | 5 +
src/app/views/admin/provider_accounts/edit.haml | 13 +++
src/app/views/admin/provider_accounts/index.haml | 3 +-
src/app/views/admin/provider_accounts/new.haml | 16 ++++
src/app/views/admin/provider_accounts/show.haml | 5 +
11 files changed, 211 insertions(+), 1 deletions(-)
create mode 100644 src/app/views/admin/provider_accounts/_credentials.haml
create mode 100644 src/app/views/admin/provider_accounts/_form.haml
create mode 100644 src/app/views/admin/provider_accounts/_history.haml
create mode 100644 src/app/views/admin/provider_accounts/_list.haml
create mode 100644 src/app/views/admin/provider_accounts/_permissions.haml
create mode 100644 src/app/views/admin/provider_accounts/_properties.haml
create mode 100644 src/app/views/admin/provider_accounts/edit.haml
create mode 100644 src/app/views/admin/provider_accounts/new.haml
create mode 100644 src/app/views/admin/provider_accounts/show.haml
diff --git a/src/app/controllers/admin/provider_accounts_controller.rb b/src/app/controllers/admin/provider_accounts_controller.rb
index dda74ae..0565a20 100644
--- a/src/app/controllers/admin/provider_accounts_controller.rb
+++ b/src/app/controllers/admin/provider_accounts_controller.rb
@@ -1,6 +1,97 @@
class Admin::ProviderAccountsController < ApplicationController
before_filter :require_user
+ before_filter :load_accounts, :only => [:index, :show]
def index
end
+
+ def show
+ @tab_captions = ['Properties', 'Credentials', 'History', 'Permissions']
+ @account = CloudAccount.find(params[:id])
+ @details_tab = params[:details_tab].blank? ? 'properties' : params[:details_tab]
+ respond_to do |format|
+ format.js do
+ if @url_params.delete :details_pane
+ render :partial => 'layouts/details_pane' and return
+ end
+ render :partial => @details_tab and return
+ end
+ format.html { render :action => 'show'}
+ end
+ end
+
+ def new
+ @cloud_account = CloudAccount.new
+ @quota = Quota.new
+ @providers = Provider.all
+ end
+
+ def create
+ @provider = Provider.find(params[:provider_id])
+ require_privilege(Privilege::ACCOUNT_MODIFY, @provider)
+
+ @providers = Provider.all
+ @cloud_account = CloudAccount.new(params[:cloud_account])
+ @cloud_account.provider = @provider
+ @cloud_account.quota = @quota = Quota.new
+
+ limit = params[:quota][:maximum_running_instances] if params[:quota]
+ @cloud_account.quota.set_maximum_running_instances(limit)
+
+ if @cloud_account.invalid?
+ if not @cloud_account.valid_credentials?
+ flash.now[:error] = "The entered credential information is incorrect"
+ elsif @cloud_account.errors.on(:username)
+ flash.now[:error] = "The access key '#{params[:cloud_account][:username]}' has already been taken."
+ else
+ flash.now[:error] = "You must fill in all the required fields"
+ end
+ render :action => 'new' and return
+ end
+
+ @cloud_account.zones << Zone.default
+ @cloud_account.save!
+ if @cloud_account.populate_realms
+ flash[:notice] = "Provider account added."
+ end
+ redirect_to admin_provider_accounts_path(@cloud_account)
+ kick_condor
+ end
+
+ def edit
+ @cloud_account = CloudAccount.find(params[:id])
+ @quota = @cloud_account.quota
+ @provider = @cloud_account.provider
+ require_privilege(Privilege::ACCOUNT_MODIFY,@provider)
+ end
+
+ def update
+ @cloud_account = CloudAccount.find(params[:id])
+ @provider = @cloud_account.provider
+ require_privilege(Privilege::ACCOUNT_MODIFY, @provider)
+ @quota = @cloud_account.quota
+
+ limit = params[:quota][:maximum_running_instances] if params[:quota]
+ @cloud_account.quota.set_maximum_running_instances(limit)
+ if @cloud_account.update_attributes(params[:cloud_account])
+ flash[:notice] = "Cloud Account updated!"
+ redirect_to admin_provider_account_path(@cloud_account)
+ else
+ render :action => :edit
+ end
+ end
+
+ protected
+
+ def load_accounts
+ @header = [
+ { :name => "Name", :sort_attr => :name },
+ { :name => "Username", :sort_attr => :username},
+ ]
+ @accounts = CloudAccount.paginate(:all,
+ :page => params[:page] || 1,
+ :order => (params[:order_field] || 'label') +' '+ (params[:order_dir] || 'asc')
+ )
+ @url_params = params
+ end
end
diff --git a/src/app/views/admin/provider_accounts/_credentials.haml b/src/app/views/admin/provider_accounts/_credentials.haml
new file mode 100644
index 0000000..9d31c8d
--- /dev/null
+++ b/src/app/views/admin/provider_accounts/_credentials.haml
@@ -0,0 +1,3 @@
+%h3
+ Credentials for
+ = @account.name
diff --git a/src/app/views/admin/provider_accounts/_form.haml b/src/app/views/admin/provider_accounts/_form.haml
new file mode 100644
index 0000000..853d348
--- /dev/null
+++ b/src/app/views/admin/provider_accounts/_form.haml
@@ -0,0 +1,52 @@
+= error_messages_for 'cloud_account'
+%fieldset.clearfix.nomargin
+ %label.grid_4.la.alpha
+ = t('cloud_accounts.form.account_name')
+ %span.required *
+ %label.grid_3.la
+ = t('cloud_accounts.form.user_name')
+ %span.required *
+ %label.grid_3.la
+ = t('cloud_accounts.form.password')
+ %span.required *
+ %label.grid_3.la.omega
+ = t('cloud_accounts.form.quota_instances')
+ %span.required *
+%fieldset.nomargin.clearfix
+ = f.text_field :label, :title => t('cloud_accounts.form.account_name'), :class => "grid_4 alpha"
+ = f.text_field :username, :title => t('cloud_accounts.form.user_name'), :class => "grid_3"
+ = f.password_field :password, :title => t('cloud_accounts.form.password'), :class => "grid_3"
+ = text_field "quota", :maximum_running_instances, :title => t('cloud_accounts.form.quota_instances'), :value => @quota.maximum_running_instances || "unlimited", :id => "quota_instances", :class => "grid_3 omega"
+%fieldset.nomargin.clearfix
+ .grid_3.prefix_10.alpha.omega
+ (
+ %button.linkbutton.nospace{ :type => 'button', :onclick => "set_unlimited_quota(\"quota_instances\");" }<>
+ = t('cloud_accounts.form.unlimited_quota')
+ )
+%fieldset.clearfix.nomargin
+ %label.grid_4.la.alpha
+ = t('cloud_accounts.form.account_number')
+ %span.required *
+ %label.grid_3.la
+ = t('cloud_accounts.form.account_private_cert')
+ %span.required *
+ %label.grid_3.la
+ = t('cloud_accounts.form.account_public_cert')
+ %span.required *
+ .grid_3.omega
+%fieldset.clearfix.nomargin
+ = f.text_field :account_number, :title => t('cloud_accounts.form.account_number'), :class => "grid_4 alpha"
+ .grid_3
+ = f.file_field :x509_cert_priv_file, :title => t('cloud_accounts.form.account_private_cert')
+ .grid_3
+ = f.file_field :x509_cert_pub_file, :title => t('cloud_accounts.form.account_public_cert')
+ .grid_3.omega
+ (
+ %button.linkbutton.nospace{ :type => 'submit', :value => t('cloud_accounts.form.test_account'), :name => 'test_account', :id => 'test_account' }<>
+ = t('cloud_accounts.form.test_account')
+ )
+
+:javascript
+ function set_unlimited_quota(elem_id) {
+ $("#" + elem_id)[0].value = "unlimited";
+ }
diff --git a/src/app/views/admin/provider_accounts/_history.haml b/src/app/views/admin/provider_accounts/_history.haml
new file mode 100644
index 0000000..429320a
--- /dev/null
+++ b/src/app/views/admin/provider_accounts/_history.haml
@@ -0,0 +1,3 @@
+%h3
+ History for
+ = @account.name
diff --git a/src/app/views/admin/provider_accounts/_list.haml b/src/app/views/admin/provider_accounts/_list.haml
new file mode 100644
index 0000000..3330f47
--- /dev/null
+++ b/src/app/views/admin/provider_accounts/_list.haml
@@ -0,0 +1,18 @@
+- form_tag do
+ = link_to "New Account", new_admin_provider_account_path, :class => 'button'
+ = restful_submit_tag "Delete", "new", new_admin_provider_account_path, 'GET'
+ %p
+ Select:
+ = link_to "All", @url_params.merge(:select => 'all')
+ %span> ,
+ = link_to "None", @url_params.merge(:select => 'none')
+ %table
+ = sortable_table_header @header
+ - @accounts.each do |account|
+ %tr
+ %td
+ - selected = @url_params[:select] == 'all'
+ = check_box(:account, "selected[#{account.id}]", :checked => selected)
+ = link_to account.name, admin_provider_account_path(account)
+ %td
+ =account.username
diff --git a/src/app/views/admin/provider_accounts/_permissions.haml b/src/app/views/admin/provider_accounts/_permissions.haml
new file mode 100644
index 0000000..92ad7a5
--- /dev/null
+++ b/src/app/views/admin/provider_accounts/_permissions.haml
@@ -0,0 +1,3 @@
+%h3
+ Permissions for
+ = @account.name
diff --git a/src/app/views/admin/provider_accounts/_properties.haml b/src/app/views/admin/provider_accounts/_properties.haml
new file mode 100644
index 0000000..d85c7d6
--- /dev/null
+++ b/src/app/views/admin/provider_accounts/_properties.haml
@@ -0,0 +1,5 @@
+%h3
+ Properties for
+ = @account.name
+= link_to "Edit", edit_admin_provider_account_path(@account), { :class => 'button' }
+= link_to "Test", 'path_to_test_account', { :class => 'button disabled' }
diff --git a/src/app/views/admin/provider_accounts/edit.haml b/src/app/views/admin/provider_accounts/edit.haml
new file mode 100644
index 0000000..025b35f
--- /dev/null
+++ b/src/app/views/admin/provider_accounts/edit.haml
@@ -0,0 +1,13 @@
+#details.grid_13
+ %h2
+ = t('cloud_accounts.edit.edit_provider_account')
+ - form_for @cloud_account, :url => admin_provider_account_path(@cloud_account), :html => { :method => :put, :multipart => true } do |f|
+ = render :partial => 'form', :locals => { :f => f }
+ %fieldset.clearfix
+ .grid_13.alpha.omega
+ = submit_tag t(:edit), :class => "ra nomargin dialogbutton"
+ %section
+ %p.requirement
+ %span.required *
+ \-
+ = t('cloud_accounts.edit.required_field')
diff --git a/src/app/views/admin/provider_accounts/index.haml b/src/app/views/admin/provider_accounts/index.haml
index 72c0ee2..62ccbc6 100644
--- a/src/app/views/admin/provider_accounts/index.haml
+++ b/src/app/views/admin/provider_accounts/index.haml
@@ -1 +1,2 @@
-admin/provider_accounts/index.haml
+- content_for :list do
+ = render :partial => 'list'
diff --git a/src/app/views/admin/provider_accounts/new.haml b/src/app/views/admin/provider_accounts/new.haml
new file mode 100644
index 0000000..8a524ce
--- /dev/null
+++ b/src/app/views/admin/provider_accounts/new.haml
@@ -0,0 +1,16 @@
+#details.grid_13
+ %h2
+ = t('cloud_accounts.new.new_provider_account')
+ - form_for @cloud_account, :url => admin_provider_accounts_path(@provider), :html => { :multipart => true } do |f|
+ %label{ :for => :provider_id }
+ Provider
+ = select_tag :provider_id, options_for_select((a)providers.map{ |p| [p.name, p.id] })
+ = render :partial => 'form', :locals => { :f => f }
+ %fieldset.clearfix
+ .grid_13.alpha.omega
+ = submit_tag t(:add), :class => "ra nomargin dialogbutton"
+ %section
+ %p.requirement
+ %span.required *
+ \-
+ = t('cloud_accounts.new.required_field')
diff --git a/src/app/views/admin/provider_accounts/show.haml b/src/app/views/admin/provider_accounts/show.haml
new file mode 100644
index 0000000..05eeedd
--- /dev/null
+++ b/src/app/views/admin/provider_accounts/show.haml
@@ -0,0 +1,5 @@
+- content_for :list do
+ = render :partial => 'list'
+
+- content_for :details do
+ = render :partial => 'layouts/details_pane'
--
1.7.3.3
13 years, 4 months