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

Split js logic into multiple files #2944

Merged
merged 26 commits into from
Mar 9, 2020
Merged

Conversation

maxaleks
Copy link
Collaborator

@maxaleks maxaleks commented Jan 9, 2020

Closes #2721

@maxaleks maxaleks requested a review from vbaranov January 9, 2020 16:20
@coveralls
Copy link

coveralls commented Jan 9, 2020

Pull Request Test Coverage Report for Build 9a9b8435-aa9d-4d6a-8739-b472d2a1c912

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 75.095%

Totals Coverage Status
Change from base Build 10e974ea-1ae5-48e7-bf8e-0224aed7f40c: 0.0%
Covered Lines: 5506
Relevant Lines: 7332

💛 - Coveralls

Copy link
Member

@vbaranov vbaranov left a comment

Choose a reason for hiding this comment

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

@maxaleks one test failed:

error: assign @conn not available in eex template.  Please make sure all proper assigns have been set. If this is a child template, ensure assigns are given explicitly by the parent template as they are not automatically forwarded.  Available assigns: [:action, :module_name] 

@vbaranov vbaranov self-requested a review January 15, 2020 16:16
Copy link
Member

@vbaranov vbaranov left a comment

Choose a reason for hiding this comment

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

@maxaleks API -> Eth RPC "Try it out" button doesn't work. It can be reproduced with eth_blockNumber method of API

@vbaranov vbaranov self-requested a review January 22, 2020 14:15
@vbaranov vbaranov added the wip label Jan 22, 2020
Copy link
Member

@vbaranov vbaranov left a comment

Choose a reason for hiding this comment

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

@maxaleks there is a bug in this PR causing this error:

2020-01-30T14:06:22.044 [error] GenServer #PID<0.9627.0> terminating
** (ArgumentError) assign @conn not available in eex template.

Please make sure all proper assigns have been set. If this
is a child template, ensure assigns are given explicitly by
the parent template as they are not automatically forwarded.

Available assigns: [:transaction, :view_module, :view_template]

    (phoenix_html) lib/phoenix_html/engine.ex:133: Phoenix.HTML.Engine.fetch_assign!/2
    (block_scout_web) lib/block_scout_web/templates/transaction/_tile.html.eex:79: BlockScoutWeb.TransactionView."_tile.html"/1
    (phoenix) lib/phoenix/view.ex:399: Phoenix.View.render_to_iodata/3
    (phoenix) lib/phoenix/view.ex:406: Phoenix.View.render_to_string/3
    (block_scout_web) lib/block_scout_web/channels/transaction_channel.ex:47: BlockScoutWeb.TransactionChannel.handle_out/3
    (phoenix) lib/phoenix/channel/server.ex:301: Phoenix.Channel.Server.handle_info/2
    (stdlib) gen_server.erl:637: :gen_server.try_dispatch/4
    (stdlib) gen_server.erl:711: :gen_server.handle_msg/6
