Browse Source

fix : #169 - show logged in user email.

Signed-off-by: Naveen MR <oof1lab@gmail.com>
pull/559/head
Naveen MR 3 years ago
parent
commit
65db37a08e
  1. 38
      packages/nc-gui/layouts/default.vue
  2. 12
      packages/nc-gui/store/users.js

38
packages/nc-gui/layouts/default.vue

@ -320,19 +320,30 @@
</v-list-item-title> </v-list-item-title>
</v-list-item>--> </v-list-item>-->
<v-list-item v-ge="['Sign Out','']" dense>
<v-list-item-title>
<v-icon small>
mdi-at
</v-icon>&nbsp; <span class="font-weight-bold">{{ userEmail }}</span>
</v-list-item-title>
</v-list-item>
<v-list-item <v-divider></v-divider>
<v-list-item v-if="isDashboard"
v-clipboard="$store.state.users.token" v-clipboard="$store.state.users.token"
dense dense
@click.stop="$toast.success('Auth token copied to clipboard').goAway(3000)" @click.stop="$toast.success('Auth token copied to clipboard').goAway(3000)"
> >
<v-list-item-title> <v-list-item-title>
<v-icon key="terminal-dash" small> <v-icon key="terminal-dash" small>
mdi-console mdi-content-copy
</v-icon>&nbsp; </v-icon>&nbsp;
<span class="font-weight-regular">Copy auth token</span> <span class="font-weight-regular">Copy auth token</span>
</v-list-item-title> </v-list-item-title>
</v-list-item> </v-list-item>
<!-- <!--
<v-list-item dense @click.stop="projectInfoTabAdd"> <v-list-item dense @click.stop="projectInfoTabAdd">
<v-list-item-title> <v-list-item-title>
@ -357,23 +368,25 @@
{{ isGql ? 'GraphQL APIs' : 'Swagger APIs Doc' }}</span> {{ isGql ? 'GraphQL APIs' : 'Swagger APIs Doc' }}</span>
</v-list-item-title> </v-list-item-title>
</v-list-item> </v-list-item>
<v-divider></v-divider>
<v-list-item v-if="isDashboard" v-ge="['Sign Out','']" dense @click="copyProjectInfo">
<v-list-item-title>
<v-icon small>
mdi-information-outline
</v-icon>&nbsp; <span class="font-weight-regular">Copy Project info</span>
</v-list-item-title>
</v-list-item>
<v-list-item dense @click.stop="settingsTabAdd"> <v-list-item dense @click.stop="settingsTabAdd" v-if="isDashboard">
<v-list-item-title> <v-list-item-title>
<v-icon key="terminal-dash" small> <v-icon key="terminal-dash" small>
mdi-cog mdi-palette
</v-icon>&nbsp; </v-icon>&nbsp;
<span class="font-weight-regular">Themes</span> <span class="font-weight-regular">Themes</span>
</v-list-item-title> </v-list-item-title>
</v-list-item> </v-list-item>
<v-list-item v-if="isDashboard" v-ge="['Sign Out','']" dense @click="copyProjectInfo"> <v-divider v-if="isDashboard"></v-divider>
<v-list-item-title>
<v-icon small>
info
</v-icon>&nbsp; <span class="font-weight-regular">Copy Project info</span>
</v-list-item-title>
</v-list-item>
<v-list-item v-ge="['Sign Out','']" dense @click="MtdSignOut"> <v-list-item v-ge="['Sign Out','']" dense @click="MtdSignOut">
<v-list-item-title> <v-list-item-title>
@ -626,7 +639,8 @@ export default {
isGql: 'project/GtrProjectIsGraphql', isGql: 'project/GtrProjectIsGraphql',
isRest: 'project/GtrProjectIsRest', isRest: 'project/GtrProjectIsRest',
isGrpc: 'project/GtrProjectIsGrpc', isGrpc: 'project/GtrProjectIsGrpc',
role: 'users/GtrRole' role: 'users/GtrRole',
userEmail: 'users/GtrUserEmail'
}), }),
user() { user() {
return this.$store.getters['users/GtrUser'] return this.$store.getters['users/GtrUser']

12
packages/nc-gui/store/users.js

@ -49,6 +49,9 @@ export const getters = {
return state.paidUser return state.paidUser
}, },
GtrIsAuthenticated(state, getters, rootState) { GtrIsAuthenticated(state, getters, rootState) {
return rootState.project.projectInfo && return rootState.project.projectInfo &&
(rootState.project.projectInfo.authType === 'none' || (rootState.project.projectInfo.authType === 'none' ||
@ -88,7 +91,14 @@ export const getters = {
'creator', 'creator',
'editor', 'editor',
'viewer'].find(r => state.user.roles[r]) || Object.keys(state.user.roles)[0]) 'viewer'].find(r => state.user.roles[r]) || Object.keys(state.user.roles)[0])
} },
GtrUserEmail(state) {
if(state.user && state.user.email)
return state.user.email;
else
return '';
},
} }

Loading…
Cancel
Save