import { BaseList, TableList } from 'features/shared/components'
import ListItem from './ListItem'
-import { chainClient } from 'utility/environment'
-import { store } from 'app'
const type = 'key'
class KeyList extends BaseList.ItemList {
- constructor(props) {
- super(props)
- const client = chainClient()
-
- this.setStat = () => client.mockHsm.keys.progress().then(({data}) => {
- store.dispatch({
- type: 'RECEIVED_IMPORT_STATUS',
- data
- })
-
- const isImporting = item => {
- return typeof item.percent === 'number' && item.percent < 100
- }
-
- if ((data || []).filter(isImporting).length > 0) {
- window.setTimeout(this.setStat, 5000)
- }
- })
-
- this.setStat()
- }
}
export default BaseList.connect(
object='key'
title={lang === 'zh' ? '详情' : 'Details'}
actions={[
- <button key='show-exportkey' className='btn btn-link' onClick={this.showExportKey.bind(this, item, lang)}> {lang === 'zh' ? '导出私钥' : 'Export Private Key' }</button>,
<Link key='reset-password-btn' className='btn btn-link' to={`/keys/${item.id}/reset-password`}>{lang === 'zh' ? '重置密码' : 'Reset Password' }</Link>
]}
items={[
const type = 'key'
const idFunc = item => item.xpub
-const importStatusReducer = (state = [], action) => {
- if (action.type === 'RECEIVED_IMPORT_STATUS') {
- return action.data
- }
-
- return state
-}
-
export default combineReducers({
items: reducers.itemsReducer(type, idFunc),
queries: reducers.queriesReducer(type, idFunc),
autocompleteIsLoaded: reducers.autocompleteIsLoadedReducer(type),
- importStatus: importStatusReducer,
})