zuora_connect 1.7.26 → 1.7.27

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cdd23ff523fc28aa516b84e5fb5506901ddc05e7
4
- data.tar.gz: cd905c41aa9a522956d2be9742f68352da30fce0
3
+ metadata.gz: a456ef32d3f83e4fd5e511b7954e31ba93d1661d
4
+ data.tar.gz: 73ebb420bea1ab82671f89079337fa64dd7c94ab
5
5
  SHA512:
6
- metadata.gz: 482383209074d117f49285b24c6bdf8334108fdbdeb37d4cdee293fe84818b8c651e0c1c7a5e21c501a71f5ecaa7ef343e07618baece575c1ae4bda1bf37b23e
7
- data.tar.gz: 9f64ac670ab2224018d7801c81aa8279aab13b520c84c0f7db99276aec52a79960cd7a01a59ac3b46b18af63460591f6c1e04afe944457ae9f19233b7c2b1651
6
+ metadata.gz: 10c79c86e31e49aee08fec601b3a95f6c0c494f9ac885525a00a14b310abee4ac74806461cdbd835d23f26afa8f7387f8722deb3f945c7a6988a3dbc37709eeb
7
+ data.tar.gz: c8777b59d8b457b67e65a42662f17cc13a20aac1bbabd0f8516c6d9f212f26a234834734f98eed73b76817eaf4a27fb2953e87f6e6cdc808eef80df172cbe9db
@@ -1,6 +1,6 @@
1
1
  module ZuoraConnect
2
2
  class StaticController < ApplicationController
3
- before_filter :authenticate_connect_app_request, :except => [:metrics, :health, :session_error, :invalid_app_instance_error, :initialize_app]
3
+ before_filter :authenticate_connect_app_request, :except => [:metrics, :health, :session_error, :invalid_app_instance_error, :launch, :switch, :initialize_app]
4
4
  after_filter :persist_connect_app_session, :except => [:metrics, :health, :session_error, :invalid_app_instance_error, :initialize_app]
5
5
  skip_before_filter :verify_authenticity_token, :only => [:initialize_app]
6
6
 
@@ -30,6 +30,39 @@ module ZuoraConnect
30
30
  }, status: 200
31
31
  end
32
32
 
33
+ def launch
34
+ @ids = JSON.parse(Base64.decode64(URI.decode(params["ids"])))
35
+ if @ids.count == 1
36
+ redirect_to :action => :switch, :commit => @ids[0][0]
37
+ else
38
+ respond_to do |format|
39
+ format.html
40
+ end
41
+ end
42
+ end
43
+
44
+ def switch
45
+ host = request.headers["HTTP_X_FORWARDED_HOST"]
46
+ zuora_client = ZuoraAPI::Login.new(url: "https://#{host}")
47
+ menus = zuora_client.get_full_nav(cookies.to_h)["menus"]
48
+ menus = JSON.parse(response)["menus"]
49
+ app = menus.select do |item|
50
+ matches = /(?<=.com\/)(.*?)(?=\/|$)/.match(item["url"])
51
+ if !matches.blank?
52
+ matches[0] == ENV["DEIS_APP"]
53
+ end
54
+ end
55
+ url_tasks = JSON.parse(Base64.decode64(URI.decode(URI.parse(app[0]["url"]).query.split("ids=")[1])))
56
+ if url_tasks.map { |i| i[0] }.include?(params["commit"].to_i)
57
+ @appinstance = ZuoraConnect::AppInstance.find(params["commit"].to_i)
58
+ @appinstance.new_session(session: {})
59
+ @appinstance.cache_app_instance
60
+ redirect_to main_app.root_path
61
+ else
62
+ redirect_to main_app.root_path
63
+ end
64
+ end
65
+
33
66
  def initialize_app
34
67
  begin
35
68
  authenticate_connect_app_request
@@ -0,0 +1,79 @@
1
+ <html><head>
2
+ <title>Select Task ID</title>
3
+ <meta name="viewport" content="width=device-width,initial-scale=1">
4
+ <style>
5
+ body {
6
+ background-color: #EFEFEF;
7
+ color: #2E2F30;
8
+ text-align: center;
9
+ font-family: arial, sans-serif;
10
+ margin: 0;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 95%;
15
+ max-width: 33em;
16
+ margin: 4em auto 0;
17
+ }
18
+
19
+ div.dialog > div {
20
+ margin: 0 0 1em;
21
+ border: 1px solid #CCC;
22
+ border-right-color: #999;
23
+ border-left-color: #999;
24
+ border-bottom-color: #BBB;
25
+ border-top: #3D4B5A solid 4px;
26
+ border-top-left-radius: 9px;
27
+ border-top-right-radius: 9px;
28
+ border-bottom-left-radius: 9px;
29
+ border-bottom-right-radius: 9px;
30
+ background-color: white;
31
+ padding: 7px 12% 0;
32
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
33
+ }
34
+
35
+ h1 {
36
+ font-size: 100%;
37
+ color: #3D4B5A;
38
+ line-height: 1.5em;
39
+ }
40
+
41
+ input.submit {
42
+ margin: 1em 0 1em;
43
+ padding: 1em;
44
+ width: 300px;
45
+ font-size: 12pt;
46
+ font-weight: bold;
47
+ background-color: #F7F7F7;
48
+ border: 1px solid #CCC;
49
+ border-right-color: #999;
50
+ border-left-color: #999;
51
+ border-bottom-color: #999;
52
+ border-top-left-radius: 4px;
53
+ border-top-right-radius: 4px;
54
+ border-bottom-left-radius: 4px;
55
+ border-bottom-right-radius: 4px;
56
+ border-top-color: #999;
57
+ color: #666;
58
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
59
+ }
60
+ </style>
61
+ </head>
62
+
63
+ <body>
64
+ <div class="dialog">
65
+ <div>
66
+ <h1>Please select the instance you would like to launch.</h1>
67
+
68
+
69
+ <% @ids.each do |id| %>
70
+ <%= form_tag({:controller => "static", :action => "switch"}, method: "post") do %>
71
+
72
+ <%= submit_tag("#{id[0]} - #{id[1]}", :class => "submit")%>
73
+ <% end %>
74
+ <% end %>
75
+ </div>
76
+ </div>
77
+
78
+
79
+ </body></html>
data/config/routes.rb CHANGED
@@ -3,6 +3,8 @@ ZuoraConnect::Engine.routes.draw do
3
3
  get '/internal/data' => 'static#metrics'
4
4
  get '/invalid_session' => 'static#session_error', :as => :invalid_session
5
5
  get '/invalid_instance' => "static#invalid_app_instance_error", :as => :invalid_instance
6
+ match '/hallway/launch' => 'static#launch', via: :get
7
+ match '/hallway/switch' => 'static#switch', via: [:get, :post]
6
8
  post '/initialize_app' => 'static#initialize_app'
7
9
 
8
10
  namespace :api do
@@ -1,3 +1,3 @@
1
1
  module ZuoraConnect
2
- VERSION = "1.7.26"
2
+ VERSION = "1.7.27"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zuora_connect
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.26
4
+ version: 1.7.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Connect Team
@@ -264,6 +264,7 @@ files:
264
264
  - app/views/layouts/zuora_connect/application.html.erb
265
265
  - app/views/sql/refresh_aggregate_table.txt
266
266
  - app/views/zuora_connect/static/invalid_app_instance_error.html.erb
267
+ - app/views/zuora_connect/static/launch.html.erb
267
268
  - app/views/zuora_connect/static/session_error.html.erb
268
269
  - config/initializers/apartment.rb
269
270
  - config/initializers/object_method_hooks.rb