Skip to content

Commit

Permalink
More cfg UI
Browse files Browse the repository at this point in the history
Signed-off-by: Lucas ONeil <lucasoneil@gmail.com>
  • Loading branch information
loneil committed Nov 11, 2023
1 parent b21a5a5 commit 0896178
Show file tree
Hide file tree
Showing 4 changed files with 279 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,22 @@
>
<ProgressSpinner v-if="loading" />
<div v-else>
<!-- Topline version info -->
<p>
<strong>{{ $t('serverConfig.acapyVersion') }}</strong>
{{ serverConfig?.config?.version }}
</p>
<p>
<strong>{{ $t('serverConfig.tractionProxy') }}</strong>
{{ config.frontend.tenantProxyPath }}
<a :href="swaggerUrl" target="_blank"> <i class="pi pi-external-link ml-2" /> </a>
<a :href="swaggerUrl" target="_blank">
<i class="pi pi-external-link ml-2" />
</a>
</p>

<div class="grid mt-3">
<div class="col">
<!-- Traction cfg - ledger -->
<Fieldset
:legend="$t('serverConfig.ledger.ledgerDetails')"
:toggleable="true"
Expand All @@ -39,8 +43,46 @@
</p>
</Fieldset>

<!-- Traction cfg - storage -->
<Fieldset
class="mt-4"
:legend="$t('serverConfig.storage.title')"
:toggleable="true"
>
<p class="mt-0">
<strong>{{
$t('serverConfig.storage.walletStorageConfig')
}}</strong>
{{ serverConfig?.config?.['wallet.storage_config'] }}
</p>
<p>
<strong>{{
$t('serverConfig.storage.walletStorageType')
}}</strong>
{{ serverConfig?.config?.['wallet.storage_type'] }}
</p>
<p>
<strong>{{ $t('serverConfig.storage.walletType') }}</strong>
{{ serverConfig?.config?.['wallet.type'] }}
</p>
<p>
<strong>{{
$t('serverConfig.storage.multitenantWalletName')
}}</strong>
{{ serverConfig?.config?.['multitenant.wallet_name'] }}
</p>
<p>
<strong>{{
$t('serverConfig.storage.multitenantWalletType')
}}</strong>
{{ serverConfig?.config?.['multitenant.wallet_type'] }}
</p>
</Fieldset>

<!-- Plugins from API call to get them -->
<PluginList class="mt-4" />

<!-- Traction cfg - raw json -->
<Accordion class="mt-4">
<AccordionTab :header="$t('serverConfig.expand')">
<div v-if="loading" class="flex justify-content-center">
Expand All @@ -52,21 +94,113 @@
</div>

<div class="col">
<!-- Details about tenants/reservations -->
<Fieldset
:legend="$t('serverConfig.tenants.title')"
:toggleable="true"
>
<p class="mt-0">
<strong>{{ $t('serverConfig.tenants.token') }}</strong>
{{
serverConfig?.config?.plugin_config?.multitenant_provider
?.token_expiry?.amount
}}
{{
serverConfig?.config?.plugin_config?.multitenant_provider
?.token_expiry?.units
}}
</p>
<h3>{{ $t('serverConfig.tenants.reservation') }}</h3>
<p>
<strong>{{
$t('serverConfig.tenants.reservationExpiry')
}}</strong>
{{
serverConfig?.config?.plugin_config?.traction_innkeeper
?.reservation?.expiry_minutes
}}
</p>
<p>
<strong>{{
$t('serverConfig.tenants.reservationAutoApprove')
}}</strong>
{{
serverConfig?.config?.plugin_config?.traction_innkeeper
?.reservation?.auto_approve
}}
</p>
<p>
<strong>{{
$t('serverConfig.tenants.reservationAutoIssuer')
}}</strong>
{{
serverConfig?.config?.plugin_config?.traction_innkeeper
?.reservation?.auto_issuer
}}
</p>
<p class="">
<strong>{{ $t('serverConfig.tenants.reservationOidc') }}</strong>
{{ config.frontend.showOIDCReservationLogin }}
</p>
<div class="grid mt-0">
<div class="col xl:col-8">
<Accordion>
<AccordionTab
:header="$t('serverConfig.tenants.reservationForm')"
>
<div v-if="loading" class="flex justify-content-center">
<ProgressSpinner />
</div>
<vue-json-pretty v-else :data="resFormData" />
</AccordionTab>
</Accordion>
</div>
</div>
</Fieldset>

<!-- Specific Tenant UI cfg fields -->
<Fieldset
class="mt-4"
:legend="$t('serverConfig.tenantUi.tenantUi')"
:toggleable="true"
>
<p class="m-0"></p>
<p class="mt-0">
<strong>{{ $t('serverConfig.tenantUi.showWrite') }}</strong>
{{ config.frontend.showWritableComponents }}
</p>
<p>
<strong>{{ $t('serverConfig.tenantUi.sessionExpiry') }}</strong>
{{
$t('serverConfig.tenantUi.sessionExpiryVal', [
config.frontend.session?.timeoutSeconds,
config.frontend.session?.countdownSeconds,
])
}}
</p>
<p>
<strong>{{ $t('serverConfig.tenantUi.oidc') }}</strong>
{{ config.frontend.oidc?.authority }}
</p>
</Fieldset>

