Commit 37bfcc1e authored by Mark Chao's avatar Mark Chao

Merge branch 'enable-deployments-filters' into 'master'

Enable deployments filters

See merge request gitlab-org/gitlab!46683
parents b2e75851 215d8f9a
...@@ -96,43 +96,41 @@ export default (IssuableTokenKeys, disableTargetBranchFilter = false) => { ...@@ -96,43 +96,41 @@ export default (IssuableTokenKeys, disableTargetBranchFilter = false) => {
IssuableTokenKeys.tokenKeysWithAlternative.splice(tokenPosition, 0, ...[approvedBy.token]); IssuableTokenKeys.tokenKeysWithAlternative.splice(tokenPosition, 0, ...[approvedBy.token]);
IssuableTokenKeys.conditions.push(...approvedBy.condition); IssuableTokenKeys.conditions.push(...approvedBy.condition);
if (gon?.features?.deploymentFilters) { const environmentToken = {
const environmentToken = { formattedKey: __('Environment'),
formattedKey: __('Environment'), key: 'environment',
key: 'environment', type: 'string',
type: 'string', param: '',
param: '', symbol: '',
symbol: '', icon: 'cloud-gear',
icon: 'cloud-gear', tag: 'environment',
tag: 'environment', };
};
const deployedBeforeToken = { const deployedBeforeToken = {
formattedKey: __('Deployed-before'), formattedKey: __('Deployed-before'),
key: 'deployed-before', key: 'deployed-before',
type: 'string', type: 'string',
param: '', param: '',
symbol: '', symbol: '',
icon: 'clock', icon: 'clock',
tag: 'deployed_before', tag: 'deployed_before',
}; };
const deployedAfterToken = { const deployedAfterToken = {
formattedKey: __('Deployed-after'), formattedKey: __('Deployed-after'),
key: 'deployed-after', key: 'deployed-after',
type: 'string', type: 'string',
param: '', param: '',
symbol: '', symbol: '',
icon: 'clock', icon: 'clock',
tag: 'deployed_after', tag: 'deployed_after',
}; };
IssuableTokenKeys.tokenKeys.push(environmentToken, deployedBeforeToken, deployedAfterToken); IssuableTokenKeys.tokenKeys.push(environmentToken, deployedBeforeToken, deployedAfterToken);
IssuableTokenKeys.tokenKeysWithAlternative.push( IssuableTokenKeys.tokenKeysWithAlternative.push(
environmentToken, environmentToken,
deployedBeforeToken, deployedBeforeToken,
deployedAfterToken, deployedAfterToken,
); );
}
}; };
...@@ -30,7 +30,6 @@ class GroupsController < Groups::ApplicationController ...@@ -30,7 +30,6 @@ class GroupsController < Groups::ApplicationController
before_action do before_action do
push_frontend_feature_flag(:vue_issuables_list, @group) push_frontend_feature_flag(:vue_issuables_list, @group)
push_frontend_feature_flag(:deployment_filters)
end end
before_action do before_action do
...@@ -181,8 +180,6 @@ class GroupsController < Groups::ApplicationController ...@@ -181,8 +180,6 @@ class GroupsController < Groups::ApplicationController
end end
def unfoldered_environment_names def unfoldered_environment_names
return render_404 unless Feature.enabled?(:deployment_filters)
respond_to do |format| respond_to do |format|
format.json do format.json do
render json: EnvironmentNamesFinder.new(@group, current_user).execute render json: EnvironmentNamesFinder.new(@group, current_user).execute
......
...@@ -48,7 +48,6 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo ...@@ -48,7 +48,6 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
before_action do before_action do
push_frontend_feature_flag(:vue_issuable_sidebar, @project.group) push_frontend_feature_flag(:vue_issuable_sidebar, @project.group)
push_frontend_feature_flag(:deployment_filters)
end end
around_action :allow_gitaly_ref_name_caching, only: [:index, :show, :discussions] around_action :allow_gitaly_ref_name_caching, only: [:index, :show, :discussions]
......
...@@ -317,8 +317,6 @@ class ProjectsController < Projects::ApplicationController ...@@ -317,8 +317,6 @@ class ProjectsController < Projects::ApplicationController
end end
def unfoldered_environment_names def unfoldered_environment_names
return render_404 unless Feature.enabled?(:deployment_filters)
respond_to do |format| respond_to do |format|
format.json do format.json do
render json: EnvironmentNamesFinder.new(@project, current_user).execute render json: EnvironmentNamesFinder.new(@project, current_user).execute
......
...@@ -155,19 +155,6 @@ class MergeRequestsFinder < IssuableFinder ...@@ -155,19 +155,6 @@ class MergeRequestsFinder < IssuableFinder
.or(table[:title].matches('(Draft)%')) .or(table[:title].matches('(Draft)%'))
end end
# rubocop: disable CodeReuse/ActiveRecord
def by_deployment(items)
return items unless deployment_id
items.includes(:deployment_merge_requests)
.where(deployment_merge_requests: { deployment_id: deployment_id })
end
# rubocop: enable CodeReuse/ActiveRecord
def deployment_id
@deployment_id ||= params[:deployment_id].presence
end
# Filter by merge requests that had been approved by specific users # Filter by merge requests that had been approved by specific users
# rubocop: disable CodeReuse/Finder # rubocop: disable CodeReuse/Finder
def by_approvals(items) def by_approvals(items)
...@@ -178,10 +165,6 @@ class MergeRequestsFinder < IssuableFinder ...@@ -178,10 +165,6 @@ class MergeRequestsFinder < IssuableFinder
# rubocop: enable CodeReuse/Finder # rubocop: enable CodeReuse/Finder
def by_deployments(items) def by_deployments(items)
# Until this feature flag is enabled permanently, we retain the old
# filtering behaviour/code.
return by_deployment(items) unless Feature.enabled?(:deployment_filters)
env = params[:environment] env = params[:environment]
before = params[:deployed_before] before = params[:deployed_before]
after = params[:deployed_after] after = params[:deployed_after]
......
---
title: Add merge requests filters for filtering by environments and deployment dates
merge_request: 46683
author:
type: added
---
name: deployment_filters
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/44041
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/267561
type: development
group: group::source code
default_enabled: false
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