Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ᚬmaster] Rc/v0.18.0 beta.0 #874

Merged
merged 54 commits into from
Aug 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
3b75e89
chore(wallet-deps): Add @types/webdriverio
cezres Aug 11, 2019
503e948
chore: Add wallet e2e test
cezres Aug 11, 2019
e922383
chore(wallet-deps): Add spectron-menu-addon
cezres Aug 12, 2019
d3b0b3c
chore: Add delete wallet e2e test
cezres Aug 12, 2019
5e8d16c
chore: Update wallet e2e test
cezres Aug 12, 2019
9a72125
refactor(neuron-ui): tag a tx as sending or receiving if its status i…
Keith-CY Aug 12, 2019
56571d7
refactor(neuron-ui): tag a tx as sent or received if it's failed
Keith-CY Aug 12, 2019
37c8639
feat: Show available update's version
ashchan Aug 13, 2019
b4bd95d
chore: don't show error when network off
classicalliu Aug 13, 2019
1ad4833
chore: Add edit wallet e2e test
cezres Aug 13, 2019
5b8ea95
chore(wallet-deps): Remove spectron-menu-addon
cezres Aug 13, 2019
d3a917c
feat(neuron-ui): add import keystore
Keith-CY Aug 13, 2019
09020a1
Merge pull request #860 from nervosnetwork/show-version-when-update
ashchan Aug 13, 2019
bf33aca
Merge pull request #859 from Keith-CY/tag-pending-activities-as-sendi…
ashchan Aug 13, 2019
72edead
Merge pull request #861 from nervosnetwork/sync-off
ashchan Aug 13, 2019
0dc23ae
Update packages/neuron-ui/src/locales/en.json
Keith-CY Aug 13, 2019
d942f62
Update packages/neuron-wallet/src/locales/en.ts
Keith-CY Aug 13, 2019
01a7665
Update packages/neuron-wallet/src/locales/en.ts
Keith-CY Aug 13, 2019
6d8bfcf
Update packages/neuron-ui/src/locales/en.json
Keith-CY Aug 13, 2019
5410369
Update packages/neuron-ui/src/locales/en.json
Keith-CY Aug 13, 2019
f8a4796
refactor(neuron-ui): align components in the import keystore view ver…
Keith-CY Aug 13, 2019
cc98e09
Merge branch 'develop' into e2e-test
cezres Aug 13, 2019
efc4ad6
Merge pull request #862 from Keith-CY/enable-importing-keystore
Keith-CY Aug 13, 2019
d5621e5
feat(neuron-ui): check the JSON format before keystore validation
Keith-CY Aug 13, 2019
914890a
chore: Set default locale of e2e test
cezres Aug 13, 2019
227448f
refactor(neuron-ui): rename invalid-JSON to invalid-json
Keith-CY Aug 13, 2019
4af4cbc
Merge pull request #852 from cezres/e2e-test
ashchan Aug 13, 2019
c520dc7
Merge pull request #864 from Keith-CY/enable-importing-keystore
ashchan Aug 13, 2019
7493492
chore: Add debug log for e2e test
cezres Aug 13, 2019
e45c9a9
chore(e2e): Save screenshot when the test fails
cezres Aug 13, 2019
2a7dbc9
Merge remote-tracking branch 'upstream/e2e-tests' into e2e-test
cezres Aug 13, 2019
c39d457
chore(e2e): Update import-mnemonic-seed button text
cezres Aug 13, 2019
0529ff8
refactor(neuron-ui): disable submit button when the wallet name is used
Keith-CY Aug 13, 2019
7d2b5b8
Merge pull request #866 from Keith-CY/enable-importing-keystore
ashchan Aug 14, 2019
3406bfa
chore: Add debug log for e2e test
cezres Aug 13, 2019
4709c3a
chore(e2e): Save screenshot when the test fails
cezres Aug 13, 2019
d1303a2
chore(e2e): Update import-mnemonic-seed button text
cezres Aug 13, 2019
ae2b113
chore(e2e): Update pause time
cezres Aug 14, 2019
e81dc33
Merge branch 'e2e-test' of https://github.com/cezres/neuron into e2e-…
cezres Aug 14, 2019
494c94e
chore(e2e): Add main text log for test fail
cezres Aug 14, 2019
c1475f7
Merge pull request #865 from cezres/e2e-test
Keith-CY Aug 14, 2019
92398c4
chore: Enable integration tests to always run
ashchan Aug 14, 2019
07c8667
feat(neuron-ui): memorize lists for performance
Keith-CY Aug 14, 2019
9f3ccfc
Merge pull request #867 from Keith-CY/memorize-history-and-addresses
ashchan Aug 15, 2019
a3e49ff
feat: Add report issue menu item
ashchan Aug 16, 2019
e7ab34c
chore: Bump to 0.18.0-beta.0, the initial public beta
ashchan Aug 16, 2019
8a18b7a
Merge pull request #869 from nervosnetwork/report-issue-menu-item
ashchan Aug 16, 2019
a41f528
chore: set busy timeout to 3000ms
classicalliu Aug 16, 2019
57c13c9
feat(neuron-ui): update display of recent activities
Keith-CY Aug 16, 2019
fe1d462
Merge pull request #870 from Keith-CY/display-absolute-value
ashchan Aug 16, 2019
62d9bff
Merge pull request #871 from nervosnetwork/set-busy-timeout
ashchan Aug 16, 2019
9eaf2f3
fix: generate address and notify wallet created when import keystore
classicalliu Aug 16, 2019
fcdb0f5
Merge pull request #873 from nervosnetwork/fix-import-keystore
ashchan Aug 16, 2019
f115279
chore: Bump to 0.18.0-beta.0
zengbing15 Aug 16, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
# [0.18.0-beta.0](https://github.com/nervosnetwork/neuron/compare/v0.18.0-alpha.1...v0.18.0-beta.0) (2019-08-16)


