Browse Source

get chain info from middleware instead of env

readme
Mayank 5 years ago
parent
commit
e180111022
No known key found for this signature in database GPG Key ID: D037D60476CE748C
  1. 3
      .env
  2. 3
      .env.production
  3. 3
      .env.staging
  4. 2
      .github/workflows/main.yml
  5. 1
      package.json
  6. 33
      src/layouts/DashboardLayout.vue
  7. 2
      src/store/modules/bitcoin.js

3
.env

@ -1,2 +1 @@
VUE_APP_API_URL=http://localhost:3005
VUE_APP_NETWORK=regtest
VUE_APP_API_URL=http://localhost:3005

3
.env.production

@ -1,2 +1 @@
VUE_APP_API_URL=/api
VUE_APP_NETWORK=mainnet
VUE_APP_API_URL=/api

3
.env.staging

@ -1,2 +1 @@
VUE_APP_API_URL=/api
VUE_APP_NETWORK=testnet
VUE_APP_API_URL=/api

2
.github/workflows/main.yml

@ -17,7 +17,7 @@ jobs:
run: npm install
- name: Build in staging mode
run: npm run build-stage
run: npm run build
- name: Deploy to testnet server
uses: mayankchhabra/ssh-deploy@v2.1.2

1
package.json

@ -5,7 +5,6 @@
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build --mode production",
"build-stage": "vue-cli-service build --mode staging",
"lint": "vue-cli-service lint",
"deploy-local": "vue-cli-service build --mode production && rsync -aP --delete dist/ umbrel@umbrel.local:/home/umbrel/nginx/www"
},

33
src/layouts/DashboardLayout.vue

@ -26,14 +26,13 @@
<!-- Right aligned nav items -->
<b-navbar-nav class="ml-auto">
<!-- Testnet badge -->
<!-- Chain badge -->
<b-badge
variant="success"
v-if="network !== 'mainnet'"
v-if="chain !== 'mainnet'"
class="align-self-center mr-2 text-capitalize"
pill
>{{ network }}</b-badge
>
>{{ chain }}</b-badge>
<div
class="nav-hamburger-icon d-lg-none d-xl-none ml-1"
@ -42,11 +41,7 @@
>
<div></div>
</div>
<b-nav-item-dropdown
class="d-none d-lg-block d-xl-block"
right
no-caret
>
<b-nav-item-dropdown class="d-none d-lg-block d-xl-block" right no-caret>
<!-- Using 'button-content' slot -->
<template v-slot:button-content>Satoshi</template>
<b-dropdown-item @click="logout">Log out</b-dropdown-item>
@ -56,10 +51,7 @@
<!-- Mobile menu -->
<transition name="mobile-vertical-menu">
<div
class="mobile-vertical-menu d-lg-none d-xl-none"
v-show="isMobileMenuOpen"
>
<div class="mobile-vertical-menu d-lg-none d-xl-none" v-show="isMobileMenuOpen">
<authenticated-vertical-navbar :isMobileMenu="true" />
</div>
</transition>
@ -73,12 +65,7 @@
</transition>
<b-row class="mx-0">
<b-col
col
lg="3"
xl="2"
class="d-none d-lg-block d-xl-block pl-0 pr-0 pr-xl-2"
>
<b-col col lg="3" xl="2" class="d-none d-lg-block d-xl-block pl-0 pr-0 pr-xl-2">
<authenticated-vertical-navbar />
</b-col>
@ -108,12 +95,12 @@ import AuthenticatedVerticalNavbar from "@/components/AuthenticatedVerticalNavba
export default {
data() {
return {
environment: process.env.NODE_ENV,
network: process.env.VUE_APP_NETWORK
};
return {};
},
computed: {
chain() {
return this.$store.state.bitcoin.chain;
},
isDarkMode() {
return this.$store.getters.isDarkMode;
},

2
src/store/modules/bitcoin.js

@ -9,6 +9,7 @@ const state = () => ({
ipAddress: "",
onionAddress: "",
currentBlock: 0,
chain: "",
blockHeight: 0,
blocks: [],
percent: -1, //for loading state
@ -93,6 +94,7 @@ const mutations = {
state.percent = toPrecision(parseFloat(sync.percent) * 100, 2);
state.currentBlock = sync.currentBlock;
state.blockHeight = sync.headerCount;
state.chain = sync.chain;
if (sync.status === "calibrating") {
state.calibrating = true;

Loading…
Cancel
Save