From 030530cfd515c01f258425f5e35984a66a0aa8ec Mon Sep 17 00:00:00 2001
From: MickeyWang <1244134672@qq.com>
Date: Wed, 7 Aug 2019 16:31:06 +0800
Subject: [PATCH 1/2] update ui
---
src/common/lang/en.js | 4 +++-
src/common/lang/zh.js | 4 +++-
src/core/utils.js | 4 ++--
src/renderer/components/Identitys.vue | 3 ++-
src/renderer/components/Identitys/Import/BasicInfo.vue | 4 ++--
src/renderer/components/Node/NodeStake/NodeStakeInfo.vue | 6 +++---
src/renderer/components/Wallets.vue | 5 +++--
src/renderer/store/modules/NodeAuthorization.js | 1 +
8 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/src/common/lang/en.js b/src/common/lang/en.js
index 5aab708..296ef36 100644
--- a/src/common/lang/en.js
+++ b/src/common/lang/en.js
@@ -114,7 +114,9 @@ export default {
passError: 'Password error',
ontidNotExist: 'The ONT ID to import does not exist on the blockchain',
keystoreImport: 'ONT ID Keystore Import',
- invalidKeystore: 'The keysotre you input is invalid.'
+ invalidKeystore: 'The keysotre you input is invalid.',
+ ontidExist: 'The identity already exists in local.',
+ importSuccess: 'Import Identity succeessfully!'
},
wallets: {
diff --git a/src/common/lang/zh.js b/src/common/lang/zh.js
index da53f65..e46378f 100644
--- a/src/common/lang/zh.js
+++ b/src/common/lang/zh.js
@@ -114,7 +114,9 @@ export default {
passError: '密码错误',
ontidNotExist: '要导入的ONT ID不存在于区块链上',
keystoreImport: '导入ONT ID Keystore',
- invalidKeystore: '您输入的keystore不正确。'
+ invalidKeystore: '您输入的keystore不正确。',
+ ontidExist: '要导入的ONT ID本地已存在。',
+ importSuccess: '导入ONT ID成功。'
},
wallets: {
diff --git a/src/core/utils.js b/src/core/utils.js
index e48e661..d3cefff 100644
--- a/src/core/utils.js
+++ b/src/core/utils.js
@@ -187,13 +187,13 @@ export function getTokenBalanceUrl(token_type, address) {
export function validateKeystorePath(path) {
const system = os.platform();
- if(system.indexOf('win') > -1) {
+ if(system.indexOf('win') > -1 && system !== 'darwin') {
const files = fs.readdirSync(path)
if(files && files.indexOf('resources') > -1 && files.indexOf('OWallet.exe') > -1) {
return false;
}
const cwd = process.cwd();
- if(path && (path === cwd || path.indexOf(cwd) > -1)) {
+ if(path && cwd !== '/' && (path === cwd || path.indexOf(cwd) > -1)) {
return false;
}
}
diff --git a/src/renderer/components/Identitys.vue b/src/renderer/components/Identitys.vue
index b3ef9f0..38941f3 100644
--- a/src/renderer/components/Identitys.vue
+++ b/src/renderer/components/Identitys.vue
@@ -109,7 +109,8 @@ import IdentityView from './Identitys/IdentityView'
.div-create-wallet {
width: 24.63rem;
height: 13.19rem;
- margin-right: 3.75rem;
+ margin-right: 1.75rem;
+ margin-left:1.75rem;
margin-bottom: 2.75rem;
}
diff --git a/src/renderer/components/Identitys/Import/BasicInfo.vue b/src/renderer/components/Identitys/Import/BasicInfo.vue
index 5da6d89..34fb9b3 100644
--- a/src/renderer/components/Identitys/Import/BasicInfo.vue
+++ b/src/renderer/components/Identitys/Import/BasicInfo.vue
@@ -139,12 +139,12 @@ import { getRestClient, formatScryptParams } from '../../../../core/utils';
dbService.insert(wallet, function (err, newDoc) {
if (err) {
console.log(err)
- that.$message.warning('The identity already exists in local.')
+ that.$message.warning(that.$t('importIdentity.ontidExist'))
that.$store.dispatch('hideLoadingModals')
return;
}
- that.$message.success('Import Identity succeessfully!')
+ that.$message.success(that.$t('importIdentity.importSuccess'))
that.$router.push({name: 'Identitys'})
})
},
diff --git a/src/renderer/components/Node/NodeStake/NodeStakeInfo.vue b/src/renderer/components/Node/NodeStake/NodeStakeInfo.vue
index 8b58b56..73b0a0c 100644
--- a/src/renderer/components/Node/NodeStake/NodeStakeInfo.vue
+++ b/src/renderer/components/Node/NodeStake/NodeStakeInfo.vue
@@ -114,8 +114,8 @@
{{$t('nodeStake.stakeQuantity')}}
{{current_peer.initPos}}
-
-
+
+
{{$t('nodeMgmt.addInitPos')}}
{{$t('nodeStake.refund')}}
{{$t('nodeStake.quitNode')}}
{{$t('nodeStake.newStake')}}
-
+
diff --git a/src/renderer/components/Wallets.vue b/src/renderer/components/Wallets.vue
index ab45157..6874f82 100644
--- a/src/renderer/components/Wallets.vue
+++ b/src/renderer/components/Wallets.vue
@@ -198,9 +198,10 @@
.normalWallet,
.div-create-wallet {
- width: 23.63rem;
+ width: 24.63rem;
height: 13.19rem;
- margin-right: 3.75rem;
+ margin-right: 1.75rem;
+ margin-left:1.75rem;
margin-bottom: 2.75rem;
}
diff --git a/src/renderer/store/modules/NodeAuthorization.js b/src/renderer/store/modules/NodeAuthorization.js
index f463ffc..fd3651b 100644
--- a/src/renderer/store/modules/NodeAuthorization.js
+++ b/src/renderer/store/modules/NodeAuthorization.js
@@ -375,6 +375,7 @@ const actions = {
item.detailUrl = NODE_DETAIL + item.peerPubkey;
// matchNodeName(item)
})
+ console.log(JSON.stringify(list))
commit('UPDATE_NODE_LIST', {list});
dispatch('hideLoadingModals')
From fc8c336efd0ffe3a47ad74dc7e5be79127c1a875 Mon Sep 17 00:00:00 2001
From: MickeyWang <1244134672@qq.com>
Date: Wed, 7 Aug 2019 21:05:47 +0800
Subject: [PATCH 2/2] fix refund amount error;
---
src/common/lang/en.js | 6 ++++--
src/common/lang/zh.js | 4 +++-
.../components/Node/NodeStake/NodeStakeInfo.vue | 12 +++++++++++-
3 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/src/common/lang/en.js b/src/common/lang/en.js
index 296ef36..97bb5c5 100644
--- a/src/common/lang/en.js
+++ b/src/common/lang/en.js
@@ -114,7 +114,7 @@ export default {
passError: 'Password error',
ontidNotExist: 'The ONT ID to import does not exist on the blockchain',
keystoreImport: 'ONT ID Keystore Import',
- invalidKeystore: 'The keysotre you input is invalid.',
+ invalidKeystore: 'The keystore you input is invalid.',
ontidExist: 'The identity already exists in local.',
importSuccess: 'Import Identity succeessfully!'
},
@@ -628,7 +628,9 @@ Within their 50% share each consensus node will receive their share according to
initPosInLock: "Locked",
initPosRedeemable: 'Claimable',
noClaimbleInitPos: 'No claimble ONT.',
- redeemInitPosOk: 'Redeem'
+ redeemInitPosOk: 'Redeem',
+ hasClaimableInitPos: 'You have redeemable init pos. Plase redeem this part first.',
+ noClaimbleToRefund: 'No redeemable ONT to refund.'
},
exchange: {
exchange: 'Exchange',
diff --git a/src/common/lang/zh.js b/src/common/lang/zh.js
index e46378f..e7331b5 100644
--- a/src/common/lang/zh.js
+++ b/src/common/lang/zh.js
@@ -623,7 +623,9 @@ export default {
initPosInLock: "锁定中",
initPosRedeemable: '可提取',
noClaimbleInitPos: '没有可提取的初始质押。',
- redeemInitPosOk: '确认提取'
+ redeemInitPosOk: '确认提取',
+ hasClaimableInitPos: '您还有可提取的初始质押。请先提取该部分ONT。',
+ noClaimbleToRefund: '没有可提取的ONT。无法提款。'
},
exchange: {
exchange: 'Exchange',
diff --git a/src/renderer/components/Node/NodeStake/NodeStakeInfo.vue b/src/renderer/components/Node/NodeStake/NodeStakeInfo.vue
index 73b0a0c..1bbc7e1 100644
--- a/src/renderer/components/Node/NodeStake/NodeStakeInfo.vue
+++ b/src/renderer/components/Node/NodeStake/NodeStakeInfo.vue
@@ -441,17 +441,27 @@ export default {
},
handleRefund() {
+ if(this.authorizationInfo && this.authorizationInfo.claimableVal === 0) {
+ this.$message.warning(this.$t('nodeMgmt.noClaimbleToRefund'))
+ return;
+ }
const userAddr = new Crypto.Address(this.stakeWallet.address);
const peerPubkeys = [this.detail.publickey]
// const withdrawList = [this.detail.stakequantity]
// Fix:节点质押部分可能会增加或减少,退款应该用initPos;
- const withdrawList = [this.current_peer.initPos]
+ // Fix2: 退款都可以用可提取部分
+ const withdrawList = [this.authorizationInfo.claimableVal]
const payer = userAddr
const tx = GovernanceTxBuilder.makeWithdrawTx(userAddr, peerPubkeys, withdrawList, payer, GAS_PRICE, GAS_LIMIT)
this.tx = tx;
this.walletPassModal = true;
},
handleQuitNode() {
+ //Fixme:退出节点前先把可提取初始质押提取出来。
+ if(this.authorizationInfo && this.authorizationInfo.claimableVal > 0) {
+ this.$message.warning(this.$t('nodeMgmt.hasClaimableInitPos'))
+ return;
+ }
const userAddr = new Crypto.Address(this.stakeWallet.address);
const peerPubkey = this.detail.publickey;
const payer = userAddr;