Skip to content
Permalink
Browse files

Merge branch 'develop' into chore/ddw-615-move-the-gpu-safe-mode-unde…

…r-help-and-support-submenu-and-add-a-confirmation-dialog
  • Loading branch information...
DeeJayElly committed May 14, 2019
2 parents b0169de + dde7001 commit 411f9817e966baf4fd05f5f7db34992f0e631d7e
Showing with 2,178 additions and 397 deletions.
  1. +2 −1 CHANGELOG.md
  2. +1 −0 default.nix
  3. +64 −0 features/tests/e2e/steps/wallets-utxos-steps.js
  4. +7 −0 features/tests/unit/setup/utxo-helpers.js
  5. +130 −0 features/tests/unit/steps/utxos-chart-steps.js
  6. +91 −0 features/utxos-chart.feature
  7. +27 −0 features/wallet-utxos.feature
  8. +1 −0 installers/nix/nix-installer.nix
  9. +2 −2 package.json
  10. +1 −1 source/main/config.js
  11. +1 −2 source/main/ipc/compress-logs.js
  12. +1 −1 source/main/preload.js
  13. +1 −1 source/main/utils/logging.js
  14. +1 −1 source/main/utils/safeExitWithCode.js
  15. +8 −10 source/main/utils/setupLogging.js
  16. +2 −0 source/renderer/app/Routes.js
  17. +2 −0 source/renderer/app/actions/wallet-settings-actions.js
  18. +22 −0 source/renderer/app/api/api.js
  19. +2 −5 source/renderer/app/api/wallets/requests/deleteWallet.js
  20. +14 −0 source/renderer/app/api/wallets/requests/getWalletUtxos.js
  21. +16 −0 source/renderer/app/api/wallets/types.js
  22. +3 −0 source/renderer/app/assets/images/exclamation-point.inline.svg
  23. +3 −0 source/renderer/app/assets/images/question-mark.inline.svg
  24. +17 −0 source/renderer/app/components/loading/StatusIcons-tooltip.scss
  25. +4 −3 source/renderer/app/components/loading/StatusIcons.js
  26. +14 −0 source/renderer/app/components/loading/StatusIcons.scss
  27. +8 −1 source/renderer/app/components/wallet/layouts/WalletWithNavigation.js
  28. +6 −0 source/renderer/app/components/wallet/layouts/WalletWithNavigation.scss
  29. +45 −0 source/renderer/app/components/wallet/navigation/WalletNavDropdown.js
  30. +45 −0 source/renderer/app/components/wallet/navigation/WalletNavDropdown.scss
  31. +37 −0 source/renderer/app/components/wallet/navigation/WalletNavOptionsStyles.scss
  32. +62 −0 source/renderer/app/components/wallet/navigation/WalletNavSelectSkin.js
  33. +4 −0 source/renderer/app/components/wallet/navigation/WalletNavSelectStyles.scss
  34. +29 −5 source/renderer/app/components/wallet/navigation/WalletNavigation.js
  35. +11 −11 source/renderer/app/components/wallet/{ → settings}/WalletSettings.js
  36. +1 −1 source/renderer/app/components/wallet/{ → settings}/WalletSettings.scss
  37. +173 −0 source/renderer/app/components/wallet/utxo/WalletUtxo.js
  38. +79 −0 source/renderer/app/components/wallet/utxo/WalletUtxo.scss
  39. +36 −0 source/renderer/app/components/wallet/utxo/WalletUtxoCursor.js
  40. +5 −0 source/renderer/app/components/wallet/utxo/WalletUtxoCursor.scss
  41. +37 −0 source/renderer/app/components/wallet/utxo/WalletUtxoTick.js
  42. +14 −0 source/renderer/app/components/wallet/utxo/WalletUtxoTick.scss
  43. +76 −0 source/renderer/app/components/wallet/utxo/WalletUtxoTooltip.js
  44. +19 −0 source/renderer/app/components/wallet/utxo/WalletUtxoTooltip.scss
  45. +8 −0 source/renderer/app/components/widgets/forms/FormFieldSkinTooltip-tooltip.scss
  46. +67 −0 source/renderer/app/components/widgets/forms/FormFieldSkinTooltip.js
  47. +22 −0 source/renderer/app/components/widgets/forms/FormFieldSkinTooltip.scss
  48. +8 −0 source/renderer/app/components/widgets/forms/InlineEditingDropdown-tooltip.scss
  49. +28 −1 source/renderer/app/components/widgets/forms/InlineEditingDropdown.js
  50. +27 −1 source/renderer/app/components/widgets/forms/InlineEditingDropdown.scss
  51. +1 −0 source/renderer/app/config/timingConfig.js
  52. +14 −0 source/renderer/app/config/utxoConfig.js
  53. +2 −1 source/renderer/app/containers/wallet/Wallet.js
  54. +1 −1 source/renderer/app/containers/wallet/WalletSettingsPage.js
  55. +43 −0 source/renderer/app/containers/wallet/WalletUtxoPage.js
  56. +10 −0 source/renderer/app/i18n/locales/de-DE.json
  57. +303 −153 source/renderer/app/i18n/locales/defaultMessages.json
  58. +10 −0 source/renderer/app/i18n/locales/en-US.json
  59. +10 −0 source/renderer/app/i18n/locales/hr-HR.json
  60. +10 −0 source/renderer/app/i18n/locales/ja-JP.json
  61. +10 −0 source/renderer/app/i18n/locales/ko-KR.json
  62. +10 −0 source/renderer/app/i18n/locales/zh-CN.json
  63. +1 −0 source/renderer/app/routes-config.js
  64. +4 −0 source/renderer/app/stores/AppStore.js
  65. +66 −7 source/renderer/app/stores/WalletSettingsStore.js
  66. +8 −0 source/renderer/app/stores/WalletsStore.js
  67. +16 −0 source/renderer/app/themes/daedalus/cardano.js
  68. +16 −0 source/renderer/app/themes/daedalus/dark-blue.js
  69. +16 −0 source/renderer/app/themes/daedalus/light-blue.js
  70. +1 −28 source/renderer/app/themes/overrides/TooltipOverrides.scss
  71. +5 −0 source/renderer/app/utils/formatters.js
  72. +57 −0 source/renderer/app/utils/utxoUtils.js
  73. +109 −0 storybook/stories/WalletScreens-Settings.stories.js
  74. +58 −0 storybook/stories/WalletScreens-Utxo.stories.js
  75. +13 −104 storybook/stories/WalletScreens.stories.js
  76. +1 −1 storybook/stories/support/StoryProvider.js
  77. +98 −55 yarn.lock
  78. +1 −0 yarn2nix.nix
