Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Web Based Dapps #3956

Merged
merged 26 commits into from
Dec 27, 2016
Merged

Web Based Dapps #3956

merged 26 commits into from
Dec 27, 2016

Conversation

tomusdrw
Copy link
Collaborator

@tomusdrw tomusdrw commented Dec 22, 2016

  • Web Browsing dapp
  • Streaming content instead of using temporary files
  • Better timeouts handling for fetch
  • Protecting Web-based dapps endpoint with random token

What's left

  • Tests for fetching/streaming! (separate PR)

Testing: npm start and then http://127.0.0.1:3000/#/web

screenshot from 2016-12-23 10 59 45

Tomasz Drwięga added 20 commits December 15, 2016 16:39
Conflicts:
	dapps/src/apps/fetcher.rs
	dapps/src/handlers/fetch.rs
Conflicts:
	Cargo.lock
	hash-fetch/Cargo.toml
	hash-fetch/src/client.rs
	rpc/Cargo.toml
	rpc/src/lib.rs
	rpc/src/v1/impls/parity_set.rs
	util/fetch/Cargo.toml
	util/https-fetch/Cargo.toml
Conflicts:
	dapps/src/apps/fetcher/installers.rs
	dapps/src/apps/fetcher/mod.rs
	dapps/src/apps/mod.rs
	dapps/src/handlers/fetch.rs
	dapps/src/lib.rs
	dapps/src/web.rs
	js/src/views/Web/index.js
	parity/dapps.rs
	parity/run.rs
	util/fetch/src/client.rs
	util/fetch/src/lib.rs
	util/reactor/src/lib.rs
@tomusdrw tomusdrw added A0-pleasereview 🤓 Pull request needs code review. M4-core ⛓ Core client code / Rust. labels Dec 22, 2016
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling afe25d7 on web-dapps3 into ** on master**.

height: 100%;
width: 100%;
}
.loading {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would prefer a space between the blocks, doesn't cost anything but aids in readability. (Same for at the end of this block). -

.wrapper {
  ...
}

.loading {
  ...
}

.url {
  ...
}

display: flex;
}

.url > input {
Copy link
Contributor

Choose a reason for hiding this comment

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

PostCSS nesting enabled, so would generally prefer -

.url {
  ...

  & > input {
    ...
  }
}


handleUpdateUrl = (url) => {
try {
window.localStorage.setItem('parity-web-lastAddress', url);
Copy link
Contributor

@jacogr jacogr Dec 22, 2016

Choose a reason for hiding this comment

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

Could use store and not need the catch block. In addition, would make the key a constant of the form

const LS_LAST_ADDRESS = '_parity::webLastAddress';

While we are still wildly inconsistent in naming of localStorage keys, @ngotchac started the _parity:: movement so it would make sense for new keys to conform.

lastAddress () {
let res = null;
try {
res = window.localStorage.getItem('parity-web-lastAddress');
Copy link
Contributor

Choose a reason for hiding this comment

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

As per above, would prefer the key a constant and using store (just a bit less boilerplate)

if (!token) {
return (
<div
className={ styles.wrapper }
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we have a single attribute, could keep it on the preceding line.


return (
<div
className={ styles.wrapper }
Copy link
Contributor

Choose a reason for hiding this comment

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

Single attribute.

}
}

class AddressBar extends Component {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would prefer the component at least in a separate file, just aids things not growing uncontrollably in a single source.

}

class AddressBar extends Component {

Copy link
Contributor

Choose a reason for hiding this comment

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

Unneeded blank line padding the class here. (Previous component didn't, which is preferred, although not always enforced.)


static propTypes = {
isLoading: PropTypes.bool.isRequired,
url: PropTypes.string.isRequired,
Copy link
Contributor

Choose a reason for hiding this comment

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

Alphabetical order so nobody needs to wonder is preferred here with properties, state, passing props, imports, etc. (Just making some sense of the chaos)

currentUrl: this.props.url
};

onUpdateUrl = (ev) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we move the event methods to beneath render? Lifecycle, render, events.

};

onKey = (ev) => {
const KEY_ESC = 27;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should rather define these at global file-level

type='text'
value={ currentUrl }
/>
<button
Copy link
Contributor

Choose a reason for hiding this comment

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

Would probably have used ui/Button here, but good as-is, we can tweak slightly as per your comments.

</div>
);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

As per previous comment, unneeded blank line padding the class here.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling fd62442 on web-dapps3 into ** on master**.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 9a58a77 on web-dapps3 into ** on master**.

@coveralls
Copy link

coveralls commented Dec 23, 2016

Coverage Status

Changes Unknown when pulling f54c502 on web-dapps3 into ** on master**.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling e00690d on web-dapps3 into ** on master**.

@gavofyork gavofyork added A8-looksgood 🦄 Pull request is reviewed well. and removed A0-pleasereview 🤓 Pull request needs code review. labels Dec 27, 2016
@gavofyork gavofyork merged commit c7c309d into master Dec 27, 2016
@gavofyork gavofyork deleted the web-dapps3 branch December 27, 2016 10:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A8-looksgood 🦄 Pull request is reviewed well. M4-core ⛓ Core client code / Rust.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants