Commit bd481e29 authored by Jose Vargas's avatar Jose Vargas

Move feature flag to features helper

This also addresses some smaller code concerns
parent e5f104c1
......@@ -54,15 +54,15 @@ export default {
};
</script>
<template>
<div class="gl-display-flex gl-pr-4">
<div class="gl-display-flex gl-pr-3">
<gl-search-box-by-click
v-model="searchTerm"
:placeholder="$options.i18n.searchPlaceholder"
class="gl-pr-4"
class="gl-pr-3"
data-testid="tag-search"
@submit="visitUrlFromOption(selectedKey)"
/>
<gl-dropdown :text="selectedSortMethod" data-testid="tags-dropdown">
<gl-dropdown :text="selectedSortMethod" right data-testid="tags-dropdown">
<gl-dropdown-item
v-for="(value, key) in sortOptions"
:key="key"
......
......@@ -10,7 +10,7 @@ class Projects::TagsController < Projects::ApplicationController
before_action :authorize_download_code!
before_action :authorize_admin_tag!, only: [:new, :create, :destroy]
before_action do
push_frontend_feature_flag(:gldropdown_tags)
push_frontend_feature_flag(:gldropdown_tags, default_enabled: :yaml)
end
feature_category :source_code_management, [:index, :show, :new, :destroy]
......
......@@ -47,8 +47,4 @@ module TagsHelper
okTitle: s_('TagsPage|Delete tag')
}.to_json
end
def gldropdown_tags_enabled?
Feature.enabled?(:gldropdown_tags)
end
end
......@@ -9,7 +9,7 @@
= s_('TagsPage|Tags give the ability to mark specific points in history as being important')
.nav-controls
- if !gldropdown_tags_enabled?
- unless Gitlab::Ci::Features.gldropdown_tags_enabled?
= form_tag(filter_tags_path, method: :get) do
= search_field_tag :search, params[:search], { placeholder: s_('TagsPage|Filter by tag name'), id: 'tag-search', class: 'form-control search-text-input input-short', spellcheck: false }
......
......@@ -63,6 +63,10 @@ module Gitlab
def self.multiple_cache_per_job?
::Feature.enabled?(:multiple_cache_per_job, default_enabled: :yaml)
end
def self.gldropdown_tags_enabled?
::Feature.enabled?(:gldropdown_tags, default_enabled: :yaml)
end
end
end
end
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe TagsHelper do
describe '#gl_dropdown_tags_enabled?' do
context 'when the feature is enabled' do
it 'returns true' do
expect(helper.gldropdown_tags_enabled?).to be_truthy
end
end
context 'when the feature is disabled' do
it 'returns false' do
stub_feature_flags(gldropdown_tags: false)
expect(helper.gldropdown_tags_enabled?).to be_falsy
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment