[PATCH conductor] Implement the user dropdown menu functionality
by Tomas Sedovic
From: Tomas Sedovic <tsedovic(a)redhat.com>
https://www.aeolusproject.org/redmine/issues/1752
This allows the user to log out and see their account information upon
clicking on the dropdown button next to their name in the header.
It also provides a fallback for browsers that do not have JavaScript enabled.
---
src/app/helpers/application_helper.rb | 4 ++++
src/app/stylesheets/custom.scss | 18 ++++++++++++++++++
src/app/views/layouts/_masthead.haml | 5 ++++-
src/public/javascripts/application.js | 16 +++++++++++++++-
4 files changed, 41 insertions(+), 2 deletions(-)
diff --git a/src/app/helpers/application_helper.rb b/src/app/helpers/application_helper.rb
index 3fae4de..023e705 100644
--- a/src/app/helpers/application_helper.rb
+++ b/src/app/helpers/application_helper.rb
@@ -245,4 +245,8 @@ module ApplicationHelper
:filter_link => filter_link
}
end
+
+ def javascript?
+ session[:javascript_enabled]
+ end
end
diff --git a/src/app/stylesheets/custom.scss b/src/app/stylesheets/custom.scss
index acf8af9..e259f39 100644
--- a/src/app/stylesheets/custom.scss
+++ b/src/app/stylesheets/custom.scss
@@ -13,3 +13,21 @@
#admin_subsections a {
color: blue;
}
+
+#user-menu.nojs a {
+ margin-left: 1em;
+}
+
+#user-menu.js {
+ position: fixed;
+ width: 100px;
+ height: 30px;
+ background: white;
+ display: none;
+ border: 2px solid #E7E7E7;
+ padding: 0.5em;
+
+ a {
+ display: block;
+ }
+}
diff --git a/src/app/views/layouts/_masthead.haml b/src/app/views/layouts/_masthead.haml
index 0638f55..308b22a 100644
--- a/src/app/views/layouts/_masthead.haml
+++ b/src/app/views/layouts/_masthead.haml
@@ -6,8 +6,11 @@
%span.name.label.strong.small-caps
= "#{(a)current_user.first_name} #{(a)current_user.last_name}" if @current_user.present?
%a.button.pill.user-dropdown{:href => '#'}
+ %span#user-menu{ :class => javascript? ? 'js' : 'nojs' }
+ = link_to "My Account", account_path
+ = link_to t(:logout), logout_path
%li.separator
%li
%div.query-input
-# Using verbatim HTML because CSS inline-block requires it.
- != "<input type='text' placeholder='Search...' /><input type='submit' value='search' />"
\ No newline at end of file
+ != "<input type='text' placeholder='Search...' /><input type='submit' value='search' />"
diff --git a/src/public/javascripts/application.js b/src/public/javascripts/application.js
index 4dfdac8..90aedfb 100644
--- a/src/public/javascripts/application.js
+++ b/src/public/javascripts/application.js
@@ -136,7 +136,20 @@ var Conductor = {
$('.control').click(function() {
$('#flash-hud').slideUp(100).fadeOut(100);
});
- }
+ },
+
+ enhanceUserMenu: function() {
+ var $userDropdown = $('#system a.user-dropdown');
+ if($userDropdown.length == 0) return;
+
+ var offset = $userDropdown.offset()
+ offset.top = offset.top + 40;
+ $('#user-menu').offset(offset)
+ $userDropdown.click(function(ev) {
+ ev.preventDefault();
+ $('#user-menu').toggle();
+ });
+ },
};
@@ -231,4 +244,5 @@ $(document).ready(function () {
Conductor.bind_pretty_toggle();
Conductor.multiDestroyValidation();
Conductor.closeNotification();
+ Conductor.enhanceUserMenu();
});
--
1.7.4.4
13 years
[PATCH] New UI in edit, and new actions for Pools
by Jirka Tomasek
From: Jiri Tomasek <jtomasek(a)redhat.com>
---
src/app/views/pools/_edit.haml | 42 ++++++++++-------------------
src/app/views/pools/_form.haml | 27 +++++++++++++++++++
src/app/views/pools/_new.haml | 32 +++++-----------------
src/app/views/pools/_section_header.haml | 5 +++
src/app/views/pools/index.haml | 6 ++--
src/features/pool.feature | 8 +++---
6 files changed, 61 insertions(+), 59 deletions(-)
create mode 100644 src/app/views/pools/_form.haml
create mode 100644 src/app/views/pools/_section_header.haml
diff --git a/src/app/views/pools/_edit.haml b/src/app/views/pools/_edit.haml
index 94e486f..84fa9d8 100644
--- a/src/app/views/pools/_edit.haml
+++ b/src/app/views/pools/_edit.haml
@@ -1,30 +1,18 @@
-= error_messages_for :pool
-%h1
- Edit pool
- = @pool.name
+= render :partial => 'layouts/admin_header'
-- form_for @pool do |form|
- %fieldset
- = form.label :name, "Name:", :class => "grid_2 alpha"
- = form.text_field :name
- %fieldset
- = form.label :pool_family_id, "Pool Family:", :class => "grid_2 alpha"
- = form.collection_select :pool_family_id, PoolFamily.all, :id, :name
- %fieldset
- = label_tag "Quota"
- = text_field :quota, :maximum_running_instances, :title => t('provider_accounts.form.quota_instances'), :value => @quota.maximum_running_instances || "unlimited", :id => "quota_instances", :class => "grid_3 omega"
- (
- %button.linkbutton.nospace{ :type => 'button', :onclick => "set_unlimited_quota(\"quota_instances\");" }<>
- = t('provider_accounts.form.unlimited_quota')
- )
- %fieldset
- = form.label :enabled, "Enabled:",{ :class => "grid_2 alpha" }
- = form.check_box :enabled
- %fieldset.clear
+%header.page-header
+ %h1{:class => controller.controller_name}= @pool.name
+ #obj_actions.button-container
+ = link_to 'New Pool', new_pool_url, :class => 'button primary', :id => 'new_pool_button'
+ .button-group
+ = link_to 'Cancel Editing', pool_path(@pool), :class => 'button pill danger', :id => 'new_user_button'
+ .corner
- = form.submit "Save"
+%section.content-section.user
+ %header
+ %h2
+ Edit pool
+ = @pool.name
-:javascript
- function set_unlimited_quota(elem_id) {
- $("#" + elem_id)[0].value = "unlimited";
- }
+ .content
+ = render :partial => 'form'
diff --git a/src/app/views/pools/_form.haml b/src/app/views/pools/_form.haml
new file mode 100644
index 0000000..e2f1b66
--- /dev/null
+++ b/src/app/views/pools/_form.haml
@@ -0,0 +1,27 @@
+- form_for @pool do |form|
+ = error_messages_for :pool
+ %fieldset
+ = form.label :name, "Name:", :class => "grid_2 alpha"
+ = form.text_field :name
+ %fieldset
+ = form.label :pool_family_id, "Pool Family:", :class => "grid_2 alpha"
+ = form.collection_select :pool_family_id, PoolFamily.all, :id, :name
+ %fieldset
+ = label_tag "Quota:"
+ = text_field :quota, :maximum_running_instances, :title => t('provider_accounts.form.quota_instances'), :value => @quota.maximum_running_instances || "unlimited", :id => "quota_instances", :class => "grid_3 omega"
+ (
+ %button.linkbutton.nospace{ :type => 'button', :onclick => "set_unlimited_quota(\"quota_instances\");" }<>
+ = t('provider_accounts.form.unlimited_quota')
+ )
+ %fieldset
+ = form.label :enabled, "Enabled:",{ :class => "grid_2 alpha" }
+ = form.check_box :enabled
+ %fieldset.clear
+
+ = form.submit "Save", :class => 'button'
+ = link_to 'Cancel', pools_path, :class => 'button danger'
+
+:javascript
+ function set_unlimited_quota(elem_id) {
+ $("#" + elem_id)[0].value = "unlimited";
+ }
diff --git a/src/app/views/pools/_new.haml b/src/app/views/pools/_new.haml
index 09df69e..d5c3a24 100644
--- a/src/app/views/pools/_new.haml
+++ b/src/app/views/pools/_new.haml
@@ -1,27 +1,9 @@
-= error_messages_for :pool
-%h1 Create a new Pool
-- form_for @pool, :url => pools_path do |form|
- %fieldset
- = form.label :name, "Name:", :class => "grid_2 alpha"
- = form.text_field :name
- %fieldset
- = form.label :pool_family_id, "Pool Family:", :class => "grid_2 alpha"
- = form.collection_select :pool_family_id, PoolFamily.all, :id, :name
- %fieldset
- = label_tag "Quota:"
- = text_field :quota, :maximum_running_instances, :title => t('provider_accounts.form.quota_instances'), :value => @quota.maximum_running_instances || "unlimited", :id => "quota_instances", :class => "grid_3 omega"
- (
- %button.linkbutton.nospace{ :type => 'button', :onclick => "set_unlimited_quota(\"quota_instances\");" }<>
- = t('provider_accounts.form.unlimited_quota')
- )
- %fieldset
- = form.label :enabled, "Enabled:",{ :class => "grid_2 alpha" }
- = form.check_box :enabled
- %fieldset.clear
+= render :partial => 'layouts/admin_header'
+= render :partial => 'section_header'
- = form.submit "Save"
+%section.content-section.pools
+ %header
+ %h2 Create New Pool
-:javascript
- function set_unlimited_quota(elem_id) {
- $("#" + elem_id)[0].value = "unlimited";
- }
+ .content
+ = render :partial => 'form'
diff --git a/src/app/views/pools/_section_header.haml b/src/app/views/pools/_section_header.haml
new file mode 100644
index 0000000..94599e3
--- /dev/null
+++ b/src/app/views/pools/_section_header.haml
@@ -0,0 +1,5 @@
+%header.page-header
+ %h1{:class => controller.controller_name} Pools
+ #obj_actions.button-group
+ = link_to 'New Pool', new_pool_url, :class => 'button primary', :id => 'new_pool_button'
+ .corner
diff --git a/src/app/views/pools/index.haml b/src/app/views/pools/index.haml
index e24f692..03001a7 100644
--- a/src/app/views/pools/index.haml
+++ b/src/app/views/pools/index.haml
@@ -1,8 +1,8 @@
%header.page-header
%h1.section-index Overview
- -# Insert appropriate controls here, or ommit %ul.controls
- = pretty_filter_toggle(pools_path(:view => 'pretty'), pools_path(:view => 'filter'))
- = link_to "New Pool", new_pool_path, { :class => 'button' }
+ #obj_actions.button-container
+ = pretty_filter_toggle(pools_path(:view => 'pretty'), pools_path(:view => 'filter'))
+ = link_to "New Pool", new_pool_path, { :class => 'button primary' }
.corner
= render :partial => 'scoreboard_index'
diff --git a/src/features/pool.feature b/src/features/pool.feature
index 30417fc..d7d5142 100644
--- a/src/features/pool.feature
+++ b/src/features/pool.feature
@@ -12,7 +12,7 @@ Feature: Manage Pools
And there is not a pool named "mockpool"
When I follow "New Pool"
Then I should be on the new pool page
- And I should see "Create a new Pool"
+ And I should see "Create New Pool"
When I fill in "pool_name" with "mockpool"
And I select "default" from "pool_pool_family_id"
And I fill in "quota_instances" with "unlimited"
@@ -25,7 +25,7 @@ Feature: Manage Pools
Given I request XHR
And I am on the new pool page
Then I should get back a partial
- And I should see "Create a new Pool"
+ And I should see "Create New Pool"
When I fill in "pool_name" with "mockpool"
And I select "default" from "pool_pool_family_id"
And I fill in "quota_instances" with "unlimited"
@@ -73,7 +73,7 @@ Feature: Manage Pools
When I follow "Filter View"
And I follow "New Pool"
Then I should be on the new pool page
- And I should see "Create a new Pool"
+ And I should see "Create New Pool"
When I fill in "pool_name" with "mockpool"
And I select "default" from "pool_pool_family_id"
And I press "Save"
@@ -85,7 +85,7 @@ Feature: Manage Pools
And I follow "Filter View"
And I follow "New Pool"
Then I should be on the new pool page
- And I should see "Create a new Pool"
+ And I should see "Create New Pool"
When I fill in "pool_name" with "foopool"
And I select "default" from "pool_pool_family_id"
And I press "Save"
--
1.7.4.2
13 years
[PATCH 1/6] augmented IWHD-backed model to add explicit methods to pull latest_build and provider, and to filter on provider+build
by Scott Seago
Signed-off-by: Scott Seago <sseago(a)redhat.com>
---
src/app/models/image.rb | 6 +++++-
src/app/models/provider_image.rb | 22 +++++++++++++++++++++-
2 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/src/app/models/image.rb b/src/app/models/image.rb
index 6cb232c..6246969 100644
--- a/src/app/models/image.rb
+++ b/src/app/models/image.rb
@@ -8,7 +8,11 @@ class Image < WarehouseModel
end
end
+ def latest_build
+ ImageBuild.find(@latest_build) if @latest_build
+ end
+
def image_builds
ImageBuild.find_all_by_image_uuid(self.uuid)
end
-end
\ No newline at end of file
+end
diff --git a/src/app/models/provider_image.rb b/src/app/models/provider_image.rb
index d50e622..fb71f80 100644
--- a/src/app/models/provider_image.rb
+++ b/src/app/models/provider_image.rb
@@ -7,4 +7,24 @@ class ProviderImage < WarehouseModel
send(:"#{k}=", v)
end
end
-end
\ No newline at end of file
+
+ def provider
+ Provider.find_by_name(@provider)
+ end
+
+ def self.find_all_by_provider_and_build(provider, build)
+ provider_name = provider.name
+ build_uuid = build.uuid
+ self.set_warehouse_and_bucket if self.bucket.nil?
+ self.bucket.objects.map do |wh_object|
+ if wh_object.attr('provider')[1] == provider_name
+ # FIX ME: We need to add build metadata tag so we don't need
+ # this extra query
+ target_uuid = wh_object.attr('target_image')[1]
+ if TargetImage.find(target_uuid).build == build_uuid
+ ProviderImage.new(wh_object.attrs(wh_object.attr_list))
+ end
+ end
+ end.compact
+ end
+end
--
1.7.4.4
13 years
Directions for aeolus-image build patch
by Jason Guiditta
[PATCH conductor] Issue #1700: Build an image via aeolus-image tool
The factory console gem/rpm (with factory 0.2.0) are required for this to
be tested. The aeolus-image lib is not yet packaged, as I am not sure if it
will be a standalone gem/rpm or bundled with something. Packaging will be
added once this is decided.
In the meantime, the executable can be run this way:
ruby -r 'rubygems' bin/aeolus-image.rb build -T mock,ec2 -e 'spec/sample_data/custom_repo.tdl'
the -r flag is not needed for 'spec' or 'rake spec' commands.
-j
13 years
[PATCH] Add -x option to write libxml file data to a specified file
by Steven Dake
Third party users may have a difficult time determining the libvirt XML
configuration unless they read the output of oz. Instead add an option which
allows the XML filename to be overridden to a specific filename.
Signed-off-by: Steven Dake <sdake(a)redhat.com>
---
man/oz-install.1 | 5 +++++
oz-install | 12 +++++++++---
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/man/oz-install.1 b/man/oz-install.1
index b497813..862bac2 100644
--- a/man/oz-install.1
+++ b/man/oz-install.1
@@ -46,6 +46,11 @@ Turn on debugging output to level \fBloglevel\fR. The log levels are:
.IP "4 - all messages, prepended with the level and classname"
.RE
.TP
+.B "\-x <xmlfile>"
+Oz will normally generate a libvirt XML file in the current working
+directory suffixed with the date and time. Specifing the -x option
+allows the filename to be overridden.
+.TP
.B "\-f"
Force the generation of new installation media. By default, oz-install will
always try to use a locally cached version of the oz-modified install
diff --git a/oz-install b/oz-install
index 4755701..8b41d00 100755
--- a/oz-install
+++ b/oz-install
@@ -33,6 +33,7 @@ def usage():
print "\t\tof using the hard-coded one. This is useful if you want to pass"
print "\t\ta custom kickstart for installation"
print " -c <config>\tGet config from <config> (default is /etc/oz/oz.cfg)"
+ print " -x <xmlfile>\tWrite libvirt XML to the specified file"
print " -d <level>\tTurn up logging level. The levels are:"
print "\t\t\t0 - errors only (this is the default)"
print "\t\t\t1 - errors and warnings"
@@ -52,8 +53,8 @@ def usage():
sys.exit(1)
try:
- opts, args = getopt.gnu_getopt(sys.argv[1:], 'a:c:d:fghpt:u',
- ['auto', 'config', 'debug', 'force-download',
+ opts, args = getopt.gnu_getopt(sys.argv[1:], 'a:c:d:x:fghpt:u',
+ ['auto', 'config', 'debug', 'xmlfile', 'force-download',
'generate-icicle', 'help', 'cleanup',
'timeout', 'customize'])
except getopt.GetoptError, err:
@@ -65,6 +66,7 @@ logformat = "%(message)s"
force_download = False
config_file = "/etc/oz/oz.cfg"
generate_icicle = False
+generate_xmlfile = True
customize = False
cleanup = False
auto = None
@@ -72,6 +74,9 @@ timeout = None
for o, a in opts:
if o in ("-a", "--auto"):
auto = a
+ elif o in ("-x", "--xmlfile"):
+ filename = a
+ generate_xmlfile = False
elif o in ("-c", "--config"):
config_file = a
elif o in ("-d", "--debug"):
@@ -146,7 +151,8 @@ try:
elif generate_icicle:
print guest.generate_icicle(libvirt_xml)
- filename = guest.name + time.strftime("%b_%d_%Y-%H:%M:%S")
+ if generate_xmlfile:
+ filename = guest.name + time.strftime("%b_%d_%Y-%H:%M:%S")
open(filename, 'w').write(libvirt_xml)
print "Libvirt XML was written to " + filename
except Exception, exc:
--
1.7.4.4
13 years
Fixes "Remove failed" button
by Matt Wagner
This is a quick little patch that seeks to fix something we've had a lot of complaints for -- the "Remove failed" button not actually removing failed jobs.
I changed it to remove jobs in the "create_failed" state as well, and to just destroy the instance if it's failed and has no condor_job_id. (Previously we tried to remove it from Condor even if it had no Condor ID.)
I wrote a test case, but I'm not able to induce a wide variety of failures, so it would be super if someone could test this in the real world against actually-failed instances.
-- Matt
13 years
[PATCH] Add NTP to the aeolus-all requirements.
by Justin Clift
---
aeolus-all.spec.in | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/aeolus-all.spec.in b/aeolus-all.spec.in
index 7acf01a..318c61d 100644
--- a/aeolus-all.spec.in
+++ b/aeolus-all.spec.in
@@ -19,6 +19,7 @@ Requires: rubygem(image_factory_connector)
Requires: mongodb-server
Requires: mod_ssl
Requires: deltacloud-core
+Requires: ntp
# FIXME: this Requires doesn't actually belong here, it belongs in
# deltacloud-core. We leave it in until deltacloud-core is fixed
Requires: rubygem(aws)
--
1.7.4.4
13 years