-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Differentiate in LicenseAlert between Admin & User
Show a different message to the user if the license is epired or exceeded because a user does not have access to the admin section. Also reuse the already retrieved license status from the calling component.
- Loading branch information
Showing
4 changed files
with
22 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,49 @@ | ||
<template> | ||
<div v-if="license && license.isExpired()" class="rounded-md bg-red-50 p-4 mb-3"> | ||
<div v-if="props.licenseStatus.isExpired()" class="rounded-md bg-red-50 p-4 mb-3"> | ||
<div class="flex"> | ||
<div class="flex-shrink-0"> | ||
<XCircleIcon class="h-5 w-5 text-red-400" aria-hidden="true" /> | ||
</div> | ||
<div class="ml-3"> | ||
<h3 class="text-sm font-medium text-red-800">{{ t('licenseAlert.licenseExpired.title') }}</h3> | ||
<i18n-t keypath="licenseAlert.licenseExpired.description" scope="global" tag="p" class="mt-2 text-sm text-red-700"> | ||
<i18n-t v-if="props.isAdmin" keypath="licenseAlert.licenseExpired.admin.description" scope="global" tag="p" class="mt-2 text-sm text-red-700"> | ||
<router-link to="/app/admin/settings" class="text-sm text-red-700 underline hover:text-red-600"> | ||
{{ t('licenseAlert.button') }} | ||
</router-link> | ||
</i18n-t> | ||
<p v-else class="mt-2 text-sm text-red-700">{{ t('licenseAlert.licenseExpired.user.description') }}</p> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div v-else-if="license && license.isExceeded()" class="rounded-md bg-yellow-50 p-4 mb-3"> | ||
<div v-else-if="props.licenseStatus.isExceeded()" class="rounded-md bg-yellow-50 p-4 mb-3"> | ||
<div class="flex"> | ||
<div class="flex-shrink-0"> | ||
<ExclamationTriangleIcon class="h-5 w-5 text-yellow-400" aria-hidden="true" /> | ||
</div> | ||
<div class="ml-3"> | ||
<h3 class="text-sm font-medium text-yellow-800">{{ t('licenseAlert.noRemainingSeats.title') }}</h3> | ||
<i18n-t keypath="licenseAlert.noRemainingSeats.description" scope="global" tag="p" class="mt-2 text-sm text-yellow-700"> | ||
<i18n-t v-if="props.isAdmin" keypath="licenseAlert.noRemainingSeats.admin.description" scope="global" tag="p" class="mt-2 text-sm text-yellow-700"> | ||
<router-link to="/app/admin/settings" class="text-sm text-yellow-700 underline hover:text-yellow-600"> | ||
{{ t('licenseAlert.button') }} | ||
</router-link> | ||
</i18n-t> | ||
<p v-else class="mt-2 text-sm text-yellow-700">{{ t('licenseAlert.noRemainingSeats.user.description') }}</p> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { ExclamationTriangleIcon, XCircleIcon } from '@heroicons/vue/20/solid'; | ||
import { onMounted, ref } from 'vue'; | ||
import { useI18n } from 'vue-i18n'; | ||
import backend, { LicenseUserInfoDto } from '../common/backend'; | ||
import { LicenseUserInfoDto } from '../common/backend'; | ||
const { t } = useI18n({ useScope: 'global' }); | ||
const license = ref<LicenseUserInfoDto>(); | ||
const props = defineProps<{ | ||
isAdmin: boolean, | ||
licenseStatus: LicenseUserInfoDto | ||
}>(); | ||
onMounted(fetchData); | ||
async function fetchData() { | ||
try { | ||
license.value = await backend.license.getUserInfo(); | ||
} catch (error) { | ||
console.error('Retrieving license information failed', error); | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters