improve UI for demo instance

This commit is contained in:
Hayden 2022-10-12 12:48:52 -08:00
parent 79f1456017
commit 5f57b1ed97
6 changed files with 36 additions and 0 deletions

View file

@ -1580,6 +1580,9 @@ const docTemplate = `{
"build": {
"$ref": "#/definitions/v1.Build"
},
"demo": {
"type": "boolean"
},
"health": {
"type": "boolean"
},

View file

@ -1572,6 +1572,9 @@
"build": {
"$ref": "#/definitions/v1.Build"
},
"demo": {
"type": "boolean"
},
"health": {
"type": "boolean"
},

View file

@ -335,6 +335,8 @@ definitions:
properties:
build:
$ref: '#/definitions/v1.Build'
demo:
type: boolean
health:
type: boolean
message:

View file

@ -56,6 +56,10 @@ func NewControllerV1(svc *services.AllServices, options ...func(*V1Controller))
svc: svc,
}
for _, opt := range options {
opt(ctrl)
}
return ctrl
}

View file

@ -227,6 +227,7 @@ export interface UserRegistration {
export interface ApiSummary {
build: Build;
demo: boolean;
health: boolean;
message: string;
title: string;

View file

@ -11,6 +11,24 @@
const api = usePublicApi();
const toast = useNotifier();
const { data: status } = useAsyncData(async () => {
const { data } = await api.status();
if (data) {
console.log(data);
username.value = "demo@email.com";
password.value = "demo";
}
return data;
});
whenever(status, status => {
if (status?.demo) {
email.value = "demo@email.com";
loginPassword.value = "demo";
}
});
const authStore = useAuthStore();
if (!authStore.isTokenExpired) {
navigateTo("/home");
@ -178,6 +196,11 @@
<Icon name="heroicons-user" class="mr-1 w-7 h-7" />
Login
</h2>
<template v-if="status && status.demo">
<p class="text-xs italic text-center">This is a demo instance</p>
<p class="text-xs text-center"><b>Email</b> demo@email.com</p>
<p class="text-xs text-center"><b>Password</b> demo</p>
</template>
<FormTextField v-model="email" label="Email" />
<FormTextField v-model="loginPassword" label="Password" type="password" />
<div class="card-actions justify-end mt-2">