openshift-origin-console 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (291) hide show
  1. data/COPYRIGHT +1 -0
  2. data/Gemfile +21 -0
  3. data/LICENSE +203 -0
  4. data/README.md +123 -0
  5. data/Rakefile +44 -0
  6. data/app/assets/images/cartridge-edge.gif +0 -0
  7. data/app/assets/images/console/arrow-down.png +0 -0
  8. data/app/assets/images/console/console-sprite.png +0 -0
  9. data/app/assets/images/favicon-32.png +0 -0
  10. data/app/assets/images/loader-dark.gif +0 -0
  11. data/app/assets/images/loader.gif +0 -0
  12. data/app/assets/images/sprite-vert.png +0 -0
  13. data/app/assets/javascripts/console.js +10 -0
  14. data/app/assets/javascripts/console/form.js.coffee +51 -0
  15. data/app/assets/stylesheets/_alerts.scss +84 -0
  16. data/app/assets/stylesheets/_breadcrumbs.scss +31 -0
  17. data/app/assets/stylesheets/_buttons.scss +229 -0
  18. data/app/assets/stylesheets/_code.scss +86 -0
  19. data/app/assets/stylesheets/_custom.scss +207 -0
  20. data/app/assets/stylesheets/_footer.scss +54 -0
  21. data/app/assets/stylesheets/_forms.scss +710 -0
  22. data/app/assets/stylesheets/_grid.scss +28 -0
  23. data/app/assets/stylesheets/_input-prepend-append.scss +138 -0
  24. data/app/assets/stylesheets/_labels.scss +40 -0
  25. data/app/assets/stylesheets/_mixins.scss +76 -0
  26. data/app/assets/stylesheets/_override-variables.scss +1 -0
  27. data/app/assets/stylesheets/_responsive.scss +438 -0
  28. data/app/assets/stylesheets/_ribbon.scss +57 -0
  29. data/app/assets/stylesheets/_type.scss +306 -0
  30. data/app/assets/stylesheets/_utilities.scss +10 -0
  31. data/app/assets/stylesheets/_variables.scss +131 -0
  32. data/app/assets/stylesheets/common.css.scss +82 -0
  33. data/app/assets/stylesheets/console/_application.scss +194 -0
  34. data/app/assets/stylesheets/console/_base.scss +26 -0
  35. data/app/assets/stylesheets/console/_breadcrumbs.scss +32 -0
  36. data/app/assets/stylesheets/console/_buttons.scss +214 -0
  37. data/app/assets/stylesheets/console/_core.scss +1002 -0
  38. data/app/assets/stylesheets/console/_dropdowns.scss +63 -0
  39. data/app/assets/stylesheets/console/_help.scss +54 -0
  40. data/app/assets/stylesheets/console/_mixins.scss +11 -0
  41. data/app/assets/stylesheets/console/_navbar.scss +415 -0
  42. data/app/assets/stylesheets/console/_ribbon.scss +82 -0
  43. data/app/assets/stylesheets/console/_tile.scss +122 -0
  44. data/app/assets/stylesheets/origin.css.scss +37 -0
  45. data/app/controllers/account/dashboard.rb +13 -0
  46. data/app/controllers/account_controller.rb +3 -0
  47. data/app/controllers/application_types_controller.rb +80 -0
  48. data/app/controllers/applications_controller.rb +183 -0
  49. data/app/controllers/building_controller.rb +81 -0
  50. data/app/controllers/capability_aware.rb +18 -0
  51. data/app/controllers/cartridge_types_controller.rb +53 -0
  52. data/app/controllers/cartridges_controller.rb +43 -0
  53. data/app/controllers/console/auth/basic.rb +65 -0
  54. data/app/controllers/console/auth/none.rb +5 -0
  55. data/app/controllers/console/auth/remote_user.rb +69 -0
  56. data/app/controllers/console/rescue.rb +48 -0
  57. data/app/controllers/console_controller.rb +19 -0
  58. data/app/controllers/console_index_controller.rb +14 -0
  59. data/app/controllers/domain_aware.rb +26 -0
  60. data/app/controllers/domain_session_sweeper.rb +29 -0
  61. data/app/controllers/domains_controller.rb +30 -0
  62. data/app/controllers/keys_controller.rb +43 -0
  63. data/app/controllers/scaling_controller.rb +46 -0
  64. data/app/controllers/sshkey_aware.rb +23 -0
  65. data/app/controllers/sshkey_session_sweeper.rb +29 -0
  66. data/app/controllers/user_session_sweeper.rb +29 -0
  67. data/app/helpers/console/community_helper.rb +78 -0
  68. data/app/helpers/console/console_helper.rb +26 -0
  69. data/app/helpers/console/help_helper.rb +270 -0
  70. data/app/helpers/console/html5_boilerplate_helper.rb +63 -0
  71. data/app/helpers/console/layout_helper.rb +277 -0
  72. data/app/helpers/console/model_helper.rb +106 -0
  73. data/app/helpers/console/secured_helper.rb +5 -0
  74. data/app/models/alias.rb +10 -0
  75. data/app/models/application.rb +148 -0
  76. data/app/models/application_associations.rb +36 -0
  77. data/app/models/application_template.rb +90 -0
  78. data/app/models/application_type.rb +258 -0
  79. data/app/models/async_aware.rb +60 -0
  80. data/app/models/capabilities.rb +62 -0
  81. data/app/models/cartridge.rb +122 -0
  82. data/app/models/cartridge_type.rb +140 -0
  83. data/app/models/domain.rb +44 -0
  84. data/app/models/domain_associations.rb +33 -0
  85. data/app/models/embedded.rb +11 -0
  86. data/app/models/gear.rb +13 -0
  87. data/app/models/gear_group.rb +104 -0
  88. data/app/models/key.rb +87 -0
  89. data/app/models/quickstart.rb +135 -0
  90. data/app/models/rest_api.rb +130 -0
  91. data/app/models/rest_api/base.rb +781 -0
  92. data/app/models/rest_api/cacheable.rb +91 -0
  93. data/app/models/rest_api/environment.rb +13 -0
  94. data/app/models/rest_api/info.rb +34 -0
  95. data/app/models/rest_api/log_subscriber.rb +29 -0
  96. data/app/models/rest_api/railties/controller_runtime.rb +37 -0
  97. data/app/models/user.rb +27 -0
  98. data/app/models/user_associations.rb +6 -0
  99. data/app/views/account/_domain.html.haml +14 -0
  100. data/app/views/account/_keys.html.haml +20 -0
  101. data/app/views/account/_user.html.haml +5 -0
  102. data/app/views/account/show.html.haml +15 -0
  103. data/app/views/application_templates/_application_template.html.haml +5 -0
  104. data/app/views/application_types/_application_type.html.haml +19 -0
  105. data/app/views/application_types/_custom.html.haml +19 -0
  106. data/app/views/application_types/_persisted.html.haml +26 -0
  107. data/app/views/application_types/_tile.html.haml +9 -0
  108. data/app/views/application_types/index.html.haml +87 -0
  109. data/app/views/application_types/search.html.haml +67 -0
  110. data/app/views/application_types/show.html.haml +219 -0
  111. data/app/views/applications/_application.html.haml +34 -0
  112. data/app/views/applications/_applications_filter.html.haml +8 -0
  113. data/app/views/applications/_footer.html.haml +0 -0
  114. data/app/views/applications/_name.html.haml +28 -0
  115. data/app/views/applications/delete.html.haml +19 -0
  116. data/app/views/applications/get_started.html.haml +145 -0
  117. data/app/views/applications/index.html.haml +55 -0
  118. data/app/views/applications/show.html.haml +193 -0
  119. data/app/views/building/delete.html.haml +22 -0
  120. data/app/views/building/new.html.haml +57 -0
  121. data/app/views/building/show.html.haml +12 -0
  122. data/app/views/cartridge_types/_cartridge_type.html.haml +61 -0
  123. data/app/views/cartridge_types/index.html.haml +37 -0
  124. data/app/views/cartridge_types/show.html.haml +21 -0
  125. data/app/views/cartridges/next_steps.html.haml +58 -0
  126. data/app/views/cartridges/show.html.haml +1 -0
  127. data/app/views/console/error.html.haml +58 -0
  128. data/app/views/console/help.html.haml +90 -0
  129. data/app/views/console/not_found.html.haml +69 -0
  130. data/app/views/console/unauthorized.html.haml +7 -0
  131. data/app/views/domains/_domain.html.haml +14 -0
  132. data/app/views/domains/_form.html.haml +13 -0
  133. data/app/views/domains/edit.html.haml +5 -0
  134. data/app/views/domains/new.html.haml +6 -0
  135. data/app/views/keys/_form.html.haml +14 -0
  136. data/app/views/keys/_simple_form.html.haml +14 -0
  137. data/app/views/keys/new.html.haml +2 -0
  138. data/app/views/layouts/_footer.html.haml +38 -0
  139. data/app/views/layouts/_head.html.haml +35 -0
  140. data/app/views/layouts/console.html.haml +60 -0
  141. data/app/views/layouts/console/_header.html.haml +44 -0
  142. data/app/views/layouts/console/_identity.html.haml +7 -0
  143. data/app/views/layouts/console/_javascripts.html.haml +5 -0
  144. data/app/views/layouts/console/_stylesheets.html.haml +6 -0
  145. data/app/views/scaling/delete.html.haml +17 -0
  146. data/app/views/scaling/new.html.haml +24 -0
  147. data/app/views/scaling/show.html.haml +81 -0
  148. data/app/views/shared/_tracking.html.haml +0 -0
  149. data/conf/console.conf.example +108 -0
  150. data/conf/openshift_console.conf +10 -0
  151. data/config/cartridge_types.yml +54 -0
  152. data/config/initializers/barista_config.rb +86 -0
  153. data/config/initializers/cartridge_types.rb +5 -0
  154. data/config/initializers/console_security.rb +1 -0
  155. data/config/initializers/date_helper.rb +5 -0
  156. data/config/initializers/extended_logger.rb +51 -0
  157. data/config/initializers/formtastic.rb +100 -0
  158. data/config/initializers/inflections.rb +38 -0
  159. data/config/initializers/rdiscount.rb +8 -0
  160. data/config/initializers/rest_api.rb +22 -0
  161. data/config/initializers/sass.rb +30 -0
  162. data/config/initializers/session_trace.rb +32 -0
  163. data/config/initializers/x_frame_options.rb +53 -0
  164. data/config/locales/en.yml +12 -0
  165. data/lib/active_resource/associations.rb +107 -0
  166. data/lib/active_resource/associations/builder/association.rb +35 -0
  167. data/lib/active_resource/associations/builder/belongs_to.rb +5 -0
  168. data/lib/active_resource/associations/builder/has_many.rb +5 -0
  169. data/lib/active_resource/associations/builder/has_one.rb +5 -0
  170. data/lib/active_resource/persistent_connection.rb +341 -0
  171. data/lib/active_resource/persistent_http_mock.rb +68 -0
  172. data/lib/active_resource/reflection.rb +78 -0
  173. data/lib/console.rb +8 -0
  174. data/lib/console/config_file.rb +13 -0
  175. data/lib/console/configuration.rb +163 -0
  176. data/lib/console/engine.rb +28 -0
  177. data/lib/console/formtastic/bootstrap_form_builder.rb +369 -0
  178. data/lib/console/rails/app_redirector.rb +40 -0
  179. data/lib/console/rails/filter_hash.rb +15 -0
  180. data/lib/console/rails/routes.rb +51 -0
  181. data/lib/console/version.rb +5 -0
  182. data/lib/tasks/assets.rake +79 -0
  183. data/lib/tasks/stats.rake +18 -0
  184. data/lib/tasks/test_suites.rake +73 -0
  185. data/test/coverage_helper.rb +27 -0
  186. data/test/fixtures/cartridges.json +1 -0
  187. data/test/fixtures/quickstarts.csv +3 -0
  188. data/test/functional/account_controller_test.rb +14 -0
  189. data/test/functional/application_types_controller_test.rb +251 -0
  190. data/test/functional/applications_controller_sanity_test.rb +26 -0
  191. data/test/functional/applications_controller_test.rb +365 -0
  192. data/test/functional/building_controller_test.rb +203 -0
  193. data/test/functional/cartridge_types_controller_isolation_test.rb +68 -0
  194. data/test/functional/cartridge_types_controller_test.rb +48 -0
  195. data/test/functional/cartridges_controller_test.rb +83 -0
  196. data/test/functional/console_auth_basic_controller_test.rb +82 -0
  197. data/test/functional/console_auth_remote_user_controller_test.rb +90 -0
  198. data/test/functional/console_index_controller_test.rb +22 -0
  199. data/test/functional/domains_controller_test.rb +194 -0
  200. data/test/functional/keys_controller_test.rb +163 -0
  201. data/test/functional/quickstarts.json +18 -0
  202. data/test/functional/scaling_controller_test.rb +153 -0
  203. data/test/integration/assets_test.rb +34 -0
  204. data/test/integration/help_link_test.rb +43 -0
  205. data/test/integration/quickstarts_test.rb +24 -0
  206. data/test/integration/rescue_from_test.rb +25 -0
  207. data/test/integration/rest_api/application_test.rb +115 -0
  208. data/test/integration/rest_api/cartridge_test.rb +44 -0
  209. data/test/integration/rest_api/cartridge_type_test.rb +143 -0
  210. data/test/integration/rest_api/domain_test.rb +91 -0
  211. data/test/integration/rest_api/info_test.rb +9 -0
  212. data/test/integration/rest_api/key_test.rb +85 -0
  213. data/test/integration/static_pages_test.rb +44 -0
  214. data/test/rails_app/Rakefile +7 -0
  215. data/test/rails_app/app/controllers/application_controller.rb +5 -0
  216. data/test/rails_app/config.ru +4 -0
  217. data/test/rails_app/config/application.rb +48 -0
  218. data/test/rails_app/config/boot.rb +10 -0
  219. data/test/rails_app/config/database.yml +25 -0
  220. data/test/rails_app/config/environment.rb +5 -0
  221. data/test/rails_app/config/environments/development.rb +38 -0
  222. data/test/rails_app/config/environments/production.rb +70 -0
  223. data/test/rails_app/config/environments/test.rb +43 -0
  224. data/test/rails_app/config/initializers/auth.rb +0 -0
  225. data/test/rails_app/config/initializers/backtrace_silencers.rb +7 -0
  226. data/test/rails_app/config/initializers/inflections.rb +10 -0
  227. data/test/rails_app/config/initializers/mime_types.rb +5 -0
  228. data/test/rails_app/config/initializers/secret_token.rb +7 -0
  229. data/test/rails_app/config/initializers/session_store.rb +8 -0
  230. data/test/rails_app/config/locales/en.yml +5 -0
  231. data/test/rails_app/config/routes.rb +4 -0
  232. data/test/rails_app/script/rails +6 -0
  233. data/test/support/auth.rb +111 -0
  234. data/test/support/base.rb +142 -0
  235. data/test/support/errors.rb +28 -0
  236. data/test/support/rest_api.rb +189 -0
  237. data/test/test_helper.rb +14 -0
  238. data/test/unit/active_model_compliance_test.rb +23 -0
  239. data/test/unit/async_aware_test.rb +55 -0
  240. data/test/unit/configuration_test.rb +158 -0
  241. data/test/unit/filter_hash_test.rb +64 -0
  242. data/test/unit/helpers/model_helper_test.rb +61 -0
  243. data/test/unit/overrides_test.rb +9 -0
  244. data/test/unit/rest_api_test.rb +1590 -0
  245. data/vendor/assets/javascripts/MIT-LICENSE.txt +20 -0
  246. data/vendor/assets/javascripts/bootstrap-collapse.js +157 -0
  247. data/vendor/assets/javascripts/bootstrap-dropdown.js +100 -0
  248. data/vendor/assets/javascripts/bootstrap-tab.js +135 -0
  249. data/vendor/assets/javascripts/bootstrap-transition.js +61 -0
  250. data/vendor/assets/javascripts/jquery.spin.js +47 -0
  251. data/vendor/assets/javascripts/jquery.ui.widget.js +16 -0
  252. data/vendor/assets/javascripts/jquery_cookie.js +41 -0
  253. data/vendor/assets/javascripts/jquery_validate_min.js +51 -0
  254. data/vendor/assets/javascripts/modernizr.min.js +2 -0
  255. data/vendor/assets/javascripts/plugins.js +16 -0
  256. data/vendor/assets/stylesheets/bootstrap/_accordion.scss +28 -0
  257. data/vendor/assets/stylesheets/bootstrap/_alerts.scss +70 -0
  258. data/vendor/assets/stylesheets/bootstrap/_breadcrumbs.scss +22 -0
  259. data/vendor/assets/stylesheets/bootstrap/_button-groups.scss +147 -0
  260. data/vendor/assets/stylesheets/bootstrap/_buttons.scss +183 -0
  261. data/vendor/assets/stylesheets/bootstrap/_carousel.scss +121 -0
  262. data/vendor/assets/stylesheets/bootstrap/_close.scss +18 -0
  263. data/vendor/assets/stylesheets/bootstrap/_code.scss +57 -0
  264. data/vendor/assets/stylesheets/bootstrap/_component-animations.scss +18 -0
  265. data/vendor/assets/stylesheets/bootstrap/_dropdowns.scss +130 -0
  266. data/vendor/assets/stylesheets/bootstrap/_forms.scss +522 -0
  267. data/vendor/assets/stylesheets/bootstrap/_grid.scss +8 -0
  268. data/vendor/assets/stylesheets/bootstrap/_hero-unit.scss +20 -0
  269. data/vendor/assets/stylesheets/bootstrap/_labels.scss +32 -0
  270. data/vendor/assets/stylesheets/bootstrap/_layouts.scss +17 -0
  271. data/vendor/assets/stylesheets/bootstrap/_mixins.scss +602 -0
  272. data/vendor/assets/stylesheets/bootstrap/_modals.scss +84 -0
  273. data/vendor/assets/stylesheets/bootstrap/_navbar.scss +299 -0
  274. data/vendor/assets/stylesheets/bootstrap/_navs.scss +353 -0
  275. data/vendor/assets/stylesheets/bootstrap/_pager.scss +30 -0
  276. data/vendor/assets/stylesheets/bootstrap/_pagination.scss +55 -0
  277. data/vendor/assets/stylesheets/bootstrap/_popovers.scss +49 -0
  278. data/vendor/assets/stylesheets/bootstrap/_progress-bars.scss +95 -0
  279. data/vendor/assets/stylesheets/bootstrap/_reset.scss +126 -0
  280. data/vendor/assets/stylesheets/bootstrap/_scaffolding.scss +33 -0
  281. data/vendor/assets/stylesheets/bootstrap/_sprites.scss +158 -0
  282. data/vendor/assets/stylesheets/bootstrap/_tables.scss +150 -0
  283. data/vendor/assets/stylesheets/bootstrap/_thumbnails.scss +35 -0
  284. data/vendor/assets/stylesheets/bootstrap/_tooltip.scss +35 -0
  285. data/vendor/assets/stylesheets/bootstrap/_type.scss +218 -0
  286. data/vendor/assets/stylesheets/bootstrap/_utilities.scss +23 -0
  287. data/vendor/assets/stylesheets/bootstrap/_variables.scss +107 -0
  288. data/vendor/assets/stylesheets/bootstrap/_wells.scss +17 -0
  289. data/vendor/assets/stylesheets/bootstrap/bootstrap.scss +66 -0
  290. data/vendor/assets/stylesheets/bootstrap/responsive.scss +334 -0
  291. metadata +506 -0
