Changeset View
Changeset View
Standalone View
Standalone View
src/resources/vue/Widgets/Status.vue
<template> | <template> | ||||
<div v-if="!state.isReady" id="status-box" :class="'p-4 mb-3 rounded process-' + className"> | <div v-if="!state.isReady" id="status-box" :class="'p-4 mb-3 rounded process-' + className"> | ||||
<div v-if="state.step != 'domain-confirmed'" class="d-flex align-items-start"> | <div v-if="state.step != 'domain-confirmed'" class="d-flex align-items-start"> | ||||
<p id="status-body" class="flex-grow-1"> | <p id="status-body" class="flex-grow-1"> | ||||
<span v-if="scope == 'dashboard'">{{ $t('status.prepare-account') }}</span> | <span>{{ $t('status.prepare-' + scopeLabel()) }}</span> | ||||
<span v-else-if="scope == 'domain'">{{ $t('status.prepare-domain') }}</span> | |||||
<span v-else-if="scope == 'distlist'">{{ $t('status.prepare-distlist') }}</span> | |||||
<span v-else-if="scope == 'resource'">{{ $t('status.prepare-resource') }}</span> | |||||
<span v-else>{{ $t('status.prepare-user') }}</span> | |||||
<br> | <br> | ||||
{{ $t('status.prepare-hint') }} | {{ $t('status.prepare-hint') }} | ||||
<br> | <br> | ||||
<span id="refresh-text" v-if="refresh">{{ $t('status.prepare-refresh') }}</span> | <span id="refresh-text" v-if="refresh">{{ $t('status.prepare-refresh') }}</span> | ||||
</p> | </p> | ||||
<button v-if="refresh" id="status-refresh" href="#" class="btn btn-secondary" @click="statusRefresh"> | <button v-if="refresh" id="status-refresh" href="#" class="btn btn-secondary" @click="statusRefresh"> | ||||
<svg-icon icon="sync-alt"></svg-icon> {{ $t('btn.refresh') }} | <svg-icon icon="sync-alt"></svg-icon> {{ $t('btn.refresh') }} | ||||
</button> | </button> | ||||
</div> | </div> | ||||
<div v-else class="d-flex align-items-start"> | <div v-else class="d-flex align-items-start"> | ||||
<p id="status-body" class="flex-grow-1"> | <p id="status-body" class="flex-grow-1"> | ||||
<span v-if="scope == 'dashboard'">{{ $t('status.ready-account') }}</span> | <span>{{ $t('status.ready-' + scopeLabel()) }}</span> | ||||
<span v-else-if="scope == 'domain'">{{ $t('status.ready-domain') }}</span> | |||||
<span v-else-if="scope == 'distlist'">{{ $t('status.ready-distlist') }}</span> | |||||
<span v-else-if="scope == 'resource'">{{ $t('status.ready-resource') }}</span> | |||||
<span v-else>{{ $t('status.ready-user') }}</span> | |||||
<br> | <br> | ||||
{{ $t('status.verify') }} | {{ $t('status.verify') }} | ||||
</p> | </p> | ||||
<div v-if="scope == 'domain'"> | <div v-if="scope == 'domain'"> | ||||
<button id="status-verify" class="btn btn-secondary text-nowrap" @click="confirmDomain"> | <button id="status-verify" class="btn btn-secondary text-nowrap" @click="confirmDomain"> | ||||
<svg-icon icon="sync-alt"></svg-icon> {{ $t('btn.verify') }} | <svg-icon icon="sync-alt"></svg-icon> {{ $t('btn.verify') }} | ||||
</button> | </button> | ||||
</div> | </div> | ||||
▲ Show 20 Lines • Show All 144 Lines • ▼ Show 20 Lines | export default { | ||||
}, | }, | ||||
emitEvent(data) { | emitEvent(data) { | ||||
// Remove useless data and emit the event (to parent components) | // Remove useless data and emit the event (to parent components) | ||||
delete data.status | delete data.status | ||||
delete data.message | delete data.message | ||||
this.$emit('status-update', data) | this.$emit('status-update', data) | ||||
}, | }, | ||||
getUrl() { | getUrl() { | ||||
let url | let scope = this.scope | ||||
let id = this.$route.params[scope] | |||||
switch (this.scope) { | if (scope == 'dashboard') { | ||||
case 'dashboard': | id = this.$store.state.authInfo.id | ||||
url = '/api/v4/users/' + this.$store.state.authInfo.id + '/status' | scope = 'user' | ||||
break | } else if (scope =='distlist') { | ||||
case 'distlist': | id = this.$route.params.list | ||||
url = '/api/v4/groups/' + this.$route.params.list + '/status' | scope = 'group' | ||||
break | } else if (scope == 'shared-folder') { | ||||
default: | id = this.$route.params.folder | ||||
url = '/api/v4/' + this.scope + 's/' + this.$route.params[this.scope] + '/status' | |||||
} | } | ||||
return url | return '/api/v4/' + scope + 's/' + id + '/status' | ||||
}, | |||||
scopeLabel() { | |||||
return this.scope == 'dashboard' ? 'account' : this.scope | |||||
} | } | ||||
} | } | ||||
} | } | ||||
</script> | </script> |