Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

812 account tabs #815

Merged
merged 9 commits into from
Feb 8, 2024
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"universal-authenticator-library": "^0.3.0",
"vue": "^3.0.0",
"vue-class-component": "^7.2.6",
"vue-json-viewer": "3",
"vue-json-viewer": "^3.0.4",
"vue-router": "^4.0.0",
"vue3-openlayers": "^0.1.63",
"vuex": "^4.0.1"
Expand Down
9 changes: 7 additions & 2 deletions src/components/BpVotes.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, defineProps, onBeforeMount } from 'vue';
import { ref, defineProps, onBeforeMount, watch } from 'vue';
import { getHyperionAccountData } from 'src/api/hyperion';

const props = defineProps({
Expand All @@ -10,7 +10,7 @@ const props = defineProps({
});

const bpVotes = ref([]);
onBeforeMount(async () => {
const fetchVotes = async () => {
try {
const {
account: {
Expand All @@ -21,6 +21,11 @@ onBeforeMount(async () => {
} catch(e) {
console.error(e);
}
};
onBeforeMount(fetchVotes);
watch(() => props.account, async () => {
bpVotes.value = [];
await fetchVotes();
});
</script>

Expand Down
6 changes: 5 additions & 1 deletion src/components/ChildrenPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { useQuasar } from 'quasar';
import { api } from 'src/api';
import { Action, NewAccountData } from 'src/types';
import { defineComponent, onMounted, ref } from 'vue';
import { defineComponent, onMounted, ref, watch } from 'vue';
export default defineComponent({
name: 'ChildrenPanel',
components: {},
Expand All @@ -29,6 +29,10 @@ export default defineComponent({
formatAccount((el.act.data as NewAccountData).newact, 'account'),
);
};
watch(()=> props.account, async () => {
children.value = [];
await loadAccountData();
});
// TODO Refactor
const formatAccount = (
name: string,
Expand Down
6 changes: 5 additions & 1 deletion src/components/KeysPanel.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import { Permission, PermissionLinks } from 'src/types';
import PermissionCard from 'components/PermissionCard.vue';
import { computed, defineComponent, onMounted, ref } from 'vue';
import { computed, defineComponent, onMounted, ref, watch } from 'vue';
import { api } from 'src/api';
import { useQuasar } from 'quasar';
import { API } from '@greymass/eosio';
Expand Down Expand Up @@ -46,6 +46,10 @@ export default defineComponent({

permission.value = sortPermissions(permissions);
};
watch(account, async () => {
permission.value = null;
await loadAccountData();
});
const sortPermissions = (perm: Permission[]) => {
let result: Permission;
result = perm.find(p => p.perm_name.toString() === 'owner');
Expand Down
5 changes: 5 additions & 0 deletions src/components/TokensPanel.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script lang="ts">
import { watch } from 'vue';
import { api } from 'src/api';
import { Token } from 'src/types';
import { defineComponent, onMounted, ref, toRef } from 'vue';
Expand All @@ -25,6 +26,10 @@ export default defineComponent({
return [];
}
};
watch(account, async () => {
tokens.value = [];
await loadTokens();
});

const loadTokens = async (): Promise<void> => {
// TODO Refactor redundant getTokens in AccountCard
Expand Down
7 changes: 6 additions & 1 deletion src/components/contract/ContractActions.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import { defineComponent, ref, computed, onMounted } from 'vue';
import { defineComponent, ref, computed, onMounted, watch } from 'vue';
import { useStore } from 'src/store';
import ViewTransaction from 'src/components/ViewTransanction.vue';

Expand Down Expand Up @@ -53,6 +53,11 @@ export default defineComponent({
}
}

watch(actions, () => {
action.value = actions.value[0];
memo.value = {};
});

onMounted(async () => {
actor.value = await store.state.account.user.getAccountName();
permission.value = store.state.account.accountPermission;
Expand Down
7 changes: 6 additions & 1 deletion src/components/contract/ContractTables.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import { defineComponent, ref, computed, onMounted } from 'vue';
import { defineComponent, ref, computed, onMounted, watch } from 'vue';
import { useStore } from 'src/store';
import { api } from 'src/api/index';
import { GetTableRowsParams, GenericTable } from 'src/types';
Expand Down Expand Up @@ -67,6 +67,11 @@ export default defineComponent({
await getRows();
});

watch(account, async () => {
rows.value = []
table.value = options.value[0];
});

async function showMore() {
limit.value = (Number(limit.value) + Number(limit.value)).toString();
await getRows();
Expand Down
4 changes: 4 additions & 0 deletions src/pages/Account.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ export default defineComponent({
await store.dispatch('account/updateABI', route.params.account);
});

watch([account], async () => {
await store.dispatch('account/updateABI', route.params.account);
});

watch([tab], () => {
void router.push({
path: router.currentRoute.value.path,
Expand Down
1 change: 1 addition & 0 deletions src/store/account/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ export const actions: ActionTree<AccountStateInterface, StateInterface> = {
commit('setTransactionError', '');
},
async updateABI({ commit }, account: string) {
commit('setABI', {});
const abi = await api.getABI(account);
commit('setABI', abi);
},
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11302,7 +11302,7 @@ vue-jest@^5.0.0-alpha.10:
source-map "0.5.6"
tsconfig "^7.0.0"

vue-json-viewer@3:
vue-json-viewer@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/vue-json-viewer/-/vue-json-viewer-3.0.4.tgz#c1d65515e57d4036defbbc18fa942d7fd5fb9a8b"
integrity sha512-pnC080rTub6YjccthVSNQod2z9Sl5IUUq46srXtn6rxwhW8QM4rlYn+CTSLFKXWfw+N3xv77Cioxw7B4XUKIbQ==
Expand Down
Loading