diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-17 19:05:49 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-17 19:05:49 +0300 |
commit | 43a25d93ebdabea52f99b05e15b06250cd8f07d7 (patch) | |
tree | dceebdc68925362117480a5d672bcff122fb625b /app/assets/javascripts/jira_connect/subscriptions/pages/sign_in | |
parent | 20c84b99005abd1c82101dfeff264ac50d2df211 (diff) |
Add latest changes from gitlab-org/gitlab@16-0-stable-eev16.0.0-rc42
Diffstat (limited to 'app/assets/javascripts/jira_connect/subscriptions/pages/sign_in')
6 files changed, 108 insertions, 64 deletions
diff --git a/app/assets/javascripts/jira_connect/subscriptions/pages/sign_in/sign_in_gitlab_com.vue b/app/assets/javascripts/jira_connect/subscriptions/pages/sign_in/sign_in_gitlab_com.vue index 6de3f507a39..113ce34fdcd 100644 --- a/app/assets/javascripts/jira_connect/subscriptions/pages/sign_in/sign_in_gitlab_com.vue +++ b/app/assets/javascripts/jira_connect/subscriptions/pages/sign_in/sign_in_gitlab_com.vue @@ -2,29 +2,20 @@ import { s__ } from '~/locale'; import { GITLAB_COM_BASE_PATH } from '~/jira_connect/subscriptions/constants'; -import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import SubscriptionsList from '../../components/subscriptions_list.vue'; export default { name: 'SignInGitlabCom', components: { SubscriptionsList, - SignInLegacyButton: () => import('../../components/sign_in_legacy_button.vue'), SignInOauthButton: () => import('../../components/sign_in_oauth_button.vue'), }, - mixins: [glFeatureFlagMixin()], - inject: ['usersPath'], props: { hasSubscriptions: { type: Boolean, required: true, }, }, - computed: { - useSignInOauthButton() { - return this.glFeatures.jiraConnectOauth; - }, - }, i18n: { signInButtonTextWithSubscriptions: s__('Integrations|Sign in to add namespaces'), signInText: s__('JiraService|Sign in to GitLab to get started.'), @@ -44,16 +35,12 @@ export default { <div v-if="hasSubscriptions"> <div class="gl-display-flex gl-justify-content-end gl-mb-3"> <sign-in-oauth-button - v-if="useSignInOauthButton" :gitlab-base-path="$options.GITLAB_COM_BASE_PATH" @sign-in="$emit('sign-in-oauth', $event)" @error="onSignInError" > {{ $options.i18n.signInButtonTextWithSubscriptions }} </sign-in-oauth-button> - <sign-in-legacy-button v-else :users-path="usersPath"> - {{ $options.i18n.signInButtonTextWithSubscriptions }} - </sign-in-legacy-button> </div> <subscriptions-list /> @@ -61,12 +48,10 @@ export default { <div v-else class="gl-text-center"> <p class="gl-mb-7">{{ $options.i18n.signInText }}</p> <sign-in-oauth-button - v-if="useSignInOauthButton" :gitlab-base-path="$options.GITLAB_COM_BASE_PATH" @sign-in="$emit('sign-in-oauth', $event)" @error="onSignInError" /> - <sign-in-legacy-button v-else class="gl-mb-7" :users-path="usersPath" /> </div> </div> </template> diff --git a/app/assets/javascripts/jira_connect/subscriptions/pages/sign_in/sign_in_gitlab_multiversion/index.vue b/app/assets/javascripts/jira_connect/subscriptions/pages/sign_in/sign_in_gitlab_multiversion/index.vue index 7c6ff002014..8cc107930d1 100644 --- a/app/assets/javascripts/jira_connect/subscriptions/pages/sign_in/sign_in_gitlab_multiversion/index.vue +++ b/app/assets/javascripts/jira_connect/subscriptions/pages/sign_in/sign_in_gitlab_multiversion/index.vue @@ -12,7 +12,6 @@ import { import { SET_ALERT } from '~/jira_connect/subscriptions/store/mutation_types'; import SignInOauthButton from '../../../components/sign_in_oauth_button.vue'; -import SetupInstructions from './setup_instructions.vue'; import VersionSelectForm from './version_select_form.vue'; export default { @@ -20,31 +19,23 @@ export default { components: { GlButton, SignInOauthButton, - SetupInstructions, VersionSelectForm, }, data() { return { gitlabBasePath: null, loadingVersionSelect: false, - showSetupInstructions: false, }; }, computed: { hasSelectedVersion() { return this.gitlabBasePath !== null; }, - subtitle() { - return this.hasSelectedVersion - ? this.$options.i18n.signInSubtitle - : this.$options.i18n.versionSelectSubtitle; - }, }, mounted() { this.gitlabBasePath = retrieveBaseUrl(); - setApiBaseURL(this.gitlabBasePath); if (this.gitlabBasePath !== GITLAB_COM_BASE_PATH) { - this.showSetupInstructions = true; + setApiBaseURL(this.gitlabBasePath); } }, methods: { @@ -70,9 +61,6 @@ export default { this.loadingVersionSelect = false; }); }, - onSetupNext() { - this.showSetupInstructions = false; - }, onSignInError() { this.$emit('error'); }, @@ -80,7 +68,6 @@ export default { i18n: { title: s__('JiraService|Welcome to GitLab for Jira'), signInSubtitle: s__('JiraService|Sign in to GitLab to link namespaces.'), - versionSelectSubtitle: s__('JiraService|What version of GitLab are you using?'), changeVersionButtonText: s__('JiraService|Change GitLab version'), }, }; @@ -90,7 +77,6 @@ export default { <div> <div class="gl-text-center"> <h2>{{ $options.i18n.title }}</h2> - <p data-testid="subtitle">{{ subtitle }}</p> </div> <version-select-form @@ -101,9 +87,8 @@ export default { /> <template v-else> - <setup-instructions v-if="showSetupInstructions" @next="onSetupNext" /> - - <div v-else class="gl-text-center"> + <div class="gl-text-center"> + <p data-testid="subtitle">{{ $options.i18n.signInSubtitle }}</p> <sign-in-oauth-button class="gl-mb-5" :gitlab-base-path="gitlabBasePath" diff --git a/app/assets/javascripts/jira_connect/subscriptions/pages/sign_in/sign_in_gitlab_multiversion/self_managed_alert.vue b/app/assets/javascripts/jira_connect/subscriptions/pages/sign_in/sign_in_gitlab_multiversion/self_managed_alert.vue new file mode 100644 index 00000000000..8ddbbffa708 --- /dev/null +++ b/app/assets/javascripts/jira_connect/subscriptions/pages/sign_in/sign_in_gitlab_multiversion/self_managed_alert.vue @@ -0,0 +1,22 @@ +<script> +import { GlAlert } from '@gitlab/ui'; +import { s__ } from '~/locale'; + +export default { + components: { + GlAlert, + }, + i18n: { + title: s__('JiraService|Are you a GitLab administrator?'), + body: s__( + "JiraService|Setting up this integration is only possible if you're a GitLab administrator.", + ), + }, +}; +</script> + +<template> + <gl-alert variant="warning" :title="$options.i18n.title" :dismissible="false"> + {{ $options.i18n.body }} + </gl-alert> +</template> diff --git a/app/assets/javascripts/jira_connect/subscriptions/pages/sign_in/sign_in_gitlab_multiversion/setup_instructions.vue b/app/assets/javascripts/jira_connect/subscriptions/pages/sign_in/sign_in_gitlab_multiversion/setup_instructions.vue index 00fa739b518..621bcccd19a 100644 --- a/app/assets/javascripts/jira_connect/subscriptions/pages/sign_in/sign_in_gitlab_multiversion/setup_instructions.vue +++ b/app/assets/javascripts/jira_connect/subscriptions/pages/sign_in/sign_in_gitlab_multiversion/setup_instructions.vue @@ -12,7 +12,7 @@ export default { </script> <template> - <div class="gl-max-w-62 gl-mx-auto gl-mt-7"> + <div class="gl-mt-5"> <h3>{{ s__('JiraService|Continue setup in GitLab') }}</h3> <p> {{ @@ -28,8 +28,9 @@ export default { > </p> - <gl-button variant="confirm" @click="$emit('next')"> - {{ __('Next') }} - </gl-button> + <div class="gl-display-flex gl-justify-content-space-between"> + <gl-button @click="$emit('back')">{{ __('Back') }}</gl-button> + <gl-button variant="confirm" @click="$emit('next')">{{ __('Next') }}</gl-button> + </div> </div> </template> diff --git a/app/assets/javascripts/jira_connect/subscriptions/pages/sign_in/sign_in_gitlab_multiversion/version_select_form.vue b/app/assets/javascripts/jira_connect/subscriptions/pages/sign_in/sign_in_gitlab_multiversion/version_select_form.vue index 37a65946b3f..3a080afd3c5 100644 --- a/app/assets/javascripts/jira_connect/subscriptions/pages/sign_in/sign_in_gitlab_multiversion/version_select_form.vue +++ b/app/assets/javascripts/jira_connect/subscriptions/pages/sign_in/sign_in_gitlab_multiversion/version_select_form.vue @@ -10,6 +10,8 @@ import { import { __, s__ } from '~/locale'; import { GITLAB_COM_BASE_PATH } from '~/jira_connect/subscriptions/constants'; +import SelfManagedAlert from './self_managed_alert.vue'; +import SetupInstructions from './setup_instructions.vue'; const RADIO_OPTIONS = { saas: 'saas', @@ -27,6 +29,8 @@ export default { GlFormInput, GlFormRadio, GlButton, + SelfManagedAlert, + SetupInstructions, }, props: { loading: { @@ -39,25 +43,54 @@ export default { return { selected: DEFAULT_RADIO_OPTION, selfManagedBasePathInput: '', + showSetupInstructions: false, + showSelfManagedInstanceInput: false, }; }, computed: { isSelfManagedSelected() { return this.selected === RADIO_OPTIONS.selfManaged; }, + submitText() { + return this.isSelfManagedSelected + ? this.$options.i18n.buttonNext + : this.$options.i18n.buttonSave; + }, + showVersonSelect() { + return !this.showSetupInstructions && !this.showSelfManagedInstanceInput; + }, }, methods: { onSubmit() { - const gitlabBasePath = - this.selected === RADIO_OPTIONS.saas ? GITLAB_COM_BASE_PATH : this.selfManagedBasePathInput; + if (this.isSelfManagedSelected && !this.showSelfManagedInstanceInput) { + this.showSetupInstructions = true; + return; + } + + const gitlabBasePath = this.isSelfManagedSelected + ? this.selfManagedBasePathInput + : GITLAB_COM_BASE_PATH; this.$emit('submit', gitlabBasePath); }, + + onSetupNext() { + this.showSetupInstructions = false; + this.showSelfManagedInstanceInput = true; + }, + + onSetupBack() { + this.showSetupInstructions = false; + this.showSelfManagedInstanceInput = false; + }, }, radioOptions: RADIO_OPTIONS, i18n: { + title: s__('JiraService|What version of GitLab are you using?'), saasRadioLabel: __('GitLab.com (SaaS)'), saasRadioHelp: __('Most common'), selfManagedRadioLabel: __('GitLab (self-managed)'), + buttonNext: __('Next'), + buttonSave: __('Save'), instanceURLInputLabel: s__('JiraService|GitLab instance URL'), instanceURLInputDescription: s__('JiraService|For example: https://gitlab.example.com'), }, @@ -66,30 +99,50 @@ export default { <template> <gl-form class="gl-max-w-62 gl-mx-auto" @submit.prevent="onSubmit"> - <gl-form-radio-group v-model="selected" class="gl-mb-3" name="gitlab_version"> - <gl-form-radio :value="$options.radioOptions.saas"> - {{ $options.i18n.saasRadioLabel }} - <template #help> - {{ $options.i18n.saasRadioHelp }} - </template> - </gl-form-radio> - <gl-form-radio :value="$options.radioOptions.selfManaged"> - {{ $options.i18n.selfManagedRadioLabel }} - </gl-form-radio> - </gl-form-radio-group> + <div v-if="showVersonSelect"> + <h5 class="gl-mb-5">{{ $options.i18n.title }}</h5> + <gl-form-radio-group v-model="selected" class="gl-mb-3" name="gitlab_version"> + <gl-form-radio :value="$options.radioOptions.saas"> + {{ $options.i18n.saasRadioLabel }} + <template #help> + {{ $options.i18n.saasRadioHelp }} + </template> + </gl-form-radio> + <gl-form-radio :value="$options.radioOptions.selfManaged"> + {{ $options.i18n.selfManagedRadioLabel }} + </gl-form-radio> + </gl-form-radio-group> + <self-managed-alert v-if="isSelfManagedSelected" /> + + <div class="gl-display-flex gl-justify-content-end gl-mt-5"> + <gl-button variant="confirm" type="submit" :loading="loading" data-testid="submit-button">{{ + submitText + }}</gl-button> + </div> + </div> - <gl-form-group - v-if="isSelfManagedSelected" - class="gl-ml-6" - :label="$options.i18n.instanceURLInputLabel" - :description="$options.i18n.instanceURLInputDescription" - label-for="self-managed-instance-input" - > - <gl-form-input id="self-managed-instance-input" v-model="selfManagedBasePathInput" required /> - </gl-form-group> + <setup-instructions v-else-if="showSetupInstructions" @next="onSetupNext" @back="onSetupBack" /> - <div class="gl-display-flex gl-justify-content-end"> - <gl-button variant="confirm" type="submit" :loading="loading">{{ __('Save') }}</gl-button> + <div v-else-if="showSelfManagedInstanceInput"> + <gl-form-group + :label="$options.i18n.instanceURLInputLabel" + :description="$options.i18n.instanceURLInputDescription" + label-for="self-managed-instance-input" + > + <gl-form-input + id="self-managed-instance-input" + v-model="selfManagedBasePathInput" + required + /> + </gl-form-group> + <div class="gl-display-flex gl-justify-content-space-between"> + <gl-button data-testid="back-button" @click.prevent="onSetupBack">{{ + __('Back') + }}</gl-button> + <gl-button variant="confirm" type="submit" :loading="loading">{{ + $options.i18n.buttonSave + }}</gl-button> + </div> </div> </gl-form> </template> diff --git a/app/assets/javascripts/jira_connect/subscriptions/pages/sign_in/sign_in_page.vue b/app/assets/javascripts/jira_connect/subscriptions/pages/sign_in/sign_in_page.vue index e6a94ffbaa4..ee20e21011f 100644 --- a/app/assets/javascripts/jira_connect/subscriptions/pages/sign_in/sign_in_page.vue +++ b/app/assets/javascripts/jira_connect/subscriptions/pages/sign_in/sign_in_page.vue @@ -1,12 +1,10 @@ <script> -import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import SignInGitlabCom from './sign_in_gitlab_com.vue'; import SignInGitlabMultiversion from './sign_in_gitlab_multiversion/index.vue'; export default { name: 'SignInPage', components: { SignInGitlabCom, SignInGitlabMultiversion }, - mixins: [glFeatureFlagMixin()], props: { hasSubscriptions: { type: Boolean, @@ -19,7 +17,7 @@ export default { }, computed: { isOauthSelfManagedEnabled() { - return this.glFeatures.jiraConnectOauth && this.publicKeyStorageEnabled; + return this.publicKeyStorageEnabled; }, }, }; |