Commit 47b7970a authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'jira-issue-view-init' into 'master'

Render empty Jira issue in GitLab (behind feature flag)

See merge request gitlab-org/gitlab!52446
parents d27bc0c3 52d90b2c
---
name: jira_issues_show_integration
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/52446
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/299832
milestone: '13.9'
type: development
group: group::ecosystem
default_enabled: false
<script>
export default {
name: 'JiraIssuesShow',
};
</script>
<template>
<div></div>
</template>
import Vue from 'vue';
import JiraIssuesShowApp from './components/jira_issues_show_root.vue';
export default function initJiraIssueShow({ mountPointSelector }) {
const mountPointEl = document.querySelector(mountPointSelector);
if (!mountPointEl) {
return null;
}
return new Vue({
el: mountPointEl,
render: (createElement) => createElement(JiraIssuesShowApp),
});
}
import initJiraIssueShow from 'ee/integrations/jira/issues_show/jira_issues_show_bundle';
initJiraIssueShow({ mountPointSelector: '.js-jira-issues-show-app' });
...@@ -9,6 +9,7 @@ module Projects ...@@ -9,6 +9,7 @@ module Projects
include SortingPreference include SortingPreference
before_action :check_feature_enabled! before_action :check_feature_enabled!
before_action :check_issues_show_enabled!, only: :show
before_action do before_action do
push_frontend_feature_flag(:jira_issues_integration, project, type: :licensed, default_enabled: true) push_frontend_feature_flag(:jira_issues_integration, project, type: :licensed, default_enabled: true)
...@@ -76,6 +77,10 @@ module Projects ...@@ -76,6 +77,10 @@ module Projects
return render_404 unless project.jira_issues_integration_available? && project.jira_service.issues_enabled return render_404 unless project.jira_issues_integration_available? && project.jira_service.issues_enabled
end end
def check_issues_show_enabled!
render_404 unless ::Feature.enabled?(:jira_issues_show_integration, @project, default_enabled: :yaml)
end
# Return the informational message to the user # Return the informational message to the user
def render_integration_error(exception) def render_integration_error(exception)
render json: { errors: [exception.message] }, status: :bad_request render json: { errors: [exception.message] }, status: :bad_request
......
...@@ -110,7 +110,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do ...@@ -110,7 +110,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
namespace :integrations do namespace :integrations do
namespace :jira do namespace :jira do
resources :issues, only: [:index] resources :issues, only: [:index, :show]
end end
end end
......
...@@ -172,4 +172,30 @@ RSpec.describe Projects::Integrations::Jira::IssuesController do ...@@ -172,4 +172,30 @@ RSpec.describe Projects::Integrations::Jira::IssuesController do
end end
end end
end end
describe 'GET #show' do
context 'when `jira_issues_show_integration` feature is disabled' do
before do
stub_feature_flags(jira_issues_show_integration: false)
end
it 'returns 404 status' do
get :show, params: { namespace_id: project.namespace, project_id: project, id: 1 }
expect(response).to have_gitlab_http_status(:not_found)
end
end
context 'when `jira_issues_show_integration` feature is enabled' do
before do
stub_feature_flags(jira_issues_show_integration: true)
end
it 'renders `show` template' do
get :show, params: { namespace_id: project.namespace, project_id: project, id: 1 }
expect(response).to render_template(:show)
end
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