diff options
author | Ash McKenzie <amckenzie@gitlab.com> | 2018-05-18 11:24:59 +1000 |
---|---|---|
committer | Ash McKenzie <amckenzie@gitlab.com> | 2019-05-27 14:28:52 +1000 |
commit | 31bcdea104b31c774ccb92acff8acaf4d0e86b9d (patch) | |
tree | 6f4e80f5598e1e3e52cc3054623cd6c8ca3f469e | |
parent | 2b60a67e1b2504ac9711593b6fed18b3d46fb2a4 (diff) | |
download | gitlab-ce-ash.mckenzie/add-flipper-ui.tar.gz |
Add Flipper UI to Admin areaash.mckenzie/add-flipper-ui
-rw-r--r-- | Gemfile | 1 | ||||
-rw-r--r-- | Gemfile.lock | 7 | ||||
-rw-r--r-- | app/controllers/admin/features_controller.rb | 4 | ||||
-rw-r--r-- | app/views/admin/features/show.html.haml | 11 | ||||
-rw-r--r-- | app/views/layouts/nav/sidebar/_admin.html.haml | 4 | ||||
-rw-r--r-- | config/routes.rb | 1 | ||||
-rw-r--r-- | config/routes/admin.rb | 1 | ||||
-rw-r--r-- | config/routes/flipper.rb | 4 |
8 files changed, 33 insertions, 0 deletions
@@ -433,6 +433,7 @@ gem 'toml-rb', '~> 1.0.0', require: false # Feature toggles gem 'flipper', '~> 0.13.0' +gem 'flipper-ui', '~> 0.13.0' gem 'flipper-active_record', '~> 0.13.0' gem 'flipper-active_support_cache_store', '~> 0.13.0' diff --git a/Gemfile.lock b/Gemfile.lock index 9a2411713c0..05c0452ccca 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -199,6 +199,7 @@ GEM encryptor (3.0.0) equalizer (0.0.11) erubi (1.8.0) + erubis (2.7.0) escape_utils (1.2.1) et-orbi (1.2.1) tzinfo @@ -229,6 +230,11 @@ GEM flipper-active_support_cache_store (0.13.0) activesupport (>= 3.2, < 6) flipper (~> 0.13.0) + flipper-ui (0.13.0) + erubis (~> 2.7.0) + flipper (~> 0.13.0) + rack (>= 1.4, < 3) + rack-protection (>= 1.5.3, < 2.1.0) flowdock (0.7.1) httparty (~> 0.7) multi_json @@ -1063,6 +1069,7 @@ DEPENDENCIES flipper (~> 0.13.0) flipper-active_record (~> 0.13.0) flipper-active_support_cache_store (~> 0.13.0) + flipper-ui (~> 0.13.0) flowdock (~> 0.7) fog-aliyun (~> 0.3) fog-aws (~> 3.3) diff --git a/app/controllers/admin/features_controller.rb b/app/controllers/admin/features_controller.rb new file mode 100644 index 00000000000..9df933b8772 --- /dev/null +++ b/app/controllers/admin/features_controller.rb @@ -0,0 +1,4 @@ +class Admin::FeaturesController < Admin::ApplicationController + def show + end +end diff --git a/app/views/admin/features/show.html.haml b/app/views/admin/features/show.html.haml new file mode 100644 index 00000000000..9fb6662b89d --- /dev/null +++ b/app/views/admin/features/show.html.haml @@ -0,0 +1,11 @@ +- @no_container = true +- page_title "Features" + +%div{ class: container_class } + %h3.page-title Features + %p.light GitLab uses the #{link_to "flipper", "https://featureflipper.com/"} library for feature flipping. + + %hr + + .panel.panel-default + %iframe{ src: flipper_path, width: '100%', height: 970, style: "border: 0" } diff --git a/app/views/layouts/nav/sidebar/_admin.html.haml b/app/views/layouts/nav/sidebar/_admin.html.haml index 83fe871285a..76cb83a0e33 100644 --- a/app/views/layouts/nav/sidebar/_admin.html.haml +++ b/app/views/layouts/nav/sidebar/_admin.html.haml @@ -69,6 +69,10 @@ = link_to admin_background_jobs_path, title: _('Background Jobs') do %span = _('Background Jobs') + = nav_link(controller: :features) do + = link_to admin_features_path, title: 'Features' do + %span + = _('Features') = nav_link(controller: :logs) do = link_to admin_logs_path, title: _('Logs') do %span diff --git a/config/routes.rb b/config/routes.rb index f5957f43655..b17f7f9a106 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -113,6 +113,7 @@ Rails.application.routes.draw do draw :api draw :sidekiq + draw :flipper draw :help draw :snippets diff --git a/config/routes/admin.rb b/config/routes/admin.rb index bc19219a0b8..8cf38bdf20f 100644 --- a/config/routes/admin.rb +++ b/config/routes/admin.rb @@ -72,6 +72,7 @@ namespace :admin do resource :health_check, controller: 'health_check', only: [:show] resource :background_jobs, controller: 'background_jobs', only: [:show] + resource :features, controller: 'features', only: [:show] resource :system_info, controller: 'system_info', only: [:show] resources :requests_profiles, only: [:index, :show], param: :name, constraints: { name: /.+\.html/ } diff --git a/config/routes/flipper.rb b/config/routes/flipper.rb new file mode 100644 index 00000000000..f0731a7f512 --- /dev/null +++ b/config/routes/flipper.rb @@ -0,0 +1,4 @@ +constraint = lambda { |request| request.env['warden'].authenticate? && request.env['warden'].user.admin? } +constraints constraint do + mount Flipper::UI.app(Flipper), at: '/admin/flipper', as: :flipper +end |