Commit 89f29ade authored by Sean McGivern's avatar Sean McGivern

Merge branch '13020-add-new-jira-connect-app-ui-feature-flag' into 'master'

Add feature flag and boilerplate code for new Jira Connect app UI

See merge request gitlab-org/gitlab!50692
parents eef6e638 f1758b84
<script> <script>
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
export default { export default {
name: 'JiraConnectApp', name: 'JiraConnectApp',
mixins: [glFeatureFlagsMixin()],
computed: { computed: {
state() { state() {
return this.$root.$data.state || {}; return this.$root.$data.state || {};
...@@ -8,9 +11,17 @@ export default { ...@@ -8,9 +11,17 @@ export default {
error() { error() {
return this.state.error; return this.state.error;
}, },
showNewUi() {
return this.glFeatures.newJiraConnectUi;
},
}, },
}; };
</script> </script>
<template> <template>
<div></div> <div>
<div v-if="showNewUi">
<h3>{{ s__('Integrations|Linked namespaces') }}</h3>
</div>
</div>
</template> </template>
import Vue from 'vue'; import Vue from 'vue';
import $ from 'jquery'; import $ from 'jquery';
import setConfigs from '@gitlab/ui/dist/config';
import Translate from '~/vue_shared/translate';
import GlFeatureFlagsPlugin from '~/vue_shared/gl_feature_flags_plugin';
import App from './components/app.vue'; import App from './components/app.vue';
import { addSubscription, removeSubscription } from '~/jira_connect/api'; import { addSubscription, removeSubscription } from '~/jira_connect/api';
...@@ -28,12 +32,14 @@ const initJiraFormHandlers = () => { ...@@ -28,12 +32,14 @@ const initJiraFormHandlers = () => {
alert(error); alert(error);
}; };
AP.getLocation((location) => { if (typeof AP.getLocation === 'function') {
$('.js-jira-connect-sign-in').each(function updateSignInLink() { AP.getLocation((location) => {
const updatedLink = `${$(this).attr('href')}?return_to=${location}`; $('.js-jira-connect-sign-in').each(function updateSignInLink() {
$(this).attr('href', updatedLink); const updatedLink = `${$(this).attr('href')}?return_to=${location}`;
$(this).attr('href', updatedLink);
});
}); });
}); }
$('#add-subscription-form').on('submit', function onAddSubscriptionForm(e) { $('#add-subscription-form').on('submit', function onAddSubscriptionForm(e) {
const addPath = $(this).attr('action'); const addPath = $(this).attr('action');
...@@ -63,6 +69,14 @@ function initJiraConnect() { ...@@ -63,6 +69,14 @@ function initJiraConnect() {
initJiraFormHandlers(); initJiraFormHandlers();
if (!el) {
return null;
}
setConfigs();
Vue.use(Translate);
Vue.use(GlFeatureFlagsPlugin);
return new Vue({ return new Vue({
el, el,
data: { data: {
......
...@@ -2,6 +2,11 @@ ...@@ -2,6 +2,11 @@
// We should only import styles that we actually use. // We should only import styles that we actually use.
// @import '@gitlab/ui/src/scss/gitlab_ui'; // @import '@gitlab/ui/src/scss/gitlab_ui';
@import '@gitlab/ui/src/scss/bootstrap';
@import 'bootstrap-vue/src/index';
@import '@gitlab/ui/src/scss/utilities';
$atlaskit-border-color: #dfe1e6; $atlaskit-border-color: #dfe1e6;
.ac-content { .ac-content {
...@@ -40,14 +45,16 @@ $header-height: 40px; ...@@ -40,14 +45,16 @@ $header-height: 40px;
} }
.jira-connect-user { .jira-connect-user {
float: right; font-size: $gl-font-size;
position: relative; position: fixed;
top: -30px; top: 10px;
right: 20px;
} }
.jira-connect-app { .jira-connect-app {
margin-top: $header-height; margin-top: $header-height;
max-width: 600px; max-width: 600px;
min-height: 95vh;
padding-top: 48px; padding-top: 48px;
padding-left: 16px; padding-left: 16px;
padding-right: 16px; padding-right: 16px;
...@@ -108,5 +115,6 @@ svg { ...@@ -108,5 +115,6 @@ svg {
} }
.browser-limitations-notice { .browser-limitations-notice {
font-size: $gl-font-size;
margin-top: 32px; margin-top: 32px;
} }
...@@ -19,6 +19,9 @@ class JiraConnect::SubscriptionsController < JiraConnect::ApplicationController ...@@ -19,6 +19,9 @@ class JiraConnect::SubscriptionsController < JiraConnect::ApplicationController
before_action :allow_rendering_in_iframe, only: :index before_action :allow_rendering_in_iframe, only: :index
before_action :verify_qsh_claim!, only: :index before_action :verify_qsh_claim!, only: :index
before_action :authenticate_user!, only: :create before_action :authenticate_user!, only: :create
before_action do
push_frontend_feature_flag(:new_jira_connect_ui, type: :development, default_enabled: :yaml)
end
def index def index
@subscriptions = current_jira_installation.subscriptions.preload_namespace_route @subscriptions = current_jira_installation.subscriptions.preload_namespace_route
......
# frozen_string_literal: true
module JiraConnectHelper
def new_jira_connect_ui?
Feature.enabled?(:new_jira_connect_ui, type: :development, default_enabled: :yaml)
end
end
...@@ -23,15 +23,16 @@ ...@@ -23,15 +23,16 @@
- else - else
.js-jira-connect-app .js-jira-connect-app
%form#add-subscription-form.subscription-form{ action: jira_connect_subscriptions_path } - unless new_jira_connect_ui?
.ak-field-group %form#add-subscription-form.subscription-form{ action: jira_connect_subscriptions_path }
%label .ak-field-group
GitLab namespace %label
GitLab namespace
.ak-field-group.field-group-input .ak-field-group.field-group-input
%input#namespace-input.ak-field-text{ type: 'text', required: true, placeholder: 'e.g. "MyCompany" or "MyCompany/GroupName"' } %input#namespace-input.ak-field-text{ type: 'text', required: true, placeholder: 'e.g. "MyCompany" or "MyCompany/GroupName"' }
%button.ak-button.ak-button__appearance-primary{ type: 'submit' } %button.ak-button.ak-button__appearance-primary{ type: 'submit' }
Link namespace to Jira Link namespace to Jira
- if @subscriptions.present? - if @subscriptions.present?
%table.subscriptions %table.subscriptions
...@@ -49,6 +50,7 @@ ...@@ -49,6 +50,7 @@
- else - else
%h4.empty-subscriptions %h4.empty-subscriptions
No linked namespaces No linked namespaces
%p= s_('Integrations|Namespaces are your GitLab groups and subgroups that will be linked to this Jira instance.')
%p.browser-limitations-notice %p.browser-limitations-notice
%strong Browser limitations: %strong Browser limitations:
......
...@@ -3,8 +3,9 @@ ...@@ -3,8 +3,9 @@
%meta{ content: "text/html; charset=utf-8", "http-equiv" => "Content-Type" } %meta{ content: "text/html; charset=utf-8", "http-equiv" => "Content-Type" }
%title %title
GitLab GitLab
= stylesheet_link_tag 'https://unpkg.com/@atlaskit/css-reset@3.0.6/dist/bundle.css' - unless new_jira_connect_ui?
= stylesheet_link_tag 'https://unpkg.com/@atlaskit/reduced-ui-pack@10.5.5/dist/bundle.css' = stylesheet_link_tag 'https://unpkg.com/@atlaskit/css-reset@3.0.6/dist/bundle.css'
= stylesheet_link_tag 'https://unpkg.com/@atlaskit/reduced-ui-pack@10.5.5/dist/bundle.css'
= yield :page_specific_styles = yield :page_specific_styles
= javascript_include_tag 'https://connect-cdn.atl-paas.net/all.js' = javascript_include_tag 'https://connect-cdn.atl-paas.net/all.js'
......
---
name: new_jira_connect_ui
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/50692
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/295647
milestone: '13.8'
type: development
group: group::ecosystem
default_enabled: false
...@@ -15135,6 +15135,12 @@ msgstr "" ...@@ -15135,6 +15135,12 @@ msgstr ""
msgid "Integrations|Issues created in Jira are shown here once you have created the issues in project setup in Jira." msgid "Integrations|Issues created in Jira are shown here once you have created the issues in project setup in Jira."
msgstr "" msgstr ""
msgid "Integrations|Linked namespaces"
msgstr ""
msgid "Integrations|Namespaces are your GitLab groups and subgroups that will be linked to this Jira instance."
msgstr ""
msgid "Integrations|Projects using custom settings will not be affected." msgid "Integrations|Projects using custom settings will not be affected."
msgstr "" msgstr ""
......
import { shallowMount } from '@vue/test-utils';
import JiraConnectApp from '~/jira_connect/components/app.vue';
describe('JiraConnectApp', () => {
let wrapper;
const createComponent = (options = {}) => {
wrapper = shallowMount(JiraConnectApp, {
provide: {
glFeatures: { newJiraConnectUi: true },
},
...options,
});
};
afterEach(() => {
wrapper.destroy();
wrapper = null;
});
const findHeader = () => wrapper.find('h3');
const findHeaderText = () => findHeader().text();
describe('template', () => {
it('renders new UI', () => {
createComponent();
expect(findHeader().exists()).toBe(true);
expect(findHeaderText()).toBe('Linked namespaces');
});
describe('newJiraConnectUi is false', () => {
it('does not render new UI', () => {
createComponent({
provide: {
glFeatures: { newJiraConnectUi: false },
},
});
expect(findHeader().exists()).toBe(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