Skip to content
This repository has been archived by the owner on Apr 15, 2019. It is now read-only.

Move network selection to login module - Closes #89 #102

Merged
merged 12 commits into from
Apr 13, 2017

Conversation

reyraa
Copy link
Contributor

@reyraa reyraa commented Apr 6, 2017

Changes made:

  • The network select element and corresponding watcher is moved to login module
  • Instead added a label showing the selected network in top module
  • Tests are changed accordingly

Closes #89

@karmacoma karmacoma self-assigned this Apr 6, 2017
@slaweet slaweet self-requested a review April 6, 2017 10:23
@coveralls
Copy link

Coverage Status

Coverage increased (+0.8%) to 83.013% when pulling 877eb84 on 89-move-network-selection-to-login into f22ae91 on development.

@karmacoma karmacoma changed the base branch from development to 1.0.0 April 6, 2017 10:41
Copy link
Contributor

@slaweet slaweet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall it looks very good.
Only issues:

  • network dropdown should have a default
  • end-to-end tests need to be updated, to see what's not passing run:
npm run e2e-test

@@ -95,6 +95,7 @@ module.exports = function (config) {
// If true, Karma captures browsers, runs the tests and exits
singleRun: !opts.live,
client: {
captureConsole: true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should go a separate commit

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree

@@ -16,6 +16,7 @@ const PATHS = {
};

const common = {
devtool: 'source-map',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should go a separate commit

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree

@karmacoma karmacoma changed the base branch from 1.0.0 to development April 6, 2017 10:55
@coveralls
Copy link

coveralls commented Apr 6, 2017

Coverage Status

Coverage increased (+0.06%) to 82.315% when pulling 80a1a2a on 89-move-network-selection-to-login into bfe45a0 on development.

Copy link
Contributor

@slaweet slaweet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Login screen layout is broken in Safari, but I'm not sure if we care
screen shot 2017-04-07 at 08 21 42

src/spec/spec.js Outdated
@@ -120,22 +125,19 @@ function testAddress() {
}

function testPeer() {
login(masterAccount);
waitForElemAndCheckItsText('.peer md-select-value .md-text', 'localhost:4000');
expect(element.all(by.css('form md-select md-select-value span:first-child')).get(0).getText()).toEqual('Choose your network node');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test doesn't work if you run only this one because you first need to launchApp();

md-select(ng-model='$ctrl.$peers.currentPeerConfig', aria-label='Peer')
md-optgroup(ng-repeat='(name, peers) in $ctrl.$peers.stack', ng-if='peers.length', label='{{ name }}')
md-option(ng-repeat='peer in peers', ng-value='peer') {{ peer.node }}{{ peer.port ? ':' + peer.port : '' }}
div.address.value {{ $ctrl.$peers.currentPeerConfig.node }}:{{ $ctrl.$peers.currentPeerConfig.port }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.address class shouldn't be here, it causes this warning in e2e tests:

W/element - more than one element found for locator By(css selector, .address) - the first result will be used

@karmacoma karmacoma changed the title move network selection to login module, closes #89 Move network selection to login module - Closes #89 Apr 7, 2017
@karmacoma
Copy link
Contributor

Login screen layout is broken in Safari, but I'm not sure if we care

I think we should try to fix at least. Or at least find out why it is broken specifically on Safari.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.3%) to 82.524% when pulling 0729eda on 89-move-network-selection-to-login into 6b5f02a on development.

Copy link
Contributor

@karmacoma karmacoma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have requested some changes.

The main problem I encountered is that upon selecting a node and logging in, the user is present with the following empty peer.

image

@@ -95,6 +95,7 @@ module.exports = function (config) {
// If true, Karma captures browsers, runs the tests and exits
singleRun: !opts.live,
client: {
captureConsole: true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree

src/package.json Outdated
@@ -52,7 +52,7 @@
"jasmine-spec-reporter": "^3.2.0",
"jit-grunt": "=0.10.0",
"json-loader": "=0.5.4",
"karma": "^1.5.0",
"karma": "1.4.1",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

=1.4.1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1.5.0 has some bugs, according to the authors

src/spec/spec.js Outdated
@@ -83,11 +84,15 @@ function testNewAccount() {
launchApp();

element.all(by.css('.md-button.md-primary')).get(0).click();
/**
* To generate a random pattern of mousemove events, we're randomizing the x,y pairs that
* based on even/odd valkuds of i will locate right/left halves of screen
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling and grammar.

/**
 * To generate a random pattern of mousemove events, we are randomizing the x,y pairs that
 * based on even/odd values we locate the right/left halves of the screen
 */

@@ -67,6 +72,29 @@ describe('Login controller', () => {
controller.passphrase = '';
});

describe('controller()', () => {
it('Should define a watcher for $ctrl.$peers.currentPeerConfig', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should

expect(spy).to.have.been.calledWith();
});

it('Should be able to change the active peer', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should

@@ -16,6 +16,7 @@ const PATHS = {
};

const common = {
devtool: 'source-map',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree

form(ng-submit='$ctrl.doTheLogin()')
md-input-container.md-block(md-is-error='$ctrl.valid === 0')
label Enter your passphrase
label.select Choose your network node
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would phrase it as: Choose a peer.

Also, upon logging in, the selection is referred to as a "Peer", not a node.

I'm happy to see either or, as long as the terminology is consistently applied.

@reyraa
Copy link
Contributor Author

reyraa commented Apr 11, 2017

I'm not sure if the interpolation issue with the active peer is related to this ticket. based on the templates I suppose such issue must happen in many cases. besides, we're using interpolation markup in many cases, taking in to account that it uses watchers, replacing it with ngBind, ngValue and other directives can help improve performance.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.3%) to 82.524% when pulling c72a85d on 89-move-network-selection-to-login into 6b5f02a on development.

@karmacoma
Copy link
Contributor

@alihaghighatkhah Can we remove colon from hostname when there is no port? Looks like so atm:

image

@karmacoma
Copy link
Contributor

karmacoma commented Apr 11, 2017

@Tosch110 @slaweet @alihaghighatkhah: If there is a failure to connect to a selected peer, then the current behaviour results in a another mainnet node being selected. Even if localhost or testnet peer is chosen. I think this should be fixed in: lisk-js. We should keep users on same network at least.

See: LiskArchive/lisk-elements#96

@coveralls
Copy link

Coverage Status

Coverage increased (+0.3%) to 82.524% when pulling 42d8b65 on 89-move-network-selection-to-login into 6b5f02a on development.

@reyraa reyraa force-pushed the 89-move-network-selection-to-login branch from 42d8b65 to c72a85d Compare April 13, 2017 08:51
@coveralls
Copy link

Coverage Status

Coverage increased (+0.3%) to 82.524% when pulling 59fc3d3 on 89-move-network-selection-to-login into 6b5f02a on development.

@karmacoma karmacoma changed the base branch from development to 1.0.0 April 13, 2017 09:25
@karmacoma karmacoma merged commit a0cb4d7 into 1.0.0 Apr 13, 2017
@karmacoma karmacoma deleted the 89-move-network-selection-to-login branch April 13, 2017 09:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants