Generate invite link

This commit is contained in:
Angelina Filippova 2020-04-20 22:53:34 +00:00
parent a54d09c486
commit a806a06107
3 changed files with 38 additions and 4 deletions

View file

@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Put Instance Reboot button on all pages of admin-fe - Put Instance Reboot button on all pages of admin-fe
- Make Instance Reboot button's positon fixed on Settings page - Make Instance Reboot button's positon fixed on Settings page
- Update jest and babel-jest - Update jest and babel-jest
- Generate an invite link when an invite token has been generated
### Fixed ### Fixed

View file

@ -397,6 +397,7 @@ export default {
expiresAt: 'Expires at', expiresAt: 'Expires at',
tokenCreated: 'Invite token was created', tokenCreated: 'Invite token was created',
token: 'Token', token: 'Token',
inviteLink: 'Invite link',
uses: 'Uses', uses: 'Uses',
used: 'Used', used: 'Used',
cancel: 'Cancel', cancel: 'Cancel',

View file

@ -49,9 +49,22 @@
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>{{ $t('invites.tokenCreated') }}</span> <span>{{ $t('invites.tokenCreated') }}</span>
</div> </div>
<p>{{ this.$t('invites.token') }}: {{ newToken.token }}</p> <el-form label-width="80px" class="new-token-card">
<p>{{ this.$t('invites.maxUse') }}: {{ newToken.maxUse }}</p> <el-form-item :label="$t('invites.inviteLink')">
<p>{{ this.$t('invites.expiresAt') }}: {{ newToken.expiresAt }}</p> <el-link :href="inviteLink" :underline="false" target="_blank">
{{ inviteLink }}
</el-link>
</el-form-item>
<el-form-item :label="$t('invites.token')">
{{ newToken.token }}
</el-form-item>
<el-form-item :label="$t('invites.maxUse')">
{{ newToken.maxUse }}
</el-form-item>
<el-form-item :label="$t('invites.expiresAt')">
{{ newToken.expiresAt || '(not set)' }}
</el-form-item>
</el-form>
</el-card> </el-card>
</el-dialog> </el-dialog>
<el-dialog <el-dialog
@ -144,6 +157,8 @@
<script> <script>
import RebootButton from '@/components/RebootButton' import RebootButton from '@/components/RebootButton'
import { mapGetters } from 'vuex'
import { baseName } from '@/api/utils'
export default { export default {
components: { RebootButton }, components: { RebootButton },
@ -167,9 +182,15 @@ export default {
} }
}, },
computed: { computed: {
...mapGetters([
'authHost'
]),
getLabelWidth() { getLabelWidth() {
return this.isDesktop ? '100px' : '80px' return this.isDesktop ? '100px' : '80px'
}, },
inviteLink() {
return `${baseName(this.authHost)}/registration/${this.newToken.token}`
},
isDesktop() { isDesktop() {
return this.$store.state.app.device === 'desktop' return this.$store.state.app.device === 'desktop'
}, },
@ -248,7 +269,13 @@ export default {
padding: 10px; padding: 10px;
} }
.create-new-token-dialog { .create-new-token-dialog {
width: 40% width: 50%;
a {
margin-bottom: 3px;
}
.el-card__body {
padding: 10px 20px;
}
} }
.el-dialog__body { .el-dialog__body {
padding: 5px 20px 0 20px padding: 5px 20px 0 20px
@ -283,6 +310,11 @@ export default {
line-height: 22px; line-height: 22px;
margin: 0 0 10px 0; margin: 0 0 10px 0;
} }
.new-token-card {
.el-form-item {
margin: 0;
}
}
.reboot-button { .reboot-button {
padding: 10px; padding: 10px;
margin: 0; margin: 0;