### Bug Fixes

* generate address and notify wallet created when import keystore ([9eaf2f3](https://github.com/nervosnetwork/neuron/commit/9eaf2f3))


### Features

* **neuron-ui:** update display of recent activities ([57c13c9](https://github.com/nervosnetwork/neuron/commit/57c13c9))
* Add report issue menu item ([a3e49ff](https://github.com/nervosnetwork/neuron/commit/a3e49ff))
* **neuron-ui:** add import keystore ([d3a917c](https://github.com/nervosnetwork/neuron/commit/d3a917c))
* **neuron-ui:** check the JSON format before keystore validation ([d5621e5](https://github.com/nervosnetwork/neuron/commit/d5621e5))
* **neuron-ui:** memorize lists for performance ([07c8667](https://github.com/nervosnetwork/neuron/commit/07c8667))
* Show available update's version ([37c8639](https://github.com/nervosnetwork/neuron/commit/37c8639))



# [0.18.0-alpha.1](https://github.com/nervosnetwork/neuron/compare/v0.18.0-alpha.0...v0.18.0-alpha.1) (2019-08-12)


Expand Down
5 changes: 0 additions & 5 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,6 @@ jobs:
name: Test

- job: Integration
condition: |
or(
eq(variables['build.sourceBranch'], 'refs/heads/e2e-tests'),
startsWith(variables['Build.SourceBranch'], 'refs/heads/rc/')
)
pool:
vmImage: 'macos-10.14'
steps:
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"packages": [
"packages/*"
],
"version": "0.18.0-alpha.1",
"version": "0.18.0-beta.0",
"npmClient": "yarn",
"useWorkspaces": true
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "neuron",
"productName": "Neuron",
"description": "CKB Neuron Wallet",
"version": "0.18.0-alpha.1",
"version": "0.18.0-beta.0",
"private": true,
"author": {
"name": "Nervos Core Dev",
Expand Down
2 changes: 1 addition & 1 deletion packages/neuron-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "neuron-ui",
"version": "0.18.0-alpha.1",
"version": "0.18.0-beta.0",
"private": true,
"author": {
"name": "Nervos Core Dev",
Expand Down
30 changes: 17 additions & 13 deletions packages/neuron-ui/src/components/Addresses/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,20 +158,24 @@ const Addresses = ({
semanticColors,
]
)

return (
<ShimmeredDetailsList
enableShimmer={isLoading}
checkboxVisibility={CheckboxVisibility.hidden}
columns={addressColumns.map(col => ({ ...col, name: t(col.name) }))}
items={addresses}
onItemContextMenu={item => {
contextMenu({ type: 'addressList', id: item.identifier })
}}
className="listWithDesc"
onRenderRow={onRenderRow}
/>
const List = useMemo(
() => (
<ShimmeredDetailsList
enableShimmer={isLoading}
checkboxVisibility={CheckboxVisibility.hidden}
columns={addressColumns.map(col => ({ ...col, name: t(col.name) }))}
items={addresses}
onItemContextMenu={item => {
contextMenu({ type: 'addressList', id: item.identifier })
}}
className="listWithDesc"
onRenderRow={onRenderRow}
/>
),
[isLoading, addressColumns, addresses, t]
)

return List
}

Addresses.displayName = 'Addresses'
Expand Down
98 changes: 58 additions & 40 deletions packages/neuron-ui/src/components/History/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useCallback, useEffect } from 'react'
import React, { useCallback, useEffect, useMemo } from 'react'
import { RouteComponentProps } from 'react-router-dom'
import { useTranslation } from 'react-i18next'
import { Stack, SearchBox } from 'office-ui-fabric-react'
Expand Down Expand Up @@ -33,47 +33,65 @@ const History = ({
}, [id, history])
const onSearch = useCallback(() => history.push(`${Routes.History}?keywords=${keywords}`), [history, keywords])

return (
<Stack>
<Stack horizontal horizontalAlign="end" tokens={{ childrenGap: 15 }}>
<SearchBox
value={keywords}
styles={{ root: { width: 500 } }}
placeholder={t('history.search.placeholder')}
onChange={onKeywordsChange}
onSearch={onSearch}
iconProps={{ iconName: 'Search', styles: { root: { height: '18px' } } }}
const List = useMemo(() => {
return (
<Stack>
<Stack horizontal horizontalAlign="end" tokens={{ childrenGap: 15 }}>
<SearchBox
value={keywords}
styles={{ root: { width: 500 } }}
placeholder={t('history.search.placeholder')}
onChange={onKeywordsChange}
onSearch={onSearch}
iconProps={{ iconName: 'Search', styles: { root: { height: '18px' } } }}
/>
</Stack>
<TransactionList
isLoading={isLoading}
isUpdatingDescription={isUpdatingDescription}
walletID={id}
items={items}
dispatch={dispatch}
/>
<Pagination
selectedPageIndex={pageNo - 1}
pageCount={Math.ceil(totalCount / pageSize)}
itemsPerPage={pageSize}
totalItemCount={totalCount}
previousPageAriaLabel={t('pagination.previous-page')}
nextPageAriaLabel={t('pagination.next-page')}
firstPageAriaLabel={t('pagination.first-page')}
lastPageAriaLabel={t('pagination.last-page')}
pageAriaLabel={t('pagination-page')}
selectedAriaLabel={t('pagination-selected')}
firstPageIconProps={{ iconName: 'FirstPage' }}
previousPageIconProps={{ iconName: 'PrevPage' }}
nextPageIconProps={{ iconName: 'NextPage' }}
lastPageIconProps={{ iconName: 'LastPage' }}
format="buttons"
onPageChange={(idx: number) => {
history.push(`${Routes.History}?pageNo=${idx + 1}`)
}}
/>
</Stack>
<TransactionList
isLoading={isLoading}
isUpdatingDescription={isUpdatingDescription}
walletID={id}
items={items}
dispatch={dispatch}
/>
<Pagination
selectedPageIndex={pageNo - 1}
pageCount={Math.ceil(totalCount / pageSize)}
itemsPerPage={pageSize}
totalItemCount={totalCount}
previousPageAriaLabel={t('pagination.previous-page')}
nextPageAriaLabel={t('pagination.next-page')}
firstPageAriaLabel={t('pagination.first-page')}
lastPageAriaLabel={t('pagination.last-page')}
pageAriaLabel={t('pagination-page')}
selectedAriaLabel={t('pagination-selected')}
firstPageIconProps={{ iconName: 'FirstPage' }}
previousPageIconProps={{ iconName: 'PrevPage' }}
nextPageIconProps={{ iconName: 'NextPage' }}
lastPageIconProps={{ iconName: 'LastPage' }}
format="buttons"
onPageChange={(idx: number) => {
history.push(`${Routes.History}?pageNo=${idx + 1}`)
}}
/>
</Stack>
)
)
}, [
keywords,
onKeywordsChange,
onSearch,
isLoading,
isUpdatingDescription,
id,
items,
dispatch,
pageNo,
totalCount,
pageSize,
history,
t,
])

return List
}

History.displayName = 'History'
Expand Down
106 changes: 106 additions & 0 deletions packages/neuron-ui/src/components/ImportKeystore/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
import React, { useState, useCallback, useMemo } from 'react'
import { RouteComponentProps } from 'react-router-dom'
import { Stack, DefaultButton, PrimaryButton, TextField } from 'office-ui-fabric-react'
import { useTranslation } from 'react-i18next'
import { showOpenDialog } from 'services/remote'
import { importWalletWithKeystore } from 'states/stateProvider/actionCreators'
import { StateWithDispatch } from 'states/stateProvider/reducer'
import { useGoBack } from 'utils/hooks'

const defaultFields = {
path: '',
name: '',
password: '',
}

const ImportKeystore = (props: React.PropsWithoutRef<StateWithDispatch & RouteComponentProps>) => {
const [t] = useTranslation()
const {
history,
dispatch,
settings: { wallets },
} = props
const [fields, setFields] = useState(defaultFields)
const goBack = useGoBack(history)

const exsitingNames = useMemo(() => {
return wallets.map(w => w.name)
}, [wallets])

const isNameUsed = useMemo(() => {
return exsitingNames.includes(fields.name || '')
}, [exsitingNames, fields.name])

const onFileClick = useCallback(() => {
showOpenDialog({
title: 'import keystore',
onUpload: (filePaths: string[]) => {
if (!filePaths || filePaths.length === 0) {
return
}
const filePath = filePaths[0]
const filename = filePath.split('/').pop() || 'Imported wallet'
setFields({
...fields,
path: filePath,
name: filename,
})
},
})
}, [fields])

const onSubmit = useCallback(() => {
importWalletWithKeystore({
name: fields.name,
keystorePath: fields.path,
password: fields.password,
})(dispatch, history)
}, [fields.name, fields.password, fields.path, history, dispatch])

return (
<Stack verticalFill verticalAlign="center" tokens={{ childrenGap: 15 }}>
<Stack tokens={{ childrenGap: 15 }}>
{Object.entries(fields).map(([key, value]) => {
return (
<TextField
key={key}
onClick={key === 'path' ? onFileClick : undefined}
label={t(`import-keystore.label.${key}`)}
placeholder={t(`import-keystore.placeholder.${key}`)}
type={key === 'password' ? 'password' : 'text'}
readOnly={key === 'path'}
value={value}
validateOnLoad={false}
onGetErrorMessage={(text?: string) => {
if (text === '') {
return t('messages.is-required', { field: t(`import-keystore.label.${key}`) })
}
if (key === 'name' && isNameUsed) {
return t('messages.is-used', { field: t(`import-keystore.label.${key}`) })
}
return ''
}}
onChange={(_e: React.FormEvent<HTMLInputElement | HTMLTextAreaElement>, newValue?: string) => {
if (newValue !== undefined) {
setFields({
...fields,
[key]: newValue,
})
}
}}
/>
)
})}
</Stack>
<Stack horizontal horizontalAlign="end" tokens={{ childrenGap: 15 }}>
<DefaultButton onClick={goBack}>{t('import-keystore.button.back')}</DefaultButton>
<PrimaryButton disabled={!(fields.name && fields.path && fields.password && !isNameUsed)} onClick={onSubmit}>
{t('import-keystore.button.submit')}
</PrimaryButton>
</Stack>
</Stack>
)
}

ImportKeystore.displayName = 'ImportKeystore'
export default ImportKeystore
22 changes: 17 additions & 5 deletions packages/neuron-ui/src/components/Overview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,26 @@ import { backToTop } from 'utils/animations'
const TITLE_FONT_SIZE = 'xxLarge'
export type ActivityItem = State.Transaction & { confirmations: string; typeLabel: string }

const genTypeLabel = (type: 'send' | 'receive', confirmationCount: number) => {
const genTypeLabel = (
type: 'send' | 'receive',
confirmationCount: number,
status: 'pending' | 'success' | 'failed'
) => {
switch (type) {
case 'send': {
if (confirmationCount < CONFIRMATION_THRESHOLD) {
if (status === 'failed') {
return 'sent'
}
if (status === 'pending' || confirmationCount < CONFIRMATION_THRESHOLD) {
return 'sending'
}
return 'sent'
}
case 'receive': {
if (confirmationCount < CONFIRMATION_THRESHOLD) {
if (status === 'failed') {
return 'received'
}
if (status === 'pending' || confirmationCount < CONFIRMATION_THRESHOLD) {
return 'receiving'
}
return 'received'
Expand Down Expand Up @@ -287,13 +297,14 @@ const Overview = ({
let typeLabel: string = item.type
let { status } = item
if (item.blockNumber !== undefined) {
const confirmationCount = 1 + Math.max(+syncedBlockNumber, +tipBlockNumber) - +item.blockNumber
const confirmationCount =
item.blockNumber === undefined ? 0 : 1 + Math.max(+syncedBlockNumber, +tipBlockNumber) - +item.blockNumber

if (status === 'success' && confirmationCount < CONFIRMATION_THRESHOLD) {
status = 'pending'
}

typeLabel = genTypeLabel(item.type, confirmationCount)
typeLabel = genTypeLabel(item.type, confirmationCount, status)

if (confirmationCount === 1) {
confirmations = `(${t('overview.confirmation', {
Expand All @@ -309,6 +320,7 @@ const Overview = ({
return {
...item,
status,
value: item.value.replace(/^-/, ''),
confirmations: item.status === 'success' ? confirmations : '',
typeLabel: t(`overview.${typeLabel}`),
}
Expand Down
6 changes: 5 additions & 1 deletion packages/neuron-ui/src/components/WalletSetting/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ const buttons = [
url: `${Routes.WalletWizard}${WalletWizardPath.Mnemonic}/${MnemonicAction.Create}`,
},
{
label: 'wizard.import-wallet',
label: 'wizard.import-mnemonic',
url: `${Routes.WalletWizard}${WalletWizardPath.Mnemonic}/${MnemonicAction.Import}`,
},
{
label: 'wizard.import-keystore',
url: Routes.ImportKeystore,
},
]

const WalletSetting = ({
Expand Down
Loading