diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-01 12:10:01 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-01 12:10:01 +0300 |
commit | 44c29521a1f5b9fa7e930dbe2a21b894f6b75e74 (patch) | |
tree | 252704b55a395c4b34239718a5b82fc979bcb37c /app/assets/javascripts/jira_connect | |
parent | c925120e3026601193099ec1ed7fe635a8aafa8e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/jira_connect')
3 files changed, 49 insertions, 7 deletions
diff --git a/app/assets/javascripts/jira_connect/subscriptions/components/app.vue b/app/assets/javascripts/jira_connect/subscriptions/components/app.vue index afdb414e82c..dfee70793eb 100644 --- a/app/assets/javascripts/jira_connect/subscriptions/components/app.vue +++ b/app/assets/javascripts/jira_connect/subscriptions/components/app.vue @@ -3,12 +3,15 @@ import { GlAlert, GlLink, GlSprintf } from '@gitlab/ui'; import { isEmpty } from 'lodash'; import { mapState, mapMutations } from 'vuex'; import { retrieveAlert } from '~/jira_connect/subscriptions/utils'; +import AccessorUtilities from '~/lib/utils/accessor'; +import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import { I18N_DEFAULT_SIGN_IN_ERROR_MESSAGE } from '../constants'; import { SET_ALERT } from '../store/mutation_types'; import SignInPage from '../pages/sign_in.vue'; import SubscriptionsPage from '../pages/subscriptions.vue'; import UserLink from './user_link.vue'; import CompatibilityAlert from './compatibility_alert.vue'; +import BrowserSupportAlert from './browser_support_alert.vue'; export default { name: 'JiraConnectApp', @@ -18,9 +21,11 @@ export default { GlSprintf, UserLink, CompatibilityAlert, + BrowserSupportAlert, SignInPage, SubscriptionsPage, }, + mixins: [glFeatureFlagMixin()], inject: { usersPath: { default: '', @@ -45,6 +50,16 @@ export default { userSignedIn() { return Boolean(!this.usersPath || this.user); }, + isOauthEnabled() { + return this.glFeatures.jiraConnectOauth; + }, + /** + * Returns false if the GitLab for Jira app doesn't support the user's browser. + * Any web API that the GitLab for Jira app depends on should be checked here. + */ + isBrowserSupported() { + return !this.isOauthEnabled || AccessorUtilities.canUseCrypto(); + }, }, created() { this.setInitialAlert(); @@ -71,12 +86,12 @@ export default { </script> <template> - <div> - <compatibility-alert /> + <browser-support-alert v-if="!isBrowserSupported" class="gl-mb-7" /> + <div v-else data-testid="jira-connect-app"> + <compatibility-alert class="gl-mb-7" /> <gl-alert v-if="shouldShowAlert" - class="gl-mb-7" :variant="alert.variant" :title="alert.title" data-testid="jira-connect-persisted-alert" diff --git a/app/assets/javascripts/jira_connect/subscriptions/components/browser_support_alert.vue b/app/assets/javascripts/jira_connect/subscriptions/components/browser_support_alert.vue new file mode 100644 index 00000000000..ea7db5be0c4 --- /dev/null +++ b/app/assets/javascripts/jira_connect/subscriptions/components/browser_support_alert.vue @@ -0,0 +1,30 @@ +<script> +import { GlAlert, GlSprintf, GlLink } from '@gitlab/ui'; +import { s__ } from '~/locale'; +import { helpPagePath } from '~/helpers/help_page_helper'; + +export default { + name: 'BrowserSupportAlert', + components: { + GlAlert, + GlSprintf, + GlLink, + }, + i18n: { + title: s__('Integrations|Your browser is not supported'), + body: s__( + 'Integrations|You must use a %{linkStart}supported browser%{linkEnd} to use the GitLab for Jira app.', + ), + }, + DOCS_LINK_URL: helpPagePath('install/requirements', { anchor: 'supported-web-browsers' }), +}; +</script> +<template> + <gl-alert variant="danger" :title="$options.i18n.title" :dismissible="false"> + <gl-sprintf :message="$options.i18n.body"> + <template #link="{ content }"> + <gl-link :href="$options.DOCS_LINK_URL" target="_blank">{{ content }}</gl-link> + </template> + </gl-sprintf> + </gl-alert> +</template> diff --git a/app/assets/javascripts/jira_connect/subscriptions/components/compatibility_alert.vue b/app/assets/javascripts/jira_connect/subscriptions/components/compatibility_alert.vue index 3cfbd87ac53..c5b56535247 100644 --- a/app/assets/javascripts/jira_connect/subscriptions/components/compatibility_alert.vue +++ b/app/assets/javascripts/jira_connect/subscriptions/components/compatibility_alert.vue @@ -46,16 +46,13 @@ export default { > <gl-alert v-if="shouldShowAlert" - class="gl-mb-7" variant="info" :title="$options.i18n.title" @dismiss="dismissAlert" > <gl-sprintf :message="$options.i18n.body"> <template #link="{ content }"> - <gl-link :href="$options.DOCS_LINK_URL" target="_blank" rel="noopener noreferrer">{{ - content - }}</gl-link> + <gl-link :href="$options.DOCS_LINK_URL" target="_blank">{{ content }}</gl-link> </template> </gl-sprintf> </gl-alert> |