diff options
author | Ash McKenzie <amckenzie@gitlab.com> | 2018-05-18 11:24:59 +1000 |
---|---|---|
committer | Ash McKenzie <amckenzie@gitlab.com> | 2019-05-30 16:05:13 +1000 |
commit | 390d4833ce62e6101d34287d757efe6175e55eee (patch) | |
tree | 658ac0a293797dbce57df5de9de0a1266548ce4d | |
parent | 42df87c878430b46e3eb29f55caa2d16a8f351d7 (diff) | |
download | gitlab-ce-ashmckenzie/add-flipper-ui.tar.gz |
Add Flipper UI to Admin areaashmckenzie/add-flipper-ui
-rw-r--r-- | Gemfile | 1 | ||||
-rw-r--r-- | Gemfile.lock | 7 | ||||
-rw-r--r-- | app/controllers/admin/features_controller.rb | 6 | ||||
-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 | 5 |
8 files changed, 36 insertions, 0 deletions
@@ -435,6 +435,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 3f85fa958bd..f0db36158e0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -201,6 +201,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 @@ -231,6 +232,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 @@ -1067,6 +1073,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..2c7b46b9e6e --- /dev/null +++ b/app/controllers/admin/features_controller.rb @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +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 ae79beb1dba..27044974d10 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..17b80caea63 --- /dev/null +++ b/config/routes/flipper.rb @@ -0,0 +1,5 @@ +constraint = lambda { |request| request.env['warden'].authenticate? && request.env['warden'].user.admin? } + +constraints constraint do + mount Flipper::UI.app(Feature.flipper), at: '/admin/flipper', as: :flipper +end |