<!-- Tenant UI config endpoint raw json -->
<Accordion class="mt-4">
<AccordionTab :header="$t('serverConfig.tenantUi.expand')">
<div v-if="loading" class="flex justify-content-center">
<ProgressSpinner />
</div>
<vue-json-pretty v-else :data="config" />
</AccordionTab>
</Accordion>
</div>
</div>
</div>
<vue-json-pretty :data="config" />
</MainCardContent>
</template>

<script setup lang="ts">
// Imports
import axios from 'axios';
import Accordion from 'primevue/accordion';
import AccordionTab from 'primevue/accordiontab';
import Column from 'primevue/column';
Expand All @@ -92,11 +226,17 @@ onMounted(async () => {
loadConfig();
});

let resFormData: any;

const loadConfig = async () => {
innkeeperTenantsStore.getServerConfig().catch((err: string) => {
console.error(err);
toast.error(`Failure: ${err}`);
});

// use axios to get forms/reservation.json from the root url
const response = await axios.get('/forms/reservation.json');
resFormData = response.data;
};

const ledgerConfigList = computed(() => {
Expand Down
45 changes: 34 additions & 11 deletions services/tenant-ui/frontend/src/plugins/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -363,11 +363,6 @@
"title": "Reservation Approved",
"toast": "Reservation Approved for {email}"
},
"refreshed": {
"text": "The Check-In password has been re-sent to {email}",
"title": "Password Refreshed",
"toast": "Password Refreshed for {email}"
},
"approveRequest": "Approve Request",
"checkJunkFolder": "(Please check your junk/spam folder before contacting us, as it is very common to have the email delivery problems because of automated filters.)",
"contactEmail": "Contact Email",
Expand All @@ -380,7 +375,6 @@
"toast": "Reservation Denied for {email}"
},
"denyRequest": "Deny Request",
"refreshPassword": "Refresh Password",
"emailSentTo": "An email has also been sent to {0} with the reservation number below.",
"enterPassword": "Please enter the reservation password below to validate your account.",
"history": "History",
Expand All @@ -390,6 +384,12 @@
"passwordAvailable": "The reservation password is visible below, please use it to complete your check-in.",
"passwordValid48Hours": "The reservation password is only valid for 48 hours from the time it was sent to your email address.",
"pending!": "PENDING!",
"refreshed": {
"text": "The Check-In password has been re-sent to {email}",
"title": "Password Refreshed",
"toast": "Password Refreshed for {email}"
},
"refreshPassword": "Refresh Password",
"requestDeclined": "We regret to inform you that your request has been declined.",
"requestProcessingTime": "It ususally takes 3-4 business days to process a request. Thanks for your patience.",
"requestReservedOn": "Your request has been received on {0}",
Expand Down Expand Up @@ -424,11 +424,34 @@
"ledgerList": "Ledger List",
"quickConnect": "Tenant UI quick-connect endorser:"
},
"tractionProxy": "Traction Proxy URL:",
"serverConfig": "Server Configuration",
"storage": {
"multitenantWalletName": "Multitenant Wallet Name:",
"multitenantWalletType": "Multitenant Wallet Type:",
"title": "Storage",
"walletStorageConfig": "Wallet Storage Config:",
"walletStorageType": "Wallet Storage Type:",
"walletType": "Wallet Type:"
},
"tenants": {
"reservation": "Reservation",
"reservationAutoApprove": "Auto approve reservations:",
"reservationAutoIssuer": "Auto issuance approval:",
"reservationExpiry": "Reservation expiry (minutes):",
"reservationForm": "Reservation Form",
"reservationOidc": "OIDC login requried for reservation:",
"title": "Tenants/Reservations",
"token": "Token Expiry:"
},
"tenantUi": {
"expand": "Show Full Tenant UI Frontend Config",
"oidc": "OIDC Endpoint:",
"sessionExpiry": "Frontend session expiry:",
"sessionExpiryVal": "{0} seconds (Countdown: {1} seconds)",
"showWrite": "Show 'Write' Components:",
"tenantUi": "Tenant UI"
}
},
"tractionProxy": "Traction Proxy URL:"
},
"session": {
"countdown": "You are going to be logged out in { seconds } seconds...",
Expand Down Expand Up @@ -490,13 +513,13 @@
"canBecomeIssuer": "Tenant can become issuer, i.e connect to endorser and register DID",
"canConnectEndorser": "Tenant allowed to connect to Endorser",
"canRegisterDid": "Tenant allowed to register public DID",
"confirmDeletion": "To confirm, type \"{tenantName}\" in the box below",
"deleteTenant": "Delete Tenant",
"editSettings": "Edit Tenant Config",
"enableLedgerSwitch": "Tenant can switch endorser/ledger",
"endorserAlias": "Endorser Alias:",
"ledgerName": "Ledger Name:",
"success": "Tenant Config Updated",
"confirmDeletion": "To confirm, type \"{tenantName}\" in the box below",
"deleteTenant": "Delete Tenant"
"success": "Tenant Config Updated"
},
"tenants": "Tenants"
},
Expand Down
Loading

0 comments on commit 0896178

Please sign in to comment.