mno-enterprise-api 2.0.9 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/mno_enterprise/config.js.coffee.erb +10 -0
  3. data/app/controllers/mno_enterprise/impersonate_controller.rb +5 -13
  4. data/app/controllers/mno_enterprise/jpi/v1/admin/audit_events_controller.rb +2 -2
  5. data/app/controllers/mno_enterprise/jpi/v1/admin/organizations_controller.rb +1 -1
  6. data/app/controllers/mno_enterprise/jpi/v1/admin/theme_controller.rb +109 -0
  7. data/app/controllers/mno_enterprise/jpi/v1/admin/users_controller.rb +1 -1
  8. data/app/controllers/mno_enterprise/jpi/v1/app_instances_sync_controller.rb +2 -2
  9. data/app/controllers/mno_enterprise/jpi/v1/impac/widgets_controller.rb +59 -1
  10. data/app/controllers/mno_enterprise/status_controller.rb +2 -4
  11. data/app/views/mno_enterprise/auth/confirmations/{default/_form.html.haml → _form.html.haml} +13 -17
  12. data/app/views/mno_enterprise/auth/confirmations/lounge.html.haml +32 -4
  13. data/app/views/mno_enterprise/auth/confirmations/new.html.haml +2 -2
  14. data/app/views/mno_enterprise/auth/confirmations/show.html.haml +10 -4
  15. data/app/views/mno_enterprise/auth/passwords/edit.html.haml +2 -13
  16. data/app/views/mno_enterprise/auth/passwords/new.html.haml +2 -2
  17. data/app/views/mno_enterprise/auth/registrations/{default/_form.html.haml → _form.html.haml} +12 -11
  18. data/app/views/mno_enterprise/auth/registrations/new.html.haml +11 -4
  19. data/app/views/mno_enterprise/auth/sessions/{default/_form.html.haml → _form.html.haml} +5 -4
  20. data/app/views/mno_enterprise/auth/sessions/new.html.haml +11 -4
  21. data/app/views/mno_enterprise/auth/shared/_links.html.haml +6 -6
  22. data/app/views/mno_enterprise/auth/unlocks/new.html.haml +3 -2
  23. data/app/views/mno_enterprise/jpi/v1/current_users/show.json.jbuilder +4 -2
  24. data/app/views/mno_enterprise/jpi/v1/impac/kpis/_kpi.json.jbuilder +1 -1
  25. data/app/views/mno_enterprise/jpi/v1/organizations/_credit_card.json.jbuilder +2 -2
  26. data/app/views/mno_enterprise/pages/app_access_unauthorized.html.haml +4 -7
  27. data/app/views/mno_enterprise/pages/app_logout.html.haml +3 -6
  28. data/app/views/mno_enterprise/pages/billing_details_required.html.haml +4 -7
  29. data/app/views/mno_enterprise/provision/_provision_apps.html.haml +7 -9
  30. data/app/views/mno_enterprise/provision/_select_organization.html.haml +4 -4
  31. data/app/views/mno_enterprise/webhook/o_auth/authorize.html.haml +4 -4
  32. data/app/views/mno_enterprise/webhook/o_auth/providers/myob.html.haml +12 -11
  33. data/app/views/mno_enterprise/webhook/o_auth/providers/xero.html.haml +11 -10
  34. data/config/initializers/sprockets.rb +11 -0
  35. data/config/routes.rb +6 -1
  36. data/lib/mno_enterprise/api/engine.rb +10 -0
  37. data/lib/mno_enterprise/concerns/controllers/org_invites_controller.rb +2 -6
  38. data/lib/mno_enterprise/concerns/controllers/pages_controller.rb +1 -1
  39. data/lib/mno_enterprise/concerns/controllers/provision_controller.rb +1 -7
  40. data/lib/mno_enterprise/concerns/controllers/webhook/o_auth_controller.rb +15 -1
  41. data/lib/mno_enterprise/concerns/mailers/system_notification_mailer.rb +1 -2
  42. data/lib/tasks/non_digested_assets.rake +46 -0
  43. data/spec/controllers/mno_enterprise/impersonate_controller_spec.rb +4 -15
  44. data/spec/controllers/mno_enterprise/jpi/v1/app_instances_sync_controller_spec.rb +0 -8
  45. data/spec/controllers/mno_enterprise/jpi/v1/current_users_controller_spec.rb +2 -4
  46. data/spec/controllers/mno_enterprise/jpi/v1/impac/kpis_controller_spec.rb +2 -2
  47. data/spec/controllers/mno_enterprise/org_invites_controller_spec.rb +19 -46
  48. data/spec/controllers/mno_enterprise/status_controller_spec.rb +0 -4
  49. data/spec/controllers/mno_enterprise/webhook/o_auth_controller_spec.rb +13 -2
  50. data/spec/routing/mno_enterprise/{impersonate_controller_routing.spec.rb → impersonate_controller_routing_spec.rb} +1 -1
  51. data/spec/routing/mno_enterprise/jpi/v1/admin/theme_controller_routing_spec.rb +15 -0
  52. metadata +57 -63
  53. data/app/views/mno_enterprise/auth/confirmations/default/_lounge.html.haml +0 -34
  54. data/app/views/mno_enterprise/auth/confirmations/default/_show.html.haml +0 -10
  55. data/app/views/mno_enterprise/auth/confirmations/material/_form.html.haml +0 -44
  56. data/app/views/mno_enterprise/auth/confirmations/material/_lounge.html.haml +0 -18
  57. data/app/views/mno_enterprise/auth/confirmations/material/_show.html.haml +0 -21
  58. data/app/views/mno_enterprise/auth/registrations/default/_new.html.haml +0 -11
  59. data/app/views/mno_enterprise/auth/registrations/material/_form.html.haml +0 -30
  60. data/app/views/mno_enterprise/auth/registrations/material/_new.html.haml +0 -10
  61. data/app/views/mno_enterprise/auth/sessions/default/_new.html.haml +0 -11
  62. data/app/views/mno_enterprise/auth/sessions/material/_form.html.haml +0 -26
  63. data/app/views/mno_enterprise/auth/sessions/material/_new.html.haml +0 -11
  64. data/lib/mno_enterprise/concerns/controllers/jpi/v1/impac/widgets_controller.rb +0 -72
