Table layout for filter views
by Matt Wagner
Hi,
Since we were somewhat blocked on having functional tables in the filter views, I went ahead and made some changes. This hardly completes #1579, but it should get us moving.
I added a quick bit of JS to get the Select All / Select None toggle working, but it doesn't work reliably since it binds on document.ready and then we make all sorts of XHR calls which seem to cause these to come unbound. Diagnosing this felt like too much of a tangent for now.
The search, saved view dropdown, 'Save and Share', and filter elements are all just non-functional placeholders for the time being.
Best,
Matt
11 years, 10 months
[PATCH conductor] assembly and template fix
by jzigmund@redhat.com
From: Jozef Zigmund <jzigmund(a)redhat.com>
---
src/app/controllers/builds_controller.rb | 2 +-
src/app/controllers/instances_controller.rb | 20 ++++----
src/app/controllers/legacy_templates_controller.rb | 18 ++++----
src/app/models/build_job.rb | 2 +-
src/app/models/deployable.rb | 2 +-
src/app/models/instance.rb | 8 ++--
src/app/models/legacy_image.rb | 24 +++++-----
src/app/models/legacy_template.rb | 6 +-
src/app/models/permission.rb | 2 +-
src/app/util/condormatic.rb | 4 +-
src/app/views/deployables/_assemblies.haml | 2 +-
src/app/views/deployments/new.haml | 2 +-
src/app/views/instances/_list.haml | 4 +-
src/app/views/instances/_properties.haml | 8 ++--
src/app/views/instances/new.haml | 6 +-
src/app/views/instances/select_template.haml | 8 ++--
src/app/views/legacy_templates/_builds.haml | 6 +-
src/app/views/legacy_templates/_list.haml | 8 ++--
.../xml/_hardware_profile.xml.haml | 2 +-
src/config/image_warehouse.yml | 2 +-
src/config/navigation.rb | 2 +-
src/config/routes.rb | 2 +-
.../20110207100700_create_legacy_assemblies.rb | 2 +-
src/features/image_import.feature | 2 +-
src/features/step_definitions/assembly_steps.rb | 4 +-
src/features/step_definitions/instance_steps.rb | 2 +-
src/features/step_definitions/template_steps.rb | 6 +-
src/features/support/paths.rb | 2 +-
src/features/template.feature | 46 ++++++++++----------
src/spec/controllers/builds_controller_spec.rb | 4 +-
src/spec/controllers/instance_controller_spec.rb | 2 +-
src/spec/factories/assembly.rb | 2 +-
src/spec/models/assembly_spec.rb | 2 +-
src/spec/models/deployable_spec.rb | 4 +-
src/spec/models/image_spec.rb | 2 +-
src/spec/models/instance_spec.rb | 8 ++--
src/spec/models/template_spec.rb | 6 +-
src/warehouse_sync/warehouse_sync.rb | 4 +-
38 files changed, 119 insertions(+), 119 deletions(-)
diff --git a/src/app/controllers/builds_controller.rb b/src/app/controllers/builds_controller.rb
index f3f8db3..8c87afc 100644
--- a/src/app/controllers/builds_controller.rb
+++ b/src/app/controllers/builds_controller.rb
@@ -97,7 +97,7 @@ class BuildsController < ApplicationController
end
private
- # TODO: DRY this, is used in templates controller too
+ # TODO: DRY this, is used in legacy_templates controller too
def get_order(default)
@order_dir = params[:order_dir] == 'desc' ? 'desc' : 'asc'
@order_field = params[:order_field] || default
diff --git a/src/app/controllers/instances_controller.rb b/src/app/controllers/instances_controller.rb
index ef6cb6f..204a71d 100644
--- a/src/app/controllers/instances_controller.rb
+++ b/src/app/controllers/instances_controller.rb
@@ -23,8 +23,8 @@ class InstancesController < ApplicationController
@instance = Instance.new(params[:instance])
require_privilege(Privilege::CREATE, Instance, @instance.pool) if @instance.pool
- unless @instance.template
- redirect_to select_template_instances_path
+ unless @instance.legacy_template
+ redirect_to select_legacy_template_instances_path
return
end
@@ -35,23 +35,23 @@ class InstancesController < ApplicationController
end
end
- def select_template
- # FIXME: we need to list only templates for particular user,
+ def select_legacy_template
+ # FIXME: we need to list only legacy_templates for particular user,
# => TODO: add TEMPLATE_* permissions
- @templates = LegacyTemplate.paginate(
+ @legacy_templates = LegacyTemplate.paginate(
:page => params[:page] || 1,
:include => {:images => :provider_images},
:conditions => "provider_images.status = '#{ProviderImage::STATE_COMPLETED}'"
)
respond_to do |format|
format.html
- format.json { render :json => @templates }
+ format.json { render :json => @legacy_templates }
end
end
def create
if params[:cancel]
- redirect_to select_template_instances_path
+ redirect_to select_legacy_template_instances_path
return
end
@@ -277,7 +277,7 @@ class InstancesController < ApplicationController
:include => :architecture,
:conditions => {
:provider_id => nil,
- 'hardware_profile_properties.value' => @instance.template.architecture
+ 'hardware_profile_properties.value' => @instance.legacy_template.architecture
}
)
end
@@ -286,7 +286,7 @@ class InstancesController < ApplicationController
@header = [
{:name => 'VM NAME', :sort_attr => 'name'},
{:name => 'STATUS', :sortable => false},
- {:name => 'TEMPLATE', :sort_attr => 'templates.name'},
+ {:name => 'TEMPLATE', :sort_attr => 'legacy_templates.name'},
{:name => 'PUBLIC ADDRESS', :sort_attr => 'public_addresses'},
{:name => 'PROVIDER', :sortable => false},
{:name => 'CREATED BY', :sort_attr => 'users.last_name'},
@@ -296,7 +296,7 @@ class InstancesController < ApplicationController
end
def load_instances
- @instances = Instance.all(:include => [:template, :owner],
+ @instances = Instance.all(:include => [:legacy_template, :owner],
:conditions => {:pool_id => @pools},
:order => (params[:order_field] || 'name') +' '+ (params[:order_dir] || 'asc')
)
diff --git a/src/app/controllers/legacy_templates_controller.rb b/src/app/controllers/legacy_templates_controller.rb
index abbd3a7..7255dfa 100644
--- a/src/app/controllers/legacy_templates_controller.rb
+++ b/src/app/controllers/legacy_templates_controller.rb
@@ -9,7 +9,7 @@ class LegacyTemplatesController < ApplicationController
@params = params
@search_term = params[:q]
if @search_term.blank?
- load_templates
+ load_legacy_templates
return
end
@@ -17,11 +17,11 @@ class LegacyTemplatesController < ApplicationController
search = LegacyTemplate.search do
keywords(params[:q])
end
- @templates = search.results
+ @legacy_templates = search.results
end
def show
- load_templates
+ load_legacy_templates
@tpl = LegacyTemplate.find(params[:id])
require_privilege(Privilege::VIEW, @tpl)
@url_params = params.clone
@@ -188,7 +188,7 @@ class LegacyTemplatesController < ApplicationController
destroyed = []
failed = []
LegacyTemplate.find(params[:selected]).each do |template|
- if check_privilege(Privilege::MODIFY, template) and template.destroy
+ if check_privilege(Privilege::MODIFY, legacy_template) and template.destroy
destroyed << template.name
else
failed << template.name
@@ -196,12 +196,12 @@ class LegacyTemplatesController < ApplicationController
end
unless destroyed.empty?
- flash[:notice] = t('templates.index.deleted', :count => destroyed.length, :list => destroyed.join(', '))
+ flash[:notice] = t('legacy_templates.index.deleted', :count => destroyed.length, :list => destroyed.join(', '))
end
unless failed.empty?
- flash[:error] = t('templates.index.not_deleted', :count => failed.length, :list => failed.join(', '))
+ flash[:error] = t('legacy_templates.index.not_deleted', :count => failed.length, :list => failed.join(', '))
end
- redirect_to templates_url
+ redirect_to legacy_templates_url
end
protected
@@ -233,8 +233,8 @@ class LegacyTemplatesController < ApplicationController
@url_params = params.clone
end
- def load_templates
- @templates = LegacyTemplate.list_for_user(current_user,
+ def load_legacy_templates
+ @legacy_templates = LegacyTemplate.list_for_user(current_user,
Privilege::VIEW,
:include => :legacy_images,
:order => get_order('name')
diff --git a/src/app/models/build_job.rb b/src/app/models/build_job.rb
index ae21a9c..02f6252 100644
--- a/src/app/models/build_job.rb
+++ b/src/app/models/build_job.rb
@@ -34,7 +34,7 @@ class BuildJob < Struct.new(:image_id, :hydra)
:method => :post,
:timeout => 60*1000, # in milliseconds
:params => {
- :template => image.template.warehouse_url,
+ :template => image.legacy_template.warehouse_url,
:target => image.provider_type.codename})
request.on_complete do |response|
if response.success?
diff --git a/src/app/models/deployable.rb b/src/app/models/deployable.rb
index 4c0147b..1c6569e 100644
--- a/src/app/models/deployable.rb
+++ b/src/app/models/deployable.rb
@@ -85,7 +85,7 @@ class Deployable < ActiveRecord::Base
def launchable?
return false if legacy_assemblies.empty?
legacy_assemblies.each do |a|
- return false if a.templates.empty?
+ return false if a.legacy_templates.empty?
# TODO: should we check if there is an uploaded image for each template in
# assembly?
end
diff --git a/src/app/models/instance.rb b/src/app/models/instance.rb
index fcf354b..128d13d 100644
--- a/src/app/models/instance.rb
+++ b/src/app/models/instance.rb
@@ -79,7 +79,7 @@ class Instance < ActiveRecord::Base
belongs_to :hardware_profile
belongs_to :legacy_template
- belongs_to :legacy_legacy_assembly
+ belongs_to :legacy_assembly
belongs_to :frontend_realm
belongs_to :owner, :class_name => "User", :foreign_key => "owner_id"
belongs_to :instance_hwp
@@ -93,7 +93,7 @@ class Instance < ActiveRecord::Base
validates_presence_of :pool_id
validates_presence_of :hardware_profile_id
- validates_presence_of :template_id, :unless => :deployment_id
+ validates_presence_of :legacy_template_id, :unless => :deployment_id
validates_presence_of :legacy_assembly_id, :if => :deployment_id
#validates_presence_of :external_key
@@ -129,9 +129,9 @@ class Instance < ActiveRecord::Base
USER_MUTABLE_ATTRS = ['name']
def validate
- if legacy_assembly and template
+ if legacy_assembly and legacy_template
errors.add(:legacy_assembly, "Please specify either template or legacy_assembly, but not both")
- errors.add(:template, "Please specify either template or legacy_assembly, but not both")
+ errors.add(:legacy_template, "Please specify either template or legacy_assembly, but not both")
end
end
diff --git a/src/app/models/legacy_image.rb b/src/app/models/legacy_image.rb
index cbe971f..85aed85 100644
--- a/src/app/models/legacy_image.rb
+++ b/src/app/models/legacy_image.rb
@@ -55,10 +55,10 @@ class LegacyImage < ActiveRecord::Base
validates_presence_of :name
validates_length_of :name, :maximum => 1024
validates_presence_of :status
- validates_presence_of :template_id
+ validates_presence_of :legacy_template_id
validates_presence_of :provider_type_id
- validates_uniqueness_of :template_id, :scope => :provider_type_id
+ validates_uniqueness_of :legacy_template_id, :scope => :provider_type_id
SEARCHABLE_COLUMNS = %w(name)
@@ -73,7 +73,7 @@ class LegacyImage < ActiveRecord::Base
INACTIVE_STATES = [STATE_COMPLETED, STATE_FAILED, STATE_CANCELED]
def generate_uuid
- self.uuid ||= "image-#{self.template_id}-#{Time.now.to_f.to_s}"
+ self.uuid ||= "image-#{self.legacy_template_id}-#{Time.now.to_f.to_s}"
end
# TODO: for now when build is finished we call upload automatically for all providers
@@ -87,7 +87,7 @@ class LegacyImage < ActiveRecord::Base
def rebuild!
# TODO: remove this check when we have UI for pushing images
if self.provider_type.providers.empty? or not self.provider_type.providers.detect {|p| !p.provider_accounts.empty?}
- raise "Error: A valid provider and provider account are required to create and build templates"
+ raise "Error: A valid provider and provider account are required to create and build legacy_templates"
end
self.status = STATE_QUEUED
self.save!
@@ -102,18 +102,18 @@ class LegacyImage < ActiveRecord::Base
end
end
- def self.create_and_build!(template, provider_type)
- if LegacyImage.find_by_template_id_and_provider_type_id(template.id, provider_type.id)
+ def self.create_and_build!(legacy_template, provider_type)
+ if LegacyImage.find_by_legacy_template_id_and_provider_type_id(legacy_template.id, provider_type.id)
raise ImageExistsError, "An attempted build of this template for the target '#{provider_type.name}' already exists"
end
# TODO: remove this check when we have UI for pushing images
if provider_type.providers.empty? or not provider_type.providers.detect {|p| !p.provider_accounts.empty?}
- raise "Error: A valid provider and provider account are required to create and build templates"
+ raise "Error: A valid provider and provider account are required to create and build legacy_templates"
end
img = LegacyImage.create!(
- :name => "#{template.name}/#{provider_type.codename}",
+ :name => "#{legacy_template.name}/#{provider_type.codename}",
:provider_type_id => provider_type.id,
- :template_id => template.id,
+ :legacy_template_id => legacy_template.id,
:status => LegacyImage::STATE_QUEUED
)
Delayed::Job.enqueue(BuildJob.new(img.id))
@@ -161,13 +161,13 @@ class LegacyImage < ActiveRecord::Base
:imported => true,
:owner => user
)
- template.save!
+ legacy_template.save!
image = LegacyImage.new(
:name => raw_image.name,
:status => STATE_COMPLETED,
:provider_type_id => account.provider.provider_type_id,
- :template_id => template.id
+ :legacy_template_id => legacy_template.id
)
image.generate_uuid
image.upload
@@ -209,7 +209,7 @@ class LegacyImage < ActiveRecord::Base
raise "Template with uuid #{attrs[:template]} not found"
end
self.provider_type_id = ptype.id
- self.template_id = tpl.id
+ self.legacy_template_id = tpl.id
end
private
diff --git a/src/app/models/legacy_template.rb b/src/app/models/legacy_template.rb
index 884eac5..1c85930 100644
--- a/src/app/models/legacy_template.rb
+++ b/src/app/models/legacy_template.rb
@@ -1,7 +1,7 @@
# == Schema Information
# Schema version: 20110207110131
#
-# Table name: templates
+# Table name: legacy_templates
#
# id :integer not null, primary key
# uuid :string(255) not null
@@ -94,7 +94,7 @@ class LegacyTemplate < ActiveRecord::Base
# TODO: rewrite cleanly
ProviderImage.all(
:include => [:image, :provider],
- :conditions => {:images => {:template_id => self.id}}
+ :conditions => {:images => {:legacy_template_id => self.id}}
).map {|p| p.provider}
end
@@ -165,7 +165,7 @@ class LegacyTemplate < ActiveRecord::Base
end
def warehouse_bucket
- 'templates'
+ 'legacy_templates'
end
def warehouse_sync
diff --git a/src/app/models/permission.rb b/src/app/models/permission.rb
index ab8f9c9..4b27060 100644
--- a/src/app/models/permission.rb
+++ b/src/app/models/permission.rb
@@ -57,7 +57,7 @@ class Permission < ActiveRecord::Base
:foreign_key => "permission_object_id"
belongs_to :provider_account, :class_name => "ProviderAccount",
:foreign_key => "permission_object_id"
- belongs_to :template, :class_name => "LegacyTemplate",
+ belongs_to :legacy_template, :class_name => "LegacyTemplate",
:foreign_key => "permission_object_id"
belongs_to :legacy_assembly, :class_name => "LegacyAssembly",
:foreign_key => "permission_object_id"
diff --git a/src/app/util/condormatic.rb b/src/app/util/condormatic.rb
index fa9ef62..a5d7a94 100644
--- a/src/app/util/condormatic.rb
+++ b/src/app/util/condormatic.rb
@@ -35,7 +35,7 @@ end
def match(instance)
possibles = []
- template_id = instance.template ? instance.template.id : instance.legacy_assembly.templates.first.id
+ legacy_template_id = instance.legacy_template ? instance.legacy_template.id : instance.legacy_assembly.legacy_templates.first.id
PoolFamily.all.each do |pool_family|
if instance.pool.pool_family.id != pool_family.id
@@ -51,7 +51,7 @@ def match(instance)
provider_images = hwp.provider.provider_images.find(:all,
:conditions => ['provider_image_key IS NOT NULL'])
provider_images.each do |pi|
- if pi.image.template.id != template_id
+ if pi.image.legacy_template.id != legacy_template_id
next
end
diff --git a/src/app/views/deployables/_assemblies.haml b/src/app/views/deployables/_assemblies.haml
index c0a46db..5397a56 100644
--- a/src/app/views/deployables/_assemblies.haml
+++ b/src/app/views/deployables/_assemblies.haml
@@ -9,7 +9,7 @@
%th
%th= "Name"
%th= "Created"
- -@deployable.legacy_assemblies(:include => :templates).each do |assembly|
+ -@deployable.legacy_assemblies(:include => :legacy_templates).each do |assembly|
%tr
%td
%input{:name => "assemblies_selected[]", :type => "checkbox", :value => assembly.id, :id => "assembly_checkbox_#{assembly.id}" }
diff --git a/src/app/views/deployments/new.haml b/src/app/views/deployments/new.haml
index 3bc8700..e8566b4 100644
--- a/src/app/views/deployments/new.haml
+++ b/src/app/views/deployments/new.haml
@@ -17,7 +17,7 @@
%ul
- @deployment.deployable.legacy_assemblies.each do |assembly|
%li
- - hwprofiles = @hardware_profiles.select {|hwp| hwp.architecture.value == assembly.templates.first.architecture}
+ - hwprofiles = @hardware_profiles.select {|hwp| hwp.architecture.value == assembly.legacy_templates.first.architecture}
= label_tag "hw_profiles[#{assembly.id}]", assembly.name
= select_tag "hw_profiles[#{assembly.id}]", options_from_collection_for_select(hwprofiles, 'id', 'name')
diff --git a/src/app/views/instances/_list.haml b/src/app/views/instances/_list.haml
index 75df51b..c1f5888 100644
--- a/src/app/views/instances/_list.haml
+++ b/src/app/views/instances/_list.haml
@@ -1,6 +1,6 @@
- form_tag do
= restful_submit_tag 'Stop', 'stop', multi_stop_instances_path, 'GET'
- = restful_submit_tag 'Create', 'new', select_template_instances_path, 'GET'
+ = restful_submit_tag 'Create', 'new', select_legacy_template_instances_path, 'GET'
= restful_submit_tag 'Remove failed', 'remove_failed', remove_failed_instances_path, 'GET'
%p
@@ -17,7 +17,7 @@
%input{:name => 'instance_selected[]', :type => 'checkbox', :value => inst.id, :id => "instance_checkbox_#{inst.id}", :checked => selected }
= link_to inst.name, instance_path(inst)
%td= inst.state
- %td= inst.template ? inst.template.name : "#{inst.legacy_assembly.name} (assembly)"
+ %td= inst.legacy_template ? inst.legacy_template.name : "#{inst.legacy_assembly.name} (assembly)"
%td= inst.public_addresses
%td= inst.provider_account ? inst.provider_account.provider.name : ''
%td= owner_name(inst)
diff --git a/src/app/views/instances/_properties.haml b/src/app/views/instances/_properties.haml
index 3a9fcf1..7e1d9ed 100644
--- a/src/app/views/instances/_properties.haml
+++ b/src/app/views/instances/_properties.haml
@@ -14,13 +14,13 @@
%li
= label_tag :private_addresses, 'Private Addresses'
%span= @instance.private_addresses
- - if @instance.template
+ - if @instance.legacy_template
%li
= label_tag :operating_system, 'Operating system'
- %span= "#{(a)instance.template.xml.platform} #{(a)instance.template.xml.platform_version}"
+ %span= "#{(a)instance.legacy_template.xml.platform} #{(a)instance.legacy_template.xml.platform_version}"
%li
- = label_tag :base_template, 'Base Template'
- %span= @instance.template.name
+ = label_tag :base_legacy_template, 'Base Template'
+ %span= @instance.legacy_template.name
- else
%li
= label_tag :assembly, 'Assembly'
diff --git a/src/app/views/instances/new.haml b/src/app/views/instances/new.haml
index 139d08d..6820fe8 100644
--- a/src/app/views/instances/new.haml
+++ b/src/app/views/instances/new.haml
@@ -1,14 +1,14 @@
= error_messages_for 'instance'
%h2 Launch instance
- form_for @instance, :url => instances_path do
- = hidden_field :instance, :template_id
+ = hidden_field :instance, :legacy_template_id
%ul
%li
= label :instance, :name
= text_field :instance, :name
%li
- = label :instance, :template
- = text_field_tag :template_name, @instance.template ? @instance.template.name : '', :disabled => true
+ = label :instance, :legacy_template
+ = text_field_tag :template_name, @instance.legacy_template ? @instance.template.name : '', :disabled => true
%li
= label :instance, :pool
- if @instance.pool
diff --git a/src/app/views/instances/select_template.haml b/src/app/views/instances/select_template.haml
index a0c9117..fe4b045 100644
--- a/src/app/views/instances/select_template.haml
+++ b/src/app/views/instances/select_template.haml
@@ -1,10 +1,10 @@
%h3 Show Templates
%hr
%ul
- - @templates.each do |tpl|
+ - @legacy_templates.each do |tpl|
%li
- form_tag new_instance_path do
- = hidden_field :instance, :template_id, :value => tpl.id
+ = hidden_field :instance, :legacy_template_id, :value => tpl.id
- if tpl.platform != "unknown"
= image_tag "platform_#{tpl.platform}.png", :size => "32x32", :alt => tpl.platform
%h3= tpl.name
@@ -15,5 +15,5 @@
%label Version:
2.5
= submit_tag 'Launch', :name => 'launch'
-= will_paginate(@templates)
-= page_entries_info(@templates)
+= will_paginate(@legacy_templates)
+= page_entries_info(@legacy_templates)
diff --git a/src/app/views/legacy_templates/_builds.haml b/src/app/views/legacy_templates/_builds.haml
index a3831e2..7e87174 100644
--- a/src/app/views/legacy_templates/_builds.haml
+++ b/src/app/views/legacy_templates/_builds.haml
@@ -1,10 +1,10 @@
Builds for
= @tpl.platform_name
= @tpl.platform_version
-, template "#{(a)tpl.name}"
+, legacy_template "#{(a)tpl.name}"
- form_tag builds_path do
- = hidden_field_tag :template_id, @tpl.id
+ = hidden_field_tag :legacy_template_id, @tpl.id
- if @targets_not_built.count > 0 then
- if @tpl.imported
Build imported template is not supported
@@ -20,7 +20,7 @@ Builds for
- @images.each do |img|
%li
- form_tag(retry_builds_path, { :method => :post }) do
- = "#{img.name}-#{img.template.architecture}: #{img.status}"
+ = "#{img.name}-#{img.legacy_template.architecture}: #{img.status}"
= hidden_field_tag :template_id, @tpl.id
= hidden_field_tag :image_id, img.id
= submit_tag "Retry build", :name => "build"
diff --git a/src/app/views/legacy_templates/_list.haml b/src/app/views/legacy_templates/_list.haml
index 609051b..b33bbfc 100644
--- a/src/app/views/legacy_templates/_list.haml
+++ b/src/app/views/legacy_templates/_list.haml
@@ -2,14 +2,14 @@
= link_to "Create", new_legacy_template_path, :class => 'button'
= restful_submit_tag "Delete", 'destroy', multi_destroy_legacy_templates_path, 'DELETE', :id => 'delete_button'
- %table#templates_table
+ %table#legacy_templates_table
= sortable_table_header @header
%tbody
- - if @templates.empty?
+ - if @legacy_templates.empty?
%tr
%td{:colspan => 6} No Templates
- else
- - @templates.each do |template|
+ - @legacy_templates.each do |template|
%tr
%td
= check_box_tag 'selected[]', template.id, @url_params[:select] == 'all', :id => "selected_#{template.id}"
@@ -23,7 +23,7 @@
:javascript
$(document).ready(function () {
$('#delete_button').click(function(e) {
- if ($("#templates_table input[@type=radio]:checked").length == 0) {
+ if ($("#legacy_templates_table input[@type=radio]:checked").length == 0) {
alert('Please select any template to be deleted before clicking Delete button.');
e.preventDefault();
} else {
diff --git a/src/app/views/legacy_templates/xml/_hardware_profile.xml.haml b/src/app/views/legacy_templates/xml/_hardware_profile.xml.haml
index c51691f..68ccc36 100644
--- a/src/app/views/legacy_templates/xml/_hardware_profile.xml.haml
+++ b/src/app/views/legacy_templates/xml/_hardware_profile.xml.haml
@@ -3,4 +3,4 @@
%name<>
= profile.name
- [profile.memory, profile.cpu, profile.architecture, profile.storage].each do |prop|
- = render :partial => 'templates/xml/hardware_profile_property.xml', :locals => { :property => prop }
+ = render :partial => 'legacy_templates/xml/hardware_profile_property.xml', :locals => { :property => prop }
diff --git a/src/config/image_warehouse.yml b/src/config/image_warehouse.yml
index ede2baa..3a28ab3 100644
--- a/src/config/image_warehouse.yml
+++ b/src/config/image_warehouse.yml
@@ -1,3 +1,3 @@
baseurl: http://localhost:9090
# to set up the bucket, run:
-# curl -X PUT http://localhost:9090/templates
+# curl -X PUT http://localhost:9090/legacy_templates
diff --git a/src/config/navigation.rb b/src/config/navigation.rb
index 08ed896..7f0d472 100644
--- a/src/config/navigation.rb
+++ b/src/config/navigation.rb
@@ -7,7 +7,7 @@ SimpleNavigation::Configuration.run do |navigation|
second_level.item :instances, t("instances.instances"), instances_path
end
first_level.item :image_factory, t(:image_factory), legacy_templates_path, :highlights_on => /\/image_factory/ do |second_level|
- second_level.item :templates, t('templates.templates'), legacy_templates_path
+ second_level.item :legacy_templates, t('legacy_templates.legacy_templates'), legacy_templates_path
second_level.item :assemblies, t(:assemblies), legacy_assemblies_path
second_level.item :deployables, t('deployables.index.deployables'), deployables_path
second_level.item :image_imports, t(:image_imports), new_image_import_path
diff --git a/src/config/routes.rb b/src/config/routes.rb
index 39af325..68965c4 100644
--- a/src/config/routes.rb
+++ b/src/config/routes.rb
@@ -34,7 +34,7 @@ ActionController::Routing::Routes.draw do |map|
map.resources :pools, :collection => { :multi_destroy => :delete }
map.resources :deployments, :collection => { :multi_stop => :get, :launch_new => :get }
- map.resources :instances, :collection => {:start => :get, :multi_stop => :get, :select_template => :get, :remove_failed => :get, :can_start => :get, :can_create => :get }, :member => {:key => :get}
+ map.resources :instances, :collection => {:start => :get, :multi_stop => :get, :select_legacy_template => :get, :remove_failed => :get, :can_start => :get, :can_create => :get }, :member => {:key => :get}
map.can_start_instance '/instances/:instance_id/can_start/:provider_account_id', :controller => 'instances', :action => 'can_start', :conditions => { :method => :get }
map.can_create_instance '/instances/:instance_id/can_create/:provider_account_id', :controller => 'instances', :action => 'can_create', :conditions => { :method => :get }
diff --git a/src/db/migrate/20110207100700_create_legacy_assemblies.rb b/src/db/migrate/20110207100700_create_legacy_assemblies.rb
index eb1d9db..2c3a765 100644
--- a/src/db/migrate/20110207100700_create_legacy_assemblies.rb
+++ b/src/db/migrate/20110207100700_create_legacy_assemblies.rb
@@ -12,7 +12,7 @@ class CreateLegacyAssemblies < ActiveRecord::Migration
t.timestamps
end
create_table :legacy_assemblies_legacy_templates, :id => false do |t|
- t.integer :legacy_legacy_assembly_id, :null => false
+ t.integer :legacy_assembly_id, :null => false
t.integer :legacy_template_id, :null => false
end
end
diff --git a/src/features/image_import.feature b/src/features/image_import.feature
index a5e9d58..0790bad 100644
--- a/src/features/image_import.feature
+++ b/src/features/image_import.feature
@@ -19,7 +19,7 @@ Feature: Import Images
And I fill in "ami_id" with "img1"
Given I press "Import"
Then I should see "Image successfully imported"
- And I should be on the templates page
+ And I should be on the legacy_templates page
Scenario: Import an already imported image
When I select "provider1" from "provider_account_id"
diff --git a/src/features/step_definitions/assembly_steps.rb b/src/features/step_definitions/assembly_steps.rb
index 1fa4afa..a341d0e 100644
--- a/src/features/step_definitions/assembly_steps.rb
+++ b/src/features/step_definitions/assembly_steps.rb
@@ -12,9 +12,9 @@ Given /^there is an assembly named "([^"]*)" belonging to "([^"]*)" template$/ d
template = LegacyTemplate.find_by_name(template_name)
assembly = LegacyAssembly.find_by_name(assembly_name)
unless assembly.nil?
- template.legacy_assemblies << assembly
+ legacy_template.legacy_assemblies << assembly
else
- template.legacy_assemblies.create!(:name => assembly_name, :architecture => 'x86_64')
+ legacy_template.legacy_assemblies.create!(:name => assembly_name, :architecture => 'x86_64')
end
# Assembly.create!(:name => assembly, :architecture => 'x86_64', :deployable => Deployable.find_by_name(deployable))
end
diff --git a/src/features/step_definitions/instance_steps.rb b/src/features/step_definitions/instance_steps.rb
index b3c9eed..d098181 100644
--- a/src/features/step_definitions/instance_steps.rb
+++ b/src/features/step_definitions/instance_steps.rb
@@ -115,7 +115,7 @@ end
When /^I create mock instance$/ do
inst = Factory.build :mock_running_instance
- visit instances_url, :post, 'instance[name]' => inst.name, 'instance[template_id]' => inst.template_id
+ visit instances_url, :post, 'instance[name]' => inst.name, 'instance[template_id]' => inst.legacy_template_id
end
Then /^I should see mock instance in JSON format$/ do
diff --git a/src/features/step_definitions/template_steps.rb b/src/features/step_definitions/template_steps.rb
index a7c0d36..6061170 100644
--- a/src/features/step_definitions/template_steps.rb
+++ b/src/features/step_definitions/template_steps.rb
@@ -41,10 +41,10 @@ end
# web_steps.rb and in this case I have to use @template as parameter which "I
# am" doesn't support
Given /^I jump on the "([^"]*)" template software page$/ do |name|
- visit url_for(:action => 'software', :controller => 'templates', :id => @template)
+ visit url_for(:action => 'software', :controller => 'legacy_templates', :id => @template)
end
-Given /^there are these templates:$/ do |table|
+Given /^there are these legacy_templates:$/ do |table|
table.hashes.each do |hash|
@template = Factory.build(:template, :name => hash['name'],
:platform => hash['platform'])
@@ -121,7 +121,7 @@ Given /^has package "([^"]*)"$/ do |arg1|
end
When /^I edit the template$/ do
- visit edit_template_url(@template)
+ visit edit_legacy_template_url(@template)
end
When /^(?:|I )check "([^"]*)" template$/ do |template_name|
diff --git a/src/features/support/paths.rb b/src/features/support/paths.rb
index 58493c8..6614fdb 100644
--- a/src/features/support/paths.rb
+++ b/src/features/support/paths.rb
@@ -89,7 +89,7 @@ module NavigationHelpers
when /the pool family provider accounts page/
url_for pool_family_path(@pool_family, :details_tab => 'provider_accounts')
- when /the templates page/
+ when /the legacy_templates page/
legacy_templates_path
when /the create template page/
diff --git a/src/features/template.feature b/src/features/template.feature
index 90c1ed5..46f20a6 100644
--- a/src/features/template.feature
+++ b/src/features/template.feature
@@ -1,7 +1,7 @@
Feature: Manage Templates
In order to manage my cloud infrastructure
As a user
- I want to manage templates
+ I want to manage legacy_templates
Background:
Given I am an authorised user
@@ -9,7 +9,7 @@ Feature: Manage Templates
And There is a mock pulp repository
Scenario: Create a new Template
- Given I am on the templates page
+ Given I am on the legacy_templates page
When I follow "Create"
Then I should be on the new template page
When I fill in the following:
@@ -17,7 +17,7 @@ Feature: Manage Templates
| tpl_platform | fedora13 |
| tpl_summary | mockdesc |
When I press "Save"
- Then I should be on the templates page
+ Then I should be on the legacy_templates page
And I should see "Template saved"
And I should see "mocktemplate"
@@ -44,7 +44,7 @@ Feature: Manage Templates
And I should see "libdeltacloud"
Scenario: Add group and remove package to/from the template
- Given I am on the templates page
+ Given I am on the legacy_templates page
When I follow "Create"
Then I should be on the new template page
When I fill in the following:
@@ -61,7 +61,7 @@ Feature: Manage Templates
Then I should see "Managed Content to Bundle"
And the page should not contain "#package_libdeltacloud" selector
When I press "Save"
- Then I should be on the templates page
+ Then I should be on the legacy_templates page
And I should see "Template saved"
And I should see "mocktemplate"
@@ -77,18 +77,18 @@ Feature: Manage Templates
Then I should see "Managed Content to Bundle"
And the page should contain "#package_libdeltacloud" selector
When I press "Save"
- Then I should be on the templates page
+ Then I should be on the legacy_templates page
And I should see "Template updated"
When I edit the template
Then the page should contain "#package_libdeltacloud" selector
- Scenario: Sorting templates
+ Scenario: Sorting legacy_templates
Given there is a "mock1" template
And there is a "mock2" template
- And I am on the templates page
- When I follow "Name" within "#templates_table"
+ And I am on the legacy_templates page
+ When I follow "Name" within "#legacy_templates_table"
Then I should see "mock1" followed by "mock2"
- When I follow "Name" within "#templates_table"
+ When I follow "Name" within "#legacy_templates_table"
Then I should see "mock2" followed by "mock1"
Scenario: Sorting template builds
@@ -119,7 +119,7 @@ Feature: Manage Templates
Scenario: See upload status
Given there is a "mock1" template
And there is Amazon AWS build and push for this template
- And I am on the templates page
+ And I am on the legacy_templates page
When I choose this template
And I follow "Builds"
Then I should see "amazon-ec2: complete"
@@ -127,7 +127,7 @@ Feature: Manage Templates
Scenario: Build template
Given there is a "mock1" template
And there is Amazon AWS provider account
- And I am on the templates page
+ And I am on the legacy_templates page
When I choose this template
And I follow "Builds"
Then I should see "Builds for"
@@ -138,10 +138,10 @@ Feature: Manage Templates
Scenario: Upload image
Given there is a "mock1" template
- And I am on the templates page
+ And I am on the legacy_templates page
And there is Amazon AWS build for this template
And there is Amazon AWS provider
- And I am on the templates page
+ And I am on the legacy_templates page
When I choose this template
And I follow "Builds"
Then I should see "amazon-ec2: not uploaded upload"
@@ -153,18 +153,18 @@ Feature: Manage Templates
Scenario: Build imported template
Given there is an imported template
And there is Amazon AWS provider account
- And I am on the templates page
+ And I am on the legacy_templates page
When I choose this template
And I follow "Builds"
Then I should see "Build imported template is not supported"
- Scenario: Search for templates
- Given there are these templates:
+ Scenario: Search for legacy_templates
+ Given there are these legacy_templates:
| name | platform | platform_version | architecture | summary |
| Test1 | fedora13 | 13 | x86_64 | Test Template Fedora 13 64 bit Description |
| Mock | fedora14 | 14 | i386 | Test Template Fedora 14 Description |
| Other | fedora14 | 10.04 | i386 | Test Template Ubuntu 10.04 32 bit Description |
- And I am on the templates page
+ And I am on the legacy_templates page
Then I should see the following:
| NAME | OS | VERSION | ARCH |
| Test1 | Fedora | 13 | x86_64 |
@@ -201,17 +201,17 @@ Feature: Manage Templates
And I should see "Other"
And I should not see "Mock"
- Scenario: Delete multiple templates
- Given there are these templates:
+ Scenario: Delete multiple legacy_templates
+ Given there are these legacy_templates:
| name | platform | platform_version | architecture | summary |
| Test1 | fedora13 | 13 | x86_64 | Test Template Fedora 13 64 bit Description |
| Mock | fedora13 | 14 | i386 | Test Template Fedora 14 Description |
| Other | fedora13 | 10.04 | i386 | Test Template Ubuntu 10.04 32 bit Description |
- And I am on the templates page
+ And I am on the legacy_templates page
When I check "Test1" template
And I check "Mock" template
And I press "Delete"
- Then I should be on the templates page
+ Then I should be on the legacy_templates page
And I should see "Other"
Scenario: Create Assembly and Deployable
@@ -222,7 +222,7 @@ Feature: Manage Templates
| tpl_summary | mockdesc |
And I check "create_deployable"
And I press "Save"
- Then I should be on the templates page
+ Then I should be on the legacy_templates page
And I should see "mocktemplate"
When I go to the deployables page
And I should see "mocktemplate"
diff --git a/src/spec/controllers/builds_controller_spec.rb b/src/spec/controllers/builds_controller_spec.rb
index 34d9445..be01837 100644
--- a/src/spec/controllers/builds_controller_spec.rb
+++ b/src/spec/controllers/builds_controller_spec.rb
@@ -35,14 +35,14 @@ describe BuildsController do
response.should be_success
end
- context "when a user has permission to build templates" do
+ context "when a user has permission to build legacy_templates" do
#FIXME: The following functionality needs to come out of the controller
before(:each) do
UserSession.create(@admin)
@template = Factory.create(:template)
hydra = Typhoeus::Hydra.hydra
- hydra.stub(:put, %r{http://localhost:9090/templates/.*}).and_return(
+ hydra.stub(:put, %r{http://localhost:9090/legacy_templates/.*}).and_return(
Typhoeus::Response.new(:code => 200))
Factory.create(:mock_provider_account)
Factory.create(:mock_provider)
diff --git a/src/spec/controllers/instance_controller_spec.rb b/src/spec/controllers/instance_controller_spec.rb
index 9ef0548..c215fea 100644
--- a/src/spec/controllers/instance_controller_spec.rb
+++ b/src/spec/controllers/instance_controller_spec.rb
@@ -11,7 +11,7 @@ describe InstancesController do
it "should provide ui to create new instance" do
UserSession.create(@admin)
get :new
- response.should redirect_to(select_template_instances_path)
+ response.should redirect_to(select_legacy_template_instances_path)
end
it "should fail to grant access to new pool ui for unauthenticated user" do
diff --git a/src/spec/factories/assembly.rb b/src/spec/factories/assembly.rb
index 6098eeb..73bf59b 100644
--- a/src/spec/factories/assembly.rb
+++ b/src/spec/factories/assembly.rb
@@ -2,5 +2,5 @@ Factory.define :legacy_assembly do |a|
a.sequence(:name) { |n| "assembly#{n}" }
a.architecture 'x86_64'
a.association :owner, :factory => :user
- a.templates { |t| [t.association(:template)] }
+ a.legacy_templates { |t| [t.association(:template)] }
end
diff --git a/src/spec/models/assembly_spec.rb b/src/spec/models/assembly_spec.rb
index 251f256..ca2669a 100644
--- a/src/spec/models/assembly_spec.rb
+++ b/src/spec/models/assembly_spec.rb
@@ -19,7 +19,7 @@ describe LegacyAssembly do
it "should have associated template" do
a = Factory.build(:legacy_assembly)
- a.templates.size.should eql(1)
+ a.legacy_templates.size.should eql(1)
end
end
diff --git a/src/spec/models/deployable_spec.rb b/src/spec/models/deployable_spec.rb
index 7a5e80b..774089e 100644
--- a/src/spec/models/deployable_spec.rb
+++ b/src/spec/models/deployable_spec.rb
@@ -27,7 +27,7 @@ describe Deployable do
deployment = Factory.create(:deployment, :deployable_id => deployable.id)
assembly = Factory.create(:legacy_assembly)
- instance = Factory.create(:instance, :deployment_id => deployment.id, :legacy_assembly_id => assembly.id, :template_id => nil)
+ instance = Factory.create(:instance, :deployment_id => deployment.id, :legacy_assembly_id => assembly.id, :legacy_template_id => nil)
Deployable.find(deployable).should_not be_destroyable
instance.state = Instance::STATE_STOPPED
@@ -41,7 +41,7 @@ describe Deployable do
deployable.deployments << deployment
assembly = Factory.build(:legacy_assembly)
- instance = Factory.build(:instance, :deployment_id => deployment.id, :legacy_assembly_id => assembly.id, :template_id => nil)
+ instance = Factory.build(:instance, :deployment_id => deployment.id, :legacy_assembly_id => assembly.id, :legacy_template_id => nil)
instance.stub!(:restartable?).and_return(true)
deployment.instances << instance
deployable.should_not be_destroyable
diff --git a/src/spec/models/image_spec.rb b/src/spec/models/image_spec.rb
index 90d7474..7cb8b93 100644
--- a/src/spec/models/image_spec.rb
+++ b/src/spec/models/image_spec.rb
@@ -63,7 +63,7 @@ describe LegacyImage do
lambda do
img = LegacyImage.import(account, 'mock', Factory(:user))
img.should_not be_nil
- img.template.uploaded.should be_true
+ img.legacy_template.uploaded.should be_true
end.should change(LegacyImage, :count).by(1)
end.should change(LegacyTemplate, :count).by(1)
end.should change(ProviderImage, :count).by(1)
diff --git a/src/spec/models/instance_spec.rb b/src/spec/models/instance_spec.rb
index 1c1f631..622582b 100644
--- a/src/spec/models/instance_spec.rb
+++ b/src/spec/models/instance_spec.rb
@@ -25,20 +25,20 @@ describe Instance do
end
it "should require template to be set if there no deployment" do
- @instance.template_id = nil
+ @instance.legacy_template_id = nil
@instance.deployment_id = nil
@instance.should_not be_valid
- @instance.template_id = 1
+ @instance.legacy_template_id = 1
@instance.should be_valid
end
it "should not allow template to be set if there's a deployment" do
@instance.deployment_id = 1
- @instance.template_id = 1
+ @instance.legacy_template_id = 1
@instance.should_not be_valid
- @instance.template_id = nil
+ @instance.legacy_template_id = nil
@instance.legacy_assembly_id = 1
@instance.should be_valid
end
diff --git a/src/spec/models/template_spec.rb b/src/spec/models/template_spec.rb
index 7cc3e95..5df6360 100644
--- a/src/spec/models/template_spec.rb
+++ b/src/spec/models/template_spec.rb
@@ -11,7 +11,7 @@ describe LegacyTemplate do
it "should return list of providers who provides images built from this template" do
rimg = Factory.build(:mock_provider_image)
rimg.save!
- rimg.image.template.providers.size.should eql(1)
+ rimg.image.legacy_template.providers.size.should eql(1)
end
it "should not be valid if template name is too long" do
@@ -26,7 +26,7 @@ describe LegacyTemplate do
inst = Factory.build(:instance)
inst.save!
lambda do
- inst.template.destroy
+ inst.legacy_template.destroy
end.should_not change(LegacyTemplate, :count)
end
@@ -41,6 +41,6 @@ describe LegacyTemplate do
it "should have warehouse url" do
t = Factory.build(:template)
t.uuid = "uuid"
- t.warehouse_url.should == YAML.load_file("#{RAILS_ROOT}/config/image_warehouse.yml")['baseurl'] + "/templates/" + t.uuid
+ t.warehouse_url.should == YAML.load_file("#{RAILS_ROOT}/config/image_warehouse.yml")['baseurl'] + "/legacy_templates/" + t.uuid
end
end
diff --git a/src/warehouse_sync/warehouse_sync.rb b/src/warehouse_sync/warehouse_sync.rb
index e23b5fb..67fdefa 100644
--- a/src/warehouse_sync/warehouse_sync.rb
+++ b/src/warehouse_sync/warehouse_sync.rb
@@ -19,9 +19,9 @@ class WarehouseSync
while true
begin
@logger.info "***** Runnning warehouse sync"
- # TODO: I disabled template sync - templates should never
+ # TODO: I disabled template sync - legacy_templates should never
# be changed by anything else than conductor
- #(a)logger.info "*** syncing templates"
+ #(a)logger.info "*** syncing legacy_templates"
#Template.all.each do |i|
# i.safe_warehouse_sync
# i.save! if i.changed?
--
1.7.4.4
11 years, 10 months
Should thin.log be in the spec file too?
by Justin Clift
Hi all,
Should /var/log/aeolus-conductor/thin.log be owned by
aeolus:aeolus?
Unlike the rest of the log files in /var/log/aeolus-conductor,
it's root:root, which looks to be controlled by the
Conductor .spec.in file.
Wondering if we should add thin.log to the .spec.in
too?
Regards and best wishes,
Justin Clift
--
Aeolus Community Manager
http://www.aeolusproject.org
11 years, 10 months
[rbergero@redhat.com: Attention Cloud SIG pals: YOUR FEATURES WANTED]
by Chris Lalancette
FYI; I put together a feature page for Aeolus in Fedora-16:
https://fedoraproject.org/wiki/Features/Aeolus_Conductor
Expect me to be bugging people to do packaging/reviews to meet the July 26
deadline :).
--
Chris Lalancette
----- Forwarded message from Robyn Bergeron <rbergero(a)redhat.com> -----
Date: Tue, 24 May 2011 22:14:24 -0700
From: Robyn Bergeron <rbergero(a)redhat.com>
To: Fedora Cloud SIG <cloud(a)lists.fedoraproject.org>
Subject: Attention Cloud SIG pals: YOUR FEATURES WANTED
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13)
Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Thunderbird/3.1.7
Hi crew,
So you probably heard that Fedora 15 is out. Woo!
And that means one thing: I'll be asking everyone endlessly for MOAR
FEATURES IN FEDORA 16.
Feature submission deadline, per my currently still-slightly-drafty F16
schedule page at https://fedoraproject.org/wiki/Releases/16/Schedule is
July 12. Feature freeze is July 26, which is when your feature should be
more or less testable, and significantly complete.
If you are wondering what constitutes a "feature", this wiki page is a
good place to start.
http://fedoraproject.org/wiki/Features/Policy
If you are planning on doing packaging of any sort of cloud-related
project, I would recommend starting to work on it *now*, including
getting your Feature moving through the Feature process. Now, I hear
that the person who usually runs the Cloud SIG meetings also happens to
be the Fedora Feature Wrangler as part of her $dayjob, and that she
might be a good person to ask if you have questions. (That's me, in case
you're wondering.) If you're not sure if what you have should be a
feature, my simple answer is that if it's new to Fedora, then, probably. :)
Also: If you're planning on doing any packaging of your favorite
project, please pipe up here! I'm sure everyone would love to hear about
what the plans are for F16. We've got plenty of people willing to help
out with reviews and packaging right now, so by all means, seize the
opportunity.
(Hint: CloudFS, Aeolus, CloudStack, and Eucalyptus folks, I'm looking at
you. Even if it's for F17. Do tell your plans. Please. :D)
If you've already got a feature in progress and a feature page to match,
please list it on the wiki page:
https://fedoraproject.org/wiki/Cloud_SIG#Cloud_Features_in_Fedora_16
Note that we already have one in the pipeline, Sheepdog. (Thanks to
ke4qqq and sdake for working on this!)
-Robyn
_______________________________________________
cloud mailing list
cloud(a)lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/cloud
----- End forwarded message -----
11 years, 10 months
Audrey on RHEV-m
by Joseph VLcek
Mark, et al.
The Big Question:
------------------
Should the COW file be what is used to pass the Config Server contact
info. to a RHEV-m instance at launch time?
Or is there a better way to inject user data into a launching
instance on RHEV-m?
Brief:
------
A solution is needed for passing the Audrey Config Server contact
information (IP address:port/UUID) into an Audrey enabled instance on
RHEV-m. This is required so the IP address of the launching instance can
be picked up.
It seems a viable solution would be to put the Config Server contact
info into the COW file.
Extra Detail:
-------------
On EC2 the Config Server contact information is passed to the launching
instance using the EC2 user data.
On the Condor Cloud (test environment implemented with libvirt) SMBIOS
properties are used.
The plan had been to also use SMBIOS properties for RHEV-m however it
seems RHEV-m doesn't provide the option to override the SMBIOS data.
(See the rhevm-api email list for the thread started by Michal Fojtik
with the subject: "RHEV-M API SMBIOS support"). Using yet another
mechanism to pass this data to the launching instance on RHEV-m would
require small changes to Image Factory.
It seems the best solution for RHEV-m could be to put the Config Server
contact information in the COW file.
Ian Main has pointed out:
"Condor cloud uses COW images to back writes to a single image. This
way it can cache the image and just create one COW file per instance.
If we inject data, it would be into this COW file. It's very simple and
clean and easy."
Thoughts?
Thanks
Joe
11 years, 10 months
newui - 1575: Pretty/grid view toggles for AJAX
by Matt Wagner
Hi all,
This adds a filter/pretty (or grid/pretty) toggle to Pools#show. I built on Pools#index and ended up building a helper method and moving the existing code into application.js, if this isn't too much of a taboo. We'll be using it in a lot more places. I set class="active" on whichever is currently selected so that when we have elements for the icons, we can style them with CSS to indicate which is selected.
There are a lot more places where this will be needed that haven't been implemented just yet; this should make it easier to implement those.
I want to call one weird thing out because it doesn't feel right, but I can't find a less-bad solution: I duplicated the filter_view? method between ApplicationController and ApplicationHelper. Same exact code. The reason I got here is that I need to reference filter_view? in a helper and/or a partial, neither of which is able to call controller methods. I initially just moved it to ApplicationHelper instead, but it turns out that controllers need to access it too, and controllers can't call helper methods. So for now I duplicated it, hoping that someone will point out a much more elegant solution.
-- Matt
11 years, 10 months
[PATCH conductor] Added alerts div into pools#index view
by Jan Provazník
From: Jan Provaznik <jprovazn(a)redhat.com>
task #1634 (https://www.aeolusproject.org/redmine/issues/1634)
displays last_error messages for failed instances for now
---
src/app/controllers/pools_controller.rb | 3 ++-
src/app/views/pools/_alerts_index.haml | 7 +++++++
src/app/views/pools/_pretty_list.haml | 1 +
src/app/views/pools/index.haml | 1 +
src/features/pool.feature | 7 +++++++
5 files changed, 18 insertions(+), 1 deletions(-)
create mode 100644 src/app/views/pools/_alerts_index.haml
diff --git a/src/app/controllers/pools_controller.rb b/src/app/controllers/pools_controller.rb
index 1222aa0..dfb4c36 100644
--- a/src/app/controllers/pools_controller.rb
+++ b/src/app/controllers/pools_controller.rb
@@ -227,12 +227,13 @@ class PoolsController < ApplicationController
def statistics
instances = Instance.list_for_user(current_user, Privilege::VIEW)
+ @failed_instances = instances.select {|instance| instance.state == Instance::STATE_CREATE_FAILED || instance.state == Instance::STATE_ERROR}
@statistics = {
:pools_in_use => @user_pools.collect { |pool| pool.instances.pending.count > 0 || pool.instances.deployed.count > 0 }.count,
:deployments => Deployment.list_for_user(current_user, Privilege::VIEW).count,
:instances => instances.count,
:instances_pending => instances.select {|instance| instance.state == Instance::STATE_NEW || instance.state == Instance::STATE_PENDING}.count,
- :instances_failed => instances.select {|instance| instance.state == Instance::STATE_CREATE_FAILED || instance.state == Instance::STATE_ERROR}.count
+ :instances_failed => @failed_instances.count
}
end
end
diff --git a/src/app/views/pools/_alerts_index.haml b/src/app/views/pools/_alerts_index.haml
new file mode 100644
index 0000000..631f381
--- /dev/null
+++ b/src/app/views/pools/_alerts_index.haml
@@ -0,0 +1,7 @@
+- if @failed_instances.count > 0
+ %div.alerts
+ Alerts
+ %ul
+ - @failed_instances.each do |i|
+ %li
+ = "#{i.name}: #{i.last_error.blank? ? i.state : i.last_error}"
diff --git a/src/app/views/pools/_pretty_list.haml b/src/app/views/pools/_pretty_list.haml
index 72eba48..ffe6db1 100644
--- a/src/app/views/pools/_pretty_list.haml
+++ b/src/app/views/pools/_pretty_list.haml
@@ -1,4 +1,5 @@
= link_to "expand all", "#", :class => "reveal_all"
+= link_to "New Pool", new_pool_path
%table#pools_pretty_view
- @pools.each do |pool|
%tr
diff --git a/src/app/views/pools/index.haml b/src/app/views/pools/index.haml
index 35fcd43..4d2db04 100644
--- a/src/app/views/pools/index.haml
+++ b/src/app/views/pools/index.haml
@@ -1,5 +1,6 @@
= render :partial => 'header_index'
= render :partial => 'scoreboard_index'
+= render :partial => 'alerts_index'
= link_to "Pretty View", pools_path(:view => 'pretty'), :id =>'pretty_view'
= link_to "Filtred View", pools_path(:view => 'filter'), :id => 'filtred_view'
%div#view
diff --git a/src/features/pool.feature b/src/features/pool.feature
index 6c88c69..24d6443 100644
--- a/src/features/pool.feature
+++ b/src/features/pool.feature
@@ -172,3 +172,10 @@ Feature: Manage Pools
When I follow "Pretty View"
Then I should not see "Pools" within "#view"
And I should see "expand all"
+
+ Scenario: Display alerts
+ Given There is a mock pulp repository
+ And there is a "fail1" failed instance
+ When I go to the pools page
+ Then I should see "Alerts"
+ And I should see "fail1: error"
--
1.7.4
11 years, 10 months
[PATCH] Switch from using uuid to uuidtools, which reduces our dependencies.
by Chris Lalancette
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
---
contrib/aeolus-configure.spec | 2 +-
.../aeolus/lib/puppet/provider/web_request/curl.rb | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/contrib/aeolus-configure.spec b/contrib/aeolus-configure.spec
index b3b1089..f578378 100644
--- a/contrib/aeolus-configure.spec
+++ b/contrib/aeolus-configure.spec
@@ -13,7 +13,7 @@ Source0: %{name}-%{version}.tgz
BuildRoot: %{_tmppath}/%{name}-%{version}
BuildArch: noarch
Requires: puppet
-Requires: rubygem(uuid)
+Requires: rubygem(uuidtools)
# To send a request to iwhd rest interface to
# create buckets, eventually replace w/ an
# iwhd client
diff --git a/recipes/aeolus/lib/puppet/provider/web_request/curl.rb b/recipes/aeolus/lib/puppet/provider/web_request/curl.rb
index 925b865..724f70f 100644
--- a/recipes/aeolus/lib/puppet/provider/web_request/curl.rb
+++ b/recipes/aeolus/lib/puppet/provider/web_request/curl.rb
@@ -1,5 +1,5 @@
require 'curb'
-require 'uuid'
+require 'uuidtools'
require 'fileutils'
# Helper to invoke the web request w/ curl
@@ -54,7 +54,7 @@ end
def process_params(request_method, params, uri)
begin
# Set request method and generate a unique session key
- session = "/tmp/#{UUID.new.generate}"
+ session = "/tmp/#{UUIDTools::UUID.timestamp_create.to_s}"
# Invoke a login request if necessary
if params[:login]
--
1.7.4.4
11 years, 10 months