Pretty much everything loading in software Gerty

This commit is contained in:
ben 2022-12-15 14:50:32 +00:00
parent eb9ec21c89
commit 2e786e63bf
2 changed files with 130 additions and 209 deletions

View File

@ -1,7 +1,7 @@
{% extends "public.html" %} {% block toolbar_title %} Gerty: {% raw %}{{ gertyname }}{% endraw %}{%
endblock %}{% block page %} {% raw %}
<div class="q-pa-md row items-start q-gutter-md">
<div class="q-pa-md row items-start q-gutter-md" v-if="fun_exchange_market_rate || fun_satoshi_quotes">
<q-card v-if="fun_exchange_market_rate" unelevated class="q-pa-sm" style="background: none !important">
<q-card-section class="text-h1 q-pa-none">
@ -30,6 +30,36 @@ endblock %}{% block page %} {% raw %}
</q-card>
</div>
<div class="q-pa-md row items-start q-gutter-md" v-if="dashboard_onchain || dashboard_mining || lightning_dashboard">
<q-card class="q-pa-sm" v-if="dashboard_onchain" unelevated class="q-pa-sm">
<q-card-section>
<div class="text-h6">Onchain</div>
</q-card-section>
<q-card-section class="q-pa-none">
<p v-for="(item, t) in dashboard_onchain"><b>{{item[0].value}}: </b>{{item[1].value}}</p>
</q-card-section>
</q-card>
<q-card class="q-pa-sm" v-if="dashboard_mining" unelevated class="q-pa-sm">
<q-card-section>
<div class="text-h6">Mining</div>
</q-card-section>
<q-card-section class="q-pa-none">
<p v-for="(item, t) in dashboard_mining"><b>{{item[0].value}}:</b> {{item[1].value}}</p>
</q-card-section>
</q-card>
<q-card class="q-pa-sm" v-if="lightning_dashboard" unelevated class="q-pa-sm">
<q-card-section>
<div class="text-h6">Lightning (Last 7 days)</div>
</q-card-section>
<q-card-section class="q-pa-none">
<p v-for="(item, t) in lightning_dashboard"><b>{{item[0].value}}:</b> {{item[1].value}}</p>
</q-card-section>
</q-card>
</div>
{% endraw %} {% endblock %} {% block scripts %}
<script>
Vue.component(VueQrcode.name, VueQrcode)
@ -40,7 +70,7 @@ endblock %}{% block page %} {% raw %}
data: function () {
return {
lnbits_wallets_balance: {},
onchain: {},
dashboard_onchain: {},
fun_satoshi_quotes: {},
fun_exchange_market_rate: {},
gerty: [],
@ -67,7 +97,7 @@ endblock %}{% block page %} {% raw %}
},
methods: {
getGertyInfo: async function () {
for (let i = 0; i < 5; i++){
for (let i = 0; i < 8; i++){
try {
const {data} = await LNbits.api.request(
'GET',
@ -79,11 +109,7 @@ endblock %}{% block page %} {% raw %}
LNbits.utils.notifyApiError(error)
}
}
},
},
created: async function () {
await this.getGertyInfo()
console.log(this.gerty)
console.log(this.gerty)
for (let i = 0; i < this.gerty.length; i++) {
if(this.gerty[i].screen.group == "lnbits_wallets_balance"){
for (let q = 0; q < this.gerty[i].screen.areas.length; q++) {
@ -96,9 +122,17 @@ endblock %}{% block page %} {% raw %}
this.gertyname = this.gerty[i].settings.name
}
}
if(this.gerty[i].screen.group == "onchain"){
this.onchain = this.gerty[i].screen.areas
console.log(this.onchain)
if(this.gerty[i].screen.group == "dashboard_onchain"){
this.dashboard_onchain = this.gerty[i].screen.areas
this.gertyname = this.gerty[i].settings.name
}
if(this.gerty[i].screen.group == "dashboard_mining"){
this.dashboard_mining = this.gerty[i].screen.areas
this.gertyname = this.gerty[i].settings.name
}
if(this.gerty[i].screen.group == "lightning_dashboard"){
this.lightning_dashboard = this.gerty[i].screen.areas
this.gertyname = this.gerty[i].settings.name
}
if(this.gerty[i].screen.group == "fun_satoshi_quotes"){
this.fun_satoshi_quotes["quote"] = this.gerty[i].screen.areas[0][0].value
@ -110,7 +144,17 @@ endblock %}{% block page %} {% raw %}
this.fun_exchange_market_rate["amount"] = this.gerty[i].screen.areas[0][1].value
this.gertyname = this.gerty[i].settings.name
}
}
setTimeout(this.getGertyInfo, 20000);
this.$forceUpdate();
return this.gerty
},
},
created: async function () {
await this.getGertyInfo()
}
})
</script>