Last message: %Phoenix.Socket.Broadcast{event: "transaction", payload: %{transaction: %Explorer.Chain.Transaction{input: %Explorer.Chain.Data{bytes: <<169, 5, 156, 187, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 102, 181, 82, 184, 17, 68, 33, 114, 20, 138, 212, 30, 74, 238, 215, 197, 50, 140, 149, 176, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...>>}, inserted_at: ~U[2020-01-30 14:06:17.945273Z], cumulative_gas_used: #Decimal<4580513>, internal_transactions: #Ecto.Association.NotLoaded<association :internal_transactions is not loaded>, block_number: 9383953, updated_at: ~U[2020-01-30 14:06:17.945273Z], s: #Decimal<11933055616160433748955899801164253603553493910711742979123268369407413996830>, nonce: 32, created_contract_address: nil, gas_used: #Decimal<58001>, forks: #Ecto.Association.NotLoaded<association :forks is not loaded>, value: #Explorer.Chain.Wei<0>, __meta__: #Ecto.Schema.Metadata<:loaded, "transactions">, to_address: %Explorer.Chain.Address{__meta__: #Ecto.Schema.Metadata<:loaded, "addresses">, contract_code: %Explorer.Chain.Data{bytes: <<96, 128, 96, 64, 82, 96, 4, 54, 16, 97, 0, 109, 87, 96, 0, 53, 124, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...>>}, contracts_creation_internal_transaction: #Ecto.Association.NotLoaded<association :contracts_creation_internal_transaction is not loaded>, contracts_creation_transaction: #Ecto.Association.NotLoaded<association :contracts_creation_transaction is not loaded>, decompiled: true, decompiled_smart_contracts: #Ecto.Association.NotLoaded<association :decompiled_smart_contracts is not loaded>, fetched_coin_balance: #Explorer.Chain.Wei<0>, fetched_coin_balance_block_number: 9383953, has_decompiled_code?: nil, hash: %Explorer.Chain.Hash{byte_count: 20, bytes: <<160, 184, 105, 145, 198, 33, 139, 54, 193, 209, 157, 74, 46, 158, 176, 206, 54, 6, 235, 72>>}, inserted_at: ~U[2018-10-06 22:39:11.038238Z], names: [%Explorer.Chain.Address.Name{__meta__: #Ecto.Schema.Metadata<:loaded, "address_names">, address: #Ecto.Association.NotLoaded<association :address is not loaded>, address_hash: %Explorer.Chain.Hash{byte_count: 20, bytes: <<160, 184, 105, 145, 198, 33, 139, 54, 193, 209, 157, 74, 46, 158, 176, ...>>}, inserted_at: ~U[2018-10-06 22:39:26.617020Z], metadata: nil, name: "USD//C", primary: false, updated_at: ~U[2018-10-06 22:39:26.617028Z]}], nonce: nil, smart_contract: #Ecto.Association.NotLoaded<association :smart_contract is not loaded>, stale?: nil, token: #Ecto.Association.NotLoaded<association :token is not loaded>, updated_at: ~U[2018-10-06 22:39:11.038238Z], verified: false}, r: #Decimal<22815429936316461000985654864665862790489687604996919580988940962362139072949>, error: nil, token_transfers: [], created_contract_code_indexed_at: nil, status: :ok, logs: #Ecto.Association.NotLoaded<association :logs is not loaded>, from_address: %Explorer.Chain.Address{__meta__: #Ecto.Schema.Metadata<:loaded, "addresses">, contract_code: nil, contracts_creation_internal_transaction: #Ecto.Association.NotLoaded<association :contracts_creation_internal_transaction is not loaded>, contracts_creation_transaction: #Ecto.Association.NotLoaded<association :contracts_creation_transaction is not loaded>, decompiled: false, decompiled_smart_contracts: #Ecto.Association.NotLoaded<association :decompiled_smart_contracts is not loaded>, fetched_coin_balance: #Explorer.Chain.Wei<100078809000000000>, fetched_coin_balance_block_number: 9383953, has_decompiled_code?: nil, hash: %Explorer.Chain.Hash{byte_count: 20, bytes: <<205, 34, 114, 81, 61, 250, 91, 7, 133, 215, 163, 104, 206, 57, ...>>}, inserted_at: ~U[2019-12-18 07:46:41.614201Z], names: [], nonce: 32, smart_contract: #Ecto.Association.NotLoaded<association :smart_contract is not loaded>, stale?: nil, token: #Ecto.Association.NotLoaded<association :token is not loaded>, updated_at: ~U[2019-12-18 07:46:41.614201Z], verified: false}, old_block_hash: nil, from_address_hash: %Explorer.Chain.Hash{byte_count: 20, bytes: <<205, 34, 114, 81, 61, 250, 91, 7, 133, 215, 163, 104, 206, 57, 171, 33, 34, 53, 100, 110>>}, to_address_hash: %Explorer.Chain.Hash{byte_count: 20, bytes: <<160, 184, 105, 145, 198, 33, 139, 54, 193, 209, 157, 74, 46, 158, 176, 206, 54, 6, 235, 72>>}, uncles: #Ecto.Association.NotLoaded<association :uncles is not loaded>, created_contract_address_hash: nil, index: 36, v: #Decimal<37>, gas: #Decimal<200000>, block_hash: %Explorer.Chain.Hash{byte_count: 32, bytes: <<235, 170, 24, 140, 111, 98, 200, 66, 206, 180, 82, 132, 59, 107, 42, ...>>}, block: %Explorer.Chain.Block{__meta__: #Ecto.Schema.Metadata<:loaded, "blocks">, consensus: true, difficulty: #Decimal<2046176952729657>, gas_limit: #Decimal<9988809>, gas_used: #Decimal<4580513>, hash: %Explorer.Chain.Hash{byte_count: 32, bytes: <<235, 170, 24, 140, 111, 98, 200, 66, ...>>}, inserted_at: ~U[2020-01-30 14:06:17.945273Z], miner: #Ecto.Association.NotLoaded<association :miner is not loaded>, miner_hash: %Explorer.Chain.Hash{byte_count: 20, bytes: <<130, 155, 216, 36, 176, ...>>}, nephew_relations: #Ecto.Association.NotLoaded<association :nephew_relations is not loaded>, nephews: #Ecto.Association.NotLoaded<association :nephews is not loaded>, nonce: %Explorer.Chain.Hash{byte_count: 8, bytes: <<148, 185, ...>>}, number: 9383953, parent: #Ecto.Association.NotLoaded<association :parent is not loaded>, parent_hash: %Explorer.Chain.Hash{byte_count: 32, ...}, pending_operations: #Ecto.Association.NotLoaded<association :pending_operations is not loaded>, ...}, hash: %Explorer.Chain.Hash{byte_count: 32, bytes: <<63, 112, 71, 157, 56, 218, 85, 5, 228, 149, 49, 3, 149, ...>>}, gas_price: #Explorer.Chain.Wei<5000000000>, earliest_processing_start: nil}}, topic: "transactions:new_transaction"}
State: %Phoenix.Socket{assigns: %{locale: "en"}, channel: BlockScoutWeb.TransactionChannel, channel_pid: #PID<0.9627.0>, endpoint: BlockScoutWeb.Endpoint, handler: BlockScoutWeb.UserSocket, id: nil, join_ref: "9", joined: true, private: %{log_handle_in: :debug, log_join: :info}, pubsub_server: BlockScoutWeb.PubSub, ref: nil, serializer: Phoenix.Socket.V2.JSONSerializer, topic: "transactions:new_transaction", transport: :websocket, transport_pid: #PID<0.8221.0>}

You should transfer conn param in every render of "_tile.html" of TransactionView

@vbaranov vbaranov self-requested a review February 18, 2020 10:47
@vbaranov vbaranov added ready for review This PR is ready for reviews. and removed wip labels Feb 18, 2020
@vbaranov vbaranov merged commit d498d68 into master Mar 9, 2020
@vbaranov vbaranov deleted the split-js-logic-into-multiple-files branch March 9, 2020 10:09
@vbaranov vbaranov mentioned this pull request Mar 11, 2020
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready for review This PR is ready for reviews.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Split js logic into multiple files specific to concrete pages
3 participants