diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-01-29 00:09:04 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-01-29 00:09:04 +0300 |
commit | c6c346e8c7f0865f0016a458511e9fabfc8b9c1a (patch) | |
tree | 5b3a734e945e18c88817935c359c191140a11010 /app/assets/javascripts/jira_connect | |
parent | e1b9b92a49eea88ea7c3b101aec0315e64e94678 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/jira_connect')
-rw-r--r-- | app/assets/javascripts/jira_connect/api.js | 8 | ||||
-rw-r--r-- | app/assets/javascripts/jira_connect/components/app.vue | 64 | ||||
-rw-r--r-- | app/assets/javascripts/jira_connect/index.js | 3 |
3 files changed, 62 insertions, 13 deletions
diff --git a/app/assets/javascripts/jira_connect/api.js b/app/assets/javascripts/jira_connect/api.js index 9cd85396fbc..105114e4843 100644 --- a/app/assets/javascripts/jira_connect/api.js +++ b/app/assets/javascripts/jira_connect/api.js @@ -8,6 +8,14 @@ export const getJwt = () => { }); }; +export const getLocation = () => { + return new Promise((resolve) => { + AP.getLocation((location) => { + resolve(location); + }); + }); +}; + export const addSubscription = async (addPath, namespace) => { const jwt = await getJwt(); diff --git a/app/assets/javascripts/jira_connect/components/app.vue b/app/assets/javascripts/jira_connect/components/app.vue index f5bf30f4488..ed01c188752 100644 --- a/app/assets/javascripts/jira_connect/components/app.vue +++ b/app/assets/javascripts/jira_connect/components/app.vue @@ -3,6 +3,8 @@ import { mapState } from 'vuex'; import { GlAlert, GlButton, GlModal, GlModalDirective } from '@gitlab/ui'; import { __ } from '~/locale'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; + +import { getLocation } from '~/jira_connect/api'; import GroupsList from './groups_list.vue'; export default { @@ -17,17 +19,42 @@ export default { GlModalDirective, }, mixins: [glFeatureFlagsMixin()], + inject: { + usersPath: { + default: '', + }, + }, + data() { + return { + location: '', + }; + }, computed: { ...mapState(['errorMessage']), showNewUI() { return this.glFeatures.newJiraConnectUi; }, + usersPathWithReturnTo() { + if (this.location) { + return `${this.usersPath}?return_to=${this.location}`; + } + + return this.usersPath; + }, }, modal: { cancelProps: { text: __('Cancel'), }, }, + created() { + this.setLocation(); + }, + methods: { + async setLocation() { + this.location = await getLocation(); + }, + }, }; </script> @@ -37,27 +64,40 @@ export default { {{ errorMessage }} </gl-alert> - <h1>GitLab for Jira Configuration</h1> + <h2>{{ s__('JiraService|GitLab for Jira Configuration') }}</h2> <div v-if="showNewUI" - class="gl-display-flex gl-justify-content-space-between gl-my-5 gl-pb-4 gl-border-b-solid gl-border-b-1 gl-border-b-gray-200" + class="gl-display-flex gl-justify-content-space-between gl-my-7 gl-pb-4 gl-border-b-solid gl-border-b-1 gl-border-b-gray-200" > - <h3 data-testid="new-jira-connect-ui-heading">{{ s__('Integrations|Linked namespaces') }}</h3> + <h5 class="gl-align-self-center gl-mb-0" data-testid="new-jira-connect-ui-heading"> + {{ s__('Integrations|Linked namespaces') }} + </h5> <gl-button - v-gl-modal-directive="'add-namespace-modal'" + v-if="usersPath" category="primary" variant="info" class="gl-align-self-center" - >{{ s__('Integrations|Add namespace') }}</gl-button - > - <gl-modal - modal-id="add-namespace-modal" - :title="s__('Integrations|Link namespaces')" - :action-cancel="$options.modal.cancelProps" + :href="usersPathWithReturnTo" + target="_blank" + >{{ s__('Integrations|Sign in to add namespaces') }}</gl-button > - <groups-list /> - </gl-modal> + <template v-else> + <gl-button + v-gl-modal-directive="'add-namespace-modal'" + category="primary" + variant="info" + class="gl-align-self-center" + >{{ s__('Integrations|Add namespace') }}</gl-button + > + <gl-modal + modal-id="add-namespace-modal" + :title="s__('Integrations|Link namespaces')" + :action-cancel="$options.modal.cancelProps" + > + <groups-list /> + </gl-modal> + </template> </div> </div> </template> diff --git a/app/assets/javascripts/jira_connect/index.js b/app/assets/javascripts/jira_connect/index.js index 2c77717e2fc..aee671b3933 100644 --- a/app/assets/javascripts/jira_connect/index.js +++ b/app/assets/javascripts/jira_connect/index.js @@ -70,7 +70,7 @@ function initJiraConnect() { Vue.use(Translate); Vue.use(GlFeatureFlagsPlugin); - const { groupsPath, subscriptionsPath } = el.dataset; + const { groupsPath, subscriptionsPath, usersPath } = el.dataset; return new Vue({ el, @@ -78,6 +78,7 @@ function initJiraConnect() { provide: { groupsPath, subscriptionsPath, + usersPath, }, render(createElement) { return createElement(JiraConnectApp); |