Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/jira_connect/subscriptions/components/user_link.vue')
-rw-r--r--app/assets/javascripts/jira_connect/subscriptions/components/user_link.vue67
1 files changed, 67 insertions, 0 deletions
diff --git a/app/assets/javascripts/jira_connect/subscriptions/components/user_link.vue b/app/assets/javascripts/jira_connect/subscriptions/components/user_link.vue
new file mode 100644
index 00000000000..fad3d2616d8
--- /dev/null
+++ b/app/assets/javascripts/jira_connect/subscriptions/components/user_link.vue
@@ -0,0 +1,67 @@
+<script>
+import { GlLink, GlSprintf } from '@gitlab/ui';
+import { __ } from '~/locale';
+import { getGitlabSignInURL } from '~/jira_connect/subscriptions/utils';
+
+export default {
+ components: {
+ GlLink,
+ GlSprintf,
+ },
+ inject: {
+ usersPath: {
+ default: '',
+ },
+ gitlabUserPath: {
+ default: '',
+ },
+ },
+ props: {
+ userSignedIn: {
+ type: Boolean,
+ required: true,
+ },
+ hasSubscriptions: {
+ type: Boolean,
+ required: true,
+ },
+ },
+ data() {
+ return {
+ signInURL: '',
+ };
+ },
+ computed: {
+ gitlabUserHandle() {
+ return `@${gon.current_username}`;
+ },
+ },
+ async created() {
+ this.signInURL = await getGitlabSignInURL(this.usersPath);
+ },
+ i18n: {
+ signInText: __('Sign in to GitLab'),
+ signedInAsUserText: __('Signed in to GitLab as %{user_link}'),
+ },
+};
+</script>
+<template>
+ <div class="jira-connect-user gl-font-base">
+ <gl-sprintf v-if="userSignedIn" :message="$options.i18n.signedInAsUserText">
+ <template #user_link>
+ <gl-link data-testid="gitlab-user-link" :href="gitlabUserPath" target="_blank">
+ {{ gitlabUserHandle }}
+ </gl-link>
+ </template>
+ </gl-sprintf>
+
+ <gl-link
+ v-else-if="hasSubscriptions"
+ data-testid="sign-in-link"
+ :href="signInURL"
+ target="_blank"
+ >
+ {{ $options.i18n.signInText }}
+ </gl-link>
+ </div>
+</template>