Skip to content
This repository has been archived by the owner on Jul 9, 2023. It is now read-only.

Commit

Permalink
fix duration config event
Browse files Browse the repository at this point in the history
  • Loading branch information
n8maninger committed Jun 5, 2022
1 parent 7cae1c1 commit 8d707ef
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 23 deletions.
4 changes: 2 additions & 2 deletions src/components/CurrencyInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ export default {
},
emits: [
'update:modelValue',
'update'
'update',
'input'
],
computed: {
...mapState({
Expand Down Expand Up @@ -91,7 +92,6 @@ export default {
},
watch: {
refresh() {
console.log('refreshing', this.modelValue);
this.amount = this.modelValue;
this.onFormatValues(false);
}
Expand Down
6 changes: 4 additions & 2 deletions src/components/config/DurationItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export default {
value: Number,
average: Number
},
emits: ['update'],
beforeMount() {
this.duration = this.value;
this.onFormatDuration();
Expand All @@ -49,9 +50,10 @@ export default {
methods: {
onChange() {
try {
console.log('pre change', this.durationStr);
this.duration = parseBlockTimeString(this.durationStr);
this.$emit('change', this.duration);
console.log('change', this.duration, this.durationStr);
this.$emit('update', this.duration);
} catch (ex) {
console.error('DurationItem.onChange', ex);
}
Expand Down
5 changes: 3 additions & 2 deletions src/components/config/FileItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</div>
<div class="config-error"><slot name="error" /></div>
<div class="control control-search">
<input type="text" v-model="path" @input="$emit('change', path)" />
<input type="text" v-model="path" @input="$emit('update', path)" />
<button @click="onSelectDir"><icon icon="search" /> Browse</button>
</div>
<div class="config-denom"><slot name="denomination" /></div>
Expand All @@ -22,6 +22,7 @@ export default {
props: {
value: String
},
emits: ['update'],
beforeMount() {
this.path = this.value;
},
Expand All @@ -36,7 +37,7 @@ export default {
this.path = filePath || '';
this.$emit('change', this.path);
this.$emit('update', this.path);
}
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/components/config/PriceItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default {
pinned: Boolean
},
emits: [
'change'
'update'
],
mounted() {
this.price = this.value;
Expand All @@ -80,7 +80,7 @@ export default {
if (!this.price)
return;
this.$emit('change', {
this.$emit('update', {
value: this.price,
fiat: this.fiatPrice,
pinned: this.pricePinned
Expand Down
3 changes: 2 additions & 1 deletion src/components/config/SizeItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export default {
value: Object,
average: Object
},
emits: ['update'],
beforeMount() {
this.size = this.value;
this.onFormatSize();
Expand Down Expand Up @@ -55,7 +56,7 @@ export default {
try {
this.size = parseByteString(this.sizeStr);
this.$emit('change', this.size);
this.$emit('update', this.size);
} catch (ex) {
console.error('SizeItem.onChange', ex);
}
Expand Down
29 changes: 15 additions & 14 deletions src/views/pages/Config.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,61 +9,61 @@
</div>
<div class="host-config">
<div class="config-header">Storage</div>
<price-item :value="contractPrice" :average="averageSettings.contract_price" :pinned="isPinned('mincontractprice')" @change="onChangePrice('mincontractprice', $event)">
<price-item :value="contractPrice" :average="averageSettings.contract_price" :pinned="isPinned('mincontractprice')" @update="onChangePrice('mincontractprice', $event)">
<template v-slot:title>Contract Price</template>
<template v-slot:denomination>per contract</template>
<template v-slot:description>The amount of Siacoin to form a contract with the host. A contract is required to upload, download and store data. <span class="suggestion">Suggested: less than 1 SC. The contract fee should only be used to cover expected transaction fees.</span></template>
</price-item>
<price-item :value="storagePrice" :average="averageSettings.storage_price.times(4320).times(1e12)" :pinned="isPinned('minstorageprice')" @change="onChangePrice('minstorageprice', $event)">
<price-item :value="storagePrice" :average="averageSettings.storage_price.times(4320).times(1e12)" :pinned="isPinned('minstorageprice')" @update="onChangePrice('minstorageprice', $event)">
<template v-slot:title>Storage Price</template>
<template v-slot:denomination>per {{ dataUnit }}/Month</template>
<template v-slot:description>The amount of Siacoin to store 1 {{ dataUnit }} for 1 month</template>
</price-item>
<price-item :value="collateral" :average="averageSettings.collateral.times(4320).times(1e12)" :pinned="isPinned('collateral')" @change="onChangePrice('collateral', $event)">
<price-item :value="collateral" :average="averageSettings.collateral.times(4320).times(1e12)" :pinned="isPinned('collateral')" @update="onChangePrice('collateral', $event)">
<template v-slot:title>Collateral</template>
<template v-slot:denomination>per sector</template>
<template v-slot:description>The amount of Siacoin per 1 {{ dataUnit }}/month stored to be locked as collateral. <span class="suggestion">Suggested: {{ recommendedCollateral }}.</span></template>
</price-item>
<price-item :value="maxcollateral" :pinned="isPinned('maxcollateral')" @change="onChangePrice('maxcollateral', $event)">
<price-item :value="maxcollateral" :pinned="isPinned('maxcollateral')" @update="onChangePrice('maxcollateral', $event)">
<template v-slot:title>Max Collateral</template>
<template v-slot:denomination>per contract</template>
<template v-slot:description>The maximum amount of collateral the host will lock into a single contract. This setting also limits the amount of data that the renter can store per contract. <span class="suggestion">Suggested: {{ recommendedMaxCollateral }} (1 TB of uploaded data).</span></template>
</price-item>
<price-item :value="collateralBudget" :pinned="isPinned('collateralbudget')" @change="onChangePrice('collateralbudget', $event)">
<price-item :value="collateralBudget" :pinned="isPinned('collateralbudget')" @update="onChangePrice('collateralbudget', $event)">
<template v-slot:title>Collateral Budget</template>
<template v-slot:description>The maximum amount of Siacoin that can be used as collateral. <span class="suggestion">Suggested: to prevent issues with stale contracts, a very large number or multiple times your wallet balance.</span></template>
</price-item>
<duration-item :value="maxDuration" :average="averageSettings.max_duration" @change="onChangeValue('maxduration', $event)">
<duration-item :value="maxDuration" :average="averageSettings.max_duration" @update="onChangeValue('maxduration', $event)">
<template v-slot:title>Max Contract Duration</template>
<template v-slot:description>The maximum amount of time a contract can be created for. Payouts only occur at the end of the contract. <span class="suggestion">Suggested: at least 3 months.</span></template>
</duration-item>
<div class="config-header">Network</div>
<price-item :value="downloadPrice" :average="averageSettings.download_price.times(1e12)" :pinned="isPinned('mindownloadbandwidthprice')" @change="onChangePrice('mindownloadbandwidthprice', $event)">
<template v-slot:title>Download Price</template>
<price-item :value="downloadPrice" :average="averageSettings.download_price.times(1e12)" :pinned="isPinned('mindownloadbandwidthprice')" @update="onChangePrice('mindownloadbandwidthprice', $event)">
<template v-slot:title>Egress Price</template>
<template v-slot:denomination>per {{ dataUnit }}</template>
<template v-slot:description>The amount of Siacoin to download 1 {{ dataUnit }} from the host</template>
</price-item>
<price-item :value="uploadPrice" :average="averageSettings.upload_price.times(1e12)" :pinned="isPinned('minuploadbandwidthprice')" @change="onChangePrice('minuploadbandwidthprice', $event)">
<template v-slot:title>Upload Price</template>
<price-item :value="uploadPrice" :average="averageSettings.upload_price.times(1e12)" :pinned="isPinned('minuploadbandwidthprice')" @update="onChangePrice('minuploadbandwidthprice', $event)">
<template v-slot:title>Ingress Price</template>
<template v-slot:denomination>per {{ dataUnit }}</template>
<template v-slot:description>The amount of Siacoin to upload 1 {{ dataUnit }} to the host</template>
</price-item>
<div class="config-header">Registry</div>
<size-item :value="registrySize" @change="onChangeValue('registrysize', $event)">
<size-item :value="registrySize" @update="onChangeValue('registrysize', $event)">
<template v-slot:title>Registry Size</template>
<template v-slot:description>The size of the host registry. The registry is an in-memory key value store. Make sure that you have enough free space on your disk and enough system memory before allocating the registry. <span class="suggestion">Suggested: {{ recommendedRegistrySize }}</span></template>
</size-item>
<file-item :value="registryPath" @change="onChangeValue('customregistrypath', $event)">
<file-item :value="registryPath" @update="onChangeValue('customregistrypath', $event)">
<template v-slot:title>Registry Location</template>
<template v-slot:description>The location of the registry on disk, leave blank for default. Defaults to your Sia data path, usually the disk your operating system is installed on.</template>
</file-item>
<div class="config-header">Advanced</div>
<price-item :value="baseRPCPrice" :average="averageSettings.base_rpc_price" :pinned="isPinned('minbaserpcprice')" @change="onChangePrice('minbaserpcprice', $event)">
<price-item :value="baseRPCPrice" :average="averageSettings.base_rpc_price" :pinned="isPinned('minbaserpcprice')" @update="onChangePrice('minbaserpcprice', $event)">
<template v-slot:title>Base RPC Price</template>
<template v-slot:denomination>per RPC</template>
<template v-slot:description>The amount of Siacoin required to interact with the host. <span class="suggestion">Suggested: very low or zero since this is charged per interaction.</span></template>
</price-item>
<price-item :value="sectorAccessPrice" :average="averageSettings.sector_access_price" :pinned="isPinned('minsectoraccessprice')" @change="onChangePrice('minsectoraccessprice', $event)">
<price-item :value="sectorAccessPrice" :average="averageSettings.sector_access_price" :pinned="isPinned('minsectoraccessprice')" @update="onChangePrice('minsectoraccessprice', $event)">
<template v-slot:title>Sector Access Price</template>
<template v-slot:denomination>per sector</template>
<template v-slot:description>The amount of Siacoin required to download or upload a single sector from the host. <span class="suggestion">Suggested: very low or zero since this is charged per sector in addition to download price.</span></template>
Expand Down Expand Up @@ -265,6 +265,7 @@ export default {
},
onChangeValue(key, value) {
try {
console.log(value);
this.config[key] = value;
this.changed = true;
} catch (ex) {
Expand Down

0 comments on commit 8d707ef

Please sign in to comment.