Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-23 00:06:42 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-23 00:06:42 +0300
commitd5e0416021aa6de53b89f9d415f368226d9326e5 (patch)
tree9a3e3bd6d1aac10cfde7f0079f784a489491a48b /app
parent24fe7aa2aa199b2aace0cfec26d744f51d7e2167 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/helpers/application_settings_helper.rb4
-rw-r--r--app/models/application_setting.rb5
-rw-r--r--app/models/application_setting_implementation.rb4
-rw-r--r--app/views/admin/application_settings/_pendo.html.haml24
-rw-r--r--app/views/admin/application_settings/integrations.html.haml3
-rw-r--r--app/views/layouts/_head.html.haml3
-rw-r--r--app/views/layouts/_pendo.html.haml17
7 files changed, 56 insertions, 4 deletions
diff --git a/app/helpers/application_settings_helper.rb b/app/helpers/application_settings_helper.rb
index df17b82412f..7b5a1a02b98 100644
--- a/app/helpers/application_settings_helper.rb
+++ b/app/helpers/application_settings_helper.rb
@@ -292,7 +292,9 @@ module ApplicationSettingsHelper
:snowplow_site_id,
:push_event_hooks_limit,
:push_event_activities_limit,
- :custom_http_clone_url_root
+ :custom_http_clone_url_root,
+ :pendo_enabled,
+ :pendo_url
]
end
diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb
index a07933d4975..4ecc9bc2153 100644
--- a/app/models/application_setting.rb
+++ b/app/models/application_setting.rb
@@ -104,6 +104,11 @@ class ApplicationSetting < ApplicationRecord
hostname: true,
if: :snowplow_enabled
+ validates :pendo_url,
+ presence: true,
+ public_url: true,
+ if: :pendo_enabled
+
validates :max_attachment_size,
presence: true,
numericality: { only_integer: true, greater_than: 0 }
diff --git a/app/models/application_setting_implementation.rb b/app/models/application_setting_implementation.rb
index 0c0ffb67c9a..0312183d11f 100644
--- a/app/models/application_setting_implementation.rb
+++ b/app/models/application_setting_implementation.rb
@@ -129,7 +129,9 @@ module ApplicationSettingImplementation
snowplow_cookie_domain: nil,
snowplow_enabled: false,
snowplow_site_id: nil,
- custom_http_clone_url_root: nil
+ custom_http_clone_url_root: nil,
+ pendo_enabled: false,
+ pendo_url: nil
}
end
diff --git a/app/views/admin/application_settings/_pendo.html.haml b/app/views/admin/application_settings/_pendo.html.haml
new file mode 100644
index 00000000000..c165610b332
--- /dev/null
+++ b/app/views/admin/application_settings/_pendo.html.haml
@@ -0,0 +1,24 @@
+- expanded = true if !@application_setting.valid? && @application_setting.errors.any? { |k| k.to_s.start_with?('pendo_') }
+%section.settings.as-pendo.no-animate#js-pendo-settings{ class: ('expanded' if expanded) }
+ .settings-header
+ %h4
+ = _('Pendo')
+ %button.btn.btn-default.js-settings-toggle{ type: 'button' }
+ = expanded ? _('Collapse') : _('Expand')
+ %p
+ = _('Configure the %{link} integration.').html_safe % { link: link_to('Pendo', 'https://www.pendo.io/', target: '_blank') }
+ .settings-content
+
+ = form_for @application_setting, url: integrations_admin_application_settings_path(anchor: 'js-pendo-settings'), html: { class: 'fieldset-form' } do |f|
+ = form_errors(@application_setting) if expanded
+
+ %fieldset
+ .form-group
+ .form-check
+ = f.check_box :pendo_enabled, class: 'form-check-input'
+ = f.label :pendo_enabled, _('Enable pendo tracking'), class: 'form-check-label'
+ .form-group
+ = f.label :pendo_url, _('Pendo endpoint'), class: 'label-light'
+ = f.text_field :pendo_url, class: 'form-control', placeholder: 'https://cdn.pendo.io/agent/static/your-api-key/pendo.js'
+
+ = f.submit _('Save changes'), class: 'btn btn-success'
diff --git a/app/views/admin/application_settings/integrations.html.haml b/app/views/admin/application_settings/integrations.html.haml
index 310e86b1377..399f3566cef 100644
--- a/app/views/admin/application_settings/integrations.html.haml
+++ b/app/views/admin/application_settings/integrations.html.haml
@@ -28,4 +28,5 @@
.settings-content
= render 'third_party_offers', application_setting: @application_setting
-= render_if_exists 'admin/application_settings/snowplow', expanded: expanded_by_default?
+= render 'admin/application_settings/snowplow', expanded: expanded_by_default?
+= render 'admin/application_settings/pendo'
diff --git a/app/views/layouts/_head.html.haml b/app/views/layouts/_head.html.haml
index b8c9f0ae1e8..d7319b18092 100644
--- a/app/views/layouts/_head.html.haml
+++ b/app/views/layouts/_head.html.haml
@@ -89,4 +89,5 @@
= render 'layouts/google_analytics' if extra_config.has_key?('google_analytics_id')
= render 'layouts/piwik' if extra_config.has_key?('piwik_url') && extra_config.has_key?('piwik_site_id')
- = render_if_exists 'layouts/snowplow'
+ = render 'layouts/snowplow'
+ = render 'layouts/pendo'
diff --git a/app/views/layouts/_pendo.html.haml b/app/views/layouts/_pendo.html.haml
new file mode 100644
index 00000000000..08b1acbe3d3
--- /dev/null
+++ b/app/views/layouts/_pendo.html.haml
@@ -0,0 +1,17 @@
+- return unless Gitlab::CurrentSettings.pendo_enabled?
+
+= javascript_tag nonce: true do
+ :plain
+ ;var trackable = !['1', 'yes'].includes(window.doNotTrack || navigator.doNotTrack || navigator.msDoNotTrack);
+ if (trackable){
+ (function(p,e,n,d,o){var v,w,x,y,z;o=p[d]=p[d]||{};o._q=[];
+ v=['initialize','identify','updateOptions','pageLoad'];for(w=0,x=v.length;w<x;++w)(function(m){
+ o[m]=o[m]||function(){o._q[m===v[0]?'unshift':'push']([m].concat([].slice.call(arguments,0)));};})(v[w]);
+ y=e.createElement(n);y.async=!0;y.src='#{Gitlab::CurrentSettings.pendo_url}';
+ z=e.getElementsByTagName(n)[0];z.parentNode.insertBefore(y,z);})(window,document,'script','pendo');
+
+ pendo.initialize({
+ visitor: {
+ id: '#{current_user&.id}',
+ }
+ });};