forked from tornadocash/classic-ui
Revert "added progress percentage"
This reverts commit 551bf1a98e55b71334c1825081d400161b809893.
This commit is contained in:
parent
57d3ba5ac5
commit
039006c42c
@ -3,14 +3,15 @@
|
||||
<div class="loading-container">
|
||||
<div class="loading-tornado" data-test="tornado_loader"></div>
|
||||
<div class="loading-message">{{ message }}...</div>
|
||||
<div v-if="progress >= 0" class="loading-message">{{ progress }}%</div>
|
||||
<approve-loader v-if="isApprove" />
|
||||
</div>
|
||||
</b-loading>
|
||||
</template>
|
||||
<script>
|
||||
import { mapState, mapGetters } from 'vuex'
|
||||
|
||||
import ApproveLoader from './ApproveLoader'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
ApproveLoader
|
||||
@ -18,7 +19,7 @@ export default {
|
||||
computed: {
|
||||
...mapGetters('metamask', ['isWalletConnect']),
|
||||
...mapState('metamask', ['providerName']),
|
||||
...mapState('loading', ['enabled', 'message', 'progress', 'type']),
|
||||
...mapState('loading', ['enabled', 'message', 'type']),
|
||||
isApprove() {
|
||||
return this.type === 'approve'
|
||||
}
|
||||
|
@ -338,7 +338,6 @@ export default {
|
||||
}
|
||||
this.$store.dispatch('application/setAndUpdateStatistic', { currency, amount: Number(amount) })
|
||||
this.$store.dispatch('fees/calculateWithdrawalFeeViaRelayer', {})
|
||||
this.$store.dispatch('loading/updateProgress', { progress: -1 })
|
||||
this.depositsPast = Number(depositsPast) <= 0 ? 0 : depositsPast
|
||||
this.depositTxHash = txHash
|
||||
this.depositTimestamp = timestamp
|
||||
|
@ -7,13 +7,6 @@ import InstanceABI from '@/abis/Instance.abi.json'
|
||||
import { CONTRACT_INSTANCES, eventsType, httpConfig } from '@/constants'
|
||||
import { sleep, flattenNArray, formatEvents, capitalizeFirstLetter } from '@/utils'
|
||||
|
||||
let store
|
||||
if (process.browser) {
|
||||
window.onNuxtReady(({ $store }) => {
|
||||
store = $store
|
||||
})
|
||||
}
|
||||
|
||||
class EventService {
|
||||
constructor({ netId, amount, currency, factoryMethods }) {
|
||||
this.idb = window.$nuxt.$indexedDB(netId)
|
||||
@ -36,15 +29,6 @@ class EventService {
|
||||
return `${type}s_${this.netId}_${this.currency}_${this.amount}`
|
||||
}
|
||||
|
||||
updateEventProgress(percentage, type) {
|
||||
if (store) {
|
||||
store.dispatch('loading/updateProgress', {
|
||||
message: `Fetching past ${type} events`,
|
||||
progress: Math.ceil(percentage * 100)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
async getEvents(type) {
|
||||
let cachedEvents = await this.getEventsFromDB(type)
|
||||
|
||||
@ -345,8 +329,6 @@ class EventService {
|
||||
const batchCount = Math.ceil(batchDigest / batchSize)
|
||||
|
||||
if (fromBlock < currentBlockNumber) {
|
||||
this.updateEventProgress(0, type)
|
||||
|
||||
for (let batchIndex = 0; batchIndex < batchCount; batchIndex++) {
|
||||
const isLastBatch = batchIndex === batchCount - 1
|
||||
const params = new Array(batchSize).fill('').map((_, i) => {
|
||||
@ -361,8 +343,6 @@ class EventService {
|
||||
failed = failed.concat(requests.filter((e) => e.isFailedBatch))
|
||||
lastBlock = params[batchSize - 1].toBlock
|
||||
|
||||
const progressIndex = batchIndex - failed.length / batchSize
|
||||
|
||||
if (isLastBatch && failed.length !== 0) {
|
||||
const failedBatch = await Promise.all(this.createBatchRequest(failed))
|
||||
const failedReqs = flattenNArray(failedBatch)
|
||||
@ -374,7 +354,6 @@ class EventService {
|
||||
throw new Error('Failed to batch events')
|
||||
}
|
||||
}
|
||||
this.updateEventProgress(progressIndex / batchCount, type)
|
||||
}
|
||||
|
||||
return {
|
||||
|
@ -1,7 +1,6 @@
|
||||
export const state = () => {
|
||||
return {
|
||||
message: '',
|
||||
progress: -1,
|
||||
enabled: false,
|
||||
type: null
|
||||
}
|
||||
@ -10,16 +9,14 @@ export const state = () => {
|
||||
export const getters = {}
|
||||
|
||||
export const mutations = {
|
||||
ENABLE(state, { message, progress, type }) {
|
||||
ENABLE(state, { message, type }) {
|
||||
state.message = message
|
||||
state.enabled = true
|
||||
state.progress = progress
|
||||
state.type = type
|
||||
},
|
||||
DISABLE(state) {
|
||||
state.message = ''
|
||||
state.enabled = false
|
||||
state.progress = -1
|
||||
state.type = null
|
||||
}
|
||||
}
|
||||
@ -31,9 +28,6 @@ export const actions = {
|
||||
changeText({ commit }, { message, type }) {
|
||||
commit('ENABLE', { message, type })
|
||||
},
|
||||
updateProgress({ commit }, { message, progress }) {
|
||||
commit('ENABLE', { message, progress })
|
||||
},
|
||||
disable({ commit }) {
|
||||
commit('DISABLE')
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user