fix(apps): Show message when the user doesn't have approved apps yet

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2023-04-05 09:28:23 +02:00
parent d881703386
commit e0ee9c143b
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773
2 changed files with 52 additions and 42 deletions

View file

@ -258,6 +258,8 @@ const icons: Record<string, () => Promise<any>> = {
import(`../../../node_modules/vue-material-design-icons/EyeOutline.vue`), import(`../../../node_modules/vue-material-design-icons/EyeOutline.vue`),
PencilOutline: () => PencilOutline: () =>
import(`../../../node_modules/vue-material-design-icons/PencilOutline.vue`), import(`../../../node_modules/vue-material-design-icons/PencilOutline.vue`),
Apps: () =>
import(`../../../node_modules/vue-material-design-icons/Apps.vue`),
}; };
const props = withDefaults( const props = withDefaults(

View file

@ -21,6 +21,7 @@
) )
}} }}
</p> </p>
<div v-if="authAuthorizedApplications.length > 0">
<div <div
class="flex justify-between items-center rounded-lg bg-white shadow-xl my-6" class="flex justify-between items-center rounded-lg bg-white shadow-xl my-6"
v-for="authAuthorizedApplication in authAuthorizedApplications" v-for="authAuthorizedApplication in authAuthorizedApplications"
@ -58,12 +59,18 @@
</div> </div>
<div class="p-4"> <div class="p-4">
<o-button <o-button
@click="() => revoke({ appTokenId: authAuthorizedApplication.id })" @click="
() => revoke({ appTokenId: authAuthorizedApplication.id })
"
variant="danger" variant="danger"
>{{ t("Revoke") }}</o-button >{{ t("Revoke") }}</o-button
> >
</div> </div>
</div> </div>
</div>
<EmptyContent v-else icon="apps" inline>
{{ t("No apps authorized yet") }}
</EmptyContent>
</section> </section>
</div> </div>
</template> </template>
@ -82,6 +89,7 @@ import RouteName from "../../router/name";
import { IUser } from "@/types/current-user.model"; import { IUser } from "@/types/current-user.model";
import { formatDateString } from "@/filters/datetime"; import { formatDateString } from "@/filters/datetime";
import { Notifier } from "@/plugins/notifier"; import { Notifier } from "@/plugins/notifier";
import EmptyContent from "@/components/Utils/EmptyContent.vue";
const { t } = useI18n({ useScope: "global" }); const { t } = useI18n({ useScope: "global" });
@ -94,7 +102,7 @@ const { result: authAuthorizedApplicationsResult } = useQuery<{
const authAuthorizedApplications = computed( const authAuthorizedApplications = computed(
() => () =>
authAuthorizedApplicationsResult.value?.loggedUser authAuthorizedApplicationsResult.value?.loggedUser
?.authAuthorizedApplications ?.authAuthorizedApplications ?? []
); );
const urlToHostname = (url: string | undefined): string | null => { const urlToHostname = (url: string | undefined): string | null => {