openshift-origin-console 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,91 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Inspired by Seamus Abshere cache_method, no code reuse
|
|
3
|
+
# https://github.com/seamusabshere/cache_method
|
|
4
|
+
#
|
|
5
|
+
# Invoke cache_method <symbol for method name>, <key string, array, or lambda> for any static method on this class
|
|
6
|
+
#
|
|
7
|
+
module RestApi
|
|
8
|
+
module Cacheable
|
|
9
|
+
extend ActiveSupport::Concern
|
|
10
|
+
|
|
11
|
+
module ClassMethods
|
|
12
|
+
#
|
|
13
|
+
# Return an equivalent to this class that will may cache the defined results
|
|
14
|
+
#
|
|
15
|
+
def cached
|
|
16
|
+
class_opts = cache_options
|
|
17
|
+
if @cacheable
|
|
18
|
+
self
|
|
19
|
+
else
|
|
20
|
+
parent = self
|
|
21
|
+
Class.new(self) do
|
|
22
|
+
#FIXME: prone to breaks, needs to be cleaner
|
|
23
|
+
self.element_name = parent.element_name
|
|
24
|
+
@cacheable = true
|
|
25
|
+
@cache_opts = parent.cache_options
|
|
26
|
+
|
|
27
|
+
def self.name
|
|
28
|
+
superclass.name
|
|
29
|
+
end
|
|
30
|
+
def to_partial_path
|
|
31
|
+
self.class.superclass._to_partial_path
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
eigenclass = (class << self; self; end)
|
|
35
|
+
class_opts[:caches].each_pair do |m, opts|
|
|
36
|
+
name = "#{m}_without_caching".to_sym
|
|
37
|
+
opts ||= {}
|
|
38
|
+
#puts "define method #{m} #{name}"
|
|
39
|
+
eigenclass.class_eval do
|
|
40
|
+
define_method m do |*args, &blk|
|
|
41
|
+
key = cache_key_for(m, args)
|
|
42
|
+
result = begin
|
|
43
|
+
Rails.cache.fetch(key, class_opts.merge(opts)) do
|
|
44
|
+
parent.send(m, *args, &blk).tap do |result|
|
|
45
|
+
opts[:before].call(result) if opts[:before]
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
rescue ArgumentError, TypeError => e
|
|
49
|
+
Rails.logger.warn e
|
|
50
|
+
parent.send(m, *args, &blk)
|
|
51
|
+
end
|
|
52
|
+
opts[:after].call(result) if opts[:after]
|
|
53
|
+
result
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
protected
|
|
62
|
+
def cache_options
|
|
63
|
+
@cache_opts ||= {:expires_in => 5.minutes, :caches => {}}
|
|
64
|
+
end
|
|
65
|
+
def default_cache_timeout(time)
|
|
66
|
+
cache_options[:expires_in] = time
|
|
67
|
+
end
|
|
68
|
+
def cache_method(method, *args)
|
|
69
|
+
opts = args.extract_options!
|
|
70
|
+
cache_options[:caches][method.to_sym] = opts
|
|
71
|
+
opts[:cache_key] = args.length == 1 ? args.first : args if args.present?
|
|
72
|
+
end
|
|
73
|
+
def cache_key_for(method, *args)
|
|
74
|
+
opts = cache_options[:caches][method]
|
|
75
|
+
raise "Method #{method} is not cacheable #{cache_options.inspect}" unless opts
|
|
76
|
+
key = opts[:cache_key] || [self.superclass.name, method, *args]
|
|
77
|
+
#puts "key before #{key.inspect}"
|
|
78
|
+
key = key.call(*args) if key.is_a? Proc
|
|
79
|
+
key.map! { |k| k.respond_to?(:cache_key) ? k.cache_key : k } if key.is_a? Array
|
|
80
|
+
key
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def cache_find_method(symbol, key=[name, "find_#{symbol}"])
|
|
84
|
+
cache_method "find_#{symbol}", key, :before => remove_authorization_from_model
|
|
85
|
+
end
|
|
86
|
+
def remove_authorization_from_model
|
|
87
|
+
lambda { |e| Array(e).each { |c| c.as = nil } }
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
module RestApi
|
|
2
|
+
# An object which can return info about the REST API
|
|
3
|
+
class Info < RestApi::Base
|
|
4
|
+
include RestApi::Cacheable
|
|
5
|
+
|
|
6
|
+
self.element_name = 'api'
|
|
7
|
+
allow_anonymous
|
|
8
|
+
singleton
|
|
9
|
+
|
|
10
|
+
self.format = Class.new(OpenshiftJsonFormat) do
|
|
11
|
+
def decode(json)
|
|
12
|
+
ActiveSupport::JSON.decode(json)
|
|
13
|
+
end
|
|
14
|
+
end.new
|
|
15
|
+
|
|
16
|
+
schema do
|
|
17
|
+
string :version, :status
|
|
18
|
+
end
|
|
19
|
+
has_many :supported_api_versions, :class_name => 'string'
|
|
20
|
+
has_one :data, :class_name => 'rest_api/base/attribute_hash'
|
|
21
|
+
|
|
22
|
+
def url
|
|
23
|
+
self.class.site
|
|
24
|
+
end
|
|
25
|
+
def link(name)
|
|
26
|
+
URI.parse(data[name]['href']) if data[name]
|
|
27
|
+
end
|
|
28
|
+
def required_params(name)
|
|
29
|
+
data[name]['required_params'] if data[name]
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
cache_find_method :one
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
module RestApi
|
|
2
|
+
class LogSubscriber < ActiveSupport::LogSubscriber
|
|
3
|
+
def self.runtime=(value)
|
|
4
|
+
Thread.current["rest_api_call_runtime"] = value
|
|
5
|
+
end
|
|
6
|
+
def self.runtime
|
|
7
|
+
Thread.current["rest_api_call_runtime"] ||= 0
|
|
8
|
+
end
|
|
9
|
+
def self.reset_runtime
|
|
10
|
+
rt, self.runtime = runtime, 0
|
|
11
|
+
rt
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def request(event)
|
|
15
|
+
self.class.runtime += event.duration
|
|
16
|
+
return unless logger.debug?
|
|
17
|
+
|
|
18
|
+
name = '%s (%.1fms)' % ['OpenShift API', event.duration]
|
|
19
|
+
|
|
20
|
+
call = "#{color(event.payload.delete(:method), BOLD, true)} #{event.payload.delete(:request_uri)}"
|
|
21
|
+
|
|
22
|
+
result = event.payload[:result]
|
|
23
|
+
query = {:code => result.code}.map{ |k,v| "#{k}: #{color(v, BOLD, true)}" }.join(', ') if result
|
|
24
|
+
|
|
25
|
+
debug " #{color(name, BLUE, true)} #{call} [ #{query} ]"
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
module RestApi
|
|
2
|
+
module Railties
|
|
3
|
+
module ControllerRuntime
|
|
4
|
+
extend ActiveSupport::Concern
|
|
5
|
+
|
|
6
|
+
protected
|
|
7
|
+
|
|
8
|
+
attr_internal :ra_runtime
|
|
9
|
+
|
|
10
|
+
def process_action(action, *args)
|
|
11
|
+
RestApi::LogSubscriber.reset_runtime
|
|
12
|
+
super
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def cleanup_view_runtime
|
|
16
|
+
rt_before_render = RestApi::LogSubscriber.reset_runtime
|
|
17
|
+
runtime = super
|
|
18
|
+
rt_after_render = RestApi::LogSubscriber.reset_runtime
|
|
19
|
+
self.ra_runtime = rt_before_render + rt_after_render
|
|
20
|
+
runtime - rt_after_render
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def append_info_to_payload(payload)
|
|
24
|
+
super
|
|
25
|
+
payload[:ra_runtime] = ra_runtime
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
module ClassMethods
|
|
29
|
+
def log_process_action(payload)
|
|
30
|
+
messages, runtime = super, payload[:ra_runtime]
|
|
31
|
+
messages << ("OpenShift API: %.1fms" % runtime.to_f) if !runtime.nil? && runtime > 0
|
|
32
|
+
messages
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
data/app/models/user.rb
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#
|
|
2
|
+
# The REST API model object representing the currently authenticated user.
|
|
3
|
+
#
|
|
4
|
+
class User < RestApi::Base
|
|
5
|
+
singleton
|
|
6
|
+
|
|
7
|
+
schema do
|
|
8
|
+
string :login, :plan_id
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
include Capabilities
|
|
12
|
+
has_many :keys
|
|
13
|
+
has_many :domains
|
|
14
|
+
has_one :consumed_gear_sizes, :class_name => 'rest_api/base/attribute_hash'
|
|
15
|
+
|
|
16
|
+
def plan_id
|
|
17
|
+
super or 'freeshift'
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def plan
|
|
21
|
+
@plan ||= Aria::MasterPlan.cached.find plan_id
|
|
22
|
+
end
|
|
23
|
+
def plan=(plan)
|
|
24
|
+
@plan_id = plan.is_a?(String) ? plan : plan.id
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
%h2 Namespace
|
|
2
|
+
%p
|
|
3
|
+
Your namespace is unique to your account and is the suffix of the public URLs we assign to your applications.
|
|
4
|
+
See #{link_to 'the User Guide', user_guide_url}
|
|
5
|
+
for information about adding your own domain names to an application.
|
|
6
|
+
|
|
7
|
+
- if @domain
|
|
8
|
+
.well
|
|
9
|
+
http://applicationname–<strong class="namespace">#{@domain.name}</strong>.#{RestApi.application_domain_suffix}
|
|
10
|
+
.btn-toolbar
|
|
11
|
+
= link_to "Change your namespace...", edit_domain_path, :class => 'btn'
|
|
12
|
+
|
|
13
|
+
- else
|
|
14
|
+
= render Domain.new
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
%h2 Public Keys
|
|
2
|
+
%p
|
|
3
|
+
OpenShift uses a public key to securely encrypt the connection between
|
|
4
|
+
your local machine and your application and to authorize you to upload
|
|
5
|
+
code. You must create a private and public key on your local machine
|
|
6
|
+
and then upload the public key before you can connect to your
|
|
7
|
+
applications' Git repositories or remotely access your application.
|
|
8
|
+
= link_to "Learn more about SSH keys.", ssh_keys_help_path
|
|
9
|
+
|
|
10
|
+
- if keys.empty?
|
|
11
|
+
= render :partial => 'keys/simple_form', :locals => { :key => Key.new, :input_class => 'span4' }
|
|
12
|
+
- else
|
|
13
|
+
%table.table.table-condensed.table-striped.table-fixed
|
|
14
|
+
- keys.each do |key|
|
|
15
|
+
%tr{:id => "#{key.name}_sshkey"}
|
|
16
|
+
%td.sshkey-name= key.name
|
|
17
|
+
%td.code.sshkey= key.display_content
|
|
18
|
+
%td= link_to 'Delete', key_path(key), :class => 'btn btn-mini btn-danger delete_button', :method => :delete, :confirm => "Are you sure you want to delete your key '#{key.name}'?"
|
|
19
|
+
.btn-toolbar
|
|
20
|
+
= link_to "Add a new key...", new_key_path, :class => 'btn'
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
- content_for :page_title, 'My Account'
|
|
2
|
+
|
|
3
|
+
%h1 My Account
|
|
4
|
+
= flashes
|
|
5
|
+
.row
|
|
6
|
+
.span7
|
|
7
|
+
%section
|
|
8
|
+
= render :partial => 'user', :locals => {:user => @user}
|
|
9
|
+
|
|
10
|
+
%section
|
|
11
|
+
= render :partial => 'domain', :locals => {:domain => @domain}
|
|
12
|
+
|
|
13
|
+
.span5
|
|
14
|
+
%section
|
|
15
|
+
= render :partial => 'keys', :locals => {:keys => @keys}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
- type = application_type
|
|
2
|
+
= div_for type, :class => 'tile tile-click label-tags' do
|
|
3
|
+
%h3= link_to type.display_name, application_type_path(type)
|
|
4
|
+
|
|
5
|
+
- if application_type.description.html_safe?
|
|
6
|
+
= application_type.description
|
|
7
|
+
- else
|
|
8
|
+
%p= application_type.description
|
|
9
|
+
|
|
10
|
+
- if type.website
|
|
11
|
+
%p= link_to type.website, type.website
|
|
12
|
+
|
|
13
|
+
- if application_type.learn_more_url
|
|
14
|
+
%p= link_to "Learn more", application_type.learn_more_url
|
|
15
|
+
|
|
16
|
+
- if application_type.tags.include? :in_development
|
|
17
|
+
%p This type is development only and will not be accessible in production
|
|
18
|
+
|
|
19
|
+
= application_type_tags(type.tags - excluded_tags)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
%h3 From Scratch
|
|
2
|
+
%p
|
|
3
|
+
This application is based on a link. If you want others to
|
|
4
|
+
see this application, #{link_to "create a quickstart in our community", create_quickstart_url}.
|
|
5
|
+
|
|
6
|
+
%p
|
|
7
|
+
Cartridges:
|
|
8
|
+
- if application_type.cartridges.present?
|
|
9
|
+
= map_to_sentence(application_type.cartridges) do |c|
|
|
10
|
+
- if missing_cartridges.include?(c)
|
|
11
|
+
%span.text-warning{:title => "OpenShift could not locate any cartridges that match '#{c}'"}= c
|
|
12
|
+
- else
|
|
13
|
+
= c
|
|
14
|
+
- else
|
|
15
|
+
%span.text-warning{:title => "No cartridges specified"} none
|
|
16
|
+
|
|
17
|
+
%p
|
|
18
|
+
You can copy the link below to allow anyone to share this app.
|
|
19
|
+
%p= link_to "Share this link", application_type_url(application_type.id, application_type.to_params)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
%h3= application_type.display_name
|
|
2
|
+
- if application_type.description.html_safe?
|
|
3
|
+
= application_type.description
|
|
4
|
+
- else
|
|
5
|
+
%p= application_type.description
|
|
6
|
+
|
|
7
|
+
- if application_type.website
|
|
8
|
+
%p Website: #{link_to application_type.website, application_type.website}
|
|
9
|
+
|
|
10
|
+
- unless application_type.cartridge?
|
|
11
|
+
%p
|
|
12
|
+
Cartridges:
|
|
13
|
+
- if application_type.cartridges.present?
|
|
14
|
+
= map_to_sentence(application_type.cartridges) do |c|
|
|
15
|
+
- if missing_cartridges.include?(c)
|
|
16
|
+
%span.text-warning{:title => "OpenShift could not locate any cartridges that match '#{c}'"}= c
|
|
17
|
+
- else
|
|
18
|
+
= c
|
|
19
|
+
- else
|
|
20
|
+
%span.text-warning{:title => "No cartridges specified"} none
|
|
21
|
+
|
|
22
|
+
- if application_type.learn_more_url
|
|
23
|
+
%p= link_to "Learn more", application_type.learn_more_url
|
|
24
|
+
|
|
25
|
+
= application_type_tags(application_type.tags)
|
|
26
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
= div_for type, :class => "tile tile-click tile-compact label-tags application_type_#{type.source}", :title => type.description do
|
|
2
|
+
%h3= link_to type.display_name, application_type_path(type)
|
|
3
|
+
= application_type_tags(type.tags - excluded_tags)
|
|
4
|
+
|
|
5
|
+
- if type.tags.include?(:in_development)
|
|
6
|
+
%p This type is in development and will not be visible in production.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
%i.sprite.tile-arrow
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
%h1.invisible Create a New Application
|
|
2
|
+
= breadcrumb_for_create_application
|
|
3
|
+
= app_wizard_steps_create 0
|
|
4
|
+
= flashes
|
|
5
|
+
|
|
6
|
+
%section
|
|
7
|
+
%p.larger
|
|
8
|
+
Choose a web programming cartridge or kick the tires with a
|
|
9
|
+
quickstart. After you create the application
|
|
10
|
+
you can add <strong>cartridges</strong> to enable additional
|
|
11
|
+
capabilities like databases, metrics, and continuous build
|
|
12
|
+
support with Jenkins.
|
|
13
|
+
|
|
14
|
+
%section
|
|
15
|
+
%form.form-search.form-search-block{:id => 'form-search-create-apps', :method => 'get'}
|
|
16
|
+
%input.search-query{:type => 'text', :name => 'search', :placeholder => 'Search by keyword or tag'}
|
|
17
|
+
%button.search{:type => 'submit'}
|
|
18
|
+
- if @browse_tags.present?
|
|
19
|
+
%span.dropdown
|
|
20
|
+
%a.btn.dropdown-toggle{:href => '#', :data => {:toggle => 'dropdown'}}
|
|
21
|
+
Browse by tag...
|
|
22
|
+
%span.caret
|
|
23
|
+
%ul.dropdown-menu#tag-filter
|
|
24
|
+
- @browse_tags.each do |(name, tag)|
|
|
25
|
+
- if name
|
|
26
|
+
%li= link_to name, application_types_path(:tag => tag)
|
|
27
|
+
- else
|
|
28
|
+
%hr
|
|
29
|
+
|
|
30
|
+
- if @featured_types.present?
|
|
31
|
+
%section
|
|
32
|
+
%h3.divide Featured
|
|
33
|
+
.row-fluid
|
|
34
|
+
- @featured_types.each do |type|
|
|
35
|
+
%div{:class => @featured_types.length > 2 ? 'span4 tile-dark' : 'span6 tile-dark'}
|
|
36
|
+
= render :partial => 'application_type', :object => type, :locals => {:excluded_tags => []}
|
|
37
|
+
-#= div_for type, :class => 'tile tile-click' do
|
|
38
|
+
%h3= link_to type.display_name, application_type_path(type)
|
|
39
|
+
%p= type.description
|
|
40
|
+
- if type.website
|
|
41
|
+
%p= link_to type.website, type.website
|
|
42
|
+
= application_type_tags(type.tags)
|
|
43
|
+
|
|
44
|
+
%section
|
|
45
|
+
- if @type_groups.empty?
|
|
46
|
+
%p There are no applications available to install
|
|
47
|
+
|
|
48
|
+
- elsif @type_groups.length == 1
|
|
49
|
+
- title, types = @type_groups.first
|
|
50
|
+
- excluded_tags = common_tags_for(types)
|
|
51
|
+
|
|
52
|
+
%h3.divide= title
|
|
53
|
+
.row
|
|
54
|
+
- in_columns_of(2, types).each do |types|
|
|
55
|
+
.span6
|
|
56
|
+
.section.tile-dark
|
|
57
|
+
- types.sort!.each do |type|
|
|
58
|
+
= render :partial => 'tile', :locals => {:type => type, :excluded_tags => excluded_tags}
|
|
59
|
+
|
|
60
|
+
- else
|
|
61
|
+
.row
|
|
62
|
+
- in_balanced_columns_of(2, @type_groups).each do |groups|
|
|
63
|
+
.span6
|
|
64
|
+
- groups.each do |(title, types, link)|
|
|
65
|
+
.section.tile-dark
|
|
66
|
+
%h3.divide
|
|
67
|
+
= title
|
|
68
|
+
- if link
|
|
69
|
+
%small= link_to "(see all)", link, :class => 'pull-right'
|
|
70
|
+
- excluded_tags = common_tags_for(types)
|
|
71
|
+
- types.sort!.each do |type|
|
|
72
|
+
= render :partial => 'tile', :locals => {:type => type, :excluded_tags => excluded_tags}
|
|
73
|
+
|
|
74
|
+
- unless Quickstart.disabled?
|
|
75
|
+
%section
|
|
76
|
+
%p
|
|
77
|
+
Can't find what you're looking for? Try searching for a specific quickstart or filtering by tag.
|
|
78
|
+
Not all quickstarts are displayed on the first page.
|
|
79
|
+
-# , or
|
|
80
|
+
browse the entire list in our #{link_to "community Quickstart section", community_quickstarts_url}.
|
|
81
|
+
|
|
82
|
+
- content_for :javascripts do
|
|
83
|
+
:javascript
|
|
84
|
+
jQuery('.tile-click').click(function() {
|
|
85
|
+
a = $('h3 > a', this)[0];
|
|
86
|
+
window.location = a.href
|
|
87
|
+
});
|