@@ -1,34 +0,0 @@
1
- .banners.promo.dark.darkblue.confirmation-lounge
2
- .container
3
- .row
4
- .col-md-8.col-md-offset-2
5
- .row
6
- .align-center
7
- %i.fa.fa-envelope
8
- %h4 Congratulations! We've sent you a confirmation link, please check your email inbox.
9
- %h5 If you did not receive the email please click resend.
10
-
11
- %div{ 'ng-init' => "email = '#{@resource.email}'"}
12
- = form_for(@resource, :as => resource_name, :url => mno_enterprise.user_confirmation_path, :html => { 'name' => 'form', :class => 'dark form-horizontal', :autocomplete => "off" }) do |f|
13
- - unless devise_error_messages!.empty?
14
- %div
15
- .alert.alert-error
16
- %button.close{ 'data-dismiss' => "alert" } ×
17
- = devise_error_messages!
18
- .spacer2
19
- .form-group
20
- .col-sm-6.col-sm-offset-2
21
- .input-prepend
22
- = f.email_field :email, :placeholder => "Email", :required => true, 'ng-model' => 'email', :class => 'input-xlarge'
23
- .col-sm-2
24
- %button{ :class => "btn btn-lg btn-warning", :type => "submit", 'ng-click' => 'hasClicked = true', 'ng-disabled' => 'form.$invalid', 'ng-hide' => 'hasClicked' } Resend!
25
- %img{ class: 'loader-sm', 'ng-src' => asset_path('mno_enterprise/loader-32x32-bg-main.gif'), 'ng-show' => 'hasClicked' }
26
-
27
- .spacer2
28
- .row
29
- .col-md-12
30
- .align-center
31
- %h5
32
- Or if you prefer you can send an email to our
33
- = mail_to support_email, "customer care service", subject: "Signup Verification"
34
- directly and we'll activate it for you.
@@ -1,10 +0,0 @@
1
- .registration
2
- .container
3
- .row
4
- //.col-md-6.col-md-offset-3
5
- .login-box-wrapper
6
- .login-box-title
7
- %h2 Almost there
8
- .login-box
9
- .brand-logo
10
- = render "mno_enterprise/auth/confirmations/default/form"
@@ -1,44 +0,0 @@
1
- %div{ 'ng-init' => "user = { $pwdScore: {}, name: '#{resource.name}', surname: '#{resource.surname}' }" }
2
-
3
- = form_for(resource, as: resource_name, :url => mno_enterprise.user_confirmation_finalize_path, :html => { 'name' => 'loginForm', :class => 'text-center' }) do |f|
4
- = f.hidden_field :confirmation_token, value: @confirmation_token
5
-
6
- %div{ layout: '', 'layout-sm' => 'column' }
7
- %md-input-container{ flex: '' }
8
- %label Name
9
- = f.text_field :name, required: true, 'ng-model' => 'user.name'
10
-
11
- %md-input-container{ flex: '' }
12
- %label Surname
13
- = f.text_field :surname, required: true, 'ng-model' => 'user.surname'
14
-
15
-
16
-
17
- - if @phone_required && MnoEnterprise.style.devise.phone_required
18
- %div{ layout: '', 'layout-sm' => 'column' }
19
-
20
- %md-input-container
21
- %md-select{ placeholder: "Ext.", 'ng-model' => "user.phone_country_code", style: 'line-height: 26px;' }
22
- %md-option{ 'ng-value' => 'opt.alpha2', 'ng-repeat' => "opt in #{ Country.all.map {|cntry, alpha2| {alpha2: alpha2, code: Country.new(alpha2).country_code} }.to_json }" }
23
- {{ opt.alpha2 }} +{{ opt.code }}
24
- = f.hidden_field :phone_country_code, 'ng-model' => 'user.phone_country_code'
25
-
26
- %md-input-container{ flex: '' }
27
- %label Phone
28
- = f.text_field :phone, required: true, 'ng-model' => 'user.phone_number'
29
-
30
- %div{'mno-password' => 'user', form: "loginForm"}
31
-
32
-
33
- %div
34
- %button{ class: "md-raised md-accent", 'md-button' => true, type: "submit", 'ng-click' => 'hasClicked = true', 'ng-disabled' => 'loginForm.$invalid' } Create Account
35
-
36
- %br
37
-
38
- %div
39
- %p
40
- By clicking 'Create Account' you are agreeing to
41
- = "#{MnoEnterprise.app_name}'s"
42
- Terms of Use and Privacy Policy
43
-
44
- %md-progress-linear{ 'md-mode' => "indeterminate", 'ng-show' => 'hasClicked' }
@@ -1,18 +0,0 @@
1
- .registration-material
2
- .action-box{ layout: "row", 'layout-align' => "center center" }
3
-
4
- .md-whiteframe-z1{ layout: "column", flex: '33' }
5
-
6
- %md-toolbar.success
7
- .md-toolbar-tools
8
- %md-icon{ 'md-font-icon' => 'fa fa-check-circle', style: 'font-size: 28px; margin-right: 10px;' }
9
- %h3 Thanks for signing up!
10
- %span{ flex: '' }
11
-
12
- %md-content{ "layout-padding" => "", style: 'min-height: 300px; padding: 40px; text-align: left;' }
13
- %p
14
- We have just sent an email to
15
- = @resource.email
16
-
17
- %p
18
- Please check your email and click on the 'Verify my Account' link.
@@ -1,21 +0,0 @@
1
- .registration-material
2
- .action-box{ layout: "row", 'layout-align' => "center center" }
3
- %md-content.md-whiteframe-z1{ "layout-padding" => "", flex: '33' }
4
- %div{ layout: 'row', 'layout-align' => 'center center' }
5
- %h2 Verify my account
6
-
7
- %div{ layout: 'column' }
8
- = render "mno_enterprise/auth/confirmations/material/form"
9
-
10
-
11
-
12
- / .registration
13
- / .container
14
- / .row
15
- / //.col-md-6.col-md-offset-3
16
- / .login-box-wrapper
17
- / .login-box-title
18
- / %h2 Almost there
19
- / .login-box
20
- / .brand-logo
21
- / = render "mno_enterprise/auth/confirmations/material/form"
@@ -1,11 +0,0 @@
1
- .registration
2
- .container
3
- .row
4
- .login-box-wrapper
5
- .login-box-title
6
- %h2 Sign Up
7
- .login-box
8
- .brand-logo
9
- = render "mno_enterprise/auth/registrations/default/form"
10
- %hr
11
- = render "mno_enterprise/auth/shared/links"
@@ -1,30 +0,0 @@
1
- %div{ 'ng-init' => "user = { $pwdScore: {}, email: '#{params['email']}' }" }
2
-
3
- = form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { 'name' => 'form', :class => 'form-horizontal autofill-detect', :autocomplete => "off" }) do |f|
4
-
5
- - unless devise_error_messages!.empty?
6
- .row
7
- .alert.alert-error
8
- %button.close ×
9
- = devise_error_messages!
10
-
11
- %md-input-container
12
- %label Email
13
- = f.email_field :email, :placeholder => "Email", required: true, 'ng-model' => 'user.email'
14
-
15
- %br
16
-
17
- %md-input-container
18
- %label Company
19
- = f.text_field :company, placeholder: "Company", required: true, 'ng-model' => 'user.company'
20
-
21
- %br/
22
- %md-checkbox{ 'ng-model' => 'user.acceptTos', name: 'tos' }
23
- I accept the
24
- = link_to "Terms of Use", MnoEnterprise.router.terms_url, :target => '_blank'
25
-
26
- %br
27
-
28
- %div
29
- %button{ class: "md-raised md-accent", 'md-button' => true, type: "submit", 'ng-click' => 'hasClicked = true', 'ng-disabled' => 'form.$invalid' } Create my account!
30
- %md-progress-linear{ 'md-mode' => "indeterminate", 'ng-show' => 'hasClicked' }
@@ -1,10 +0,0 @@
1
- .registration-material
2
- .action-box{ layout: "row", 'layout-align' => "center center" }
3
- %md-content.md-whiteframe-z1{ "layout-padding" => "", flex: '33' }
4
- %div{ layout: 'row', 'layout-align' => 'center center' }
5
- %h2 Sign Up
6
-
7
- %div{ layout: 'column' }
8
- = render "mno_enterprise/auth/registrations/material/form"
9
- %hr
10
- = render "mno_enterprise/auth/shared/links"
@@ -1,11 +0,0 @@
1
- .registration
2
- .container
3
- .row
4
- .login-box-wrapper
5
- .login-box-title
6
- %h2 Sign In
7
- .login-box
8
- .brand-logo
9
- = render "mno_enterprise/auth/sessions/default/form"
10
- %hr
11
- = render "mno_enterprise/auth/shared/links"
@@ -1,26 +0,0 @@
1
- %div{ 'ng-init' => "user = { }" }
2
-
3
- = form_for(resource, :as => resource_name, :url => "#{session_path(resource_name)}?ltype=#{@login_type}", :html => { 'name' => 'loginForm', :class => 'autofill-detect text-center' }) do |f|
4
-
5
- %md-input-container
6
- %label Email
7
- = f.email_field :email, :placeholder => "Email", :required => true, 'ng-model' => 'user.email'
8
-
9
- %br
10
-
11
- %md-input-container
12
- %label Password
13
- = f.password_field :password, :placeholder => "Password", :required => true, 'ng-model' => 'user.password', :autocomplete => "off"
14
-
15
- - if devise_mapping.rememberable? && MnoEnterprise.style.devise.remember_checkbox_shown
16
- %br/
17
- %md-checkbox{ 'ng-model' => 'user.rememberMe', name: 'user[remember_me]' }
18
- Remember Me
19
-
20
- %br
21
-
22
- %div
23
- %button{ class: "md-raised md-accent", 'md-button' => true, type: "submit", 'ng-click' => 'hasClicked = true', 'ng-disabled' => 'loginForm.$invalid' } Sign in
24
- %md-progress-linear{ 'md-mode' => "indeterminate", 'ng-show' => 'hasClicked' }
25
-
26
-
@@ -1,11 +0,0 @@
1
- .registration-material
2
- .action-box{ layout: "row", 'layout-align' => "center center" }
3
- %md-content.md-whiteframe-z1{ "layout-padding" => "", flex: '33' }
4
- %div{ layout: 'row', 'layout-align' => 'center center' }
5
- %h2 Log in
6
-
7
- %div{ layout: 'column' }
8
- = render "mno_enterprise/auth/sessions/material/form"
9
- %hr
10
- = render "mno_enterprise/auth/shared/links"
11
-
@@ -1,72 +0,0 @@
1
- module MnoEnterprise::Concerns::Controllers::Jpi::V1::Impac::WidgetsController
2
- extend ActiveSupport::Concern
3
-
4
- #==================================================================
5
- # Included methods
6
- #==================================================================
7
- # 'included do' causes the included code to be evaluated in the
8
- # context where it is included rather than being executed in the module's context
9
- included do
10
- respond_to :json
11
- end
12
-
13
- #==================================================================
14
- # Instance methods
15
- #==================================================================
16
- # POST /mnoe/jpi/v1/impac/dashboards/:id/widgets
17
- # -> POST /api/mnoe/v1/dashboards/:id/widgets
18
- def create
19
- if widgets
20
- if @widget = widgets.create(format_attrs(['widget_category','metadata']))
21
- MnoEnterprise::EventLogger.info('widget_create', current_user.id, 'Widget Creation', nil, @widget)
22
- @nocontent = true # no data fetch from Connec!
23
- render 'show'
24
- else
25
- render json: @widget.errors, status: :bad_request
26
- end
27
- else
28
- render json: { errors: "Dashboard id #{params[:id]} doesn't exist" }, status: :not_found
29
- end
30
- end
31
-
32
- # PUT /mnoe/jpi/v1/impac/widgets/:id
33
- def update
34
- if widget.update(format_attrs(['name','metadata']))
35
- @nocontent = !params['metadata']
36
- render 'show'
37
- else
38
- render json: @widget.errors, status: :bad_request
39
- end
40
- end
41
-
42
- # DELETE /mnoe/jpi/v1/impac/dashboards/1
43
- def destroy
44
- if widget.destroy
45
- MnoEnterprise::EventLogger.info('widget_delete', current_user.id, 'Widget Deletion', nil, widget)
46
- head status: :ok
47
- else
48
- render json: 'Unable to destroy widget', status: :bad_request
49
- end
50
- end
51
-
52
-
53
- #=================================================
54
- # Private methods
55
- #=================================================
56
- private
57
-
58
- def widget
59
- @widget ||= MnoEnterprise::Impac::Widget.find(params[:id])
60
- end
61
-
62
- def widgets
63
- @widgets ||= MnoEnterprise::Impac::Dashboard.find(params[:dashboard_id]).widgets
64
- end
65
-
66
- def format_attrs(whitelist)
67
- attrs = (params[:widget] || {}).select { |k,v| whitelist.include?(k.to_s) }
68
- attrs['settings'] = widget ? widget.settings || {} : {}
69
- attrs['settings'].merge!(attrs['metadata']) if attrs['metadata']
70
- attrs.except!('metadata')
71
- end
72
- end