@@ -5,6 +5,7 @@ Changelog

### Features

- Implemented the wallet UTxO statistics screen ([PR 1353](https://github.com/input-output-hk/daedalus/pull/1353))
- Implemented scroll error message into view ([PR 1383](https://github.com/input-output-hk/daedalus/pull/1383))
- Implemented new Block-consolidation status design ([PR 1377](https://github.com/input-output-hk/daedalus/pull/1377))
- Implemented "In progress" download logs notification ([PR 1341](https://github.com/input-output-hk/daedalus/pull/1341))
@@ -13,7 +14,7 @@ Changelog

### Fixes

- Fixed file extension of downloaded logs ([PR 1381](https://github.com/input-output-hk/daedalus/pull/1381))
- Fixed file extension of Daedalus logs ([PR 1381](https://github.com/input-output-hk/daedalus/pull/1381), [PR 1384](https://github.com/input-output-hk/daedalus/pull/1384))
- Fixed password validation rules for all languages ([PR 1354](https://github.com/input-output-hk/daedalus/pull/1354))
- Fixed the routing logic which allowed the display of "Settings" screens before the wallet data is fully loaded ([PR 1373](https://github.com/input-output-hk/daedalus/pull/1373))
- Fixed the "download logs" link position in Japanese version of the "Support" screen ([PR 1372](https://github.com/input-output-hk/daedalus/pull/1372))
@@ -279,6 +279,7 @@ let
mkdir -p etc
cat /etc/hosts > etc/hosts
cat /etc/nsswitch.conf > etc/nsswitch.conf
cat /etc/localtime > etc/localtime
cat /etc/machine-id > etc/machine-id
cat /etc/resolv.conf > etc/resolv.conf
@@ -0,0 +1,64 @@
import { Then } from 'cucumber';
import { expect } from 'chai';
import { BigNumber } from 'bignumber.js';
import { getVisibleTextsForSelector } from '../helpers/shared-helpers';
import { getWalletUtxosTotalAmount } from '../../../../source/renderer/app/utils/utxoUtils';

const container = '.WalletUtxo_container';

const selectors = {
container,
title: `${container} > h1`,
description: `${container} > p`,
chart: '.WalletUtxo_responsiveContainer',
walletAmount: `${container} > p b:nth-child(1)`,
walletUtxosAmount: `${container} > p b:nth-child(2)`,
};

Then('the {string} element renders the following text:', async function(
element,
data
) {
const [expectedTextData] = data.hashes();
const [renderedText] = await getVisibleTextsForSelector(
this.client,
selectors[element]
);
const expectedText = await this.intl(expectedTextData.message);
expect(renderedText).to.equal(expectedText);
});

Then(
'the page description displays the correct wallet and UTXOs amount',
async function() {
const [renderedWalletAmount] = await getVisibleTextsForSelector(
this.client,
selectors.walletAmount
);
const [renderedWalletUtxosAmount] = await getVisibleTextsForSelector(
this.client,
selectors.walletUtxosAmount
);

const {
value: { expextedWalletAmount, histogram },
} = await this.client.executeAsync(done =>
done({
expextedWalletAmount: daedalus.stores.wallets.activeValue,
histogram: daedalus.stores.walletSettings.walletUtxos.histogram,
})
);

const expectedWalletUtxosAmount = getWalletUtxosTotalAmount(histogram);

expect(expextedWalletAmount).to.equal(renderedWalletAmount);
expect(expectedWalletUtxosAmount).to.equal(
parseInt(renderedWalletUtxosAmount, 10)
);
}
);

Then(/^the UTXOs chart is (hidden|visible)/, async function(state) {
const isVisible = state === 'visible';
await this.client.waitForVisible(selectors.chart, null, !isVisible);
});
@@ -0,0 +1,7 @@
export const getHistogramFromTable = data => {
let histogram = {};
data.hashes().forEach(({ walletAmount, walletUtxosAmount }) => {
histogram[walletAmount] = walletUtxosAmount;
});
return histogram;
};
@@ -0,0 +1,130 @@
import { Given, When, Then } from 'cucumber';
import { expect } from 'chai';
import { isValidSpendingPassword } from '../../../../source/renderer/app/utils/validations';
import {
formattedAmountToLovelace,
formattedLovelaceToAmount,
} from '../../../../source/renderer/app/utils/formatters';
import {
getUtxoChartData,
getUtxoWalletPrettyAmount,
getWalletUtxosTotalAmount,
} from '../../../../source/renderer/app/utils/utxoUtils';
import { getHistogramFromTable } from '../setup/utxo-helpers';

Given('the `getUtxoChartData` function receives the following props:', function(
data
) {
const histogram = getHistogramFromTable(data);
const utxoChartData = getUtxoChartData(histogram);
this.context.histogram = histogram;
this.context.utxoChartData = utxoChartData;
this.context.response = utxoChartData;
this.context.sortedHistogram = Object.entries(histogram).sort();
});

Then('the wallet amounts should be sorted sorted ascending', function() {
const { utxoChartData: arr } = this.context;
const isSorted = arr.every(({ walletAmount }, i) =>
i < arr.length - 1 ? walletAmount <= arr[i + 1].walletAmount : true
);
expect(isSorted).to.be.true;
});

Then(
'the wallet amounts should be formatted into human-readable text',
function() {
const { utxoChartData, sortedHistogram } = this.context;
const isFormatted = utxoChartData.every(
({ walletAmount }, index) =>
walletAmount === formattedLovelaceToAmount(sortedHistogram[index][0])
);
expect(isFormatted).to.be.true;
}
);

Then('there should be no wallet amounts greater than 100K', function() {
return this.context.utxoChartData.every(
({ walletRawAmount }) => walletRawAmount <= 100000
);
});

Then(
'the wallet UTXO amounts for wallet amounts greater than {int} should be aggregated',
function(walletAmount) {
const walletAmountThreshold = formattedAmountToLovelace(
String(walletAmount)
);
const { histogram, utxoChartData, sortedHistogram } = this.context;
const expectedAggregatedUtxosAmount = sortedHistogram.reduce(
(sum, [walletAmount, walletUtxosAmount]) => {
if (walletAmount >= walletAmountThreshold)
sum += parseInt(walletUtxosAmount, 10);
return sum;
},
0
);
const {
walletUtxosAmount: calculatedAggregatedUtxosAmount,
} = utxoChartData.find(({ walletRawAmount }) => walletRawAmount === 100000);
expect(expectedAggregatedUtxosAmount).to.equal(
calculatedAggregatedUtxosAmount
);
}
);

function getUtxoChartDataReceivesAWalletAmount(walletAmount) {
this.context.walletRawAmount = walletAmount;
const walletPrettyAmount = getUtxoWalletPrettyAmount(walletAmount);
this.context.walletAmount = walletPrettyAmount;
this.context.response = walletPrettyAmount;
}

Given(
'the `getUtxoWalletPrettyAmount` function receives the following {float}',
getUtxoChartDataReceivesAWalletAmount
);
Given(
'the `getUtxoWalletPrettyAmount` function receives the following {int}',
getUtxoChartDataReceivesAWalletAmount
);

Then('the response should have type {string}', function(type) {
const { response } = this.context;
if (type === 'array') {
return expect(Array.isArray(response)).to.be.true;
}
expect(typeof response).to.equal(type);
});

Then('wallet amounts less than {int} should not be modified', function(amount) {
const { walletAmount, walletRawAmount } = this.context;
if (walletRawAmount < amount) {
expect(walletAmount).to.equal(String(walletRawAmount));
expect(/[a-zA-Z]/.test(walletAmount)).to.be.false;
}
});

Then(
'wallet amounts equal or greater than {int} should be formatted into human-readable text',
function(amount) {
const { walletAmount, walletRawAmount } = this.context;
if (walletRawAmount >= amount) {
expect(walletAmount).to.not.equal(String(walletRawAmount));
expect(/[a-zA-Z]/.test(walletAmount)).to.be.true;
}
}
);

Given(
'the `getWalletUtxosTotalAmount` function receives the following props:',
function(data) {
const histogram = getHistogramFromTable(data);
this.context.histogram = histogram;
this.context.response = getWalletUtxosTotalAmount(histogram);
}
);

Then('the response should be the number {int}', function(response) {
expect(response).to.equal(this.context.response);
});
@@ -0,0 +1,91 @@
@unit
Feature: UTXOs chart data

Scenario: The histogram data is sent to the `getUtxoChartData` function
Given the `getUtxoChartData` function receives the following props:
| walletAmount | walletUtxosAmount |
| 10 | 0 |
| 100 | 0 |
| 1000 | 3 |
| 10000 | 0 |
| 100000 | 0 |
| 1000000 | 0 |
| 10000000 | 4 |
| 100000000 | 0 |
| 1000000000 | 0 |
| 10000000000 | 0 |
| 100000000000 | 0 |
| 1000000000000 | 0 |
| 10000000000000 | 2 |
| 100000000000000 | 0 |
| 1000000000000000 | 0 |
| 10000000000000000 | 1 |
| 45000000000000000 | 1 |
Then the response should have type "array"
And wallet amounts equal or greater than 1000 should be formatted into human-readable text
And there should be no wallet amounts greater than 100K
And the wallet UTXO amounts for wallet amounts greater than 1000000 should be aggregated

Scenario Outline: A wallet amount is sent to the `getUtxoWalletPrettyAmount` function
Given the `getUtxoWalletPrettyAmount` function receives the following <AMOUNT>
Then the response should have type "string"
And wallet amounts less than 1000 should not be modified
And wallet amounts equal or greater than 1000 should be formatted into human-readable text

Examples:
| AMOUNT |
| 0.0001 |
| 0.001 |
| 0.01 |
| 0.1 |
| 1 |
| 10 |
| 100 |
| 1000 |
| 10000 |
| 100000 |

Scenario: The histogram data is sent to the `getWalletUtxosTotalAmount` function
Given the `getWalletUtxosTotalAmount` function receives the following props:
| walletAmount | walletUtxosAmount |
| 10 | 0 |
| 100 | 0 |
| 1000 | 3 |
| 10000 | 0 |
| 100000 | 0 |
| 1000000 | 0 |
| 10000000 | 4 |
| 100000000 | 0 |
| 1000000000 | 0 |
| 10000000000 | 0 |
| 100000000000 | 0 |
| 1000000000000 | 0 |
| 10000000000000 | 2 |
| 100000000000000 | 0 |
| 1000000000000000 | 0 |
| 10000000000000000 | 1 |
| 45000000000000000 | 1 |
Then the response should have type "number"
And the response should be the number 11






















@@ -0,0 +1,27 @@
@e2e
Feature: Wallet - UTXOs

Background:
Given I have completed the basic setup

Scenario: Chart visible. Page title and description
Given I have a "Imported Wallet" with funds
When I am on the "Imported Wallet" wallet "utxo" screen
Then the "title" element renders the following text:
| message |
| wallet.settings.utxos.title |
And the page description displays the correct wallet and UTXOs amount
And the UTXOs chart is visible

Scenario: The wallet does not contain any UTxOs
Given I have the following wallets:
| name |
| NewWallet |
When I am on the "NewWallet" wallet "utxo" screen
Then the "title" element renders the following text:
| message |
| wallet.settings.utxos.title |
Then the "description" element renders the following text:
| message |
| wallet.settings.utxos.emptyWallet |
And the UTXOs chart is hidden
@@ -64,6 +64,7 @@ let
mkdir -p etc
cat /etc/hosts > etc/hosts
cat /etc/nsswitch.conf > etc/nsswitch.conf
cat /etc/localtime > etc/localtime
cat /etc/machine-id > etc/machine-id
cat /etc/resolv.conf > etc/resolv.conf
@@ -133,7 +133,7 @@
"check-disk-space": "1.5.0",
"classnames": "2.2.6",
"electron-debug": "2.0.0",
"electron-log": "2.2.17",
"electron-log-daedalus": "2.2.18",
"electron-store": "2.0.0",
"electron-unhandled": "2.1.0",
"es6-error": "4.1.1",
@@ -166,7 +166,7 @@
"react-router": "3.2.1",
"react-svg-inline": "2.1.0",
"react-virtualized": "9.21.0",
"recharts": "1.0.0-beta.10",
"recharts": "1.5.0",
"retry": "0.12.0",
"route-parser": "0.0.5",
"rust-cardano-crypto": "0.2.0",
@@ -60,7 +60,7 @@ export const appLogsFolderPath = launcherConfig.logsPrefix;
export const pubLogsFolderPath = path.join(appLogsFolderPath, 'pub');
export const appFolderPath = launcherConfig.workingDir;
export const { nodeDbPath } = launcherConfig;
export const ALLOWED_LOGS = ['Daedalus.json.log', 'System-info.json'];
export const ALLOWED_LOGS = ['Daedalus.json', 'System-info.json'];
export const ALLOWED_NODE_LOGS = new RegExp(/(node.json-)(\d{14}$)/);
export const ALLOWED_LAUNCHER_LOGS = new RegExp(/(launcher-)(\d{14}$)/);
export const MAX_NODE_LOGS_ALLOWED = 3;
@@ -45,8 +45,7 @@ export default () => {
const stream = fs.readFileSync(
path.join(pubLogsFolderPath, logFiles[i])
);
const name = logFiles[i].replace('.log', '');
archive.append(stream, { name });
archive.append(stream, { name: logFiles[i] });
}

archive.finalize(error => {
Oops, something went wrong.

0 comments on commit 411f981

Please sign in to comment.
You can’t perform that action at this time.