openshift-origin-console 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYRIGHT +1 -0
- data/Gemfile +21 -0
- data/LICENSE +203 -0
- data/README.md +123 -0
- data/Rakefile +44 -0
- data/app/assets/images/cartridge-edge.gif +0 -0
- data/app/assets/images/console/arrow-down.png +0 -0
- data/app/assets/images/console/console-sprite.png +0 -0
- data/app/assets/images/favicon-32.png +0 -0
- data/app/assets/images/loader-dark.gif +0 -0
- data/app/assets/images/loader.gif +0 -0
- data/app/assets/images/sprite-vert.png +0 -0
- data/app/assets/javascripts/console.js +10 -0
- data/app/assets/javascripts/console/form.js.coffee +51 -0
- data/app/assets/stylesheets/_alerts.scss +84 -0
- data/app/assets/stylesheets/_breadcrumbs.scss +31 -0
- data/app/assets/stylesheets/_buttons.scss +229 -0
- data/app/assets/stylesheets/_code.scss +86 -0
- data/app/assets/stylesheets/_custom.scss +207 -0
- data/app/assets/stylesheets/_footer.scss +54 -0
- data/app/assets/stylesheets/_forms.scss +710 -0
- data/app/assets/stylesheets/_grid.scss +28 -0
- data/app/assets/stylesheets/_input-prepend-append.scss +138 -0
- data/app/assets/stylesheets/_labels.scss +40 -0
- data/app/assets/stylesheets/_mixins.scss +76 -0
- data/app/assets/stylesheets/_override-variables.scss +1 -0
- data/app/assets/stylesheets/_responsive.scss +438 -0
- data/app/assets/stylesheets/_ribbon.scss +57 -0
- data/app/assets/stylesheets/_type.scss +306 -0
- data/app/assets/stylesheets/_utilities.scss +10 -0
- data/app/assets/stylesheets/_variables.scss +131 -0
- data/app/assets/stylesheets/common.css.scss +82 -0
- data/app/assets/stylesheets/console/_application.scss +194 -0
- data/app/assets/stylesheets/console/_base.scss +26 -0
- data/app/assets/stylesheets/console/_breadcrumbs.scss +32 -0
- data/app/assets/stylesheets/console/_buttons.scss +214 -0
- data/app/assets/stylesheets/console/_core.scss +1002 -0
- data/app/assets/stylesheets/console/_dropdowns.scss +63 -0
- data/app/assets/stylesheets/console/_help.scss +54 -0
- data/app/assets/stylesheets/console/_mixins.scss +11 -0
- data/app/assets/stylesheets/console/_navbar.scss +415 -0
- data/app/assets/stylesheets/console/_ribbon.scss +82 -0
- data/app/assets/stylesheets/console/_tile.scss +122 -0
- data/app/assets/stylesheets/origin.css.scss +37 -0
- data/app/controllers/account/dashboard.rb +13 -0
- data/app/controllers/account_controller.rb +3 -0
- data/app/controllers/application_types_controller.rb +80 -0
- data/app/controllers/applications_controller.rb +183 -0
- data/app/controllers/building_controller.rb +81 -0
- data/app/controllers/capability_aware.rb +18 -0
- data/app/controllers/cartridge_types_controller.rb +53 -0
- data/app/controllers/cartridges_controller.rb +43 -0
- data/app/controllers/console/auth/basic.rb +65 -0
- data/app/controllers/console/auth/none.rb +5 -0
- data/app/controllers/console/auth/remote_user.rb +69 -0
- data/app/controllers/console/rescue.rb +48 -0
- data/app/controllers/console_controller.rb +19 -0
- data/app/controllers/console_index_controller.rb +14 -0
- data/app/controllers/domain_aware.rb +26 -0
- data/app/controllers/domain_session_sweeper.rb +29 -0
- data/app/controllers/domains_controller.rb +30 -0
- data/app/controllers/keys_controller.rb +43 -0
- data/app/controllers/scaling_controller.rb +46 -0
- data/app/controllers/sshkey_aware.rb +23 -0
- data/app/controllers/sshkey_session_sweeper.rb +29 -0
- data/app/controllers/user_session_sweeper.rb +29 -0
- data/app/helpers/console/community_helper.rb +78 -0
- data/app/helpers/console/console_helper.rb +26 -0
- data/app/helpers/console/help_helper.rb +270 -0
- data/app/helpers/console/html5_boilerplate_helper.rb +63 -0
- data/app/helpers/console/layout_helper.rb +277 -0
- data/app/helpers/console/model_helper.rb +106 -0
- data/app/helpers/console/secured_helper.rb +5 -0
- data/app/models/alias.rb +10 -0
- data/app/models/application.rb +148 -0
- data/app/models/application_associations.rb +36 -0
- data/app/models/application_template.rb +90 -0
- data/app/models/application_type.rb +258 -0
- data/app/models/async_aware.rb +60 -0
- data/app/models/capabilities.rb +62 -0
- data/app/models/cartridge.rb +122 -0
- data/app/models/cartridge_type.rb +140 -0
- data/app/models/domain.rb +44 -0
- data/app/models/domain_associations.rb +33 -0
- data/app/models/embedded.rb +11 -0
- data/app/models/gear.rb +13 -0
- data/app/models/gear_group.rb +104 -0
- data/app/models/key.rb +87 -0
- data/app/models/quickstart.rb +135 -0
- data/app/models/rest_api.rb +130 -0
- data/app/models/rest_api/base.rb +781 -0
- data/app/models/rest_api/cacheable.rb +91 -0
- data/app/models/rest_api/environment.rb +13 -0
- data/app/models/rest_api/info.rb +34 -0
- data/app/models/rest_api/log_subscriber.rb +29 -0
- data/app/models/rest_api/railties/controller_runtime.rb +37 -0
- data/app/models/user.rb +27 -0
- data/app/models/user_associations.rb +6 -0
- data/app/views/account/_domain.html.haml +14 -0
- data/app/views/account/_keys.html.haml +20 -0
- data/app/views/account/_user.html.haml +5 -0
- data/app/views/account/show.html.haml +15 -0
- data/app/views/application_templates/_application_template.html.haml +5 -0
- data/app/views/application_types/_application_type.html.haml +19 -0
- data/app/views/application_types/_custom.html.haml +19 -0
- data/app/views/application_types/_persisted.html.haml +26 -0
- data/app/views/application_types/_tile.html.haml +9 -0
- data/app/views/application_types/index.html.haml +87 -0
- data/app/views/application_types/search.html.haml +67 -0
- data/app/views/application_types/show.html.haml +219 -0
- data/app/views/applications/_application.html.haml +34 -0
- data/app/views/applications/_applications_filter.html.haml +8 -0
- data/app/views/applications/_footer.html.haml +0 -0
- data/app/views/applications/_name.html.haml +28 -0
- data/app/views/applications/delete.html.haml +19 -0
- data/app/views/applications/get_started.html.haml +145 -0
- data/app/views/applications/index.html.haml +55 -0
- data/app/views/applications/show.html.haml +193 -0
- data/app/views/building/delete.html.haml +22 -0
- data/app/views/building/new.html.haml +57 -0
- data/app/views/building/show.html.haml +12 -0
- data/app/views/cartridge_types/_cartridge_type.html.haml +61 -0
- data/app/views/cartridge_types/index.html.haml +37 -0
- data/app/views/cartridge_types/show.html.haml +21 -0
- data/app/views/cartridges/next_steps.html.haml +58 -0
- data/app/views/cartridges/show.html.haml +1 -0
- data/app/views/console/error.html.haml +58 -0
- data/app/views/console/help.html.haml +90 -0
- data/app/views/console/not_found.html.haml +69 -0
- data/app/views/console/unauthorized.html.haml +7 -0
- data/app/views/domains/_domain.html.haml +14 -0
- data/app/views/domains/_form.html.haml +13 -0
- data/app/views/domains/edit.html.haml +5 -0
- data/app/views/domains/new.html.haml +6 -0
- data/app/views/keys/_form.html.haml +14 -0
- data/app/views/keys/_simple_form.html.haml +14 -0
- data/app/views/keys/new.html.haml +2 -0
- data/app/views/layouts/_footer.html.haml +38 -0
- data/app/views/layouts/_head.html.haml +35 -0
- data/app/views/layouts/console.html.haml +60 -0
- data/app/views/layouts/console/_header.html.haml +44 -0
- data/app/views/layouts/console/_identity.html.haml +7 -0
- data/app/views/layouts/console/_javascripts.html.haml +5 -0
- data/app/views/layouts/console/_stylesheets.html.haml +6 -0
- data/app/views/scaling/delete.html.haml +17 -0
- data/app/views/scaling/new.html.haml +24 -0
- data/app/views/scaling/show.html.haml +81 -0
- data/app/views/shared/_tracking.html.haml +0 -0
- data/conf/console.conf.example +108 -0
- data/conf/openshift_console.conf +10 -0
- data/config/cartridge_types.yml +54 -0
- data/config/initializers/barista_config.rb +86 -0
- data/config/initializers/cartridge_types.rb +5 -0
- data/config/initializers/console_security.rb +1 -0
- data/config/initializers/date_helper.rb +5 -0
- data/config/initializers/extended_logger.rb +51 -0
- data/config/initializers/formtastic.rb +100 -0
- data/config/initializers/inflections.rb +38 -0
- data/config/initializers/rdiscount.rb +8 -0
- data/config/initializers/rest_api.rb +22 -0
- data/config/initializers/sass.rb +30 -0
- data/config/initializers/session_trace.rb +32 -0
- data/config/initializers/x_frame_options.rb +53 -0
- data/config/locales/en.yml +12 -0
- data/lib/active_resource/associations.rb +107 -0
- data/lib/active_resource/associations/builder/association.rb +35 -0
- data/lib/active_resource/associations/builder/belongs_to.rb +5 -0
- data/lib/active_resource/associations/builder/has_many.rb +5 -0
- data/lib/active_resource/associations/builder/has_one.rb +5 -0
- data/lib/active_resource/persistent_connection.rb +341 -0
- data/lib/active_resource/persistent_http_mock.rb +68 -0
- data/lib/active_resource/reflection.rb +78 -0
- data/lib/console.rb +8 -0
- data/lib/console/config_file.rb +13 -0
- data/lib/console/configuration.rb +163 -0
- data/lib/console/engine.rb +28 -0
- data/lib/console/formtastic/bootstrap_form_builder.rb +369 -0
- data/lib/console/rails/app_redirector.rb +40 -0
- data/lib/console/rails/filter_hash.rb +15 -0
- data/lib/console/rails/routes.rb +51 -0
- data/lib/console/version.rb +5 -0
- data/lib/tasks/assets.rake +79 -0
- data/lib/tasks/stats.rake +18 -0
- data/lib/tasks/test_suites.rake +73 -0
- data/test/coverage_helper.rb +27 -0
- data/test/fixtures/cartridges.json +1 -0
- data/test/fixtures/quickstarts.csv +3 -0
- data/test/functional/account_controller_test.rb +14 -0
- data/test/functional/application_types_controller_test.rb +251 -0
- data/test/functional/applications_controller_sanity_test.rb +26 -0
- data/test/functional/applications_controller_test.rb +365 -0
- data/test/functional/building_controller_test.rb +203 -0
- data/test/functional/cartridge_types_controller_isolation_test.rb +68 -0
- data/test/functional/cartridge_types_controller_test.rb +48 -0
- data/test/functional/cartridges_controller_test.rb +83 -0
- data/test/functional/console_auth_basic_controller_test.rb +82 -0
- data/test/functional/console_auth_remote_user_controller_test.rb +90 -0
- data/test/functional/console_index_controller_test.rb +22 -0
- data/test/functional/domains_controller_test.rb +194 -0
- data/test/functional/keys_controller_test.rb +163 -0
- data/test/functional/quickstarts.json +18 -0
- data/test/functional/scaling_controller_test.rb +153 -0
- data/test/integration/assets_test.rb +34 -0
- data/test/integration/help_link_test.rb +43 -0
- data/test/integration/quickstarts_test.rb +24 -0
- data/test/integration/rescue_from_test.rb +25 -0
- data/test/integration/rest_api/application_test.rb +115 -0
- data/test/integration/rest_api/cartridge_test.rb +44 -0
- data/test/integration/rest_api/cartridge_type_test.rb +143 -0
- data/test/integration/rest_api/domain_test.rb +91 -0
- data/test/integration/rest_api/info_test.rb +9 -0
- data/test/integration/rest_api/key_test.rb +85 -0
- data/test/integration/static_pages_test.rb +44 -0
- data/test/rails_app/Rakefile +7 -0
- data/test/rails_app/app/controllers/application_controller.rb +5 -0
- data/test/rails_app/config.ru +4 -0
- data/test/rails_app/config/application.rb +48 -0
- data/test/rails_app/config/boot.rb +10 -0
- data/test/rails_app/config/database.yml +25 -0
- data/test/rails_app/config/environment.rb +5 -0
- data/test/rails_app/config/environments/development.rb +38 -0
- data/test/rails_app/config/environments/production.rb +70 -0
- data/test/rails_app/config/environments/test.rb +43 -0
- data/test/rails_app/config/initializers/auth.rb +0 -0
- data/test/rails_app/config/initializers/backtrace_silencers.rb +7 -0
- data/test/rails_app/config/initializers/inflections.rb +10 -0
- data/test/rails_app/config/initializers/mime_types.rb +5 -0
- data/test/rails_app/config/initializers/secret_token.rb +7 -0
- data/test/rails_app/config/initializers/session_store.rb +8 -0
- data/test/rails_app/config/locales/en.yml +5 -0
- data/test/rails_app/config/routes.rb +4 -0
- data/test/rails_app/script/rails +6 -0
- data/test/support/auth.rb +111 -0
- data/test/support/base.rb +142 -0
- data/test/support/errors.rb +28 -0
- data/test/support/rest_api.rb +189 -0
- data/test/test_helper.rb +14 -0
- data/test/unit/active_model_compliance_test.rb +23 -0
- data/test/unit/async_aware_test.rb +55 -0
- data/test/unit/configuration_test.rb +158 -0
- data/test/unit/filter_hash_test.rb +64 -0
- data/test/unit/helpers/model_helper_test.rb +61 -0
- data/test/unit/overrides_test.rb +9 -0
- data/test/unit/rest_api_test.rb +1590 -0
- data/vendor/assets/javascripts/MIT-LICENSE.txt +20 -0
- data/vendor/assets/javascripts/bootstrap-collapse.js +157 -0
- data/vendor/assets/javascripts/bootstrap-dropdown.js +100 -0
- data/vendor/assets/javascripts/bootstrap-tab.js +135 -0
- data/vendor/assets/javascripts/bootstrap-transition.js +61 -0
- data/vendor/assets/javascripts/jquery.spin.js +47 -0
- data/vendor/assets/javascripts/jquery.ui.widget.js +16 -0
- data/vendor/assets/javascripts/jquery_cookie.js +41 -0
- data/vendor/assets/javascripts/jquery_validate_min.js +51 -0
- data/vendor/assets/javascripts/modernizr.min.js +2 -0
- data/vendor/assets/javascripts/plugins.js +16 -0
- data/vendor/assets/stylesheets/bootstrap/_accordion.scss +28 -0
- data/vendor/assets/stylesheets/bootstrap/_alerts.scss +70 -0
- data/vendor/assets/stylesheets/bootstrap/_breadcrumbs.scss +22 -0
- data/vendor/assets/stylesheets/bootstrap/_button-groups.scss +147 -0
- data/vendor/assets/stylesheets/bootstrap/_buttons.scss +183 -0
- data/vendor/assets/stylesheets/bootstrap/_carousel.scss +121 -0
- data/vendor/assets/stylesheets/bootstrap/_close.scss +18 -0
- data/vendor/assets/stylesheets/bootstrap/_code.scss +57 -0
- data/vendor/assets/stylesheets/bootstrap/_component-animations.scss +18 -0
- data/vendor/assets/stylesheets/bootstrap/_dropdowns.scss +130 -0
- data/vendor/assets/stylesheets/bootstrap/_forms.scss +522 -0
- data/vendor/assets/stylesheets/bootstrap/_grid.scss +8 -0
- data/vendor/assets/stylesheets/bootstrap/_hero-unit.scss +20 -0
- data/vendor/assets/stylesheets/bootstrap/_labels.scss +32 -0
- data/vendor/assets/stylesheets/bootstrap/_layouts.scss +17 -0
- data/vendor/assets/stylesheets/bootstrap/_mixins.scss +602 -0
- data/vendor/assets/stylesheets/bootstrap/_modals.scss +84 -0
- data/vendor/assets/stylesheets/bootstrap/_navbar.scss +299 -0
- data/vendor/assets/stylesheets/bootstrap/_navs.scss +353 -0
- data/vendor/assets/stylesheets/bootstrap/_pager.scss +30 -0
- data/vendor/assets/stylesheets/bootstrap/_pagination.scss +55 -0
- data/vendor/assets/stylesheets/bootstrap/_popovers.scss +49 -0
- data/vendor/assets/stylesheets/bootstrap/_progress-bars.scss +95 -0
- data/vendor/assets/stylesheets/bootstrap/_reset.scss +126 -0
- data/vendor/assets/stylesheets/bootstrap/_scaffolding.scss +33 -0
- data/vendor/assets/stylesheets/bootstrap/_sprites.scss +158 -0
- data/vendor/assets/stylesheets/bootstrap/_tables.scss +150 -0
- data/vendor/assets/stylesheets/bootstrap/_thumbnails.scss +35 -0
- data/vendor/assets/stylesheets/bootstrap/_tooltip.scss +35 -0
- data/vendor/assets/stylesheets/bootstrap/_type.scss +218 -0
- data/vendor/assets/stylesheets/bootstrap/_utilities.scss +23 -0
- data/vendor/assets/stylesheets/bootstrap/_variables.scss +107 -0
- data/vendor/assets/stylesheets/bootstrap/_wells.scss +17 -0
- data/vendor/assets/stylesheets/bootstrap/bootstrap.scss +66 -0
- data/vendor/assets/stylesheets/bootstrap/responsive.scss +334 -0
- metadata +506 -0
@@ -0,0 +1,29 @@
|
|
1
|
+
class DomainSessionSweeper < ActiveModel::Observer
|
2
|
+
observe Domain
|
3
|
+
|
4
|
+
def self.before(controller)
|
5
|
+
self.domain_changes = false
|
6
|
+
true
|
7
|
+
end
|
8
|
+
def self.after(controller)
|
9
|
+
controller.session[:domain] = nil if self.domain_changes?
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.domain_changes?
|
13
|
+
Thread.current[:domain_sweeper]
|
14
|
+
end
|
15
|
+
def self.domain_changes=(bool)
|
16
|
+
Thread.current[:domain_sweeper] = bool
|
17
|
+
end
|
18
|
+
|
19
|
+
def changed
|
20
|
+
self.class.domain_changes = true
|
21
|
+
end
|
22
|
+
|
23
|
+
def after_save(domain)
|
24
|
+
changed
|
25
|
+
end
|
26
|
+
def after_destroy(domain)
|
27
|
+
changed
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
class DomainsController < ConsoleController
|
2
|
+
def new
|
3
|
+
@domain = Domain.new
|
4
|
+
end
|
5
|
+
|
6
|
+
def create
|
7
|
+
@domain = Domain.new params[:domain]
|
8
|
+
@domain.as = current_user
|
9
|
+
|
10
|
+
if @domain.save
|
11
|
+
redirect_to account_path, :flash => {:success => 'Your domain has been created'}
|
12
|
+
else
|
13
|
+
render :new
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def edit
|
18
|
+
@domain = Domain.find(:one, :as => current_user) rescue redirect_to(new_domain_path)
|
19
|
+
end
|
20
|
+
|
21
|
+
def update
|
22
|
+
@domain = Domain.find(:one, :as => current_user)
|
23
|
+
@domain.attributes = params[:domain]
|
24
|
+
if @domain.save
|
25
|
+
redirect_to account_path, :flash => {:success => 'Your domain has been changed. Your public URLs will now be different'}
|
26
|
+
else
|
27
|
+
render :edit
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
class KeysController < ConsoleController
|
2
|
+
def new
|
3
|
+
@first = true if params[:first]
|
4
|
+
@key = Key.new
|
5
|
+
end
|
6
|
+
|
7
|
+
def create
|
8
|
+
@first = true if params[:first]
|
9
|
+
@key ||= Key.new params[:key]
|
10
|
+
@key.as = current_user
|
11
|
+
|
12
|
+
if @key.save
|
13
|
+
redirect_to (@first ? :back : account_path), :flash => {:success => 'Your public key has been created'} rescue redirect_to account_path
|
14
|
+
else
|
15
|
+
Rails.logger.debug @key.errors.inspect
|
16
|
+
render :new
|
17
|
+
end
|
18
|
+
|
19
|
+
# If a key already exists with that name
|
20
|
+
# FIXME When resource validation is added, we may need the server to return a unique code
|
21
|
+
# for this condition with the error, and then this logic should be moved to Key.rescue_save_failure
|
22
|
+
# which should throw a more specific exception Key::NameExists / Key::ContentExists
|
23
|
+
rescue Key::DuplicateName
|
24
|
+
if @first
|
25
|
+
if @key.default?
|
26
|
+
@key = Key.default(:as => current_user).load(params[:key])
|
27
|
+
else
|
28
|
+
@key.make_unique! "#{@key.name}%s"
|
29
|
+
end
|
30
|
+
raise if @retried
|
31
|
+
@retried = true
|
32
|
+
retry
|
33
|
+
end
|
34
|
+
@key.errors.add(:name, 'You have already created a key with that name')
|
35
|
+
render :new
|
36
|
+
end
|
37
|
+
|
38
|
+
def destroy
|
39
|
+
@key = Key.find params[:id], :as => current_user
|
40
|
+
@key.destroy
|
41
|
+
redirect_to account_path
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
class ScalingController < ConsoleController
|
2
|
+
|
3
|
+
def show
|
4
|
+
user_default_domain
|
5
|
+
@application = @domain.find_application params[:application_id]
|
6
|
+
@cartridges = @application.cartridges
|
7
|
+
@user = User.find :one, :as => current_user
|
8
|
+
redirect_to new_application_scaling_path(@application) unless @application.scales?
|
9
|
+
end
|
10
|
+
|
11
|
+
def new
|
12
|
+
user_default_domain
|
13
|
+
@application = @domain.find_application params[:application_id]
|
14
|
+
@cartridge_type = CartridgeType.cached.find 'haproxy-1.4'
|
15
|
+
@cartridge = Cartridge.new :name => @cartridge_type.name
|
16
|
+
end
|
17
|
+
|
18
|
+
def delete
|
19
|
+
user_default_domain
|
20
|
+
@application = @domain.find_application params[:application_id]
|
21
|
+
redirect_to new_application_scaling_path(@application) unless @application.scales?
|
22
|
+
end
|
23
|
+
|
24
|
+
def update
|
25
|
+
user_default_domain
|
26
|
+
@user = User.find :one, :as => current_user
|
27
|
+
@application = @domain.find_application params[:application_id]
|
28
|
+
@cartridges = @application.cartridges
|
29
|
+
@cartridge = @cartridges.find{ |c| c.name == params[:id] } or raise RestApi::ResourceNotFound.new(Cartridge.model_name, params[:id])
|
30
|
+
|
31
|
+
range = [params[:cartridge][:scales_from].to_i, params[:cartridge][:scales_to].to_i]
|
32
|
+
range.reverse! if range.first > range.last && range.last != -1
|
33
|
+
@cartridge.scales_from, @cartridge.scales_to = range
|
34
|
+
|
35
|
+
if @cartridge.save
|
36
|
+
redirect_to application_scaling_path, :flash => {:success => "Updated scale settings for cartridge '#{@cartridge.display_name}'"}
|
37
|
+
else
|
38
|
+
render :show
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
#def update
|
43
|
+
# commit form parameters to a cartridge on an application
|
44
|
+
# redirect_to application_scaling_path
|
45
|
+
#end
|
46
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module SshkeyAware
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
|
4
|
+
included do
|
5
|
+
around_filter SshkeySessionSweeper
|
6
|
+
end
|
7
|
+
|
8
|
+
def sshkey_uploaded?
|
9
|
+
@has_key = false
|
10
|
+
if session[:has_sshkey]
|
11
|
+
logger.debug " Hit has_sshkey cache #{session.inspect}"
|
12
|
+
@has_keys = session[:has_sshkey]
|
13
|
+
else
|
14
|
+
key = Key.first :as => current_user
|
15
|
+
@has_keys = key ? true : false
|
16
|
+
session[:has_sshkey] = @has_keys
|
17
|
+
end
|
18
|
+
|
19
|
+
@has_key
|
20
|
+
end
|
21
|
+
end
|
22
|
+
RestApi::Base.observers << SshkeySessionSweeper
|
23
|
+
SshkeySessionSweeper.instance
|
@@ -0,0 +1,29 @@
|
|
1
|
+
class SshkeySessionSweeper < ActiveModel::Observer
|
2
|
+
observe Key
|
3
|
+
|
4
|
+
def self.before(controller)
|
5
|
+
self.sshkey_changes = false
|
6
|
+
true
|
7
|
+
end
|
8
|
+
def self.after(controller)
|
9
|
+
controller.session[:has_sshkey] = nil if self.sshkey_changes?
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.sshkey_changes?
|
13
|
+
Thread.current[:sshkey_sweeper]
|
14
|
+
end
|
15
|
+
def self.sshkey_changes=(bool)
|
16
|
+
Thread.current[:sshkey_sweeper] = bool
|
17
|
+
end
|
18
|
+
|
19
|
+
def changed
|
20
|
+
self.class.sshkey_changes = true
|
21
|
+
end
|
22
|
+
|
23
|
+
def after_save(key)
|
24
|
+
changed
|
25
|
+
end
|
26
|
+
def after_destroy(key)
|
27
|
+
changed
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
class UserSessionSweeper < ActiveModel::Observer
|
2
|
+
observe User, Application, Domain
|
3
|
+
|
4
|
+
def self.before(controller)
|
5
|
+
self.user_changes = false
|
6
|
+
true
|
7
|
+
end
|
8
|
+
def self.after(controller)
|
9
|
+
controller.session[:user_capabilities] = nil if self.user_changes?
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.user_changes?
|
13
|
+
Thread.current[:user_sweeper]
|
14
|
+
end
|
15
|
+
def self.user_changes=(bool)
|
16
|
+
Thread.current[:user_sweeper] = bool
|
17
|
+
end
|
18
|
+
|
19
|
+
def changed
|
20
|
+
self.class.user_changes = true
|
21
|
+
end
|
22
|
+
|
23
|
+
def after_save(user)
|
24
|
+
changed
|
25
|
+
end
|
26
|
+
def after_destroy(user)
|
27
|
+
changed
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
module Console::CommunityHelper
|
2
|
+
|
3
|
+
def irc_web_url
|
4
|
+
'http://webchat.freenode.net/?randomnick=1&channels=openshift&uio=d4'
|
5
|
+
end
|
6
|
+
|
7
|
+
def link_to_irc
|
8
|
+
link_to "IRC", irc_web_url
|
9
|
+
end
|
10
|
+
|
11
|
+
def openshift_twitter_hashtag_url
|
12
|
+
'http://twitter.com/#!/search/%23OpenShift'
|
13
|
+
end
|
14
|
+
|
15
|
+
def openshift_twitter_url
|
16
|
+
'http://www.twitter.com/#!/openshift'
|
17
|
+
end
|
18
|
+
|
19
|
+
def openshift_ops_twitter_url
|
20
|
+
'http://www.twitter.com/#!/openshift_ops'
|
21
|
+
end
|
22
|
+
|
23
|
+
def open_bug_url
|
24
|
+
'https://bugzilla.redhat.com/enter_bug.cgi?product=OpenShift%20Origin'
|
25
|
+
end
|
26
|
+
|
27
|
+
def openshift_github_url
|
28
|
+
'https://github.com/openshift'
|
29
|
+
end
|
30
|
+
|
31
|
+
def stack_overflow_url
|
32
|
+
'http://stackoverflow.com/questions/tagged/openshift/'
|
33
|
+
end
|
34
|
+
|
35
|
+
def client_tools_url
|
36
|
+
openshift_github_project_url 'rhc'
|
37
|
+
end
|
38
|
+
|
39
|
+
def origin_server_url
|
40
|
+
openshift_github_project_url 'origin-server'
|
41
|
+
end
|
42
|
+
|
43
|
+
def origin_server_source_path_url(path)
|
44
|
+
"#{openshift_github_project_url('origin-server')}/tree/master/#{path}"
|
45
|
+
end
|
46
|
+
|
47
|
+
def cartridges_source_url
|
48
|
+
origin_server_source_path_url 'cartridges'
|
49
|
+
end
|
50
|
+
|
51
|
+
def origin_server_srpm_url
|
52
|
+
"http://mirror.openshift.com/pub/origin-server/fedora-16/SRPMS/"
|
53
|
+
end
|
54
|
+
|
55
|
+
def openshift_github_project_url(project)
|
56
|
+
"https://github.com/openshift/#{project}"
|
57
|
+
end
|
58
|
+
|
59
|
+
def red_hat_account_url
|
60
|
+
'https://www.redhat.com/wapps/ugc'
|
61
|
+
end
|
62
|
+
|
63
|
+
def mailto_openshift_url
|
64
|
+
'mailto:openshift@redhat.com'
|
65
|
+
end
|
66
|
+
|
67
|
+
def link_to_account_mailto
|
68
|
+
link_to "openshift@redhat.com", mailto_openshift_url
|
69
|
+
end
|
70
|
+
|
71
|
+
def status_jsonp_url(id)
|
72
|
+
status_js_path :id => id
|
73
|
+
end
|
74
|
+
|
75
|
+
def open_issues_jsonp_url(jsonp)
|
76
|
+
open_issues_js_path :jsonp => jsonp
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Console::ConsoleHelper
|
2
|
+
|
3
|
+
def openshift_url(relative='')
|
4
|
+
"https://openshift.redhat.com/app/#{relative}"
|
5
|
+
end
|
6
|
+
|
7
|
+
def legal_opensource_disclaimer_url
|
8
|
+
openshift_url 'legal/opensource_disclaimer'
|
9
|
+
end
|
10
|
+
|
11
|
+
#FIXME: Replace with real isolation of login state
|
12
|
+
def logout_path
|
13
|
+
nil
|
14
|
+
end
|
15
|
+
|
16
|
+
def outage_notification
|
17
|
+
end
|
18
|
+
|
19
|
+
def product_branding
|
20
|
+
content_tag(:span, "<strong>Open</strong>Shift Origin".html_safe, :class => 'brand-text headline')
|
21
|
+
end
|
22
|
+
|
23
|
+
def product_title
|
24
|
+
'OpenShift Origin'
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,270 @@
|
|
1
|
+
module Console::HelpHelper
|
2
|
+
|
3
|
+
# Given a relative path within the user guide, display the topic
|
4
|
+
def user_guide_topic_url(topic)
|
5
|
+
locale = 'en-US'
|
6
|
+
"http://access.redhat.com/knowledge/docs/#{locale}/OpenShift/2.0/html/User_Guide/#{topic}"
|
7
|
+
end
|
8
|
+
|
9
|
+
def user_guide_url
|
10
|
+
user_guide_topic_url 'index.html'
|
11
|
+
end
|
12
|
+
|
13
|
+
def newsletter_signup_url
|
14
|
+
community_base_url 'newsletter/signup'
|
15
|
+
end
|
16
|
+
|
17
|
+
def ssh_keys_help_path
|
18
|
+
community_base_url 'developers/remote-access#keys'
|
19
|
+
end
|
20
|
+
|
21
|
+
def deploy_hook_user_guide_topic_url
|
22
|
+
community_base_url 'developers/deploying-and-building-applications'
|
23
|
+
end
|
24
|
+
|
25
|
+
def add_domains_user_guide_topic_url
|
26
|
+
user_guide_topic_url 'chap-User_Guide-OpenShift_Command_Line_Interface.html#sect-User_Guide-Working_With_Domains'
|
27
|
+
end
|
28
|
+
|
29
|
+
def cartridge_list_url
|
30
|
+
community_base_url 'developers/technologies'
|
31
|
+
end
|
32
|
+
|
33
|
+
def get_involved_url
|
34
|
+
community_base_url 'get-involved'
|
35
|
+
end
|
36
|
+
|
37
|
+
def suggest_features_url
|
38
|
+
community_base_url 'ideas'
|
39
|
+
end
|
40
|
+
|
41
|
+
def openshift_blog_url
|
42
|
+
community_base_url 'blogs'
|
43
|
+
end
|
44
|
+
|
45
|
+
def opensource_community_url
|
46
|
+
community_base_url 'open-source'
|
47
|
+
end
|
48
|
+
|
49
|
+
def get_involved_developers_url
|
50
|
+
community_base_url 'developers/get-involved'
|
51
|
+
end
|
52
|
+
|
53
|
+
def get_started_quickstart_url
|
54
|
+
community_base_url 'developers/get-started'
|
55
|
+
end
|
56
|
+
|
57
|
+
def developers_url
|
58
|
+
community_base_url 'developers'
|
59
|
+
end
|
60
|
+
|
61
|
+
def developers_path
|
62
|
+
community_base_url 'developers'
|
63
|
+
end
|
64
|
+
|
65
|
+
def ssh_help_url
|
66
|
+
community_base_url 'developers/remote-access'
|
67
|
+
end
|
68
|
+
|
69
|
+
def client_tools_install_help_url
|
70
|
+
community_base_url 'developers/install-the-client-tools'
|
71
|
+
end
|
72
|
+
|
73
|
+
def client_tools_help_url
|
74
|
+
community_base_url 'developers/tools'
|
75
|
+
end
|
76
|
+
|
77
|
+
def developers_get_started_path
|
78
|
+
community_base_url 'developers/get-started'
|
79
|
+
end
|
80
|
+
|
81
|
+
def livecd_wiki_url(anchor=nil)
|
82
|
+
community_base_url "wiki/getting-started-with-openshift-origin-livecd#{anchor.present? ? "##{anchor}" : ''}"
|
83
|
+
end
|
84
|
+
|
85
|
+
def post_to_forum_url
|
86
|
+
community_base_url 'forums/openshift'
|
87
|
+
end
|
88
|
+
|
89
|
+
def events_url
|
90
|
+
community_base_url 'events/'
|
91
|
+
end
|
92
|
+
|
93
|
+
def jenkins_help_url
|
94
|
+
community_base_url 'jenkins'
|
95
|
+
end
|
96
|
+
|
97
|
+
def forums_url
|
98
|
+
community_base_url 'forums/openshift'
|
99
|
+
end
|
100
|
+
|
101
|
+
def knowledge_base_url
|
102
|
+
community_base_url 'kb'
|
103
|
+
end
|
104
|
+
|
105
|
+
def faq_url
|
106
|
+
community_base_url 'faq'
|
107
|
+
end
|
108
|
+
|
109
|
+
def signup_faq_url
|
110
|
+
community_base_url 'faq/i-just-signed-up-why-didnt-i-receive-an-email-confirmation'
|
111
|
+
end
|
112
|
+
|
113
|
+
def developers_get_started_fast_url
|
114
|
+
community_base_url 'developers/get-started'
|
115
|
+
end
|
116
|
+
|
117
|
+
def community_search_url
|
118
|
+
community_base_url 'search/node'
|
119
|
+
end
|
120
|
+
|
121
|
+
def sync_git_with_remote_repo_knowledge_base_url
|
122
|
+
community_base_url 'kb/kb-e1006-sync-new-express-git-repo-with-your-own-existing-git-repo'
|
123
|
+
end
|
124
|
+
|
125
|
+
def rails_quickstart_guide_url
|
126
|
+
community_base_url 'kb/kb-e1005-ruby-on-rails-express-quickstart-guide'
|
127
|
+
end
|
128
|
+
|
129
|
+
def jboss_resources_url
|
130
|
+
community_base_url 'developers/jboss'
|
131
|
+
end
|
132
|
+
|
133
|
+
def videos_url
|
134
|
+
community_base_url 'videos'
|
135
|
+
end
|
136
|
+
|
137
|
+
def blog_post_url(post)
|
138
|
+
community_base_url "blogs/#{post}"
|
139
|
+
end
|
140
|
+
|
141
|
+
def community_document_url(file)
|
142
|
+
community_base_url "sites/default/files/documents/#{file}"
|
143
|
+
end
|
144
|
+
|
145
|
+
def mongodb_resources_url
|
146
|
+
community_base_url 'developers/mongodb'
|
147
|
+
end
|
148
|
+
|
149
|
+
def scaling_help_url
|
150
|
+
community_base_url 'developers/scaling'
|
151
|
+
end
|
152
|
+
|
153
|
+
def user_guide_url
|
154
|
+
user_guide_topic_url 'index.html'
|
155
|
+
end
|
156
|
+
|
157
|
+
def getting_started_path(opts=nil)
|
158
|
+
community_base_url "get-started", opts
|
159
|
+
end
|
160
|
+
|
161
|
+
def product_overview_path(opts=nil)
|
162
|
+
community_base_url "paas", opts
|
163
|
+
end
|
164
|
+
|
165
|
+
def opensource_process_url
|
166
|
+
community_base_url "wiki/community-process"
|
167
|
+
end
|
168
|
+
|
169
|
+
def opensource_architecture_url
|
170
|
+
community_base_url "wiki/architecture-overview"
|
171
|
+
end
|
172
|
+
|
173
|
+
def opensource_download_path(opts=nil)
|
174
|
+
community_base_url "open-source/download-origin", opts
|
175
|
+
end
|
176
|
+
def opensource_download_url(opts=nil)
|
177
|
+
opensource_download_path opts
|
178
|
+
end
|
179
|
+
|
180
|
+
def getting_started_guide_url
|
181
|
+
community_base_url 'developers/install-the-client-tools'
|
182
|
+
end
|
183
|
+
|
184
|
+
def cli_on_windows_user_guide_topic_url
|
185
|
+
community_base_url 'developers/install-the-client-tools#windows'
|
186
|
+
end
|
187
|
+
|
188
|
+
def git_homepage_url
|
189
|
+
"http://git-scm.com/"
|
190
|
+
end
|
191
|
+
|
192
|
+
def pricing_url
|
193
|
+
community_base_url 'developers/pricing'
|
194
|
+
end
|
195
|
+
|
196
|
+
def legal_url
|
197
|
+
community_base_url 'legal'
|
198
|
+
end
|
199
|
+
|
200
|
+
def policy_url
|
201
|
+
community_base_url 'policy'
|
202
|
+
end
|
203
|
+
|
204
|
+
def services_agreement_url
|
205
|
+
community_base_url 'legal/services_agreement'
|
206
|
+
end
|
207
|
+
|
208
|
+
def acceptable_use_url
|
209
|
+
community_base_url 'legal/acceptable_use'
|
210
|
+
end
|
211
|
+
|
212
|
+
def privacy_policy_url
|
213
|
+
community_base_url 'legal/openshift_privacy'
|
214
|
+
end
|
215
|
+
|
216
|
+
def terms_of_service_url
|
217
|
+
community_base_url 'legal/site_terms'
|
218
|
+
end
|
219
|
+
|
220
|
+
def security_policy_url
|
221
|
+
community_base_url 'policy/security'
|
222
|
+
end
|
223
|
+
|
224
|
+
def tax_exempt_help_status
|
225
|
+
community_base_url 'policy/tax-exemptions'
|
226
|
+
end
|
227
|
+
|
228
|
+
def create_quickstart_url
|
229
|
+
community_base_url 'node/add/quickstart'
|
230
|
+
end
|
231
|
+
|
232
|
+
def community_quickstarts_url
|
233
|
+
community_base_url 'quickstarts'
|
234
|
+
end
|
235
|
+
|
236
|
+
def console_help_links
|
237
|
+
[
|
238
|
+
{:href => developers_url,
|
239
|
+
:name => 'Developer Center'},
|
240
|
+
{:href => user_guide_url,
|
241
|
+
:name => 'OpenShift User Guide'},
|
242
|
+
{:href => getting_started_path,
|
243
|
+
:name => 'Installing OpenShift client tools on Mac OSX, Linux, and Windows'},
|
244
|
+
{:href => sync_git_with_remote_repo_knowledge_base_url,
|
245
|
+
:name => 'Sync your OpenShift repo with an existing Git repo'}
|
246
|
+
]
|
247
|
+
end
|
248
|
+
|
249
|
+
def console_faq_links
|
250
|
+
[
|
251
|
+
{:href => community_base_url('faq/how-do-i-start-a-new-forum-discussion'),
|
252
|
+
:name => 'How do I start a new Forum discussion?'},
|
253
|
+
{:href => community_base_url('faq/how-do-i-install-the-rhc-client-tools-on-windows'),
|
254
|
+
:name => 'How do I install the rhc client tools on Windows?'}
|
255
|
+
]
|
256
|
+
end
|
257
|
+
|
258
|
+
def community_path
|
259
|
+
community_base_url('')
|
260
|
+
end
|
261
|
+
|
262
|
+
def community_url
|
263
|
+
community_path
|
264
|
+
end
|
265
|
+
|
266
|
+
private
|
267
|
+
def community_base_url(path, opts=nil)
|
268
|
+
"https://openshift.redhat.com/community/#{path}#{opts && opts[:anchor] ? "##{opts[:anchor]}" : ""}"
|
269
|
+
end
|
270
|
+
end
|