提交 4be8180c 编写于 作者: I imuge

show account permission

上级 ecbc5194
因为 它太大了无法显示 source diff 。你可以改为 查看blob
......@@ -1255,6 +1255,27 @@ router.get('/:ledger/txs/hash/:tx_hash', function (req, res) {
"transactionContent": {
"ledgerHash": "j5xJwCmBvsKByY9dpkpV4VNDnS5BeFBQKWXQozjsrpgfJF",
"operations": [
{
"@type": "com.jd.blockchain.ledger.AccountPermissionSetOperation",
"accountType": "DATA",
"address": "LdeP2ji8PR1DPsLt5NoFeiBnhpckrLHgCJge6",
"mode": 770,
"role": "ROLE"
},
{
"@type": "com.jd.blockchain.ledger.AccountPermissionSetOperation",
"accountType": "DATA",
"address": "LdeP2ji8PR1DPsLt5NoFeiBnhpckrLHgCJge6",
"mode": -1,
"role": "ROLE"
},
{
"@type": "com.jd.blockchain.ledger.AccountPermissionSetOperation",
"accountType": "DATA",
"address": "LdeP2ji8PR1DPsLt5NoFeiBnhpckrLHgCJge6",
"mode": 770,
"role": ""
},
{
"@type": "com.jd.blockchain.ledger.RootCAUpdateOperation",
"certificatesAdd": [
......@@ -1461,18 +1482,27 @@ router.get('/:ledger/accounts/address/:address', function (req, res) {
Object.assign(ret, resultData, {
"data": {
"address": "LdeP2fggAK1icRgsSjPHrtbLawsK947Kr5Wnx",
"headerRootHash": "j5qaaqyBqyb14LKbu3qMrqcv5UFnuYNKGBebE6X5LXKCKs",
"address": "LdeNugLcgRpenj8wtVJuPJPZGpHc5vdjmE5sK",
"permission": {
"role": "",
"owners": [
"LdeNyibeafrAQXgHjBxgQxoLbna6hL4BcXZiw"
],
"modeBits": "-rwxrwxrwx"
},
"headerRootHash": "j5qwL5hMCJyBmJMyaMsFpEi63nxUe8NgTuqHtpzMPboCEk",
"iD": {
"address": "LdeP2fggAK1icRgsSjPHrtbLawsK947Kr5Wnx",
"pubKey": "7VeR8t8kECBTJ9hCPwZonEvQYVD74Ko4wQR5soSVdS122pdV"
"address": "LdeNugLcgRpenj8wtVJuPJPZGpHc5vdjmE5sK",
"pubKey": "7VeRNG7stmQ7uJkhuetSu4SsH9heG6EfLKwZiq9sQKPmNGca"
},
"dataset":
{ "readonly": false, "rootHash": "j5uJfAqLw1ptaZYJyKVZm37zZybboqxMPpS6Mv59rNd4xF", "updated": false, "dataCount": 0 }
,
"dataRootHash": "j5uJfAqLw1ptaZYJyKVZm37zZybboqxMPpS6Mv59rNd4xF",
"pubKey": "7VeR8t8kECBTJ9hCPwZonEvQYVD74Ko4wQR5soSVdS122pdV"
"dataset": {
"readonly": true,
"rootHash": "j5vyv6SmvSXQNKyjsEVCQJsyqXxKGZMBU62fKvtdJm2W4y",
"updated": false,
"dataCount": 1
},
"dataRootHash": "j5vyv6SmvSXQNKyjsEVCQJsyqXxKGZMBU62fKvtdJm2W4y",
"pubKey": "7VeRNG7stmQ7uJkhuetSu4SsH9heG6EfLKwZiq9sQKPmNGca"
},
"success": true
});
......@@ -1864,6 +1894,43 @@ router.get('/:ledger/events/accounts/search', function (req, res) {
res.send(ret);
});
// 事件账户查询
// GET /ledgers/{ledger}/events/accounts/search?keyword={keyword}
router.get('/:ledger/events/user/accounts/:address', function (req, res) {
res.type('json');
let params = req.body,
ret = {};
Object.assign(ret, resultData, {
"data": {
"address": "LdeNugLcgRpenj8wtVJuPJPZGpHc5vdjmE5sK",
"permission": {
"role": "",
"owners": [
"LdeNyibeafrAQXgHjBxgQxoLbna6hL4BcXZiw"
],
"modeBits": "-rwxrwxrwx"
},
"headerRootHash": "j5qwL5hMCJyBmJMyaMsFpEi63nxUe8NgTuqHtpzMPboCEk",
"iD": {
"address": "LdeNugLcgRpenj8wtVJuPJPZGpHc5vdjmE5sK",
"pubKey": "7VeRNG7stmQ7uJkhuetSu4SsH9heG6EfLKwZiq9sQKPmNGca"
},
"dataset": {
"readonly": true,
"rootHash": "j5uJfAqLw1ptaZYJyKVZm37zZybboqxMPpS6Mv59rNd4xF",
"updated": false,
"dataCount": 0
},
"dataRootHash": "j5uJfAqLw1ptaZYJyKVZm37zZybboqxMPpS6Mv59rNd4xF",
"pubKey": "7VeRNG7stmQ7uJkhuetSu4SsH9heG6EfLKwZiq9sQKPmNGca"
},
"success": true
});
res.send(ret);
});
// 指定事件账户下事件列表总数
router.get('/:ledger/events/user/accounts/:address/names/count', function (req, res) {
res.type('json');
......
......@@ -18,16 +18,16 @@ const AccountStore = types
self.accountcurrent=v;
},
// 数据账户列表
getAccount(ledger,param) {
getAccounts(ledger,param) {
self.ledger=ledger;
return fetchData(`${__HOST}/ledgers/${ledger}/accounts`,
self.setAccount,
param, {
self.setAccounts,
param, {
method: 'get',
headers: {
// accept: 'application/json',
cookie: document.cookie,
}
}
}
).catch(error => {
......@@ -37,7 +37,7 @@ const AccountStore = types
getAccountVague(ledger,param) {
self.ledger=ledger;
return fetchData(`${__HOST}/ledgers/${ledger}/accounts/search`,
self.setAccount,
self.setAccounts,
param, {
method: 'get',
headers: {
......@@ -49,7 +49,7 @@ const AccountStore = types
});
},
setAccount(result) {
setAccounts(result) {
if (result&&result.success) {
self.tableData=result.data||[];
}
......
......@@ -2,43 +2,26 @@
<h3>数据详情</h3>
<div class="{styles.info}">
<fj-Row class="{styles.gl}">
<fj-Col l=1 s=4 xs=12>头根哈希
<fj-Col l=1 s=4 xs=12>地址
</fj-Col>
<fj-Col l=5 s=8 xs=12>
<#if {{accountData && accountData.headerRootHash && accountData.headerRootHash}}>
{accountData.headerRootHash}
<#elseif {{accountData && accountData.address}}>
<AccountRootHash address={accountData.address} hash="header"/>
</#elseif>
<#else>
''
</#else>
</#if>
<fj-Col l=5 s=8 xs=12>{accountData && accountData.address && accountData.address || ''}
</fj-Col>
<fj-Col l=1 s=4 xs=12>数据根哈希
<fj-Col l=1 s=4 xs=12>公钥
</fj-Col>
<fj-Col l=5 s=8 xs=12>
<#if {{accountData && accountData.dataRootHash && accountData.dataRootHash}}>
{accountData.dataRootHash}
<#elseif {{accountData && accountData.address}}>
<AccountRootHash address={accountData.address} hash="data"/>
</#elseif>
<#else>
''
</#else>
</#if>
<fj-Col l=5 s=8 xs=12>{accountData && accountData.pubKey && accountData.pubKey || ''}
</fj-Col>
<fj-Col l=1 s=4 xs=12>数据账户地址
<fj-Col l=1 s=4 xs=12>创建用户
</fj-Col>
<fj-Col l=5 s=8 xs=12>{accountData && accountData.address && accountData.address || ''}
<fj-Col l=5 s=8 xs=12>{accountData && accountData.permission && accountData.permission.owners || ''}
</fj-Col>
<fj-Col l=1 s=4 xs=12>数据账户公钥
<fj-Col l=1 s=4 xs=12>所属角色
</fj-Col>
<fj-Col l=5 s=8 xs=12>{accountData && accountData.pubKey && accountData.pubKey || ''}
<fj-Col l=5 s=8 xs=12>{accountData && accountData.permission && accountData.permission.role || 'DEFAULT'}
</fj-Col>
<fj-Col l=1 s=4 xs=12>权限值
</fj-Col>
<fj-Col l=5 s=8 xs=12>{accountData && accountData.permission && accountData.permission.modeBits || ''}
</fj-Col>
</fj-Row>
<fj-Row class="{styles.gl}">
<fj-Col l=1 s=4 xs=12>KV数量
</fj-Col>
<fj-Col l=5 s=8 xs=12><KvCount address={accountData.address} key={accountData.address} />
......
......@@ -291,19 +291,28 @@ export default class EventInfo extends Component {
render() {
const { data, store: { event } } = this.props;
let latest = event.dataLatest && { ...event.dataLatest } || {}
console.log(latest)
return (
<div>
<h3>账户详情</h3>
<div className={styles.info}>
<Row className={styles.gl}>
<Col span={2} xs={24} sm={8} lg={2}>事件账户地址:</Col>
<Col span={2} xs={24} sm={8} lg={2}>地址:</Col>
<Col span={10} xs={24} sm={16} lg={10}>{data.address && data.address || ''}</Col>
<Col span={2} xs={24} sm={8} lg={2}>事件账户公钥:</Col>
<Col span={2} xs={24} sm={8} lg={2}>公钥:</Col>
<Col span={10} xs={24} sm={16} lg={10}>{data.pubKey && data.pubKey && data.pubKey || ''}</Col>
<Col span={2} xs={24} sm={8} lg={2}>创建用户:</Col>
<Col span={10} xs={24} sm={16} lg={10}>{data.permission && data.permission && data.permission.owners || ''}</Col>
<Col span={2} xs={24} sm={8} lg={2}>所属角色:</Col>
<Col span={10} xs={24} sm={16} lg={10}>{data.permission && data.permission && data.permission.role || 'DEFAULT'}</Col>
</Row>
<Row className={styles.gl}>
<Col span={2} xs={24} sm={8} lg={2}>权限值:</Col>
<Col span={10} xs={24} sm={16} lg={10}>{data.permission && data.permission && data.permission.modeBits || ''}</Col>
</Row>
<h3>事件列表</h3>
<Table
rowKey={record => record}
......
......@@ -195,6 +195,10 @@ export default class TransactionInfo extends Component {
certificatesRemove,
userRolesAuthorizations,
writeSet,
accountType,
address,
mode,
role,
} = opt;
console.log(opt)
return [
......@@ -619,6 +623,28 @@ export default class TransactionInfo extends Component {
))
}
</BlockCollapsePanel>
) || null,
(accountType && mode) && (
<BlockCollapsePanel title = "账户权限配置">
<table style = {{lineHeight: '41px', width: '100%'}}>
<tr>
<td>账户类型:</td>
<td>{accountType || ''}</td>
</tr>
<tr>
<td>账户地址:</td>
<td>{address || ''}</td>
</tr>
{role != '' && (<tr>
<td>所属角色:</td>
<td>{role}</td>
</tr>) || null}
{mode > -1 && (<tr>
<td>权限值:</td>
<td>{mode}</td>
</tr>) || null}
</table>
</BlockCollapsePanel>
) || null,
roles && roles.length != 0 && (
<BlockCollapsePanel title="角色配置">
......
......@@ -25,6 +25,7 @@ import Message from 'flarej/lib/components/antd/message';
import Notification from '../../../utils/notification';
import styles from './account.m.scss';
import tmpls from './account.t.html';
import {fetchData} from "../../../utils/fetchConfig";
//页面容器组件
@registerTmpl('Account')
......@@ -81,7 +82,7 @@ export default class Account extends Component {
account.getAccountCount(leaders)
]).then(() => {
if (account.accountcount > 0) {
Promise.all([account.getAccount(leaders,
Promise.all([account.getAccounts(leaders,
param
),
]).then(() => {
......@@ -157,11 +158,6 @@ export default class Account extends Component {
this.Search();
}
@autobind
onShow(record, index) {
this.accountData = record;
this.show = !this.show;
}
@computed get tableColumns() {
return [{
title: '账户地址',
......@@ -176,21 +172,7 @@ export default class Account extends Component {
render: (text, record, index) => nj`
${text}<br/>算法:${tranBase58(text)}
`()
},
// {
// title: '默克尔树根哈希',
// dataIndex: 'rootHash',
// key: 'rootHash',
// width: '25%',
// render: (text, record, index) => nj`
// <#if ${text}>
// ${text}
// <#else>
// <AccountRootHash address=${record.address}/>
// </#else>
// </#if>
// `()
// },
},
{
title: 'KV',
dataIndex: 'address',
......@@ -202,11 +184,50 @@ export default class Account extends Component {
{
title: '操作',
render: (text, record, index) => nj`
<a onClick=${() => this.onShow(record, index)}>查看</a>
<a onClick=${() => this.onShowAccount(record, index)}>查看</a>
`()
}];
}
@autobind
onShowAccount(record, index){
let ledger=this.props.store.common.getDefaultLedger();
Promise.all([this.getAccount(ledger, record.address)]).then(() => {
});
}
// 数据账户
getAccount(ledger,address) {
return fetchData(`${__HOST}/ledgers/${ledger}/accounts/address/${address}`,
this.setAccount,
{}, {
method: 'get',
headers: {
cookie: document.cookie,
}
}
).catch(error => {
});
};
@autobind
setAccount(result) {
if (result&&result.success) {
this.accountData =result.data;
this.show = !this.show;
} else{
this.accountData = '';
}
}
@autobind
onShow(record, index) {
this.accountData = record;
this.show = !this.show;
}
render() {
const { store: { account } } = this.props;
return tmpls.container({
......
......@@ -31,9 +31,7 @@ export default class Contract extends Component {
@observable pageSize = 10;
@observable contractAddress='';
@observable visible=false;
@observable contractValue='';
@observable contractState='NORMAL';
@observable chainCodeVersion=-1;
@observable contractInfo='';
constructor(props) {
super(props);
}
......@@ -168,9 +166,7 @@ export default class Contract extends Component {
Promise.all([
contract.getContractsByAddress(param)
]).then(data=> {
this.contractValue=data[0].chainCode||'';
this.contractState=data[0].state||'';
this.chainCodeVersion=data[0].chainCodeVersion;
this.contractInfo=data[0]||'';
closeLoading();
});
......@@ -178,9 +174,7 @@ export default class Contract extends Component {
@autobind
onClose(){
this.visible=!this.visible;
this.contractValue='';
this.contractState='NORMAL';
this.chainCodeVersion=-1;
this.contractInfo='';
Message.destroy();
}
......
......@@ -32,17 +32,29 @@
<table style="lineHeight:41px">
<tr>
<td>状态: </td>
<td>{contractState} </td>
<td>{contractInfo.state} </td>
</tr>
<tr>
<td>版本: </td>
<td>{chainCodeVersion} </td>
<td>{contractInfo.chainCodeVersion} </td>
</tr>
<tr>
<td>创建用户: </td>
<td>{contractInfo.permission && contractInfo.permission.owners || ''} </td>
</tr>
<tr>
<td>所属角色: </td>
<td>{contractInfo.permission && contractInfo.permission.role || 'DEFAULT'} </td>
</tr>
<tr>
<td>权限值: </td>
<td>{contractInfo.permission && contractInfo.permission.modeBits || ''} </td>
</tr>
</table>
<MonacoEditor
language="java"
theme="vs-dark"
value={contractValue}
value={contractInfo.chainCode}
/>
</div>
</ant-Drawer>
......
......@@ -20,6 +20,7 @@ import Notification from 'flarej/lib/components/antd/notification';
import styles from './event.m.scss';
import tmpls from './event.t.html';
import {fetchData} from "../../../utils/fetchConfig";
// 页面容器组件
@registerTmpl('Event')
......@@ -119,10 +120,9 @@ export default class Event extends Component {
this.onSearch()
}
}
showEvent = (record, index) => {
showEvent = (record) => {
const { store: { common, event } } = this.props;
let address = record.address && record.address || '';
let address = record.data && record.data.address || '';
const closeLoading = Message.loading('正在获取数据...', 0);
......@@ -139,14 +139,14 @@ export default class Event extends Component {
event.getEventData(common.getDefaultLedger(), address, param)
]).then(() => {
closeLoading();
this.accountData = record;
this.accountData = record.data;
this.show = !this.show;
});
} else if (event.eventTotal == 0) {
closeLoading();
this.accountData = record;
this.accountData = record.data;
this.show = !this.show;
// Notification.error({
......@@ -186,11 +186,31 @@ export default class Event extends Component {
}, {
title: '操作',
render: (text, record, index) => nj`
<a onClick=${() => this.showEvent(record, index)}>查看</a>
<a onClick=${() => {
let ledger=this.props.store.common.getDefaultLedger();
Promise.all([this.getAccount(ledger, record.address)]).then(() => {
});
}}>查看</a>
`()
}]
}
// 数据账户
@autobind
getAccount(ledger,address) {
return fetchData(`${__HOST}/ledgers/${ledger}/events/user/accounts/${address}`,
this.showEvent,
{}, {
method: 'get',
headers: {
cookie: document.cookie,
}
}
).catch(error => {
});
};
render() {
const { store: { event } } = this.props;
return tmpls.container(this.state, this.props, this, {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册