View File

@ -140,210 +140,33 @@
label="Name"
placeholder="Son of Gerty"
></q-input>
<q-checkbox
class="q-pl-md"
<p>Use the toggles below to control what your Gerty will display</p>
size="xs"
v-model="formDialog.data.display_preferences.fun_satoshi_quotes"
val="xs"
label="Satoshi Quotes"
><q-tooltip>Displays random quotes from Satoshi</q-tooltip></q-checkbox>
<q-checkbox
class="q-pl-md"
<div class="column">
<div class="col">
<q-toggle
v-model="formDialog.data.display_preferences.fun_satoshi_quotes"
label="Satoshi Quotes"
>
<q-tooltip>Displays random quotes from Satoshi</q-tooltip>
</q-toggle>
</div>
<div class="col">
<q-toggle
v-model="formDialog.data.display_preferences.fun_exchange_market_rate"
label="Fiat to BTC price"
></q-toggle>
<q-select
v-if="formDialog.data.display_preferences.fun_exchange_market_rate"
filled
dense
emit-value
v-model="formDialog.data.exchange"
:options="currencyOptions"
label="Exchange rate"
></q-select>
</div>
<div class="col">
<q-toggle
v-model="formDialog.data.display_preferences.lnbits_wallets_balance"
label="Show LNbits wallet balances"
@input="setWallets"
></q-toggle>
<q-select
v-if="formDialog.data.display_preferences.lnbits_wallets_balance"
filled
multiple
dense
emit-value
v-model="formDialog.data.lnbits_wallets"
use-input
use-chips
multiple
hide-dropdown-icon
new-value-mode="add-unique"
label="Invoice keys of wallets to watch"
>
<q-tooltip>Hit enter to add values</q-tooltip>
</q-select>
</div>
<div class="col">
<q-toggle
v-model="toggleStates.onchain"
label="Onchain Information"
@input="setOnchain"
>
</q-toggle>
<br />
<div class="row">
<div class="col">
<q-toggle
class="q-pl-lg"
v-if="toggleStates.onchain"
v-model="formDialog.data.display_preferences.onchain_difficulty_epoch_progress"
label="Epoch percentage"
></q-toggle>
</div>
<div class="col">
<q-toggle
class="q-pl-lg"
v-if="toggleStates.onchain"
v-model="formDialog.data.display_preferences.onchain_difficulty_retarget_date"
label="Retarget date"
></q-toggle>
</div>
</div>
<div class="row">
<div class="col">
<q-toggle
class="q-pl-lg"
v-if="toggleStates.onchain"
v-model="formDialog.data.display_preferences.onchain_difficulty_blocks_remaining"
label="Blocks until adjustment"
></q-toggle>
</div>
<div class="col">
<q-toggle
class="q-pl-lg"
v-if="toggleStates.onchain"
v-model="formDialog.data.display_preferences.onchain_difficulty_epoch_time_remaining"
label="Time until adjustment"
></q-toggle>
</div>
</div>
<q-toggle
class="q-pl-lg"
v-if="toggleStates.onchain"
v-model="formDialog.data.display_preferences.onchain_block_height"
label="Current block height"
></q-toggle>
</div>
<div class="col">
<q-toggle v-model="toggleStates.mempool" label="The Mempool">
</q-toggle>
<br />
<div class="row">
<div class="col">
<q-toggle
class="q-pl-lg"
v-model="formDialog.data.display_preferences.mempool_recommended_fees"
v-if="toggleStates.mempool"
label="Recommended fees"
></q-toggle>
</div>
<div class="col">
<q-toggle
class="q-pl-lg"
v-model="formDialog.data.display_preferences.mempool_tx_count"
v-if="toggleStates.mempool"
label="Transactions in mempool"
></q-toggle>
</div>
</div>
</div>
<div class="col">
<q-toggle
label="Mining Data"
v-model="toggleStates.mining"
@input="setMining"
></q-toggle>
<br />
<div class="row">
<div class="col">
<q-toggle
class="q-pl-lg"
v-if="toggleStates.mining"
v-model="formDialog.data.display_preferences.mining_current_hash_rate"
label="Mining hashrate"
></q-toggle>
</div>
<div class="col">
<q-toggle
class="q-pl-lg"
v-if="toggleStates.mining"
v-model="formDialog.data.display_preferences.mining_current_difficulty"
label="Mining difficulty"
></q-toggle>
</div>
</div>
</div>
<div class="col">
<q-toggle
label="*Advanced"
v-model="toggleStates.advanced"
@input="setAdvanced"
></q-toggle>
<br />
<q-input
v-if="toggleStates.advanced"
filled
dense
v-model.trim="formDialog.data.mempool_endpoint"
label="Mempool link"
class="q-pb-sm"
>
</q-input>
<q-input
v-if="toggleStates.advanced"
filled
dense
v-model.trim="formDialog.data.refresh_time"
label="Refresh time in seconds"
class="q-pb-md"
>
<q-tooltip
>The amount of time in seconds between screen updates
</q-tooltip>
</q-input>
<q-separator
class="q-mb-md"
v-if="toggleStates.advanced"
></q-separator>
<p class="q-pl-sm q-mb-xs" v-if="toggleStates.advanced">
Gerty Device Dashboards (for Gerty
<a
target="_blank"
href="https://shop.lnbits.com/product/gerty-a-bitcoin-assistant"
>devices</a
>):
</p>
size="xs"
v-model="formDialog.data.display_preferences.fun_exchange_market_rate"
val="xs"
label="Fiat to BTC price"
></q-checkbox>
<q-checkbox
class="q-pl-md"
v-if="toggleStates.advanced"
size="xs"
v-model="formDialog.data.display_preferences.dashboard"
v-model="formDialog.data.display_preferences.lnbits_wallets_balance"
val="xs"
label="LNbits"
></q-checkbox>
<q-checkbox
class="q-pl-md"
v-if="toggleStates.advanced"
size="xs"
v-model="formDialog.data.display_preferences.dashboard_onchain"
val="xs"
@ -351,7 +174,7 @@
></q-checkbox>
<q-checkbox
class="q-pl-md"
v-if="toggleStates.advanced"
size="xs"
v-model="formDialog.data.display_preferences.dashboard_mining"
val="xs"
@ -359,14 +182,68 @@
></q-checkbox>
<q-checkbox
class="q-pl-md"
v-if="toggleStates.advanced"
size="xs"
v-model="formDialog.data.display_preferences.lightning_dashboard"
val="xs"
label="Lightning"
></q-checkbox>
</div>
</div>
<q-select
v-if="formDialog.data.display_preferences.fun_exchange_market_rate"
filled
dense
emit-value
v-model="formDialog.data.exchange"
:options="currencyOptions"
label="Exchange rate"
></q-select>
<q-select
v-if="formDialog.data.display_preferences.lnbits_wallets_balance"
filled
multiple
dense
emit-value
v-model="formDialog.data.lnbits_wallets"
use-input
use-chips
multiple
hide-dropdown-icon
new-value-mode="add-unique"
label="Invoice keys of wallets to watch"
>
<q-tooltip>Hit enter to add values</q-tooltip>
</q-select>
<q-toggle
label="*Advanced"
v-model="toggleStates.advanced"
@input="setAdvanced"
></q-toggle>
<br />
<q-input
v-if="toggleStates.advanced"
filled
dense
v-model.trim="formDialog.data.mempool_endpoint"
label="Mempool link"
class="q-pb-sm"
>
</q-input>
<q-input
v-if="toggleStates.advanced"
filled
dense
v-model.trim="formDialog.data.refresh_time"
label="Refresh time in seconds"
class="q-pb-md"
>
<q-tooltip
>The amount of time in seconds between screen updates
</q-tooltip>
</q-input>
<div class="row q-mt-lg">
<q-btn