@@ -0,0 +1,82 @@
1
+ @import "compass";
2
+
3
+ .banner-ribbon {
4
+ position: relative;
5
+ background-color: #333b3f;
6
+ @include background-image(linear-gradient(color-stops(#333b3f, #1a2124)));
7
+ //@include box-shadow(0);
8
+ color: #bcbdbc;
9
+ text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.18);
10
+ font-weight: 400;
11
+ font-size: 11px;
12
+ min-height: 32px;
13
+
14
+ // Expand the ribbon with a border and a negative left margin
15
+ margin-left: -10px;
16
+ > div {
17
+ border-left: 10px solid transparent;
18
+ border-right: 10px solid transparent;
19
+ }
20
+
21
+ &:before {
22
+ border-left: 10px solid transparent;
23
+ /*border-top: 10px solid #91010B; red version */
24
+ border-top: 10px solid #000;
25
+ bottom: -10px;
26
+ content: "";
27
+ height: 0;
28
+ left: 0;
29
+ position: absolute;
30
+ width: 0;
31
+ }
32
+
33
+ &:after {
34
+ border-right: 10px solid transparent;
35
+ border-top: 10px solid #000;
36
+ bottom: -10px;
37
+ content: "";
38
+ height: 0;
39
+ right: 0;
40
+ position: absolute;
41
+ width: 0;
42
+ }
43
+
44
+ .more a {
45
+ /*background-color: #bb161c; red version */
46
+ background-color: rgba(0, 0, 0, 0.075);
47
+ float: right;
48
+ color: #e0e1dd;
49
+ text-transform: uppercase;
50
+ /*border-color: transparent #EB0011; red version */
51
+ border-color: transparent;
52
+ border-style: solid;
53
+ border-width: 1.5em 0 1.5em 1.5em;
54
+ color: #e0e1dd;
55
+ display: inline-block;
56
+ line-height: 0;
57
+ height: 0;
58
+ padding: 0 30px;
59
+ }
60
+ }
61
+
62
+ @media (max-width: 767px) {
63
+ .row > .banner-ribbon {
64
+ @include expand_for_phone();
65
+ min-height: 26px;
66
+ }
67
+ }
68
+ /* The ribbon should tuck in on very narrow windows */
69
+ @media (max-width: 810px) {
70
+ .banner-ribbon {
71
+ margin-left: 0;
72
+ > div {
73
+ border: 0;
74
+ }
75
+
76
+ &:before,
77
+ &:after {
78
+ display: none;
79
+ }
80
+ }
81
+ }
82
+
@@ -0,0 +1,122 @@
1
+ .tile {
2
+ padding: 15px 25px;
3
+ margin-bottom: 20px;
4
+ background-color: #222;
5
+ color: #b0b0b0;
6
+
7
+ > p {
8
+ margin-bottom: $baseLineHeight / 1.5;
9
+ }
10
+
11
+ > ul.meta > li > label, {
12
+ display: inline;
13
+ }
14
+
15
+ > h3 > a {
16
+ color: #dadada;
17
+ text-decoration: none;
18
+ }
19
+
20
+ &.cartridge_type .warning {
21
+ color: $orange;
22
+ }
23
+ }
24
+
25
+ .label-tags {
26
+ a.label {
27
+ color: #666;
28
+ background-color: transparent;
29
+ text-decoration: none;
30
+ margin-right: 5px;
31
+ text-shadow: none;
32
+
33
+ &:hover {
34
+ color: #111;
35
+ background-color: #eee !important;
36
+ }
37
+ }
38
+ }
39
+
40
+ .tile-click {
41
+ cursor: pointer;
42
+
43
+ &:hover {
44
+ background-color: #151515;
45
+
46
+ h3 {
47
+ color: #f0f0f0;
48
+ }
49
+ }
50
+
51
+ &:active {
52
+ background-color: #333;
53
+ color: white
54
+ }
55
+ }
56
+
57
+ .tile-compact {
58
+ h3 {
59
+ display: inline-block;
60
+ margin-right: 10px;
61
+ }
62
+ a.label {
63
+ display: inline-block;
64
+ vertical-align: middle;
65
+ margin-top: -5px;
66
+ }
67
+ }
68
+
69
+ .tile-dark {
70
+ .tile {
71
+ background: #131313;
72
+ }
73
+
74
+ > .tile-click {
75
+ position: relative;
76
+ margin-bottom: 3px;
77
+
78
+ .tile-target {
79
+ color:#c0c0c0;
80
+ }
81
+
82
+ &:hover {
83
+ background: #000;
84
+
85
+ .tile-target {
86
+ color: #f0f0f0;
87
+ }
88
+ i.tile-arrow {
89
+ background-position: 0 -30px;
90
+ }
91
+ }
92
+
93
+ i.tile-arrow {
94
+ background-position: 0 0;
95
+ position: absolute;
96
+ overflow: hidden;
97
+ display: block;
98
+ height: 20px;
99
+ width: 10px;
100
+ right: 5px;
101
+ top: 19px;
102
+ width: 25px;
103
+ }
104
+ }
105
+ }
106
+
107
+ .section-body .tile-dark > .tile-click {
108
+ margin-left: 5px;
109
+ > div {
110
+ margin-right: -5px;
111
+ }
112
+ }
113
+
114
+ @media (max-width: 767px) {
115
+ .section-body .row > .tile-click {
116
+ @include expand_for_phone();
117
+
118
+ i.tile-arrow {
119
+ right: -15px;
120
+ }
121
+ }
122
+ }
@@ -0,0 +1,37 @@
1
+ /* OPENSHIFT MANAGEMENT CONSOLE
2
+
3
+ Color palette
4
+ --------------------------------------------
5
+ 0 0 0 000000 Black
6
+ 177 229 242 b1e5f2 Primary Blue
7
+ 54 53 52 363634 Primary Dark Gray
8
+ 77 79 83 4d4f53 Cool Gray 11
9
+ 154 155 156 9a9b9c Cool Gray 7
10
+ 188 189 188 bcbdbc Cool Gray 4
11
+ 224 225 221 e0e1dd Cool Gray 1
12
+ 255 255 255 ffffff White
13
+ 234 0 17 ea0011 Bright Red
14
+ 205 32 44 cd202c Primary Red
15
+ 161 0 12 a1000c Dark Red
16
+
17
+ */
18
+
19
+ @import "override-variables";
20
+ @import "variables";
21
+ @import "bootstrap/variables";
22
+ @import "bootstrap/mixins";
23
+ @import "mixins";
24
+ @import "console/mixins";
25
+
26
+ @import "console/base";
27
+ @import "console/navbar";
28
+ @import "console/help";
29
+ @import "console/breadcrumbs";
30
+ @import "console/ribbon";
31
+ @import "console/buttons";
32
+ @import "bootstrap/dropdowns";
33
+ @import "console/dropdowns";
34
+ @import "console/tile";
35
+ @import "console/application";
36
+
37
+ @import "console/core";
@@ -0,0 +1,13 @@
1
+ module Account
2
+ module Dashboard
3
+ extend ActiveSupport::Concern
4
+ include DomainAware
5
+
6
+ def show
7
+ @user = current_user
8
+ user_default_domain rescue nil
9
+ @keys = Key.find :all, :as => @user
10
+ end
11
+ end
12
+ end
13
+
@@ -0,0 +1,3 @@
1
+ class AccountController < ConsoleController
2
+ include Account::Dashboard
3
+ end
@@ -0,0 +1,80 @@
1
+ class ApplicationTypesController < ConsoleController
2
+
3
+ include Console::ModelHelper
4
+
5
+ def index
6
+ @capabilities = user_capabilities
7
+ flash.now[:warning] = "You have no free gears. You'll need to scale down or delete another application first." unless @capabilities.gears_free?
8
+
9
+ @browse_tags = [
10
+ ['Java', :java],
11
+ ['PHP', :php],
12
+ ['Ruby', :ruby],
13
+ ['Python', :python],
14
+ ['Node.js', :nodejs],
15
+ ['Perl', :perl],
16
+ nil,
17
+ ['All web cartridges', :cartridge],
18
+ ['All quickstart applications', :instant_app],
19
+ nil,
20
+ ['Blogs', :blog],
21
+ ['Content management systems', :cms],
22
+ #['MongoDB', :mongo],
23
+ ]
24
+
25
+ if @tag = params[:tag].presence
26
+ types = ApplicationType.tagged(@tag)
27
+ @type_groups = [["Tagged with #{Array(@tag).to_sentence}", types.sort!]]
28
+
29
+ render :search
30
+ elsif @search = params[:search].presence
31
+ types = ApplicationType.search(@search)
32
+ @type_groups = [["Matches search '#{@search}'", types]]
33
+
34
+ render :search
35
+ else
36
+ types = ApplicationType.all
37
+ @featured_types = types.select{ |t| t.tags.include?(:featured) }.sample(3).sort!
38
+ groups, other = in_groups_by_tag(types - @featured_types, [:instant_app, :java, :php, :ruby, :python])
39
+ groups.each do |g|
40
+ g[2] = application_types_path(:tag => g[0])
41
+ g[1].sort!
42
+ g[0] = I18n.t(g[0], :scope => :types, :default => g[0].to_s.titleize)
43
+ end
44
+ groups << ['Other types', other.sort!] unless other.empty?
45
+ @type_groups = groups
46
+ end
47
+ end
48
+
49
+ def show
50
+ app_params = params[:application] || params
51
+ app_type_params = params[:application_type] || app_params
52
+ @advanced = to_boolean(params[:advanced])
53
+
54
+ user_default_domain rescue (@domain = Domain.new)
55
+
56
+ @compact = false # @domain.persisted?
57
+
58
+ @application_type = params[:id] == 'custom' ?
59
+ ApplicationType.custom(app_type_params) :
60
+ ApplicationType.find(params[:id])
61
+
62
+ @capabilities = user_capabilities :refresh => true
63
+
64
+ @application = (@application_type >> Application.new(:as => current_user)).assign_attributes(app_params)
65
+ @application.gear_profile = @capabilities.gear_sizes.first unless @capabilities.gear_sizes.include?(@application.gear_profile)
66
+
67
+ begin
68
+ @cartridges, @missing_cartridges = @application_type.matching_cartridges
69
+ flash.now[:error] = "No cartridges are defined for this type - all applications require at least one web cartridge" unless @cartridges.present?
70
+ rescue ApplicationType::CartridgeSpecInvalid
71
+ logger.debug $!
72
+ flash.now[:error] = "The cartridges defined for this type are not valid. The #{@application_type.source} may not be correct."
73
+ end
74
+
75
+ flash.now[:error] = "You have no free gears. You'll need to scale down or delete another application first." unless @capabilities.gears_free?
76
+ @disabled = @missing_cartridges.present? || @cartridges.blank?
77
+
78
+ user_default_domain rescue nil
79
+ end
80
+ end
@@ -0,0 +1,183 @@
1
+ require 'uri'
2
+
3
+ class ApplicationsFilter
4
+ extend ActiveModel::Naming
5
+ include ActiveModel::Serialization
6
+ include ActiveModel::Conversion
7
+
8
+ attr_accessor :name, 'type', :type_options
9
+ def initialize(attributes={})
10
+ attributes.each { |key,value| send("#{key}=", value) } unless attributes.nil?
11
+ end
12
+
13
+ def persisted?
14
+ false
15
+ end
16
+
17
+ def active?
18
+ @filtered
19
+ end
20
+
21
+ def present?
22
+ !(name.nil? or name.blank?) or !(type.nil? or type.blank?)
23
+ end
24
+
25
+ def apply(applications)
26
+ @filtered = !applications.empty?
27
+ @type_options = [['All','']]
28
+
29
+ types = {}
30
+ applications.select do |application|
31
+ type = application.framework
32
+ unless types.has_key? type
33
+ @type_options << [application.framework_name, type]
34
+ types[type] = true
35
+ end
36
+
37
+ ApplicationsFilter.wildcard_match?(@name, application.name) &&
38
+ (@type.nil? or @type.blank? or @type == type)
39
+ end
40
+ end
41
+
42
+ def self.wildcard_match?(search_str, value)
43
+ return true if search_str.nil? || search_str.blank?
44
+
45
+ if !(search_str =~ /\*/)
46
+ search_str = "*" + search_str + "*"
47
+ end
48
+
49
+ # make the regexp safe
50
+ wildcard_parse = search_str.split('*')
51
+ wildcard_re = ""
52
+ for element in wildcard_parse
53
+ if element == ""
54
+ wildcard_re += ".*"
55
+ else
56
+ wildcard_re += Regexp.escape(element)
57
+ end
58
+ end
59
+
60
+ # check for wildcard as last char
61
+ if search_str.ends_with? '*'
62
+ wildcard_re += ".*"
63
+ end
64
+
65
+ wildcard_re = "^" + wildcard_re + "$"
66
+ /#{wildcard_re}/.match(value)
67
+ end
68
+
69
+ end
70
+
71
+ class ApplicationsController < ConsoleController
72
+
73
+ def index
74
+ # replace domains with Applications.find :all, :as => current_user
75
+ # in the future
76
+ #domain = Domain.find :one, :as => current_user rescue nil
77
+ user_default_domain rescue nil
78
+ return redirect_to application_types_path, :notice => 'Create your first application now!' if @domain.nil? || @domain.applications.empty?
79
+
80
+ @applications_filter = ApplicationsFilter.new params[:applications_filter]
81
+ @applications = @applications_filter.apply(@domain.applications)
82
+ end
83
+
84
+ def destroy
85
+ @domain = Domain.find :one, :as => current_user
86
+ @application = @domain.find_application params[:id]
87
+ if @application.destroy
88
+ redirect_to applications_path, :flash => {:success => "The application '#{@application.name}' has been deleted"}
89
+ else
90
+ render :delete
91
+ end
92
+ end
93
+
94
+ def delete
95
+ #@domain = Domain.find :one, :as => current_user
96
+ user_default_domain
97
+ @application = @domain.find_application params[:id]
98
+
99
+ @referer = application_path(@application)
100
+ end
101
+
102
+ def new
103
+ redirect_to application_types_path
104
+ end
105
+
106
+ def create
107
+ app_params = params[:application] || params
108
+ @advanced = to_boolean(params[:advanced])
109
+ type = params[:application_type] || app_params[:application_type]
110
+ domain_name = app_params[:domain_name].presence || app_params[:domain_id].presence
111
+
112
+ @application_type = (type == 'custom' || !type.is_a?(String)) ?
113
+ ApplicationType.custom(type) :
114
+ ApplicationType.find(type)
115
+
116
+ @capabilities = user_capabilities :refresh => true
117
+
118
+ @application = (@application_type >> Application.new(:as => current_user)).assign_attributes(app_params)
119
+
120
+ begin
121
+ @cartridges, @missing_cartridges = @application_type.matching_cartridges
122
+ flash.now[:error] = "No cartridges are defined for this type - all applications require at least one web cartridge" unless @cartridges.present?
123
+ rescue ApplicationType::CartridgeSpecInvalid
124
+ logger.debug $!
125
+ flash.now[:error] = "The cartridges defined for this type are not valid. The #{@application_type.source} may not be correct."
126
+ end
127
+
128
+ #@cartridges, @missing_cartridges = ApplicationType.matching_cartridges(@application.cartridge_names.presence || @application_type.cartridges)
129
+
130
+ flash.now[:error] = "You have no free gears. You'll need to scale down or delete another application first." unless @capabilities.gears_free?
131
+ @disabled = @missing_cartridges.present? || @cartridges.blank?
132
+
133
+ # opened bug 789763 to track simplifying this block - with domain_name submission we would
134
+ # only need to check that domain_name is set (which it should be by the show form)
135
+ @domain = Domain.find :first, :as => current_user
136
+ unless @domain
137
+ @domain = Domain.create :name => domain_name, :as => current_user
138
+ unless @domain.persisted?
139
+ logger.debug "Unable to create domain, #{@domain.errors.to_hash.inspect}"
140
+ @application.valid? # set any errors on the application object
141
+ #FIXME: Ideally this should be inferred via associations between @domain and @application
142
+ @domain.errors.values.flatten.uniq.each {|e| @application.errors.add(:domain_name, e) }
143
+
144
+ return render 'application_types/show'
145
+ end
146
+ end
147
+ @application.domain = @domain
148
+
149
+ if @application.save
150
+ messages = @application.remote_results
151
+
152
+ if t = @application_type.template
153
+ messages << t.credentials_message if t.credentials
154
+ end
155
+
156
+ redirect_to get_started_application_path(@application, :wizard => true, :template => (@application_type.template.present? || nil)), :flash => {:info_pre => messages}
157
+ else
158
+ logger.debug @application.errors.inspect
159
+
160
+ render 'application_types/show'
161
+ end
162
+ end
163
+
164
+ def show
165
+ #@domain = Domain.find :one, :as => current_user
166
+ user_default_domain
167
+ @application = @domain.find_application params[:id]
168
+
169
+ @gear_groups = @application.gear_groups_with_state
170
+
171
+ sshkey_uploaded?
172
+ end
173
+
174
+ def get_started
175
+ #@domain = Domain.find :one, :as => current_user
176
+ user_default_domain
177
+ @application = @domain.find_application params[:id]
178
+
179
+ @wizard = !params[:wizard].nil?
180
+ @template = !params[:template].nil?
181
+ sshkey_uploaded?
182
+ end
183
+ end