From e886a50121e3041ab6871619eef7bdc2e5802bf2 Mon Sep 17 00:00:00 2001 From: Lei Zhou Date: Wed, 7 Aug 2024 17:07:15 -0400 Subject: [PATCH 01/27] test passing for elixir 1.17, otp 27 --- flake.nix | 6 +++--- mix.exs | 2 +- mix.lock | 16 ++++++++-------- test/epicenter/extra/string_test.exs | 2 +- test/epicenter_web/views/form_test.exs | 12 ++++-------- test/epicenter_web/views/multiselect_test.exs | 18 ++++++------------ 6 files changed, 23 insertions(+), 33 deletions(-) diff --git a/flake.nix b/flake.nix index b3ec5425..e26a9a1b 100644 --- a/flake.nix +++ b/flake.nix @@ -21,7 +21,7 @@ # erlang = pkgs.beam.interpreters.erlang; # use latest version of Erlang 27 - erlang = final.beam.interpreters.erlang_25; + erlang = final.beam.interpreters.erlang_27; # specify exact version of Erlang OTP # erlang = pkgs.beam.interpreters.erlang.override { @@ -40,7 +40,7 @@ # elixir = pkgs-beam.elixir; # use latest version of Elixir 1.17 - elixir = pkgs-beam.elixir_1_14; + elixir = pkgs-beam.elixir_1_17; # specify exact version of Elixir # elixir = pkgs-beam.elixir.override { @@ -55,7 +55,7 @@ # use the Elixr/OTP versions defined above; will also install OTP, mix, hex, rebar3 elixir - postgresql_15 + postgresql_16 # mix needs it for downloading dependencies git diff --git a/mix.exs b/mix.exs index 8b48a4da..11a38f9f 100644 --- a/mix.exs +++ b/mix.exs @@ -47,7 +47,7 @@ defmodule Epicenter.MixProject do local_or_remote(:remote, :euclid, version: "~> 0.1", path: System.get_env("EUCLID_PATH", "../euclid")), {:bcrypt_elixir, "~> 2.1"}, {:cowboy_telemetry, "~> 0.4"}, - {:ecto_sql, "~> 3.5"}, + {:ecto_sql, "~> 3.11"}, {:eqrcode, "~> 0.1"}, {:floki, ">= 0.0.0", only: :test}, {:gettext, "~> 0.11"}, diff --git a/mix.lock b/mix.lock index 52a9743e..a469840a 100644 --- a/mix.lock +++ b/mix.lock @@ -7,10 +7,10 @@ "cowboy": {:hex, :cowboy, "2.9.0", "865dd8b6607e14cf03282e10e934023a1bd8be6f6bacf921a7e2a96d800cd452", [:make, :rebar3], [{:cowlib, "2.11.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "2c729f934b4e1aa149aff882f57c6372c15399a20d54f65c8d67bef583021bde"}, "cowboy_telemetry": {:hex, :cowboy_telemetry, "0.4.0", "f239f68b588efa7707abce16a84d0d2acf3a0f50571f8bb7f56a15865aae820c", [:rebar3], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7d98bac1ee4565d31b62d59f8823dfd8356a169e7fcbb83831b8a5397404c9de"}, "cowlib": {:hex, :cowlib, "2.11.0", "0b9ff9c346629256c42ebe1eeb769a83c6cb771a6ee5960bd110ab0b9b872063", [:make, :rebar3], [], "hexpm", "2b3e9da0b21c4565751a6d4901c20d1b4cc25cbb7fd50d91d2ab6dd287bc86a9"}, - "db_connection": {:hex, :db_connection, "2.4.1", "6411f6e23f1a8b68a82fa3a36366d4881f21f47fc79a9efb8c615e62050219da", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "ea36d226ec5999781a9a8ad64e5d8c4454ecedc7a4d643e4832bf08efca01f00"}, - "decimal": {:hex, :decimal, "2.0.0", "a78296e617b0f5dd4c6caf57c714431347912ffb1d0842e998e9792b5642d697", [:mix], [], "hexpm", "34666e9c55dea81013e77d9d87370fe6cb6291d1ef32f46a1600230b1d44f577"}, - "ecto": {:hex, :ecto, "3.7.1", "a20598862351b29f80f285b21ec5297da1181c0442687f9b8329f0445d228892", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "d36e5b39fc479e654cffd4dbe1865d9716e4a9b6311faff799b6f90ab81b8638"}, - "ecto_sql": {:hex, :ecto_sql, "3.7.1", "8de624ef50b2a8540252d8c60506379fbbc2707be1606853df371cf53df5d053", [:mix], [{:db_connection, "~> 2.2", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.7.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.4.0 or ~> 0.5.0", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.15.0 or ~> 1.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.1 or ~> 2.2", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "2b42a32e2ce92f64aba5c88617891ab3b0ba34f3f3a503fa20009eae1a401c81"}, + "db_connection": {:hex, :db_connection, "2.7.0", "b99faa9291bb09892c7da373bb82cba59aefa9b36300f6145c5f201c7adf48ec", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "dcf08f31b2701f857dfc787fbad78223d61a32204f217f15e881dd93e4bdd3ff"}, + "decimal": {:hex, :decimal, "2.1.1", "5611dca5d4b2c3dd497dec8f68751f1f1a54755e8ed2a966c2633cf885973ad6", [:mix], [], "hexpm", "53cfe5f497ed0e7771ae1a475575603d77425099ba5faef9394932b35020ffcc"}, + "ecto": {:hex, :ecto, "3.11.2", "e1d26be989db350a633667c5cda9c3d115ae779b66da567c68c80cfb26a8c9ee", [:mix], [{:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "3c38bca2c6f8d8023f2145326cc8a80100c3ffe4dcbd9842ff867f7fc6156c65"}, + "ecto_sql": {:hex, :ecto_sql, "3.11.3", "4eb7348ff8101fbc4e6bbc5a4404a24fecbe73a3372d16569526b0cf34ebc195", [:mix], [{:db_connection, "~> 2.4.1 or ~> 2.5", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.11.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.6", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.16 or ~> 1.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.1 or ~> 2.2", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "e5f36e3d736b99c7fee3e631333b8394ade4bafe9d96d35669fca2d81c2be928"}, "elixir_make": {:hex, :elixir_make, "0.6.3", "bc07d53221216838d79e03a8019d0839786703129599e9619f4ab74c8c096eac", [:mix], [], "hexpm", "f5cbd651c5678bcaabdbb7857658ee106b12509cd976c2c2fca99688e1daf716"}, "eqrcode": {:hex, :eqrcode, "0.1.10", "6294fece9d68ad64eef1c3c92cf111cfd6469f4fbf230a2d4cc905a682178f3f", [:mix], [], "hexpm", "da30e373c36a0fd37ab6f58664b16029919896d6c45a68a95cc4d713e81076f1"}, "euclid": {:hex, :euclid, "0.2.4", "85714118dd8a03100d8896a7625c5a5306b55a8c721aa5a33056421c878c239f", [:mix], [], "hexpm", "8c013b6959a8db34e9eeb0908beb9b6958ecb0238f44926029c3f09f8e19a763"}, @@ -22,7 +22,7 @@ "html_entities": {:hex, :html_entities, "0.5.2", "9e47e70598da7de2a9ff6af8758399251db6dbb7eebe2b013f2bbd2515895c3c", [:mix], [], "hexpm", "c53ba390403485615623b9531e97696f076ed415e8d8058b1dbaa28181f4fdcc"}, "idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"}, "inflex": {:hex, :inflex, "2.1.0", "a365cf0821a9dacb65067abd95008ca1b0bb7dcdd85ae59965deef2aa062924c", [:mix], [], "hexpm", "14c17d05db4ee9b6d319b0bff1bdf22aa389a25398d1952c7a0b5f3d93162dd8"}, - "jason": {:hex, :jason, "1.2.2", "ba43e3f2709fd1aa1dce90aaabfd039d000469c05c56f0b8e31978e03fa39052", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "18a228f5f0058ee183f29f9eae0805c6e59d61c3b006760668d8d18ff0d12179"}, + "jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"}, "logger_json": {:hex, :logger_json, "4.3.0", "41aaaab2c2e1c071bfddbcc5a3f567884fdf312d222c7f1a7e3de6ab667774f7", [:mix], [{:ecto, "~> 2.1 or ~> 3.0", [hex: :ecto, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: true]}], "hexpm", "001bbc34d7c451cfeed298c8384cb3aab10b364db2eb095c466c7a1a28bee6e0"}, "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm", "69b09adddc4f74a40716ae54d140f93beb0fb8978d8636eaded0c31b6f099f16"}, "mime": {:hex, :mime, "2.0.2", "0b9e1a4c840eafb68d820b0e2158ef5c49385d17fb36855ac6e7e087d4b1dcc5", [:mix], [], "hexpm", "e6a3f76b4c277739e36c2e21a2c640778ba4c3846189d5ab19f97f126df5f9b7"}, @@ -46,12 +46,12 @@ "plug": {:hex, :plug, "1.12.1", "645678c800601d8d9f27ad1aebba1fdb9ce5b2623ddb961a074da0b96c35187d", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "d57e799a777bc20494b784966dc5fbda91eb4a09f571f76545b72a634ce0d30b"}, "plug_cowboy": {:hex, :plug_cowboy, "2.5.2", "62894ccd601cf9597e2c23911ff12798a8a18d237e9739f58a6b04e4988899fe", [:mix], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:cowboy_telemetry, "~> 0.3", [hex: :cowboy_telemetry, repo: "hexpm", optional: false]}, {:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "ea6e87f774c8608d60c8d34022a7d073bd7680a0a013f049fc62bf35efea1044"}, "plug_crypto": {:hex, :plug_crypto, "1.2.2", "05654514ac717ff3a1843204b424477d9e60c143406aa94daf2274fdd280794d", [:mix], [], "hexpm", "87631c7ad914a5a445f0a3809f99b079113ae4ed4b867348dd9eec288cecb6db"}, - "postgrex": {:hex, :postgrex, "0.15.13", "7794e697481799aee8982688c261901de493eb64451feee6ea58207d7266d54a", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.5 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "3ffb76e1a97cfefe5c6a95632a27ffb67f28871c9741fb585f9d1c3cd2af70f1"}, + "postgrex": {:hex, :postgrex, "0.19.0", "f7d50e50cb42e0a185f5b9a6095125a9ab7e4abccfbe2ab820ab9aa92b71dbab", [:mix], [{:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.5 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "dba2d2a0a8637defbf2307e8629cb2526388ba7348f67d04ec77a5d6a72ecfae"}, "ranch": {:hex, :ranch, "1.8.0", "8c7a100a139fd57f17327b6413e4167ac559fbc04ca7448e9be9057311597a1d", [:make, :rebar3], [], "hexpm", "49fbcfd3682fab1f5d109351b61257676da1a2fdbe295904176d5e521a2ddfe5"}, "sobelow": {:hex, :sobelow, "0.11.1", "23438964486f8112b41e743bbfd402da3e5b296fdc9eacab29914b79c48916dd", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "9897363a7eff96f4809304a90aad819e2ad5e5d24db547af502885146746a53c"}, - "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.6", "cf344f5692c82d2cd7554f5ec8fd961548d4fd09e7d22f5b62482e5aeaebd4b0", [:make, :mix, :rebar3], [], "hexpm", "bdb0d2471f453c88ff3908e7686f86f9be327d065cc1ec16fa4540197ea04680"}, + "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.7", "354c321cf377240c7b8716899e182ce4890c5938111a1296add3ec74cf1715df", [:make, :mix, :rebar3], [], "hexpm", "fe4c190e8f37401d30167c8c405eda19469f34577987c76dde613e838bbc67f8"}, "table_rex": {:hex, :table_rex, "3.1.1", "0c67164d1714b5e806d5067c1e96ff098ba7ae79413cc075973e17c38a587caa", [:mix], [], "hexpm", "678a23aba4d670419c23c17790f9dcd635a4a89022040df7d5d772cb21012490"}, - "telemetry": {:hex, :telemetry, "1.0.0", "0f453a102cdf13d506b7c0ab158324c337c41f1cc7548f0bc0e130bbf0ae9452", [:rebar3], [], "hexpm", "73bc09fa59b4a0284efb4624335583c528e07ec9ae76aca96ea0673850aec57a"}, + "telemetry": {:hex, :telemetry, "1.2.1", "68fdfe8d8f05a8428483a97d7aab2f268aaff24b49e0f599faa091f1d4e7f61c", [:rebar3], [], "hexpm", "dad9ce9d8effc621708f99eac538ef1cbe05d6a874dd741de2e689c47feafed5"}, "telemetry_metrics": {:hex, :telemetry_metrics, "0.6.1", "315d9163a1d4660aedc3fee73f33f1d355dcc76c5c3ab3d59e76e3edf80eef1f", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7be9e0871c41732c233be71e4be11b96e56177bf15dde64a8ac9ce72ac9834c6"}, "telemetry_poller": {:hex, :telemetry_poller, "1.0.0", "db91bb424e07f2bb6e73926fcafbfcbcb295f0193e0a00e825e589a0a47e8453", [:rebar3], [{:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "b3a24eafd66c3f42da30fc3ca7dda1e9d546c12250a2d60d7b81d264fbec4f6e"}, "timex": {:hex, :timex, "3.7.6", "502d2347ec550e77fdf419bc12d15bdccd31266bb7d925b30bf478268098282f", [:mix], [{:combine, "~> 0.10", [hex: :combine, repo: "hexpm", optional: false]}, {:gettext, "~> 0.10", [hex: :gettext, repo: "hexpm", optional: false]}, {:tzdata, "~> 1.0", [hex: :tzdata, repo: "hexpm", optional: false]}], "hexpm", "a296327f79cb1ec795b896698c56e662ed7210cc9eb31f0ab365eb3a62e2c589"}, diff --git a/test/epicenter/extra/string_test.exs b/test/epicenter/extra/string_test.exs index 45a29a17..db7bad0b 100644 --- a/test/epicenter/extra/string_test.exs +++ b/test/epicenter/extra/string_test.exs @@ -52,7 +52,7 @@ defmodule Epicenter.Extra.StringTest do gnu """ |> Extra.String.remove_marked_whitespace() - |> assert_eq("ant batcat dogeel foxgnu\n") + |> assert_eq("ant batcat dogeel foxgnu") end end diff --git a/test/epicenter_web/views/form_test.exs b/test/epicenter_web/views/form_test.exs index 3ac94c5b..c738fb51 100644 --- a/test/epicenter_web/views/form_test.exs +++ b/test/epicenter_web/views/form_test.exs @@ -134,8 +134,7 @@ defmodule EpicenterWeb.FormTest do
MM/DD/YYYY
-
This is a cool release date!
- \v Title\v - @@ -301,8 +298,7 @@ defmodule EpicenterWeb.FormTest do -
diff --git a/test/epicenter_web/views/multiselect_test.exs b/test/epicenter_web/views/multiselect_test.exs index e8f7864e..2b811fff 100644 --- a/test/epicenter_web/views/multiselect_test.exs +++ b/test/epicenter_web/views/multiselect_test.exs @@ -51,8 +51,7 @@ defmodule EpicenterWeb.MultiselectTest do |> assert_html_eq("""
@@ -76,14 +69,7 @@ /> diff --git a/lib/epicenter_web/live/place_search_live.html.heex b/lib/epicenter_web/live/place_search_live.html.heex index c9d1dfac..0491f4c3 100644 --- a/lib/epicenter_web/live/place_search_live.html.heex +++ b/lib/epicenter_web/live/place_search_live.html.heex @@ -1,9 +1,8 @@
@@ -46,16 +45,9 @@ tabindex="-1" >
<%= @no_results_message %>
- <%= live_redirect("+ Add new place", - to: - Routes.new_place_path( - EpicenterWeb.Endpoint, - EpicenterWeb.PlaceLive, - @case_investigation - ), - data_role: "no-results-add-new-place", - class: "new-place-link" - ) %> + <.link navigate={Routes.new_place_path(EpicenterWeb.Endpoint, EpicenterWeb.PlaceLive, @case_investigation)} + class="new-place-link" + data-role="no-results-add-new-place">+ Add new place <% end %> <%= for place_address <- @result_place_addresses do %> @@ -68,30 +60,17 @@ role="option" tabindex="-1" > - <%= live_redirect \ - to: Routes.add_visit_path(EpicenterWeb.Endpoint, EpicenterWeb.AddVisitLive, @case_investigation, place: place_address.place, place_address: place_address), - data_role: "place_address_link", - data_tid: place_address.tid \ - do %> - <%= place_address.place.name %><%= address( - place_address -) %> - <% end %> + <.link navigate={Routes.add_visit_path(EpicenterWeb.Endpoint, EpicenterWeb.AddVisitLive, @case_investigation, place: place_address.place, place_address: place_address)} + data-role="place_address_link" data-tid={place_address.tid}> + <%= place_address.place.name %><%= address(place_address) %> <% end %>
- <%= live_redirect("+ Add new place", - to: - Routes.new_place_path( - EpicenterWeb.Endpoint, - EpicenterWeb.PlaceLive, - @case_investigation - ), - data_role: "add-new-place", - class: "new-place-link" - ) %> + <.link navigate={Routes.new_place_path(EpicenterWeb.Endpoint, EpicenterWeb.PlaceLive, @case_investigation)} + class="new-place-link" + data-role="add-new-place">+ Add new place diff --git a/lib/epicenter_web/live/profile_live.html.heex b/lib/epicenter_web/live/profile_live.html.heex index d9bdb8e5..b173ca4c 100644 --- a/lib/epicenter_web/live/profile_live.html.heex +++ b/lib/epicenter_web/live/profile_live.html.heex @@ -21,16 +21,10 @@ <% end %> <%= if @potential_duplicate_count > 0 and is_editable?(@person) do %> - <%= live_redirect("View potential duplicates (#{@potential_duplicate_count})", - id: "view-potential-duplicates", - to: - Routes.potential_duplicates_path( - EpicenterWeb.Endpoint, - EpicenterWeb.PotentialDuplicatesLive, - @person - ), - data_role: "view-potential-duplicates" - ) %> + <.link navigate={Routes.potential_duplicates_path(EpicenterWeb.Endpoint, EpicenterWeb.PotentialDuplicatesLive, @person)} + id="view-potential-duplicates" + data-role="view-potential-duplicates"> + View potential duplicates (<%= @potential_duplicate_count %>) <% end %> @@ -56,15 +50,11 @@

Profile

<%= if is_editable?(@person) do %> - <%= live_redirect("Update", - to: - Routes.profile_edit_path( - EpicenterWeb.Endpoint, - EpicenterWeb.ProfileEditLive, - @person - ), - data_role: "edit-identifying-information-link" - ) %> + <.link navigate={Routes.profile_edit_path( + EpicenterWeb.Endpoint, + EpicenterWeb.ProfileEditLive, + @person)} + data-role="edit-identifying-information-link">Update <% end %> @@ -163,16 +153,11 @@ @@ -199,16 +184,11 @@

Contacts

<%= if is_editable?(@person) do %> - <%= live_redirect("+ Contact", - to: - Routes.create_case_investigation_contact_path( - EpicenterWeb.Endpoint, - EpicenterWeb.CaseInvestigationContactLive, - case_investigation - ), - id: "add-contact-case-investigation-link-001", - class: "add-contact-case-investigation-link" - ) %> + <.link + navigate={Routes.create_case_investigation_contact_path( + EpicenterWeb.Endpoint, EpicenterWeb.CaseInvestigationContactLive, case_investigation)} + id="add-contact-case-investigation-link-001" + class="add-contact-case-investigation-link">+ Contact <% end %>
@@ -216,30 +196,20 @@
- <%= live_redirect(Format.person(contact_investigation.exposed_person), - to: - Routes.profile_path( - EpicenterWeb.Endpoint, - EpicenterWeb.ProfileLive, - contact_investigation.exposed_person - ), - data: [role: "visit-contact-link"], - class: "contact-name" - ) %> + <.link navigate={Routes.profile_path(EpicenterWeb.Endpoint, EpicenterWeb.ProfileLive, contact_investigation.exposed_person)} + data-role="visit-contact-link" + class="contact-name"><%= Format.person(contact_investigation.exposed_person) %>
<%= contact_details_as_list(contact_investigation) %>
@@ -338,16 +307,13 @@ @@ -432,15 +398,10 @@

Demographics

<%= if is_editable?(@person) do %> - <%= live_redirect("Update", - to: - Routes.demographics_edit_path( - EpicenterWeb.Endpoint, - EpicenterWeb.DemographicsEditLive, - @person - ), - data_role: "edit-demographics-link" - ) %> + <.link navigate={Routes.demographics_edit_path( + EpicenterWeb.Endpoint, + EpicenterWeb.DemographicsEditLive, + @person)} data-role="edit-demographics-link">Update <% end %> diff --git a/mix.exs b/mix.exs index 078da214..e462f1b3 100644 --- a/mix.exs +++ b/mix.exs @@ -66,7 +66,7 @@ defmodule Epicenter.MixProject do {:phoenix_integration, "~> 0.8", only: :test}, {:phoenix_live_dashboard, "~> 0.6"}, {:phoenix_live_reload, "~> 1.2", only: :dev}, - {:phoenix_live_view, "== 0.18.0"}, + {:phoenix_live_view, "== 0.19.0"}, {:phoenix_view, "~> 2.0"}, {:plug_cowboy, "~> 2.0"}, {:postgrex, ">= 0.0.0"}, diff --git a/mix.lock b/mix.lock index 1bd78971..8aea79fb 100644 --- a/mix.lock +++ b/mix.lock @@ -39,9 +39,9 @@ "phoenix_ecto": {:hex, :phoenix_ecto, "4.4.0", "0672ed4e4808b3fbed494dded89958e22fb882de47a97634c0b13e7b0b5f7720", [:mix], [{:ecto, "~> 3.3", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.14.2 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:plug, "~> 1.9", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "09864e558ed31ee00bd48fcc1d4fc58ae9678c9e81649075431e69dbabb43cc1"}, "phoenix_html": {:hex, :phoenix_html, "3.3.4", "42a09fc443bbc1da37e372a5c8e6755d046f22b9b11343bf885067357da21cb3", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "0249d3abec3714aff3415e7ee3d9786cb325be3151e6c4b3021502c585bf53fb"}, "phoenix_integration": {:hex, :phoenix_integration, "0.9.2", "c84c6d30251fb45877bbbebee064412930133d6da5d75e0a4121583a6d37a6b3", [:mix], [{:floki, ">= 0.24.0", [hex: :floki, repo: "hexpm", optional: false]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.3", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.10 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: false]}], "hexpm", "bb1a7e3409606c612b76160e80f452caf08a33b5717e37cdb219539b7f024001"}, - "phoenix_live_dashboard": {:hex, :phoenix_live_dashboard, "0.7.1", "b0bf8f3348dec4910907a2ad1453e642f6fe4d444376c1c9b26222d63c73cf97", [:mix], [{:ecto, "~> 3.6.2 or ~> 3.7", [hex: :ecto, repo: "hexpm", optional: true]}, {:ecto_mysql_extras, "~> 0.5", [hex: :ecto_mysql_extras, repo: "hexpm", optional: true]}, {:ecto_psql_extras, "~> 0.7", [hex: :ecto_psql_extras, repo: "hexpm", optional: true]}, {:mime, "~> 1.6 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:phoenix_live_view, "~> 0.18.0", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}, {:telemetry_metrics, "~> 0.6 or ~> 1.0", [hex: :telemetry_metrics, repo: "hexpm", optional: false]}], "hexpm", "b6c5d744bf4b40692b1b361d3608bdfd05aeab83e17c7bc217d730f007f31abf"}, + "phoenix_live_dashboard": {:hex, :phoenix_live_dashboard, "0.8.4", "4508e481f791ce62ec6a096e13b061387158cbeefacca68c6c1928e1305e23ed", [:mix], [{:ecto, "~> 3.6.2 or ~> 3.7", [hex: :ecto, repo: "hexpm", optional: true]}, {:ecto_mysql_extras, "~> 0.5", [hex: :ecto_mysql_extras, repo: "hexpm", optional: true]}, {:ecto_psql_extras, "~> 0.7", [hex: :ecto_psql_extras, repo: "hexpm", optional: true]}, {:ecto_sqlite3_extras, "~> 1.1.7 or ~> 1.2.0", [hex: :ecto_sqlite3_extras, repo: "hexpm", optional: true]}, {:mime, "~> 1.6 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:phoenix_live_view, "~> 0.19 or ~> 1.0", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}, {:telemetry_metrics, "~> 0.6 or ~> 1.0", [hex: :telemetry_metrics, repo: "hexpm", optional: false]}], "hexpm", "2984aae96994fbc5c61795a73b8fb58153b41ff934019cfb522343d2d3817d59"}, "phoenix_live_reload": {:hex, :phoenix_live_reload, "1.3.3", "3a53772a6118d5679bf50fc1670505a290e32a1d195df9e069d8c53ab040c054", [:mix], [{:file_system, "~> 0.2.1 or ~> 0.3", [hex: :file_system, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.4", [hex: :phoenix, repo: "hexpm", optional: false]}], "hexpm", "766796676e5f558dbae5d1bdb066849673e956005e3730dfd5affd7a6da4abac"}, - "phoenix_live_view": {:hex, :phoenix_live_view, "0.18.0", "8705283efbc623df6290d5f8cb233afa9bcdcfc969749ce6e313877108f65887", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix, "~> 1.6", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 3.1", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "545f11c15d595595690da16c4f607417bfb1862e518c07c9f78c754ac186cd7d"}, + "phoenix_live_view": {:hex, :phoenix_live_view, "0.19.0", "de5643d03e3cdf5ff19cd45b5d14543a3b1ad8551d529f6b24246e88a6c6f1b8", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix, "~> 1.6.15 or ~> 1.7.0", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 3.3", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "a650b6f814c4f386314b98f1aebf92f8652649166612f84ef2e60a20894addfa"}, "phoenix_pubsub": {:hex, :phoenix_pubsub, "2.1.3", "3168d78ba41835aecad272d5e8cd51aa87a7ac9eb836eabc42f6e57538e3731d", [:mix], [], "hexpm", "bba06bc1dcfd8cb086759f0edc94a8ba2bc8896d5331a1e2c2902bf8e36ee502"}, "phoenix_template": {:hex, :phoenix_template, "1.0.4", "e2092c132f3b5e5b2d49c96695342eb36d0ed514c5b252a77048d5969330d639", [:mix], [{:phoenix_html, "~> 2.14.2 or ~> 3.0 or ~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}], "hexpm", "2c0c81f0e5c6753faf5cca2f229c9709919aba34fab866d3bc05060c9c444206"}, "phoenix_view": {:hex, :phoenix_view, "2.0.4", "b45c9d9cf15b3a1af5fb555c674b525391b6a1fe975f040fb4d913397b31abf4", [:mix], [{:phoenix_html, "~> 2.14.2 or ~> 3.0 or ~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}], "hexpm", "4e992022ce14f31fe57335db27a28154afcc94e9983266835bb3040243eb620b"}, From 1118f35c45e7e3fd1da64db5baf0f279a0a7e6c0 Mon Sep 17 00:00:00 2001 From: Lei Zhou Date: Tue, 13 Aug 2024 15:12:39 -0400 Subject: [PATCH 09/27] update phoenix_liveview to 0.20.17; all tests passed --- lib/epicenter_web.ex | 2 +- mix.exs | 2 +- mix.lock | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/epicenter_web.ex b/lib/epicenter_web.ex index 61fb9f99..f28075c0 100644 --- a/lib/epicenter_web.ex +++ b/lib/epicenter_web.ex @@ -45,7 +45,7 @@ defmodule EpicenterWeb do def live_view do quote do use Phoenix.HTML - use Phoenix.LiveView, layout: {EpicenterWeb.LayoutView, "live.html"} + use Phoenix.LiveView, layout: {EpicenterWeb.LayoutView, :live} use EpicenterWeb.SearchHandling unquote(view_helpers()) diff --git a/mix.exs b/mix.exs index e462f1b3..15e76c5f 100644 --- a/mix.exs +++ b/mix.exs @@ -66,7 +66,7 @@ defmodule Epicenter.MixProject do {:phoenix_integration, "~> 0.8", only: :test}, {:phoenix_live_dashboard, "~> 0.6"}, {:phoenix_live_reload, "~> 1.2", only: :dev}, - {:phoenix_live_view, "== 0.19.0"}, + {:phoenix_live_view, "== 0.20.17"}, {:phoenix_view, "~> 2.0"}, {:plug_cowboy, "~> 2.0"}, {:postgrex, ">= 0.0.0"}, diff --git a/mix.lock b/mix.lock index 8aea79fb..690888db 100644 --- a/mix.lock +++ b/mix.lock @@ -17,7 +17,7 @@ "euclid": {:hex, :euclid, "0.2.4", "85714118dd8a03100d8896a7625c5a5306b55a8c721aa5a33056421c878c239f", [:mix], [], "hexpm", "8c013b6959a8db34e9eeb0908beb9b6958ecb0238f44926029c3f09f8e19a763"}, "expo": {:hex, :expo, "0.4.1", "1c61d18a5df197dfda38861673d392e642649a9cef7694d2f97a587b2cfb319b", [:mix], [], "hexpm", "2ff7ba7a798c8c543c12550fa0e2cbc81b95d4974c65855d8d15ba7b37a1ce47"}, "file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"}, - "floki": {:hex, :floki, "0.32.0", "f915dc15258bc997d49be1f5ef7d3992f8834d6f5695270acad17b41f5bcc8e2", [:mix], [{:html_entities, "~> 0.5.0", [hex: :html_entities, repo: "hexpm", optional: false]}], "hexpm", "1c5a91cae1fd8931c26a4826b5e2372c284813904c8bacb468b5de39c7ececbd"}, + "floki": {:hex, :floki, "0.36.2", "a7da0193538c93f937714a6704369711998a51a6164a222d710ebd54020aa7a3", [:mix], [], "hexpm", "a8766c0bc92f074e5cb36c4f9961982eda84c5d2b8e979ca67f5c268ec8ed580"}, "gettext": {:hex, :gettext, "0.23.1", "821e619a240e6000db2fc16a574ef68b3bd7fe0167ccc264a81563cc93e67a31", [:mix], [{:expo, "~> 0.4.0", [hex: :expo, repo: "hexpm", optional: false]}], "hexpm", "19d744a36b809d810d610b57c27b934425859d158ebd56561bc41f7eeb8795db"}, "hackney": {:hex, :hackney, "1.18.0", "c4443d960bb9fba6d01161d01cd81173089686717d9490e5d3606644c48d121f", [:rebar3], [{:certifi, "~>2.8.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "~>6.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "~>1.0.0", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.3.1", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "~>1.1.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}, {:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "9afcda620704d720db8c6a3123e9848d09c87586dc1c10479c42627b905b5c5e"}, "html_entities": {:hex, :html_entities, "0.5.2", "9e47e70598da7de2a9ff6af8758399251db6dbb7eebe2b013f2bbd2515895c3c", [:mix], [], "hexpm", "c53ba390403485615623b9531e97696f076ed415e8d8058b1dbaa28181f4fdcc"}, @@ -39,9 +39,9 @@ "phoenix_ecto": {:hex, :phoenix_ecto, "4.4.0", "0672ed4e4808b3fbed494dded89958e22fb882de47a97634c0b13e7b0b5f7720", [:mix], [{:ecto, "~> 3.3", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.14.2 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:plug, "~> 1.9", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "09864e558ed31ee00bd48fcc1d4fc58ae9678c9e81649075431e69dbabb43cc1"}, "phoenix_html": {:hex, :phoenix_html, "3.3.4", "42a09fc443bbc1da37e372a5c8e6755d046f22b9b11343bf885067357da21cb3", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "0249d3abec3714aff3415e7ee3d9786cb325be3151e6c4b3021502c585bf53fb"}, "phoenix_integration": {:hex, :phoenix_integration, "0.9.2", "c84c6d30251fb45877bbbebee064412930133d6da5d75e0a4121583a6d37a6b3", [:mix], [{:floki, ">= 0.24.0", [hex: :floki, repo: "hexpm", optional: false]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.3", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.10 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: false]}], "hexpm", "bb1a7e3409606c612b76160e80f452caf08a33b5717e37cdb219539b7f024001"}, - "phoenix_live_dashboard": {:hex, :phoenix_live_dashboard, "0.8.4", "4508e481f791ce62ec6a096e13b061387158cbeefacca68c6c1928e1305e23ed", [:mix], [{:ecto, "~> 3.6.2 or ~> 3.7", [hex: :ecto, repo: "hexpm", optional: true]}, {:ecto_mysql_extras, "~> 0.5", [hex: :ecto_mysql_extras, repo: "hexpm", optional: true]}, {:ecto_psql_extras, "~> 0.7", [hex: :ecto_psql_extras, repo: "hexpm", optional: true]}, {:ecto_sqlite3_extras, "~> 1.1.7 or ~> 1.2.0", [hex: :ecto_sqlite3_extras, repo: "hexpm", optional: true]}, {:mime, "~> 1.6 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:phoenix_live_view, "~> 0.19 or ~> 1.0", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}, {:telemetry_metrics, "~> 0.6 or ~> 1.0", [hex: :telemetry_metrics, repo: "hexpm", optional: false]}], "hexpm", "2984aae96994fbc5c61795a73b8fb58153b41ff934019cfb522343d2d3817d59"}, + "phoenix_live_dashboard": {:hex, :phoenix_live_dashboard, "0.8.4-rc.0", "3af26124c9bea60253db50360912cb59668580ede2e702e7324536fb9d1cb523", [:mix], [{:ecto, "~> 3.6.2 or ~> 3.7", [hex: :ecto, repo: "hexpm", optional: true]}, {:ecto_mysql_extras, "~> 0.5", [hex: :ecto_mysql_extras, repo: "hexpm", optional: true]}, {:ecto_psql_extras, "~> 0.7", [hex: :ecto_psql_extras, repo: "hexpm", optional: true]}, {:ecto_sqlite3_extras, "~> 1.1.7 or ~> 1.2.0", [hex: :ecto_sqlite3_extras, repo: "hexpm", optional: true]}, {:mime, "~> 1.6 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:phoenix_live_view, "~> 0.19 or ~> 1.0-rc", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}, {:telemetry_metrics, "~> 0.6 or ~> 1.0", [hex: :telemetry_metrics, repo: "hexpm", optional: false]}], "hexpm", "66885624771f1a59f5b0ed6c24cbcec70fb2544356cb8085fd85320e6593720a"}, "phoenix_live_reload": {:hex, :phoenix_live_reload, "1.3.3", "3a53772a6118d5679bf50fc1670505a290e32a1d195df9e069d8c53ab040c054", [:mix], [{:file_system, "~> 0.2.1 or ~> 0.3", [hex: :file_system, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.4", [hex: :phoenix, repo: "hexpm", optional: false]}], "hexpm", "766796676e5f558dbae5d1bdb066849673e956005e3730dfd5affd7a6da4abac"}, - "phoenix_live_view": {:hex, :phoenix_live_view, "0.19.0", "de5643d03e3cdf5ff19cd45b5d14543a3b1ad8551d529f6b24246e88a6c6f1b8", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix, "~> 1.6.15 or ~> 1.7.0", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 3.3", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "a650b6f814c4f386314b98f1aebf92f8652649166612f84ef2e60a20894addfa"}, + "phoenix_live_view": {:hex, :phoenix_live_view, "0.20.17", "f396bbdaf4ba227b82251eb75ac0afa6b3da5e509bc0d030206374237dfc9450", [:mix], [{:floki, "~> 0.36", [hex: :floki, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix, "~> 1.6.15 or ~> 1.7.0", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 3.3 or ~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: true]}, {:plug, "~> 1.15", [hex: :plug, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "a61d741ffb78c85fdbca0de084da6a48f8ceb5261a79165b5a0b59e5f65ce98b"}, "phoenix_pubsub": {:hex, :phoenix_pubsub, "2.1.3", "3168d78ba41835aecad272d5e8cd51aa87a7ac9eb836eabc42f6e57538e3731d", [:mix], [], "hexpm", "bba06bc1dcfd8cb086759f0edc94a8ba2bc8896d5331a1e2c2902bf8e36ee502"}, "phoenix_template": {:hex, :phoenix_template, "1.0.4", "e2092c132f3b5e5b2d49c96695342eb36d0ed514c5b252a77048d5969330d639", [:mix], [{:phoenix_html, "~> 2.14.2 or ~> 3.0 or ~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}], "hexpm", "2c0c81f0e5c6753faf5cca2f229c9709919aba34fab866d3bc05060c9c444206"}, "phoenix_view": {:hex, :phoenix_view, "2.0.4", "b45c9d9cf15b3a1af5fb555c674b525391b6a1fe975f040fb4d913397b31abf4", [:mix], [{:phoenix_html, "~> 2.14.2 or ~> 3.0 or ~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}], "hexpm", "4e992022ce14f31fe57335db27a28154afcc94e9983266835bb3040243eb620b"}, From 4b09f9a11c937a9336747e350b20f76c95c77ff1 Mon Sep 17 00:00:00 2001 From: Lei Zhou Date: Tue, 13 Aug 2024 22:45:25 -0400 Subject: [PATCH 10/27] update to liveview 1.0.0.rc_6; tests all passed; use Flash.get/2; use update_many/1; --- .../investigation_note_component.ex | 16 +++++++--------- mix.exs | 2 +- mix.lock | 2 +- .../epicenter_web/controllers/user_auth_test.exs | 9 +++++---- .../user_reset_password_controller_test.exs | 11 ++++++----- .../user_settings_controller_test.exs | 4 ++-- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/lib/epicenter_web/live_component/investigation_note_component.ex b/lib/epicenter_web/live_component/investigation_note_component.ex index 22856d4b..2f72bbda 100644 --- a/lib/epicenter_web/live_component/investigation_note_component.ex +++ b/lib/epicenter_web/live_component/investigation_note_component.ex @@ -6,15 +6,12 @@ defmodule EpicenterWeb.InvestigationNoteComponent do alias Epicenter.Cases alias EpicenterWeb.Format - def preload(assigns) do - notes = - assigns - |> Enum.map(fn a -> a.note end) - |> Cases.preload_author() - - assigns - |> Enum.with_index() - |> Enum.map(fn {a, i} -> Map.put(a, :note, Enum.at(notes, i)) end) + def update_many(assigns_sockets) do + assigns_sockets + |> Enum.map(fn {assigns, socket} -> + socket + |> assign(assigns) + |> assign(:note, Cases.preload_author(assigns.note)) end) end def render(assigns) do @@ -47,4 +44,5 @@ defmodule EpicenterWeb.InvestigationNoteComponent do socket.assigns.on_delete.(socket.assigns.note) socket |> noreply() end + end diff --git a/mix.exs b/mix.exs index 15e76c5f..da34c456 100644 --- a/mix.exs +++ b/mix.exs @@ -66,7 +66,7 @@ defmodule Epicenter.MixProject do {:phoenix_integration, "~> 0.8", only: :test}, {:phoenix_live_dashboard, "~> 0.6"}, {:phoenix_live_reload, "~> 1.2", only: :dev}, - {:phoenix_live_view, "== 0.20.17"}, + {:phoenix_live_view, "~> 1.0.0-rc.6"}, {:phoenix_view, "~> 2.0"}, {:plug_cowboy, "~> 2.0"}, {:postgrex, ">= 0.0.0"}, diff --git a/mix.lock b/mix.lock index 690888db..e97fffd8 100644 --- a/mix.lock +++ b/mix.lock @@ -41,7 +41,7 @@ "phoenix_integration": {:hex, :phoenix_integration, "0.9.2", "c84c6d30251fb45877bbbebee064412930133d6da5d75e0a4121583a6d37a6b3", [:mix], [{:floki, ">= 0.24.0", [hex: :floki, repo: "hexpm", optional: false]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.3", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.10 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: false]}], "hexpm", "bb1a7e3409606c612b76160e80f452caf08a33b5717e37cdb219539b7f024001"}, "phoenix_live_dashboard": {:hex, :phoenix_live_dashboard, "0.8.4-rc.0", "3af26124c9bea60253db50360912cb59668580ede2e702e7324536fb9d1cb523", [:mix], [{:ecto, "~> 3.6.2 or ~> 3.7", [hex: :ecto, repo: "hexpm", optional: true]}, {:ecto_mysql_extras, "~> 0.5", [hex: :ecto_mysql_extras, repo: "hexpm", optional: true]}, {:ecto_psql_extras, "~> 0.7", [hex: :ecto_psql_extras, repo: "hexpm", optional: true]}, {:ecto_sqlite3_extras, "~> 1.1.7 or ~> 1.2.0", [hex: :ecto_sqlite3_extras, repo: "hexpm", optional: true]}, {:mime, "~> 1.6 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:phoenix_live_view, "~> 0.19 or ~> 1.0-rc", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}, {:telemetry_metrics, "~> 0.6 or ~> 1.0", [hex: :telemetry_metrics, repo: "hexpm", optional: false]}], "hexpm", "66885624771f1a59f5b0ed6c24cbcec70fb2544356cb8085fd85320e6593720a"}, "phoenix_live_reload": {:hex, :phoenix_live_reload, "1.3.3", "3a53772a6118d5679bf50fc1670505a290e32a1d195df9e069d8c53ab040c054", [:mix], [{:file_system, "~> 0.2.1 or ~> 0.3", [hex: :file_system, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.4", [hex: :phoenix, repo: "hexpm", optional: false]}], "hexpm", "766796676e5f558dbae5d1bdb066849673e956005e3730dfd5affd7a6da4abac"}, - "phoenix_live_view": {:hex, :phoenix_live_view, "0.20.17", "f396bbdaf4ba227b82251eb75ac0afa6b3da5e509bc0d030206374237dfc9450", [:mix], [{:floki, "~> 0.36", [hex: :floki, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix, "~> 1.6.15 or ~> 1.7.0", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 3.3 or ~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: true]}, {:plug, "~> 1.15", [hex: :plug, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "a61d741ffb78c85fdbca0de084da6a48f8ceb5261a79165b5a0b59e5f65ce98b"}, + "phoenix_live_view": {:hex, :phoenix_live_view, "1.0.0-rc.6", "47d2669995ea326e5c71f5c1bc9177109cebf211385c638faa7b5862a401e516", [:mix], [{:floki, "~> 0.36", [hex: :floki, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix, "~> 1.6.15 or ~> 1.7.0", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 3.3 or ~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: true]}, {:plug, "~> 1.15", [hex: :plug, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "e56e4f1642a0b20edc2488cab30e5439595e0d8b5b259f76ef98b1c4e2e5b527"}, "phoenix_pubsub": {:hex, :phoenix_pubsub, "2.1.3", "3168d78ba41835aecad272d5e8cd51aa87a7ac9eb836eabc42f6e57538e3731d", [:mix], [], "hexpm", "bba06bc1dcfd8cb086759f0edc94a8ba2bc8896d5331a1e2c2902bf8e36ee502"}, "phoenix_template": {:hex, :phoenix_template, "1.0.4", "e2092c132f3b5e5b2d49c96695342eb36d0ed514c5b252a77048d5969330d639", [:mix], [{:phoenix_html, "~> 2.14.2 or ~> 3.0 or ~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}], "hexpm", "2c0c81f0e5c6753faf5cca2f229c9709919aba34fab866d3bc05060c9c444206"}, "phoenix_view": {:hex, :phoenix_view, "2.0.4", "b45c9d9cf15b3a1af5fb555c674b525391b6a1fe975f040fb4d913397b31abf4", [:mix], [{:phoenix_html, "~> 2.14.2 or ~> 3.0 or ~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}], "hexpm", "4e992022ce14f31fe57335db27a28154afcc94e9983266835bb3040243eb620b"}, diff --git a/test/epicenter_web/controllers/user_auth_test.exs b/test/epicenter_web/controllers/user_auth_test.exs index 4e1023bd..b937b63b 100644 --- a/test/epicenter_web/controllers/user_auth_test.exs +++ b/test/epicenter_web/controllers/user_auth_test.exs @@ -8,6 +8,7 @@ defmodule EpicenterWeb.UserAuthTest do alias EpicenterWeb.UserAuth alias EpicenterWeb.Router.Helpers, as: Routes alias Plug.Conn + alias Phoenix.Flash setup %{conn: conn} do conn = @@ -165,7 +166,7 @@ defmodule EpicenterWeb.UserAuthTest do conn = conn |> fetch_flash() |> UserAuth.require_authenticated_user([]) assert conn.halted assert redirected_to(conn) == Routes.user_session_path(conn, :new) - assert get_flash(conn, :error) == "You must log in to access this page" + assert Flash.get(conn.assigns.flash, :error) == "You must log in to access this page" end test "redirects if user is authenticated but not confirmed", %{conn: conn} do @@ -173,7 +174,7 @@ defmodule EpicenterWeb.UserAuthTest do conn = conn |> fetch_flash() |> assign(:current_user, user) |> UserAuth.require_authenticated_user([]) assert conn.halted assert redirected_to(conn) == Routes.user_session_path(conn, :new) - assert get_flash(conn, :error) == "The account you logged into has not yet been activated" + assert Flash.get(conn.assigns.flash, :error) == "The account you logged into has not yet been activated" end test "redirects if the user is authenticated and confirmed but does not have mfa set up", %{conn: conn} do @@ -188,7 +189,7 @@ defmodule EpicenterWeb.UserAuthTest do conn = conn |> fetch_flash() |> assign(:current_user, user) |> UserAuth.require_authenticated_user([]) assert conn.halted assert redirected_to(conn) == Routes.user_session_path(conn, :new) - assert get_flash(conn, :error) == "Your account has been disabled by an administrator" + assert Flash.get(conn.assigns.flash, :error) == "Your account has been disabled by an administrator" end test "redirects if user is authenticated but the token expired", %{conn: conn, user: user} do @@ -205,7 +206,7 @@ defmodule EpicenterWeb.UserAuthTest do assert conn.halted assert redirected_to(conn) == Routes.user_session_path(conn, :new) - assert get_flash(conn, :error) == "Your session has expired. Please log in again." + assert Flash.get(conn.assigns.flash, :error) == "Your session has expired. Please log in again." end test "stores the path to redirect to on GET", %{conn: conn} do diff --git a/test/epicenter_web/controllers/user_reset_password_controller_test.exs b/test/epicenter_web/controllers/user_reset_password_controller_test.exs index f946234c..4c7c6c66 100644 --- a/test/epicenter_web/controllers/user_reset_password_controller_test.exs +++ b/test/epicenter_web/controllers/user_reset_password_controller_test.exs @@ -3,6 +3,7 @@ defmodule EpicenterWeb.UserResetPasswordControllerTest do alias Epicenter.Accounts alias Epicenter.Repo + alias Phoenix.Flash import Epicenter.AccountsFixtures setup do @@ -29,7 +30,7 @@ defmodule EpicenterWeb.UserResetPasswordControllerTest do conn = post(conn, path, %{"user" => %{"email" => user.email}}) assert redirected_to(conn) == "/" - assert get_flash(conn, :info) =~ "An email with instructions was sent" + assert Flash.get(conn.assigns.flash, :info) =~ "An email with instructions was sent" assert Repo.get_by!(Accounts.UserToken, user_id: user.id).context == "reset_password" end @@ -40,7 +41,7 @@ defmodule EpicenterWeb.UserResetPasswordControllerTest do conn = post(conn, path, %{"user" => %{"email" => "unknown@example.com"}}) assert redirected_to(conn) == "/" - assert get_flash(conn, :info) =~ "An email with instructions was sent" + assert Flash.get(conn.assigns.flash, :info) =~ "An email with instructions was sent" assert Repo.all(Accounts.UserToken) == [] end end @@ -63,7 +64,7 @@ defmodule EpicenterWeb.UserResetPasswordControllerTest do test "does not render reset password with invalid token", %{conn: conn} do conn = get(conn, Routes.user_reset_password_path(conn, :edit, "oops")) assert redirected_to(conn) == "/" - assert get_flash(conn, :error) =~ "Reset password link is invalid or it has expired" + assert Flash.get(conn.assigns.flash, :error) =~ "Reset password link is invalid or it has expired" end end @@ -88,7 +89,7 @@ defmodule EpicenterWeb.UserResetPasswordControllerTest do assert redirected_to(conn) == Routes.user_session_path(conn, :new) refute get_session(conn, :user_token) - assert get_flash(conn, :info) =~ "Password reset successfully" + assert Flash.get(conn.assigns.flash, :info) =~ "Password reset successfully" assert Accounts.get_user(email: user.email, password: "new valid password") end @@ -110,7 +111,7 @@ defmodule EpicenterWeb.UserResetPasswordControllerTest do test "does not reset password with invalid token", %{conn: conn} do conn = put(conn, Routes.user_reset_password_path(conn, :update, "oops")) assert redirected_to(conn) == "/" - assert get_flash(conn, :error) =~ "Reset password link is invalid or it has expired" + assert Flash.get(conn.assigns.flash, :error) =~ "Reset password link is invalid or it has expired" end end end diff --git a/test/epicenter_web/controllers/user_settings_controller_test.exs b/test/epicenter_web/controllers/user_settings_controller_test.exs index b4bdefdf..9c70a93c 100644 --- a/test/epicenter_web/controllers/user_settings_controller_test.exs +++ b/test/epicenter_web/controllers/user_settings_controller_test.exs @@ -1,6 +1,6 @@ defmodule EpicenterWeb.UserSettingsControllerTest do use EpicenterWeb.ConnCase, async: true - + alias Phoenix.Flash alias Epicenter.Accounts import Epicenter.AccountsFixtures @@ -33,7 +33,7 @@ defmodule EpicenterWeb.UserSettingsControllerTest do assert redirected_to(new_password_conn) == Routes.user_settings_path(conn, :edit) assert get_session(new_password_conn, :user_token) != get_session(conn, :user_token) - assert get_flash(new_password_conn, :info) =~ "Password updated successfully" + assert Flash.get(new_password_conn.assigns.flash, :info) =~ "Password updated successfully" assert Accounts.get_user(email: user.email, password: "new valid password") end From e8842f1516a8036f58b3575b79d047918ae264cb Mon Sep 17 00:00:00 2001 From: Lei Zhou Date: Tue, 13 Aug 2024 23:35:50 -0400 Subject: [PATCH 11/27] use <.link> partly; all tests passed --- lib/epicenter_web/live/add_visit_live.ex | 2 +- .../live/add_visit_live.html.heex | 5 +-- ...ase_investigation_clinical_details_live.ex | 2 +- ...estigation_clinical_details_live.html.heex | 5 +-- ...tion_conclude_isolation_monitoring_live.ex | 2 +- ...nclude_isolation_monitoring_live.html.heex | 5 +-- .../live/case_investigation_contact_live.ex | 2 +- .../case_investigation_contact_live.html.heex | 5 +-- .../case_investigation_discontinue_live.ex | 2 +- ...e_investigation_discontinue_live.html.heex | 5 +-- ...investigation_isolation_monitoring_live.ex | 2 +- ...gation_isolation_monitoring_live.html.heex | 5 +-- ...case_investigation_isolation_order_live.ex | 2 +- ...vestigation_isolation_order_live.html.heex | 5 +-- ...case_investigation_start_interview_live.ex | 2 +- ...vestigation_start_interview_live.html.heex | 5 +-- ...act_investigation_clinical_details_live.ex | 2 +- ...estigation_clinical_details_live.html.heex | 5 +-- ...ion_conclude_quarantine_monitoring_live.ex | 2 +- ...clude_quarantine_monitoring_live.html.heex | 5 +-- .../contact_investigation_discontinue_live.ex | 2 +- ...t_investigation_discontinue_live.html.heex | 5 +-- ...nvestigation_quarantine_monitoring_live.ex | 2 +- ...ation_quarantine_monitoring_live.html.heex | 5 +-- ...tact_investigation_start_interview_live.ex | 2 +- ...vestigation_start_interview_live.html.heex | 5 +-- lib/epicenter_web/live/contacts_live.ex | 43 ++----------------- .../live/demographics_edit_live.ex | 2 +- .../live/demographics_edit_live.html.heex | 5 +-- .../investigation_complete_interview_live.ex | 2 +- ...tigation_complete_interview_live.html.heex | 5 +-- lib/epicenter_web/live/people_live.ex | 36 ++-------------- lib/epicenter_web/live/place_live.ex | 2 +- lib/epicenter_web/live/place_live.html.heex | 5 +-- lib/epicenter_web/live/place_search_live.ex | 4 +- .../live/potential_duplicates_live.ex | 2 +- .../live/potential_duplicates_live.html.heex | 14 ++---- lib/epicenter_web/live/profile_edit_live.ex | 2 +- .../live/profile_edit_live.html.heex | 5 +-- .../live/resolve_conflicts_live.ex | 2 +- .../live/resolve_conflicts_live.html.heex | 5 +-- .../investigation_notes_section_live.ex | 2 - .../live/styleguide/styleguide_live.html.heex | 21 +++------ lib/epicenter_web/live/user_live.ex | 2 +- lib/epicenter_web/live/users_live.html.heex | 17 ++------ .../live_component/contact_investigation.ex | 1 - .../contact_investigation.html.heex | 13 ++---- .../user_multifactor_auth/new.html.heex | 12 +++--- .../templates/user_settings/edit.html.heex | 12 +++--- mix.exs | 2 +- .../contact_investigation_test.exs | 1 - .../investigation_note_component_test.exs | 1 - .../investigation_note_form_test.exs | 1 - .../investigation_notes_section_test.exs | 2 - 54 files changed, 95 insertions(+), 217 deletions(-) diff --git a/lib/epicenter_web/live/add_visit_live.ex b/lib/epicenter_web/live/add_visit_live.ex index 39448fbd..4a3232f3 100644 --- a/lib/epicenter_web/live/add_visit_live.ex +++ b/lib/epicenter_web/live/add_visit_live.ex @@ -56,7 +56,7 @@ defmodule EpicenterWeb.AddVisitLive do data = data |> Map.put(:place_id, socket.assigns.place.id), {:save, {:ok, _visit}} <- {:save, Cases.create_visit({data, audit_meta_create_visit(socket)})} do socket - |> push_redirect(to: "#{Routes.profile_path(socket, EpicenterWeb.ProfileLive, socket.assigns.case_investigation.person)}#case-investigations") + |> push_navigate(to: "#{Routes.profile_path(socket, EpicenterWeb.ProfileLive, socket.assigns.case_investigation.person)}#case-investigations") |> noreply() else {:data, {:error, %Ecto.Changeset{} = form_changeset}} -> diff --git a/lib/epicenter_web/live/add_visit_live.html.heex b/lib/epicenter_web/live/add_visit_live.html.heex index 0b389100..861f6a96 100644 --- a/lib/epicenter_web/live/add_visit_live.html.heex +++ b/lib/epicenter_web/live/add_visit_live.html.heex @@ -6,9 +6,8 @@ >
diff --git a/lib/epicenter_web/live/case_investigation_clinical_details_live.ex b/lib/epicenter_web/live/case_investigation_clinical_details_live.ex index 56371704..be1cde30 100644 --- a/lib/epicenter_web/live/case_investigation_clinical_details_live.ex +++ b/lib/epicenter_web/live/case_investigation_clinical_details_live.ex @@ -132,7 +132,7 @@ defmodule EpicenterWeb.CaseInvestigationClinicalDetailsLive do {:form, {:ok, case_investigation_attrs}} <- {:form, ClinicalDetailsForm.case_investigation_attrs(form_changeset)}, {:case_investigation, {:ok, _case_investigation}} <- {:case_investigation, update_case_investigation(socket, case_investigation_attrs)} do socket - |> push_redirect(to: "#{Routes.profile_path(socket, EpicenterWeb.ProfileLive, socket.assigns.case_investigation.person)}#case-investigations") + |> push_navigate(to: "#{Routes.profile_path(socket, EpicenterWeb.ProfileLive, socket.assigns.case_investigation.person)}#case-investigations") |> noreply() else {:form, {:error, form_changeset}} -> diff --git a/lib/epicenter_web/live/case_investigation_clinical_details_live.html.heex b/lib/epicenter_web/live/case_investigation_clinical_details_live.html.heex index 2f6c5e53..5b00eddc 100644 --- a/lib/epicenter_web/live/case_investigation_clinical_details_live.html.heex +++ b/lib/epicenter_web/live/case_investigation_clinical_details_live.html.heex @@ -5,9 +5,8 @@ >
diff --git a/lib/epicenter_web/live/case_investigation_conclude_isolation_monitoring_live.ex b/lib/epicenter_web/live/case_investigation_conclude_isolation_monitoring_live.ex index 7d3bed01..88d20036 100644 --- a/lib/epicenter_web/live/case_investigation_conclude_isolation_monitoring_live.ex +++ b/lib/epicenter_web/live/case_investigation_conclude_isolation_monitoring_live.ex @@ -80,7 +80,7 @@ defmodule EpicenterWeb.CaseInvestigationConcludeIsolationMonitoringLive do }} )} do socket - |> push_redirect(to: "#{Routes.profile_path(socket, EpicenterWeb.ProfileLive, socket.assigns.case_investigation.person)}#case-investigations") + |> push_navigate(to: "#{Routes.profile_path(socket, EpicenterWeb.ProfileLive, socket.assigns.case_investigation.person)}#case-investigations") |> noreply() else {:form, {:error, %Ecto.Changeset{valid?: false} = form_changeset}} -> diff --git a/lib/epicenter_web/live/case_investigation_conclude_isolation_monitoring_live.html.heex b/lib/epicenter_web/live/case_investigation_conclude_isolation_monitoring_live.html.heex index 1acab51b..945b1548 100644 --- a/lib/epicenter_web/live/case_investigation_conclude_isolation_monitoring_live.html.heex +++ b/lib/epicenter_web/live/case_investigation_conclude_isolation_monitoring_live.html.heex @@ -5,9 +5,8 @@ >
diff --git a/lib/epicenter_web/live/case_investigation_contact_live.ex b/lib/epicenter_web/live/case_investigation_contact_live.ex index 738b6385..18ad44d9 100644 --- a/lib/epicenter_web/live/case_investigation_contact_live.ex +++ b/lib/epicenter_web/live/case_investigation_contact_live.ex @@ -201,7 +201,7 @@ defmodule EpicenterWeb.CaseInvestigationContactLive do data = data |> Map.put(:exposing_case_id, socket.assigns.case_investigation.id), {:created, {:ok, _}} <- {:created, create_or_update_contact_investigation(contact_investigation, data, socket.assigns.current_user)} do socket - |> push_redirect(to: "#{Routes.profile_path(socket, EpicenterWeb.ProfileLive, socket.assigns.case_investigation.person)}#case-investigations") + |> push_navigate(to: "#{Routes.profile_path(socket, EpicenterWeb.ProfileLive, socket.assigns.case_investigation.person)}#case-investigations") |> noreply() else {:form, {:error, changeset}} -> diff --git a/lib/epicenter_web/live/case_investigation_contact_live.html.heex b/lib/epicenter_web/live/case_investigation_contact_live.html.heex index 2872a300..42b5a95c 100644 --- a/lib/epicenter_web/live/case_investigation_contact_live.html.heex +++ b/lib/epicenter_web/live/case_investigation_contact_live.html.heex @@ -5,9 +5,8 @@ >
diff --git a/lib/epicenter_web/live/case_investigation_discontinue_live.ex b/lib/epicenter_web/live/case_investigation_discontinue_live.ex index 8339916c..d62c9903 100644 --- a/lib/epicenter_web/live/case_investigation_discontinue_live.ex +++ b/lib/epicenter_web/live/case_investigation_discontinue_live.ex @@ -48,7 +48,7 @@ defmodule EpicenterWeb.CaseInvestigationDiscontinueLive do }} ) do socket - |> push_redirect(to: "#{Routes.profile_path(socket, EpicenterWeb.ProfileLive, socket.assigns.case_investigation.person)}#case-investigations") + |> push_navigate(to: "#{Routes.profile_path(socket, EpicenterWeb.ProfileLive, socket.assigns.case_investigation.person)}#case-investigations") |> noreply() else {:error, changeset} -> diff --git a/lib/epicenter_web/live/case_investigation_discontinue_live.html.heex b/lib/epicenter_web/live/case_investigation_discontinue_live.html.heex index 60ed9197..811e8687 100644 --- a/lib/epicenter_web/live/case_investigation_discontinue_live.html.heex +++ b/lib/epicenter_web/live/case_investigation_discontinue_live.html.heex @@ -6,9 +6,8 @@ >
diff --git a/lib/epicenter_web/live/case_investigation_isolation_monitoring_live.ex b/lib/epicenter_web/live/case_investigation_isolation_monitoring_live.ex index 95da1182..928513f0 100644 --- a/lib/epicenter_web/live/case_investigation_isolation_monitoring_live.ex +++ b/lib/epicenter_web/live/case_investigation_isolation_monitoring_live.ex @@ -87,7 +87,7 @@ defmodule EpicenterWeb.CaseInvestigationIsolationMonitoringLive do {:form, {:ok, model_attrs}} <- {:form, IsolationMonitoringForm.form_changeset_to_model_attrs(form_changeset)}, {:case_investigation, {:ok, _case_investigation}} <- {:case_investigation, update_case_investigation(socket, model_attrs)} do socket - |> push_redirect(to: "#{Routes.profile_path(socket, EpicenterWeb.ProfileLive, socket.assigns.case_investigation.person)}#case-investigations") + |> push_navigate(to: "#{Routes.profile_path(socket, EpicenterWeb.ProfileLive, socket.assigns.case_investigation.person)}#case-investigations") |> noreply() else {:form, {:error, %Ecto.Changeset{valid?: false} = form_changeset}} -> diff --git a/lib/epicenter_web/live/case_investigation_isolation_monitoring_live.html.heex b/lib/epicenter_web/live/case_investigation_isolation_monitoring_live.html.heex index 7e8cc9a9..b216a84a 100644 --- a/lib/epicenter_web/live/case_investigation_isolation_monitoring_live.html.heex +++ b/lib/epicenter_web/live/case_investigation_isolation_monitoring_live.html.heex @@ -5,9 +5,8 @@ >
diff --git a/lib/epicenter_web/live/case_investigation_isolation_order_live.ex b/lib/epicenter_web/live/case_investigation_isolation_order_live.ex index d8274e4e..3136afab 100644 --- a/lib/epicenter_web/live/case_investigation_isolation_order_live.ex +++ b/lib/epicenter_web/live/case_investigation_isolation_order_live.ex @@ -62,7 +62,7 @@ defmodule EpicenterWeb.CaseInvestigationIsolationOrderLive do {:form, {:ok, model_attrs}} <- {:form, IsolationOrderForm.form_changeset_to_model_attrs(form_changeset)}, {:case_investigation, {:ok, _case_investigation}} <- {:case_investigation, update_case_investigation(socket, model_attrs)} do socket - |> push_redirect(to: "#{Routes.profile_path(socket, EpicenterWeb.ProfileLive, socket.assigns.case_investigation.person)}#case-investigations") + |> push_navigate(to: "#{Routes.profile_path(socket, EpicenterWeb.ProfileLive, socket.assigns.case_investigation.person)}#case-investigations") |> noreply() else {:form, {:error, %Ecto.Changeset{valid?: false} = form_changeset}} -> diff --git a/lib/epicenter_web/live/case_investigation_isolation_order_live.html.heex b/lib/epicenter_web/live/case_investigation_isolation_order_live.html.heex index 77eb20e2..ae8a422b 100644 --- a/lib/epicenter_web/live/case_investigation_isolation_order_live.html.heex +++ b/lib/epicenter_web/live/case_investigation_isolation_order_live.html.heex @@ -5,9 +5,8 @@ >
diff --git a/lib/epicenter_web/live/case_investigation_start_interview_live.ex b/lib/epicenter_web/live/case_investigation_start_interview_live.ex index 545a7eaa..71064c26 100644 --- a/lib/epicenter_web/live/case_investigation_start_interview_live.ex +++ b/lib/epicenter_web/live/case_investigation_start_interview_live.ex @@ -43,7 +43,7 @@ defmodule EpicenterWeb.CaseInvestigationStartInterviewLive do {:form, {:ok, cast_investigation_attrs}} <- {:form, StartInterviewForm.investigation_attrs(form_changeset)}, {:case_investigation, {:ok, _case_investigation}} <- {:case_investigation, update_case_investigation(socket, cast_investigation_attrs)} do socket - |> push_redirect(to: "#{Routes.profile_path(socket, EpicenterWeb.ProfileLive, socket.assigns.case_investigation.person)}#case-investigations") + |> push_navigate(to: "#{Routes.profile_path(socket, EpicenterWeb.ProfileLive, socket.assigns.case_investigation.person)}#case-investigations") |> noreply() else {:form, {:error, %Ecto.Changeset{valid?: false} = form_changeset}} -> diff --git a/lib/epicenter_web/live/case_investigation_start_interview_live.html.heex b/lib/epicenter_web/live/case_investigation_start_interview_live.html.heex index e515b523..69b4a69f 100644 --- a/lib/epicenter_web/live/case_investigation_start_interview_live.html.heex +++ b/lib/epicenter_web/live/case_investigation_start_interview_live.html.heex @@ -6,9 +6,8 @@ >
diff --git a/lib/epicenter_web/live/contact_investigation_clinical_details_live.ex b/lib/epicenter_web/live/contact_investigation_clinical_details_live.ex index c080fa70..d6ae0b65 100644 --- a/lib/epicenter_web/live/contact_investigation_clinical_details_live.ex +++ b/lib/epicenter_web/live/contact_investigation_clinical_details_live.ex @@ -120,7 +120,7 @@ defmodule EpicenterWeb.ContactInvestigationClinicalDetailsLive do person = socket.assigns.contact_investigation.exposed_person socket - |> push_redirect(to: "#{Routes.profile_path(socket, EpicenterWeb.ProfileLive, person)}#contact-investigations") + |> push_navigate(to: "#{Routes.profile_path(socket, EpicenterWeb.ProfileLive, person)}#contact-investigations") |> noreply() else {:form, {:error, form_changeset}} -> diff --git a/lib/epicenter_web/live/contact_investigation_clinical_details_live.html.heex b/lib/epicenter_web/live/contact_investigation_clinical_details_live.html.heex index 9826ab7b..4d18c4fb 100644 --- a/lib/epicenter_web/live/contact_investigation_clinical_details_live.html.heex +++ b/lib/epicenter_web/live/contact_investigation_clinical_details_live.html.heex @@ -4,9 +4,8 @@ >
diff --git a/lib/epicenter_web/live/contact_investigation_conclude_quarantine_monitoring_live.ex b/lib/epicenter_web/live/contact_investigation_conclude_quarantine_monitoring_live.ex index 371e11a7..4726b213 100644 --- a/lib/epicenter_web/live/contact_investigation_conclude_quarantine_monitoring_live.ex +++ b/lib/epicenter_web/live/contact_investigation_conclude_quarantine_monitoring_live.ex @@ -79,7 +79,7 @@ defmodule EpicenterWeb.ContactInvestigationConcludeQuarantineMonitoringLive do }} )} do socket - |> push_redirect( + |> push_navigate( to: "#{Routes.profile_path(socket, EpicenterWeb.ProfileLive, socket.assigns.contact_investigation.exposed_person)}#contact-investigations" ) |> noreply() diff --git a/lib/epicenter_web/live/contact_investigation_conclude_quarantine_monitoring_live.html.heex b/lib/epicenter_web/live/contact_investigation_conclude_quarantine_monitoring_live.html.heex index ee15d823..47b87c63 100644 --- a/lib/epicenter_web/live/contact_investigation_conclude_quarantine_monitoring_live.html.heex +++ b/lib/epicenter_web/live/contact_investigation_conclude_quarantine_monitoring_live.html.heex @@ -5,9 +5,8 @@ >
diff --git a/lib/epicenter_web/live/contact_investigation_discontinue_live.ex b/lib/epicenter_web/live/contact_investigation_discontinue_live.ex index b29251ea..ff0bd2b5 100644 --- a/lib/epicenter_web/live/contact_investigation_discontinue_live.ex +++ b/lib/epicenter_web/live/contact_investigation_discontinue_live.ex @@ -52,7 +52,7 @@ defmodule EpicenterWeb.ContactInvestigationDiscontinueLive do ) socket - |> push_redirect( + |> push_navigate( to: "#{Routes.profile_path(socket, EpicenterWeb.ProfileLive, socket.assigns.contact_investigation.exposed_person)}#contact-investigations" ) |> noreply() diff --git a/lib/epicenter_web/live/contact_investigation_discontinue_live.html.heex b/lib/epicenter_web/live/contact_investigation_discontinue_live.html.heex index 54e029b4..fb78e698 100644 --- a/lib/epicenter_web/live/contact_investigation_discontinue_live.html.heex +++ b/lib/epicenter_web/live/contact_investigation_discontinue_live.html.heex @@ -6,9 +6,8 @@ >
diff --git a/lib/epicenter_web/live/contact_investigation_quarantine_monitoring_live.ex b/lib/epicenter_web/live/contact_investigation_quarantine_monitoring_live.ex index 6ea00442..4696e94f 100644 --- a/lib/epicenter_web/live/contact_investigation_quarantine_monitoring_live.ex +++ b/lib/epicenter_web/live/contact_investigation_quarantine_monitoring_live.ex @@ -96,7 +96,7 @@ defmodule EpicenterWeb.ContactInvestigationQuarantineMonitoringLive do {:form, {:ok, model_attrs}} <- {:form, QuarantineMonitoringForm.form_changeset_to_model_attrs(form_changeset)}, {:contact_investigation, {:ok, _contact_investigation}} <- {:contact_investigation, update_contact_investigation(socket, model_attrs)} do socket - |> push_redirect( + |> push_navigate( to: "#{Routes.profile_path(socket, EpicenterWeb.ProfileLive, socket.assigns.contact_investigation.exposed_person)}#case-investigations" ) |> noreply() diff --git a/lib/epicenter_web/live/contact_investigation_quarantine_monitoring_live.html.heex b/lib/epicenter_web/live/contact_investigation_quarantine_monitoring_live.html.heex index cbadb0bf..b1346502 100644 --- a/lib/epicenter_web/live/contact_investigation_quarantine_monitoring_live.html.heex +++ b/lib/epicenter_web/live/contact_investigation_quarantine_monitoring_live.html.heex @@ -5,9 +5,8 @@ >
diff --git a/lib/epicenter_web/live/contact_investigation_start_interview_live.ex b/lib/epicenter_web/live/contact_investigation_start_interview_live.ex index d8553258..ef31ccb9 100644 --- a/lib/epicenter_web/live/contact_investigation_start_interview_live.ex +++ b/lib/epicenter_web/live/contact_investigation_start_interview_live.ex @@ -44,7 +44,7 @@ defmodule EpicenterWeb.ContactInvestigationStartInterviewLive do {:contact_investigation, {:ok, _contact_investigation}} <- {:contact_investigation, update_contact_investigation(socket, cast_investigation_attrs)} do socket - |> push_redirect( + |> push_navigate( to: "#{Routes.profile_path(socket, EpicenterWeb.ProfileLive, socket.assigns.contact_investigation.exposed_person)}#contact-investigations" ) |> noreply() diff --git a/lib/epicenter_web/live/contact_investigation_start_interview_live.html.heex b/lib/epicenter_web/live/contact_investigation_start_interview_live.html.heex index 433f7bc6..45c1452c 100644 --- a/lib/epicenter_web/live/contact_investigation_start_interview_live.html.heex +++ b/lib/epicenter_web/live/contact_investigation_start_interview_live.html.heex @@ -6,9 +6,8 @@ >
diff --git a/lib/epicenter_web/live/contacts_live.ex b/lib/epicenter_web/live/contacts_live.ex index 4511d46e..8937d7fc 100644 --- a/lib/epicenter_web/live/contacts_live.ex +++ b/lib/epicenter_web/live/contacts_live.ex @@ -8,45 +8,10 @@ defmodule EpicenterWeb.ContactsFilter do def render(assigns) do ~H"""
- <%= live_patch("All", - to: - Routes.contacts_path(@socket, EpicenterWeb.ContactsLive, - filter: :with_contact_investigation - ), - class: "button", - data: [ - active: to_string(assigns.filter in [:with_contact_investigation, nil]), - role: "contacts-filter", - tid: "all" - ] - ) %><%= live_patch("Pending interview", - to: Routes.contacts_path(@socket, EpicenterWeb.ContactsLive, filter: :with_pending_interview), - class: "button", - data: [ - active: to_string(assigns.filter == :with_pending_interview), - role: "contacts-filter", - tid: "with_pending_interview" - ] - ) %><%= live_patch("Ongoing interview", - to: Routes.contacts_path(@socket, EpicenterWeb.ContactsLive, filter: :with_ongoing_interview), - class: "button", - data: [ - active: to_string(assigns.filter == :with_ongoing_interview), - role: "contacts-filter", - tid: "with_ongoing_interview" - ] - ) %><%= live_patch("Quarantine monitoring", - to: - Routes.contacts_path(@socket, EpicenterWeb.ContactsLive, - filter: :with_quarantine_monitoring - ), - class: "button", - data: [ - active: to_string(assigns.filter == :with_quarantine_monitoring), - role: "contacts-filter", - tid: "with_quarantine_monitoring" - ] - ) %> + <.link patch={Routes.contacts_path(@socket, EpicenterWeb.ContactsLive, filter: :with_contact_investigation)} class="button" data-active={to_string(assigns.filter in [:with_contact_investigation, nil])} data-role="contacts-filter" data-tid="all">All + <.link patch={Routes.contacts_path(@socket, EpicenterWeb.ContactsLive, filter: :with_pending_interview)} class="button" data-active={to_string(assigns.filter == :with_pending_interview)} data-role="contacts-filter" data-tid="with_pending_interview">Pending interview + <.link patch={Routes.contacts_path(@socket, EpicenterWeb.ContactsLive, filter: :with_ongoing_interview)} class="button" data-active={to_string(assigns.filter == :with_ongoing_interview)} data-role="contacts-filter" data-tid="with_ongoing_interview">Ongoing interview + <.link patch={Routes.contacts_path(@socket, EpicenterWeb.ContactsLive, filter: :with_quarantine_monitoring)} class="button" data-active={to_string(assigns.filter == :with_quarantine_monitoring)} data-role="contacts-filter" data-tid="with_quarantine_monitoring">Quarantine monitoring
""" |> Map.put(:root, true) diff --git a/lib/epicenter_web/live/demographics_edit_live.ex b/lib/epicenter_web/live/demographics_edit_live.ex index bd2ef08d..68b4c0a1 100644 --- a/lib/epicenter_web/live/demographics_edit_live.ex +++ b/lib/epicenter_web/live/demographics_edit_live.ex @@ -130,7 +130,7 @@ defmodule EpicenterWeb.DemographicsEditLive do with %Ecto.Changeset{} = form_changeset <- DemographicForm.attrs_to_form_changeset(demographic_params), {:form, {:ok, model_attrs}} <- {:form, DemographicForm.form_changeset_to_model_attrs(form_changeset)}, {:model, {:ok, _model}} <- {:model, create_or_update_model(model_attrs, person, current_user)} do - socket |> push_redirect(to: "#{Routes.profile_path(socket, EpicenterWeb.ProfileLive, socket.assigns.person)}#demographics-data") |> noreply() + socket |> push_navigate(to: "#{Routes.profile_path(socket, EpicenterWeb.ProfileLive, socket.assigns.person)}#demographics-data") |> noreply() else {:form, {:error, %Ecto.Changeset{valid?: false} = form_changeset}} -> socket |> assign_form_changeset(form_changeset, "Check the errors above") |> noreply() diff --git a/lib/epicenter_web/live/demographics_edit_live.html.heex b/lib/epicenter_web/live/demographics_edit_live.html.heex index ae0f6418..96245f0a 100644 --- a/lib/epicenter_web/live/demographics_edit_live.html.heex +++ b/lib/epicenter_web/live/demographics_edit_live.html.heex @@ -6,9 +6,8 @@ >
diff --git a/lib/epicenter_web/live/investigation_complete_interview_live.ex b/lib/epicenter_web/live/investigation_complete_interview_live.ex index cc5c9d75..cdcff42d 100644 --- a/lib/epicenter_web/live/investigation_complete_interview_live.ex +++ b/lib/epicenter_web/live/investigation_complete_interview_live.ex @@ -52,7 +52,7 @@ defmodule EpicenterWeb.InvestigationCompleteInterviewLive do {:form, {:ok, case_investigation_attrs}} <- {:form, CompleteInterviewForm.investigation_attrs(form_changeset)}, {:investigation, {:ok, _investigation}} <- {:investigation, update_case_investigation(socket, case_investigation_attrs)} do socket - |> push_redirect(to: "#{Routes.profile_path(socket, EpicenterWeb.ProfileLive, get_person(socket.assigns.investigation))}#case-investigations") + |> push_navigate(to: "#{Routes.profile_path(socket, EpicenterWeb.ProfileLive, get_person(socket.assigns.investigation))}#case-investigations") |> noreply() else {:form, {:error, %Ecto.Changeset{valid?: false} = form_changeset}} -> diff --git a/lib/epicenter_web/live/investigation_complete_interview_live.html.heex b/lib/epicenter_web/live/investigation_complete_interview_live.html.heex index ddf3ee4c..4268afab 100644 --- a/lib/epicenter_web/live/investigation_complete_interview_live.html.heex +++ b/lib/epicenter_web/live/investigation_complete_interview_live.html.heex @@ -5,9 +5,8 @@ >
diff --git a/lib/epicenter_web/live/people_live.ex b/lib/epicenter_web/live/people_live.ex index 7a45f172..d98db57f 100644 --- a/lib/epicenter_web/live/people_live.ex +++ b/lib/epicenter_web/live/people_live.ex @@ -8,38 +8,10 @@ defmodule EpicenterWeb.PeopleFilter do def render(assigns) do ~H"""
- <%= live_patch("All", - to: Routes.people_path(@socket, EpicenterWeb.PeopleLive, filter: :all), - class: "button", - data: [active: to_string(assigns.filter in [:all, nil]), role: "people-filter", tid: "all"] - ) %> - <%= live_patch("Pending interview", - to: Routes.people_path(@socket, EpicenterWeb.PeopleLive, filter: :pending_interview), - class: "button", - data: [ - active: to_string(assigns.filter == :pending_interview), - role: "people-filter", - tid: "pending_interview" - ] - ) %> - <%= live_patch("Ongoing interview", - to: Routes.people_path(@socket, EpicenterWeb.PeopleLive, filter: :ongoing_interview), - class: "button", - data: [ - active: to_string(assigns.filter == :ongoing_interview), - role: "people-filter", - tid: "ongoing_interview" - ] - ) %> - <%= live_patch("Isolation monitoring", - to: Routes.people_path(@socket, EpicenterWeb.PeopleLive, filter: :isolation_monitoring), - class: "button", - data: [ - active: to_string(assigns.filter == :isolation_monitoring), - role: "people-filter", - tid: "isolation_monitoring" - ] - ) %> + <.link patch={Routes.people_path(@socket, EpicenterWeb.PeopleLive, filter: :all)} class="button" data-active={to_string(assigns.filter in [:all, nil])} data-role="people-filter" data-tid="all">All + <.link patch={Routes.people_path(@socket, EpicenterWeb.PeopleLive, filter: :pending_interview)} class="button" data-active={to_string(assigns.filter == :pending_interview)} data-role="people-filter" data-tid="pending_interview">Pending interview + <.link patch={Routes.people_path(@socket, EpicenterWeb.PeopleLive, filter: :ongoing_interview)} class="button" data-active={to_string(assigns.filter == :ongoing_interview)} data-role="people-filter" data-tid="ongoing_interview">Ongoing interview + <.link patch={Routes.people_path(@socket, EpicenterWeb.PeopleLive, filter: :isolation_monitoring)} class="button" data-active={to_string(assigns.filter == :isolation_monitoring)} data-role="people-filter" data-tid="isolation_monitoring">Isolation monitoring
<% end %> diff --git a/lib/epicenter_web/live/profile_edit_live.ex b/lib/epicenter_web/live/profile_edit_live.ex index e22f9af6..7ca13afb 100644 --- a/lib/epicenter_web/live/profile_edit_live.ex +++ b/lib/epicenter_web/live/profile_edit_live.ex @@ -157,7 +157,7 @@ defmodule EpicenterWeb.ProfileEditLive do reason_event: AuditLog.Revision.edit_profile_saved_event() }} ) do - {:noreply, socket |> push_redirect(to: Routes.profile_path(socket, EpicenterWeb.ProfileLive, person))} + {:noreply, socket |> push_navigate(to: Routes.profile_path(socket, EpicenterWeb.ProfileLive, person))} else {:validation_step, _} -> {:noreply, assign(socket, :changeset, changeset)} diff --git a/lib/epicenter_web/live/profile_edit_live.html.heex b/lib/epicenter_web/live/profile_edit_live.html.heex index b261acc8..403e1a6c 100644 --- a/lib/epicenter_web/live/profile_edit_live.html.heex +++ b/lib/epicenter_web/live/profile_edit_live.html.heex @@ -6,9 +6,8 @@ >
diff --git a/lib/epicenter_web/live/resolve_conflicts_live.ex b/lib/epicenter_web/live/resolve_conflicts_live.ex index 8b2d3a95..e450a950 100644 --- a/lib/epicenter_web/live/resolve_conflicts_live.ex +++ b/lib/epicenter_web/live/resolve_conflicts_live.ex @@ -57,7 +57,7 @@ defmodule EpicenterWeb.ResolveConflictsLive do ) socket - |> push_redirect(to: "#{Routes.profile_path(socket, EpicenterWeb.ProfileLive, socket.assigns.person_id)}") + |> push_navigate(to: "#{Routes.profile_path(socket, EpicenterWeb.ProfileLive, socket.assigns.person_id)}") |> noreply() end diff --git a/lib/epicenter_web/live/resolve_conflicts_live.html.heex b/lib/epicenter_web/live/resolve_conflicts_live.html.heex index 659c1177..2ae97489 100644 --- a/lib/epicenter_web/live/resolve_conflicts_live.html.heex +++ b/lib/epicenter_web/live/resolve_conflicts_live.html.heex @@ -1,9 +1,8 @@
diff --git a/lib/epicenter_web/live/styleguide/investigation_notes_section_live.ex b/lib/epicenter_web/live/styleguide/investigation_notes_section_live.ex index af02c549..92c94074 100644 --- a/lib/epicenter_web/live/styleguide/investigation_notes_section_live.ex +++ b/lib/epicenter_web/live/styleguide/investigation_notes_section_live.ex @@ -4,8 +4,6 @@ defmodule EpicenterWeb.Styleguide.InvestigationNotesSectionLive do import EpicenterWeb.LiveHelpers, only: [assign_defaults: 1, assign_page_title: 2, ok: 1, noreply: 1] - import EpicenterWeb.LiveComponent.Helpers - alias Epicenter.Accounts.User alias Epicenter.ContactInvestigations.ContactInvestigation alias Epicenter.Cases.InvestigationNote diff --git a/lib/epicenter_web/live/styleguide/styleguide_live.html.heex b/lib/epicenter_web/live/styleguide/styleguide_live.html.heex index d7fc811c..7f9dd32a 100644 --- a/lib/epicenter_web/live/styleguide/styleguide_live.html.heex +++ b/lib/epicenter_web/live/styleguide/styleguide_live.html.heex @@ -350,22 +350,16 @@
Form
Full form examples
- <%= live_redirect("Form builder example", - to: - Routes.styleguide_form_builder_path( + <.link navigate={Routes.styleguide_form_builder_path( EpicenterWeb.Endpoint, EpicenterWeb.Styleguide.FormBuilderLive - ) - ) %> + )}>Form builder example
- <%= live_redirect("Form multiselect example", - to: - Routes.styleguide_form_multiselect_path( + <.link navigate={Routes.styleguide_form_multiselect_path( EpicenterWeb.Endpoint, EpicenterWeb.Styleguide.FormMultiselectLive - ) - ) %> + )}>Form multiselect example
@@ -386,13 +380,10 @@
Components
Component examples
- <%= live_redirect("InvestigationNotesSection example", - to: - Routes.styleguide_investigation_notes_section_path( + <.link navigate={Routes.styleguide_investigation_notes_section_path( EpicenterWeb.Endpoint, EpicenterWeb.Styleguide.InvestigationNotesSectionLive - ) - ) %> + )}>InvestigationNotesSection example
diff --git a/lib/epicenter_web/live/user_live.ex b/lib/epicenter_web/live/user_live.ex index 1d88dd4f..8ef0e0dd 100644 --- a/lib/epicenter_web/live/user_live.ex +++ b/lib/epicenter_web/live/user_live.ex @@ -101,7 +101,7 @@ defmodule EpicenterWeb.UserLive do with {:form, {:ok, user_attrs}} <- {:form, UserForm.user_attrs(form_changeset)}, {:user, {:ok, _user}} <- {:user, if(user, do: update_user(socket, user, user_attrs), else: register_user(socket, user_attrs))} do socket - |> push_redirect(to: Routes.users_path(socket, EpicenterWeb.UsersLive)) + |> push_navigate(to: Routes.users_path(socket, EpicenterWeb.UsersLive)) |> noreply() else {:form, {:error, %Ecto.Changeset{valid?: false} = invalid_form_changeset}} -> diff --git a/lib/epicenter_web/live/users_live.html.heex b/lib/epicenter_web/live/users_live.html.heex index 99719f0f..9e1d295a 100644 --- a/lib/epicenter_web/live/users_live.html.heex +++ b/lib/epicenter_web/live/users_live.html.heex @@ -2,11 +2,7 @@

Users

- <%= live_redirect("Add user", - to: Routes.new_user_path(EpicenterWeb.Endpoint, EpicenterWeb.UserLive), - data: [role: :"add-user"], - id: "add-user" - ) %> + <.link navigate={Routes.new_user_path(EpicenterWeb.Endpoint, EpicenterWeb.UserLive)} data-role="add-user" id="add-user">Add user
- <%= live_redirect(full_name(case_investigation.person), - to: - Routes.profile_path( - EpicenterWeb.Endpoint, - EpicenterWeb.ProfileLive, - case_investigation.person - ) - ) %> + <.link navigate={Routes.profile_path(EpicenterWeb.Endpoint, EpicenterWeb.ProfileLive, case_investigation.person)}><%= full_name(case_investigation.person) %> <%= external_id(case_investigation.person) %> <%= Format.date(case_investigation.initiating_lab_result.sampled_on) %> - <%= live_redirect("View", - to: - Routes.profile_path( - EpicenterWeb.Endpoint, - EpicenterWeb.ProfileLive, - person.id - ) - ) %> + <.link navigate={Routes.profile_path(EpicenterWeb.Endpoint, EpicenterWeb.ProfileLive, person.id)}>View
@@ -22,19 +18,14 @@ <%= for user <- @users do %> diff --git a/lib/epicenter_web/live/profile_live.ex b/lib/epicenter_web/live/profile_live.ex index 62707976..3d3cfd8f 100644 --- a/lib/epicenter_web/live/profile_live.ex +++ b/lib/epicenter_web/live/profile_live.ex @@ -11,10 +11,10 @@ defmodule EpicenterWeb.ProfileLive do contact_details_as_list: 1, displayable_interview_status: 1, displayable_isolation_monitoring_status: 2, - history_items: 2, - interview_buttons: 2, - isolation_monitoring_button: 2, - isolation_monitoring_history_items: 2 + history_items: 1, + interview_buttons: 1, + isolation_monitoring_button: 1, + isolation_monitoring_history_items: 1 ] import EpicenterWeb.Presenters.InvestigationPresenter, only: [displayable_clinical_status: 1, displayable_symptoms: 1] diff --git a/lib/epicenter_web/live/profile_live.html.heex b/lib/epicenter_web/live/profile_live.html.heex index b173ca4c..6b4a78e7 100644 --- a/lib/epicenter_web/live/profile_live.html.heex +++ b/lib/epicenter_web/live/profile_live.html.heex @@ -129,20 +129,12 @@

<%= displayable_interview_status(case_investigation) %>

-
- <%= for link <- interview_buttons(@person, case_investigation) do %> - <%= link %> - <% end %> -
- -
- <%= for history_item <- history_items(@person, case_investigation) do %> -
- <%= history_item.text %> - <%= history_item.link %> -
- <% end %> + <.interview_buttons + :if={is_editable?(@person)} + person={@person} + case_investigation={case_investigation} />
+ <.history_items person={@person} case_investigation={case_investigation} /> <%= if case_investigation.interview_started_at != nil do %>
@@ -289,15 +281,14 @@

<%= displayable_isolation_monitoring_status(case_investigation, @current_date) %>

-
<%= isolation_monitoring_button(@person, case_investigation) %>
-
-
- <%= for item <- isolation_monitoring_history_items(@person, case_investigation) do %> -
- <%= item.text %><%= item.link %> -
- <% end %> +
+ <.isolation_monitoring_button + :if={is_editable?(@person)} + case_investigation={case_investigation} />
+ <.isolation_monitoring_history_items + person={@person} + case_investigation={case_investigation} /> <% end %> <%= if case_investigation.isolation_monitoring_status == "ongoing" do %> diff --git a/lib/epicenter_web/live_component/contact_investigation.ex b/lib/epicenter_web/live_component/contact_investigation.ex index c5265bbc..8bb9cf64 100644 --- a/lib/epicenter_web/live_component/contact_investigation.ex +++ b/lib/epicenter_web/live_component/contact_investigation.ex @@ -1,5 +1,6 @@ defmodule EpicenterWeb.ContactInvestigation do use EpicenterWeb, :live_component + use Phoenix.Component import EpicenterWeb.Presenters.ContactInvestigationPresenter, only: [exposing_case_link: 1, history_items: 1, quarantine_history_items: 1] import EpicenterWeb.Presenters.InvestigationPresenter, only: [displayable_clinical_status: 1, displayable_symptoms: 1] @@ -57,7 +58,69 @@ defmodule EpicenterWeb.ContactInvestigation do end end - defp interview_buttons(contact_investigation) do + attr :contact_investigation, :any, required: true + + def interview_buttons(assigns) do + ~H""" + <%= for label <- to_interview_link_list(@contact_investigation) do %> + + <.router_link + label={label} + contact_investigation={@contact_investigation} /> + + <% end %> + """ + end + + attr :label, :any, required: true + attr :contact_investigation, :any, required: true + + def router_link(assigns) do + ~H""" + <.link + :if={@label==:start_interview} + navigate={Routes.contact_investigation_start_interview_path(EpicenterWeb.Endpoint,EpicenterWeb.ContactInvestigationStartInterviewLive,@contact_investigation)} + class="primary" + data-role="contact-investigation-start-interview" + >Start interview + + <.link + :if={@label==:complete_interview} + navigate={Routes.contact_investigation_complete_interview_path(EpicenterWeb.Endpoint,:complete_contact_investigation,@contact_investigation)} + class="primary" + data-role="contact-investigation-complete-interview-link" + >Complete interview + + <.link + :if={@label==:discontinue_interview} + navigate={Routes.contact_investigation_discontinue_path(EpicenterWeb.Endpoint, EpicenterWeb.ContactInvestigationDiscontinueLive, @contact_investigation)} + class="discontinue-link" + data-role="contact-investigation-discontinue-interview" + >Discontinue + """ + end + + attr :contact_investigation, :any, required: true + + def quarantine_monitoring_button(assigns) do + ~H""" + <.link + :if={@contact_investigation.quarantine_monitoring_status=="pending"} + navigate={Routes.contact_investigation_quarantine_monitoring_path(EpicenterWeb.Endpoint,EpicenterWeb.ContactInvestigationQuarantineMonitoringLive,@contact_investigation)} + class="primary" + data-role="contact-investigation-quarantine-monitoring-start-link" + >Add quarantine dates + + <.link + :if={@contact_investigation.quarantine_monitoring_status=="ongoing"} + navigate={Routes.contact_investigation_conclude_quarantine_monitoring_path(EpicenterWeb.Endpoint,EpicenterWeb.ContactInvestigationConcludeQuarantineMonitoringLive,@contact_investigation)} + class="primary" + data-role="conclude-contact-investigation-quarantine-monitoring-link" + >Conclude monitoring + """ + end + + defp to_interview_link_list(contact_investigation) do case is_editable?(contact_investigation.exposed_person) do false -> [] @@ -65,16 +128,10 @@ defmodule EpicenterWeb.ContactInvestigation do true -> case contact_investigation.interview_status do "pending" -> - [ - redirect_to(contact_investigation, :start_interview), - redirect_to(contact_investigation, :discontinue_interview) - ] + [:start_interview, :discontinue_interview] "started" -> - [ - redirect_to(contact_investigation, :complete_interview), - redirect_to(contact_investigation, :discontinue_interview) - ] + [:complete_interview, :discontinue_interview] "completed" -> [] @@ -84,76 +141,4 @@ defmodule EpicenterWeb.ContactInvestigation do end end end - - defp redirect_to(contact_investigation, :complete_interview) do - live_redirect("Complete interview", - to: - Routes.contact_investigation_complete_interview_path( - EpicenterWeb.Endpoint, - :complete_contact_investigation, - contact_investigation - ), - class: "primary", - data: [role: "contact-investigation-complete-interview-link"] - ) - end - - defp redirect_to(contact_investigation, :discontinue_interview) do - live_redirect("Discontinue", - to: - Routes.contact_investigation_discontinue_path(EpicenterWeb.Endpoint, EpicenterWeb.ContactInvestigationDiscontinueLive, contact_investigation), - class: "discontinue-link", - data: [role: "contact-investigation-discontinue-interview"] - ) - end - - defp redirect_to(contact_investigation, :start_interview) do - live_redirect("Start interview", - to: - Routes.contact_investigation_start_interview_path( - EpicenterWeb.Endpoint, - EpicenterWeb.ContactInvestigationStartInterviewLive, - contact_investigation - ), - class: "primary", - data: [role: "contact-investigation-start-interview"] - ) - end - - def quarantine_monitoring_button(contact_investigation) do - case is_editable?(contact_investigation.exposed_person) do - false -> - nil - - true -> - case contact_investigation.quarantine_monitoring_status do - "pending" -> - live_redirect("Add quarantine dates", - to: - Routes.contact_investigation_quarantine_monitoring_path( - EpicenterWeb.Endpoint, - EpicenterWeb.ContactInvestigationQuarantineMonitoringLive, - contact_investigation - ), - class: "primary", - data: [role: "contact-investigation-quarantine-monitoring-start-link"] - ) - - "ongoing" -> - live_redirect("Conclude monitoring", - to: - Routes.contact_investigation_conclude_quarantine_monitoring_path( - EpicenterWeb.Endpoint, - EpicenterWeb.ContactInvestigationConcludeQuarantineMonitoringLive, - contact_investigation - ), - class: "primary", - data: [role: "conclude-contact-investigation-quarantine-monitoring-link"] - ) - - "concluded" -> - nil - end - end - end end diff --git a/lib/epicenter_web/live_component/contact_investigation.html.heex b/lib/epicenter_web/live_component/contact_investigation.html.heex index e7f6d593..424bb433 100644 --- a/lib/epicenter_web/live_component/contact_investigation.html.heex +++ b/lib/epicenter_web/live_component/contact_investigation.html.heex @@ -10,7 +10,8 @@
- Initiated by index case<%= exposing_case_link(@contact_investigation) %> + Initiated by index case + <.exposing_case_link contact_investigation={@contact_investigation} />
<%= if @contact_investigation.under_18 do %>
    @@ -38,19 +39,10 @@ interview
    - <%= for button <- interview_buttons(@contact_investigation) do %> - <%= button %> - <% end %> + <.interview_buttons contact_investigation={@contact_investigation} />
-
- <%= for history_item <- history_items(@contact_investigation) do %> -
- <%= history_item.text %> - <%= history_item.link %> -
- <% end %> -
+ <.history_items contact_investigation={@contact_investigation} /> <%= if @contact_investigation.interview_status in ["started", "completed"] do %>
@@ -92,17 +84,12 @@ class="contact-investigation-interview-buttons" data-role="contact-investigation-quarantine-buttons" > - <%= quarantine_monitoring_button(@contact_investigation) %> + <.quarantine_monitoring_button + :if={is_editable?(@contact_investigation.exposed_person)} + contact_investigation={@contact_investigation} />
-
- <%= for history_item <- quarantine_history_items(@contact_investigation) do %> -
- <%= history_item.text %> - <%= history_item.link %> -
- <% end %> -
+ <.quarantine_history_items contact_investigation={@contact_investigation} /> <% end %>
diff --git a/lib/epicenter_web/presenters/case_investigation_presenter.ex b/lib/epicenter_web/presenters/case_investigation_presenter.ex index e0d59dc4..31a4bf48 100644 --- a/lib/epicenter_web/presenters/case_investigation_presenter.ex +++ b/lib/epicenter_web/presenters/case_investigation_presenter.ex @@ -1,7 +1,6 @@ defmodule EpicenterWeb.Presenters.CaseInvestigationPresenter do - import Phoenix.LiveView.Helpers import PhoenixHTMLHelpers.Tag - + use Phoenix.Component alias Epicenter.Cases alias Epicenter.Cases.CaseInvestigation alias Epicenter.ContactInvestigations.ContactInvestigation @@ -39,7 +38,64 @@ defmodule EpicenterWeb.Presenters.CaseInvestigationPresenter do end end - def history_items(person, case_investigation) do + attr :person, :any, required: true + attr :case_investigation, :any, required: true + + def history_items(assigns) do + ~H""" +
+ <%= for item <- to_history_items_list(@person, @case_investigation) do %> +
+ <%= item.text %> + + <.case_investigation_router_link + label={item.link} + case_investigation={@case_investigation}/> + +
+ <% end %> +
+ """ + end + + attr :label, :any, required: true + attr :case_investigation, :any, required: true + + def case_investigation_router_link(assigns) do + ~H""" + <.link + :if={@label == :started_interview} + navigate={Routes.case_investigation_start_interview_path( + EpicenterWeb.Endpoint, + EpicenterWeb.CaseInvestigationStartInterviewLive, + @case_investigation + )} + class="case-investigation-link" + >Edit + <.link + :if={@label == :discontinued_interview} + navigate={Routes.case_investigation_discontinue_path( + EpicenterWeb.Endpoint, + EpicenterWeb.CaseInvestigationDiscontinueLive, + @case_investigation + )} + id="edit-discontinue-case-investigation-link-001" + class="discontinue-case-investigation-link" + >Edit + <.link + :if={@label == :completed_interview} + navigate={Routes.case_investigation_complete_interview_path( + EpicenterWeb.Endpoint, + :complete_case_investigation, + @case_investigation + )} + id="edit-complete-interview-link-001" + class="edit-complete-interview-link" + >Edit + """ + end + + defp to_history_items_list(person, case_investigation) do items = [] items = @@ -47,20 +103,7 @@ defmodule EpicenterWeb.Presenters.CaseInvestigationPresenter do [ %{ text: "Started interview with #{with_interviewee_name(case_investigation)} on #{interview_start_date(case_investigation)}", - link: - link_if_editable( - person, - live_redirect( - "Edit", - to: - Routes.case_investigation_start_interview_path( - EpicenterWeb.Endpoint, - EpicenterWeb.CaseInvestigationStartInterviewLive, - case_investigation - ), - class: "case-investigation-link" - ) - ) + link: link_if_editable(person, :started_interview) } | items ] @@ -74,21 +117,7 @@ defmodule EpicenterWeb.Presenters.CaseInvestigationPresenter do %{ text: "Discontinued interview on #{case_investigation.interview_discontinued_at |> Format.date_time_with_presented_time_zone()}: #{case_investigation.interview_discontinue_reason}", - link: - link_if_editable( - person, - live_redirect( - "Edit", - to: - Routes.case_investigation_discontinue_path( - EpicenterWeb.Endpoint, - EpicenterWeb.CaseInvestigationDiscontinueLive, - case_investigation - ), - id: "edit-discontinue-case-investigation-link-001", - class: "discontinue-case-investigation-link" - ) - ) + link: link_if_editable(person, :discontinued_interview) } | items ] @@ -101,21 +130,7 @@ defmodule EpicenterWeb.Presenters.CaseInvestigationPresenter do [ %{ text: "Completed interview on #{completed_interview_date(case_investigation)}", - link: - link_if_editable( - person, - live_redirect( - "Edit", - to: - Routes.case_investigation_complete_interview_path( - EpicenterWeb.Endpoint, - :complete_case_investigation, - case_investigation - ), - id: "edit-complete-interview-link-001", - class: "edit-complete-interview-link" - ) - ) + link: link_if_editable(person, :completed_interview) } | items ] @@ -126,20 +141,69 @@ defmodule EpicenterWeb.Presenters.CaseInvestigationPresenter do items |> Enum.reverse() end - def interview_buttons(person, case_investigation) do + attr :person, :any, required: true + attr :case_investigation, :any, required: true + + def interview_buttons(assigns) do + ~H""" +
+ <%= for link <- to_interview_buttons_list(@person, @case_investigation) do %> + + <.interview_buttons_router_link + label={link} + case_investigation={@case_investigation}/> + + <% end %> +
+ """ + end + + attr :label, :any, required: true + attr :case_investigation, :any, required: true + + def interview_buttons_router_link(assigns) do + ~H""" + <.link + :if={@label == :start_interview} + navigate={Routes.case_investigation_start_interview_path( + EpicenterWeb.Endpoint, + EpicenterWeb.CaseInvestigationStartInterviewLive, + @case_investigation + )} + id="start-interview-case-investigation-link-001" + class="primary" + >Start interview + <.link + :if={@label == :complete_interview} + navigate={Routes.case_investigation_complete_interview_path( + EpicenterWeb.Endpoint, + :complete_case_investigation, + @case_investigation + )} + id="complete-interview-case-investigation-link-001" + class="primary" + >Complete interview + <.link + :if={@label == :discontinue_interview} + navigate={Routes.case_investigation_discontinue_path( + EpicenterWeb.Endpoint, + EpicenterWeb.CaseInvestigationDiscontinueLive, + @case_investigation + )} + id="discontinue-case-investigation-link-001" + class="discontinue-case-investigation-link" + >Discontinue + """ + end + + defp to_interview_buttons_list(person, case_investigation) do if PeoplePresenter.is_editable?(person) do case case_investigation.interview_status do "pending" -> - [ - redirect_to(case_investigation, :start_interview), - redirect_to(case_investigation, :discontinue_interview) - ] + [:start_interview, :discontinue_interview] "started" -> - [ - redirect_to(case_investigation, :complete_interview), - redirect_to(case_investigation, :discontinue_interview) - ] + [:complete_interview, :discontinue_interview] "completed" -> [] @@ -152,42 +216,82 @@ defmodule EpicenterWeb.Presenters.CaseInvestigationPresenter do end end - def isolation_monitoring_button(person, case_investigation) do - if PeoplePresenter.is_editable?(person) do - case case_investigation.isolation_monitoring_status do - "pending" -> - live_redirect("Add isolation dates", - to: - Routes.case_investigation_isolation_monitoring_path( - EpicenterWeb.Endpoint, - EpicenterWeb.CaseInvestigationIsolationMonitoringLive, - case_investigation - ), - id: "add-isolation-dates-case-investigation-link-001", - class: "primary" - ) - - "ongoing" -> - live_redirect("Conclude isolation", - to: - Routes.case_investigation_conclude_isolation_monitoring_path( - EpicenterWeb.Endpoint, - EpicenterWeb.CaseInvestigationConcludeIsolationMonitoringLive, - case_investigation - ), - id: "conclude-isolation-monitoring-case-investigation-link-001", - class: "primary" - ) - - "concluded" -> - nil - end - else - [] - end + attr :case_investigation, :any, required: true + + def isolation_monitoring_button(assigns) do + ~H""" + <.link + :if={@case_investigation.isolation_monitoring_status == "pending"} + navigate={Routes.case_investigation_isolation_monitoring_path( + EpicenterWeb.Endpoint, + EpicenterWeb.CaseInvestigationIsolationMonitoringLive, + @case_investigation + )} + id="add-isolation-dates-case-investigation-link-001" + class="primary" + >Add isolation dates + <.link + :if={@case_investigation.isolation_monitoring_status == "ongoing"} + navigate={Routes.case_investigation_conclude_isolation_monitoring_path( + EpicenterWeb.Endpoint, + EpicenterWeb.CaseInvestigationConcludeIsolationMonitoringLive, + @case_investigation + )} + id="conclude-isolation-monitoring-case-investigation-link-001" + class="primary" + >Conclude isolation + """ end - def isolation_monitoring_history_items(person, case_investigation) do + attr :person, :any, required: true + attr :case_investigation, :any, required: true + + def isolation_monitoring_history_items(assigns) do + ~H""" +
+ <%= for item <- to_isolation_monitoring_history_items_list(@person, @case_investigation) do %> +
+ <%= item.text %> + + <.isolation_monitoring_history_items_router_link + label={item.link} + case_investigation={@case_investigation}/> + +
+ <% end %> +
+ """ + end + + attr :label, :any, required: true + attr :case_investigation, :any, required: true + + def isolation_monitoring_history_items_router_link(assigns) do + ~H""" + <.link + :if={@label == :edit_isolation_monitoring} + navigate={Routes.case_investigation_isolation_monitoring_path( + EpicenterWeb.Endpoint, + EpicenterWeb.CaseInvestigationIsolationMonitoringLive, + @case_investigation + )} + id="edit-isolation-monitoring-link-001" + class="case-investigation-link" + >Edit + <.link + :if={@label == :edit_isolation_monitoring_conclusion} + navigate={Routes.case_investigation_conclude_isolation_monitoring_path( + EpicenterWeb.Endpoint, + EpicenterWeb.CaseInvestigationConcludeIsolationMonitoringLive, + @case_investigation + )} + id="edit-isolation-monitoring-conclusion-link-001" + class="case-investigation-link" + >Edit + """ + end + + defp to_isolation_monitoring_history_items_list(person, case_investigation) do items = [] items = @@ -196,21 +300,7 @@ defmodule EpicenterWeb.Presenters.CaseInvestigationPresenter do %{ text: "Isolation dates: #{Format.date(case_investigation.isolation_monitoring_starts_on)} - #{Format.date(case_investigation.isolation_monitoring_ends_on)}", - link: - link_if_editable( - person, - live_redirect( - "Edit", - to: - Routes.case_investigation_isolation_monitoring_path( - EpicenterWeb.Endpoint, - EpicenterWeb.CaseInvestigationIsolationMonitoringLive, - case_investigation - ), - id: "edit-isolation-monitoring-link-001", - class: "case-investigation-link" - ) - ) + link: link_if_editable(person, :edit_isolation_monitoring) } | items ] @@ -224,21 +314,7 @@ defmodule EpicenterWeb.Presenters.CaseInvestigationPresenter do %{ text: "Concluded isolation monitoring on #{concluded_isolation_monitoring_date(case_investigation)}. #{Gettext.gettext(Epicenter.Gettext, case_investigation.isolation_conclusion_reason)}", - link: - link_if_editable( - person, - live_redirect( - "Edit", - to: - Routes.case_investigation_conclude_isolation_monitoring_path( - EpicenterWeb.Endpoint, - EpicenterWeb.CaseInvestigationConcludeIsolationMonitoringLive, - case_investigation - ), - id: "edit-isolation-monitoring-conclusion-link-001", - class: "case-investigation-link" - ) - ) + link: link_if_editable(person, :edit_isolation_monitoring_conclusion) } | items ] @@ -365,35 +441,6 @@ defmodule EpicenterWeb.Presenters.CaseInvestigationPresenter do end end - defp redirect_to(case_investigation, :complete_interview) do - live_redirect("Complete interview", - to: - Routes.case_investigation_complete_interview_path( - EpicenterWeb.Endpoint, - :complete_case_investigation, - case_investigation - ), - id: "complete-interview-case-investigation-link-001", - class: "primary" - ) - end - - defp redirect_to(case_investigation, :start_interview) do - live_redirect("Start interview", - to: Routes.case_investigation_start_interview_path(EpicenterWeb.Endpoint, EpicenterWeb.CaseInvestigationStartInterviewLive, case_investigation), - id: "start-interview-case-investigation-link-001", - class: "primary" - ) - end - - defp redirect_to(case_investigation, :discontinue_interview) do - live_redirect("Discontinue", - to: Routes.case_investigation_discontinue_path(EpicenterWeb.Endpoint, EpicenterWeb.CaseInvestigationDiscontinueLive, case_investigation), - id: "discontinue-case-investigation-link-001", - class: "discontinue-case-investigation-link" - ) - end - defp styled_status(displayable_status, status, type, postscript \\ "") when type in [:interview, :isolation_monitoring] do type_string = %{interview: "interview", isolation_monitoring: "isolation monitoring"}[type] diff --git a/lib/epicenter_web/presenters/contact_investigation_presenter.ex b/lib/epicenter_web/presenters/contact_investigation_presenter.ex index 5f22c64e..e6d182bf 100644 --- a/lib/epicenter_web/presenters/contact_investigation_presenter.ex +++ b/lib/epicenter_web/presenters/contact_investigation_presenter.ex @@ -1,6 +1,6 @@ defmodule EpicenterWeb.Presenters.ContactInvestigationPresenter do - import Phoenix.LiveView.Helpers import EpicenterWeb.PersonHelpers, only: [demographic_field: 2] + use Phoenix.Component alias Epicenter.Cases alias Epicenter.ContactInvestigations.ContactInvestigation @@ -9,20 +9,20 @@ defmodule EpicenterWeb.Presenters.ContactInvestigationPresenter do alias EpicenterWeb.Presenters.PeoplePresenter alias EpicenterWeb.Router.Helpers, as: Routes - def exposing_case_link(contact_investigation) do - exposing_person = contact_investigation.exposing_case.person + attr :contact_investigation, :any, required: true - live_redirect( - "\##{exposing_case_person_id(contact_investigation)}", - to: - Routes.profile_path( + def exposing_case_link(assigns) do + ~H""" + <.link + navigate={Routes.profile_path( EpicenterWeb.Endpoint, EpicenterWeb.ProfileLive, - exposing_person - ), - data: [role: "visit-exposing-case-link"], - class: "visit-exposing-case-link" - ) + @contact_investigation.exposing_case.person + )} + data-role="visit-exposing-case-link" + class="visit-exposing-case-link" + ><%= "\##{exposing_case_person_id(@contact_investigation)}" %> + """ end defp exposing_case_person_id(contact_investigation) do @@ -30,7 +30,66 @@ defmodule EpicenterWeb.Presenters.ContactInvestigationPresenter do contact_investigation.exposing_case.person.id end - def history_items(contact_investigation) do + attr :contact_investigation, :any, required: true + + def history_items(assigns) do + ~H""" +
+ <%= for item <- to_history_items_list(@contact_investigation) do %> +
+ <%= item.text %> + <.history_router_link + label={item.link} + contact_investigation={@contact_investigation} /> +
+ <% end %> +
+ """ + end + + attr :label, :any, required: true + attr :contact_investigation, :any, required: true + + def history_router_link(assigns) do + ~H""" + <.link + :if={@label==:start_interview} + navigate={Routes.contact_investigation_start_interview_path( + EpicenterWeb.Endpoint, + EpicenterWeb.ContactInvestigationStartInterviewLive, + @contact_investigation + )} + data-role="contact-investigation-start-interview-edit-link" + class="contact-investigation-link" + >Edit + + <.link + :if={@label==:complete_interview} + navigate={Routes.contact_investigation_complete_interview_path( + EpicenterWeb.Endpoint, + :complete_contact_investigation, + @contact_investigation + )} + data-role="contact-investigation-complete-interview-edit-link" + class="contact-investigation-link" + >Edit + + <.link + :if={@label==:discontinue_interview} + navigate={Routes.contact_investigation_discontinue_path( + EpicenterWeb.Endpoint, + EpicenterWeb.ContactInvestigationDiscontinueLive, + @contact_investigation + )} + data-role="contact-investigation-discontinue-interview-edit-link" + class="contact-investigation-link" + >Edit + """ + end + + def to_history_items_list(contact_investigation) do [ interview_started_at_history(contact_investigation), interview_completed_at_history(contact_investigation), @@ -47,17 +106,7 @@ defmodule EpicenterWeb.Presenters.ContactInvestigationPresenter do link: link_if_editable( contact_investigation.exposed_person, - live_redirect( - "Edit", - to: - Routes.contact_investigation_start_interview_path( - EpicenterWeb.Endpoint, - EpicenterWeb.ContactInvestigationStartInterviewLive, - contact_investigation - ), - class: "contact-investigation-link", - data: [role: "contact-investigation-start-interview-edit-link"] - ) + :start_interview ) } end @@ -70,17 +119,7 @@ defmodule EpicenterWeb.Presenters.ContactInvestigationPresenter do link: link_if_editable( contact_investigation.exposed_person, - live_redirect( - "Edit", - to: - Routes.contact_investigation_complete_interview_path( - EpicenterWeb.Endpoint, - :complete_contact_investigation, - contact_investigation - ), - class: "contact-investigation-link", - data: [role: "contact-investigation-complete-interview-edit-link"] - ) + :complete_interview ) } end @@ -94,17 +133,7 @@ defmodule EpicenterWeb.Presenters.ContactInvestigationPresenter do link: link_if_editable( contact_investigation.exposed_person, - live_redirect( - "Edit", - to: - Routes.contact_investigation_discontinue_path( - EpicenterWeb.Endpoint, - EpicenterWeb.ContactInvestigationDiscontinueLive, - contact_investigation - ), - class: "contact-investigation-link", - data: [role: "contact-investigation-discontinue-interview-edit-link"] - ) + :discontinue_interview ) } end @@ -117,7 +146,55 @@ defmodule EpicenterWeb.Presenters.ContactInvestigationPresenter do end end - def quarantine_history_items(contact_investigation) do + attr :contact_investigation, :any, required: true + + def quarantine_history_items(assigns) do + ~H""" +
+ <%= for item <- to_quarantine_history_items_list(@contact_investigation) do %> +
+ <%= item.text %> + <.quarantine_history_router_link + label={item.link} + contact_investigation={@contact_investigation} /> +
+ <% end %> +
+ """ + end + + attr :label, :any, required: true + attr :contact_investigation, :any, required: true + + def quarantine_history_router_link(assigns) do + ~H""" + <.link + :if={@label == :quarantine_dates_history} + navigate={Routes.contact_investigation_quarantine_monitoring_path( + EpicenterWeb.Endpoint, + EpicenterWeb.ContactInvestigationQuarantineMonitoringLive, + @contact_investigation + )} + data-role="edit-contact-investigation-quarantine-monitoring-link" + class="contact-investigation-link" + >Edit + + <.link + :if={@label == :quarantine_conclusion} + navigate={Routes.contact_investigation_conclude_quarantine_monitoring_path( + EpicenterWeb.Endpoint, + EpicenterWeb.ContactInvestigationConcludeQuarantineMonitoringLive, + @contact_investigation + )} + data-role="conclude-contact-investigation-quarantine-monitoring-edit-link" + class="contact-investigation-link" + >Edit + """ + end + + def to_quarantine_history_items_list(contact_investigation) do [ quarantine_dates_history(contact_investigation), quarantine_conclusion(contact_investigation) @@ -135,17 +212,7 @@ defmodule EpicenterWeb.Presenters.ContactInvestigationPresenter do link: link_if_editable( contact_investigation.exposed_person, - live_redirect( - "Edit", - to: - Routes.contact_investigation_quarantine_monitoring_path( - EpicenterWeb.Endpoint, - EpicenterWeb.ContactInvestigationQuarantineMonitoringLive, - contact_investigation - ), - class: "contact-investigation-link", - data: [role: "edit-contact-investigation-quarantine-monitoring-link"] - ) + :quarantine_dates_history ) } end @@ -159,17 +226,7 @@ defmodule EpicenterWeb.Presenters.ContactInvestigationPresenter do link: link_if_editable( contact_investigation.exposed_person, - live_redirect( - "Edit", - to: - Routes.contact_investigation_conclude_quarantine_monitoring_path( - EpicenterWeb.Endpoint, - EpicenterWeb.ContactInvestigationConcludeQuarantineMonitoringLive, - contact_investigation - ), - class: "contact-investigation-link", - data: [role: "conclude-contact-investigation-quarantine-monitoring-edit-link"] - ) + :quarantine_conclusion ) } end From 4aa35615a494d4208bbc41012a023014c14a8379 Mon Sep 17 00:00:00 2001 From: Lei Zhou Date: Fri, 16 Aug 2024 07:17:52 -0400 Subject: [PATCH 24/27] function renaming --- lib/epicenter_web/live_component/contact_investigation.ex | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/epicenter_web/live_component/contact_investigation.ex b/lib/epicenter_web/live_component/contact_investigation.ex index 8bb9cf64..3d7aa789 100644 --- a/lib/epicenter_web/live_component/contact_investigation.ex +++ b/lib/epicenter_web/live_component/contact_investigation.ex @@ -62,9 +62,9 @@ defmodule EpicenterWeb.ContactInvestigation do def interview_buttons(assigns) do ~H""" - <%= for label <- to_interview_link_list(@contact_investigation) do %> + <%= for label <- to_interview_buttons_list(@contact_investigation) do %> - <.router_link + <.interview_buttons_router_link label={label} contact_investigation={@contact_investigation} /> @@ -75,7 +75,7 @@ defmodule EpicenterWeb.ContactInvestigation do attr :label, :any, required: true attr :contact_investigation, :any, required: true - def router_link(assigns) do + def interview_buttons_router_link(assigns) do ~H""" <.link :if={@label==:start_interview} @@ -120,7 +120,7 @@ defmodule EpicenterWeb.ContactInvestigation do """ end - defp to_interview_link_list(contact_investigation) do + defp to_interview_buttons_list(contact_investigation) do case is_editable?(contact_investigation.exposed_person) do false -> [] From 36a2bc88b9dd2732b6f0baa1ed453cfbf2799a66 Mon Sep 17 00:00:00 2001 From: Lei Zhou Date: Fri, 16 Aug 2024 07:24:52 -0400 Subject: [PATCH 25/27] use .tool-versions for otp/elixir version in CI --- .github/workflows/main.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 53da274f..c1538c97 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -40,9 +40,6 @@ jobs: with: fetch-depth: 0 - uses: erlef/setup-beam@v1 - with: - otp-version: '27.0.1' - elixir-version: '1.17.2' - name: Install dependencies run: | From fd8df66e151fe8028bd4fda0a18f7c3fd24dbd00 Mon Sep 17 00:00:00 2001 From: Lei Zhou Date: Fri, 16 Aug 2024 07:30:18 -0400 Subject: [PATCH 26/27] fix ci: use version-file --- .github/workflows/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c1538c97..0f5ef8a0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -40,6 +40,8 @@ jobs: with: fetch-depth: 0 - uses: erlef/setup-beam@v1 + with: + version-file: .tool-versions - name: Install dependencies run: | From feed5e70a998944b429bcdd5ff028b94e1aa3b86 Mon Sep 17 00:00:00 2001 From: Lei Zhou Date: Fri, 16 Aug 2024 07:32:32 -0400 Subject: [PATCH 27/27] fix ci: add version-type --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0f5ef8a0..d73ad52c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -42,7 +42,7 @@ jobs: - uses: erlef/setup-beam@v1 with: version-file: .tool-versions - + version-type: strict - name: Install dependencies run: | npm install --prefix assets
- <%= live_redirect(user.name, - to: Routes.user_path(EpicenterWeb.Endpoint, EpicenterWeb.UserLive, user) - ) %> + <.link navigate={Routes.user_path(EpicenterWeb.Endpoint, EpicenterWeb.UserLive, user)}><%= user.name %> <%= user.email %> <%= user.type %> <%= user.active_status %> - <%= live_redirect("View", - to: - Routes.user_logins_path(EpicenterWeb.Endpoint, EpicenterWeb.UserLoginsLive, user), - data: [tid: "view-audit-trail-#{user.tid}"] - ) %> + <.link navigate={Routes.user_logins_path(EpicenterWeb.Endpoint, EpicenterWeb.UserLoginsLive, user)} + data-tid={"view-audit-trail-#{user.tid}"}>View <%= if user.password_reset_url do %> diff --git a/lib/epicenter_web/live_component/contact_investigation.ex b/lib/epicenter_web/live_component/contact_investigation.ex index 7e6be7ce..c5265bbc 100644 --- a/lib/epicenter_web/live_component/contact_investigation.ex +++ b/lib/epicenter_web/live_component/contact_investigation.ex @@ -1,7 +1,6 @@ defmodule EpicenterWeb.ContactInvestigation do use EpicenterWeb, :live_component - import EpicenterWeb.LiveComponent.Helpers import EpicenterWeb.Presenters.ContactInvestigationPresenter, only: [exposing_case_link: 1, history_items: 1, quarantine_history_items: 1] import EpicenterWeb.Presenters.InvestigationPresenter, only: [displayable_clinical_status: 1, displayable_symptoms: 1] import EpicenterWeb.Presenters.PeoplePresenter, only: [is_editable?: 1] diff --git a/lib/epicenter_web/live_component/contact_investigation.html.heex b/lib/epicenter_web/live_component/contact_investigation.html.heex index bb864265..e7f6d593 100644 --- a/lib/epicenter_web/live_component/contact_investigation.html.heex +++ b/lib/epicenter_web/live_component/contact_investigation.html.heex @@ -59,16 +59,9 @@ diff --git a/lib/epicenter_web/templates/user_multifactor_auth/new.html.heex b/lib/epicenter_web/templates/user_multifactor_auth/new.html.heex index 86906363..cdabfe1c 100644 --- a/lib/epicenter_web/templates/user_multifactor_auth/new.html.heex +++ b/lib/epicenter_web/templates/user_multifactor_auth/new.html.heex @@ -3,14 +3,14 @@
<%= login_icon() %>

Multi-factor authentication

- <%= if get_flash(@conn, :info) do %> -
<%= get_flash(@conn, :info) %>
+ <%= if Phoenix.Flash.get(@flash, :info) do %> +
<%= Phoenix.Flash.get(@flash, :info) %>
<% end %> - <%= if get_flash(@conn, :extra) do %> -
<%= get_flash(@conn, :extra) %>
+ <%= if Phoenix.Flash.get(@flash, :extra) do %> +
<%= Phoenix.Flash.get(@flash, :extra) %>
<% end %> - <%= if get_flash(@conn, :error) do %> - <% error = get_flash(@conn, :error) %> + <%= if Phoenix.Flash.get(@flash, :error) do %> + <% error = Phoenix.Flash.get(@flash, :error) %>
<%= error %>
<% end %> <%= if @error_message do %> diff --git a/lib/epicenter_web/templates/user_settings/edit.html.heex b/lib/epicenter_web/templates/user_settings/edit.html.heex index 7ea1a57a..314a74f1 100644 --- a/lib/epicenter_web/templates/user_settings/edit.html.heex +++ b/lib/epicenter_web/templates/user_settings/edit.html.heex @@ -2,14 +2,14 @@

Settings

- <%= if get_flash(@conn, :info) do %> -
<%= get_flash(@conn, :info) %>
+ <%= if Phoenix.Flash.get(@flash, :info) do %> +
<%= Phoenix.Flash.get(@flash, :info) %>
<% end %> - <%= if get_flash(@conn, :error) do %> -
<%= get_flash(@conn, :error) %>
+ <%= if Phoenix.Flash.get(@flash, :error) do %> +
<%= Phoenix.Flash.get(@flash, :error) %>
<% end %> - <%= if get_flash(@conn, :extra) do %> -
<%= get_flash(@conn, :extra) %>
+ <%= if Phoenix.Flash.get(@flash, :extra) do %> +
<%= Phoenix.Flash.get(@flash, :extra) %>
<% end %>
Change password
diff --git a/mix.exs b/mix.exs index da34c456..cacc62cc 100644 --- a/mix.exs +++ b/mix.exs @@ -7,7 +7,7 @@ defmodule Epicenter.MixProject do version: "0.1.0", elixir: "~> 1.7", elixirc_paths: elixirc_paths(Mix.env()), - compilers: [:phoenix] ++ Mix.compilers(), + compilers: Mix.compilers(), start_permanent: Mix.env() == :prod, aliases: aliases(), deps: deps(), diff --git a/test/epicenter_web/live_components/contact_investigation_test.exs b/test/epicenter_web/live_components/contact_investigation_test.exs index 0e1fd4dd..07e60431 100644 --- a/test/epicenter_web/live_components/contact_investigation_test.exs +++ b/test/epicenter_web/live_components/contact_investigation_test.exs @@ -1,7 +1,6 @@ defmodule EpicenterWeb.ContactInvestigationTest do use EpicenterWeb.ConnCase, async: true - import EpicenterWeb.LiveComponent.Helpers import Phoenix.LiveViewTest alias Epicenter.Accounts diff --git a/test/epicenter_web/live_components/investigation_note_component_test.exs b/test/epicenter_web/live_components/investigation_note_component_test.exs index 9cdb79ef..9b0e755c 100644 --- a/test/epicenter_web/live_components/investigation_note_component_test.exs +++ b/test/epicenter_web/live_components/investigation_note_component_test.exs @@ -1,7 +1,6 @@ defmodule EpicenterWeb.InvestigationNoteComponentTest do use EpicenterWeb.ConnCase, async: true - import EpicenterWeb.LiveComponent.Helpers import Phoenix.LiveViewTest alias Epicenter.Accounts.User diff --git a/test/epicenter_web/live_components/investigation_note_form_test.exs b/test/epicenter_web/live_components/investigation_note_form_test.exs index ebe22111..70be43ad 100644 --- a/test/epicenter_web/live_components/investigation_note_form_test.exs +++ b/test/epicenter_web/live_components/investigation_note_form_test.exs @@ -1,7 +1,6 @@ defmodule EpicenterWeb.InvestigationNoteFormTest do use EpicenterWeb.ConnCase, async: true - import EpicenterWeb.LiveComponent.Helpers import Phoenix.LiveViewTest alias Epicenter.Accounts diff --git a/test/epicenter_web/live_components/investigation_notes_section_test.exs b/test/epicenter_web/live_components/investigation_notes_section_test.exs index 31fbbcda..34de9f42 100644 --- a/test/epicenter_web/live_components/investigation_notes_section_test.exs +++ b/test/epicenter_web/live_components/investigation_notes_section_test.exs @@ -1,7 +1,6 @@ defmodule EpicenterWeb.InvestigationNotesSectionTest do use EpicenterWeb.ConnCase, async: true - import EpicenterWeb.LiveComponent.Helpers import Phoenix.LiveViewTest alias Epicenter.Cases.InvestigationNote @@ -31,7 +30,6 @@ defmodule EpicenterWeb.InvestigationNotesSectionTest do defmodule TestLiveView do use EpicenterWeb, :live_view - import EpicenterWeb.LiveComponent.Helpers import EpicenterWeb.LiveHelpers, only: [assign_defaults: 1, noreply: 1] alias Epicenter.Accounts From 23629c40f4dedb018a3aa7c6cf066cd6dc1acfd9 Mon Sep 17 00:00:00 2001 From: Lei Zhou Date: Tue, 13 Aug 2024 23:45:54 -0400 Subject: [PATCH 12/27] use <.link> partly; all tests passed --- lib/epicenter_web/templates/layout/live.html.heex | 4 +--- lib/epicenter_web/templates/layout/root.html.heex | 4 +++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/epicenter_web/templates/layout/live.html.heex b/lib/epicenter_web/templates/layout/live.html.heex index e8353050..a65ae736 100644 --- a/lib/epicenter_web/templates/layout/live.html.heex +++ b/lib/epicenter_web/templates/layout/live.html.heex @@ -32,9 +32,7 @@
    <%= if @current_user.admin do %>
  • - <%= live_redirect("Admin", - to: Routes.users_path(EpicenterWeb.Endpoint, EpicenterWeb.UsersLive) - ) %> + <.link navigate={Routes.users_path(EpicenterWeb.Endpoint, EpicenterWeb.UsersLive)}>Admin
  • <% end %>
  • diff --git a/lib/epicenter_web/templates/layout/root.html.heex b/lib/epicenter_web/templates/layout/root.html.heex index f46e88b4..7de4e308 100644 --- a/lib/epicenter_web/templates/layout/root.html.heex +++ b/lib/epicenter_web/templates/layout/root.html.heex @@ -4,7 +4,9 @@ <%= csrf_meta_tag() %><%= live_title_tag(assigns[:page_title] || "", suffix: " · Viewpoint") %><%= csrf_meta_tag() %> + <.live_title suffix=" · Viewpoint"><%= assigns[:page_title] || "" %> + Date: Wed, 14 Aug 2024 00:05:18 -0400 Subject: [PATCH 13/27] remove unused alias; use Flash.get; all tests passed --- lib/epicenter_web/live/contacts_live.ex | 2 +- lib/epicenter_web/live/people_live.ex | 1 - .../presenters/case_investigation_presenter.ex | 1 - .../presenters/contact_investigation_presenter.ex | 1 - .../user_multifactor_auth_setup/new.html.heex | 4 ++-- .../templates/user_session/new.html.heex | 12 ++++++------ 6 files changed, 9 insertions(+), 12 deletions(-) diff --git a/lib/epicenter_web/live/contacts_live.ex b/lib/epicenter_web/live/contacts_live.ex index 8937d7fc..a0f60a31 100644 --- a/lib/epicenter_web/live/contacts_live.ex +++ b/lib/epicenter_web/live/contacts_live.ex @@ -41,7 +41,7 @@ defmodule EpicenterWeb.ContactsLive do alias Epicenter.Cases alias Epicenter.ContactInvestigations alias Epicenter.ContactsFilterError - alias EpicenterWeb.ContactsFilter + @clock Application.compile_env(:epicenter, :clock) diff --git a/lib/epicenter_web/live/people_live.ex b/lib/epicenter_web/live/people_live.ex index d98db57f..4db49d2f 100644 --- a/lib/epicenter_web/live/people_live.ex +++ b/lib/epicenter_web/live/people_live.ex @@ -55,7 +55,6 @@ defmodule EpicenterWeb.PeopleLive do alias Epicenter.CaseInvestigationFilterError alias Epicenter.Cases alias EpicenterWeb.Format - alias EpicenterWeb.PeopleFilter @clock Application.compile_env(:epicenter, :clock) diff --git a/lib/epicenter_web/presenters/case_investigation_presenter.ex b/lib/epicenter_web/presenters/case_investigation_presenter.ex index 2ea96cba..309a1304 100644 --- a/lib/epicenter_web/presenters/case_investigation_presenter.ex +++ b/lib/epicenter_web/presenters/case_investigation_presenter.ex @@ -1,6 +1,5 @@ defmodule EpicenterWeb.Presenters.CaseInvestigationPresenter do import Phoenix.LiveView.Helpers - import Phoenix.Component import Phoenix.HTML.Tag alias Epicenter.Cases diff --git a/lib/epicenter_web/presenters/contact_investigation_presenter.ex b/lib/epicenter_web/presenters/contact_investigation_presenter.ex index 9f4a1eca..3b80ad0b 100644 --- a/lib/epicenter_web/presenters/contact_investigation_presenter.ex +++ b/lib/epicenter_web/presenters/contact_investigation_presenter.ex @@ -1,6 +1,5 @@ defmodule EpicenterWeb.Presenters.ContactInvestigationPresenter do import Phoenix.LiveView.Helpers - import Phoenix.Component import EpicenterWeb.PersonHelpers, only: [demographic_field: 2] alias Epicenter.Cases diff --git a/lib/epicenter_web/templates/user_multifactor_auth_setup/new.html.heex b/lib/epicenter_web/templates/user_multifactor_auth_setup/new.html.heex index 5213ee0a..ea116f20 100644 --- a/lib/epicenter_web/templates/user_multifactor_auth_setup/new.html.heex +++ b/lib/epicenter_web/templates/user_multifactor_auth_setup/new.html.heex @@ -1,8 +1,8 @@

    Set up multi-factor authentication

    - <%= if get_flash(@conn, :error) do %> - <% error = get_flash(@conn, :error) %> + <%= if Phoenix.Flash.get(@flash, :error) do %> + <% error = Phoenix.Flash.get(@flash, :error) %>
    <%= error %>
    <% end %>

    diff --git a/lib/epicenter_web/templates/user_session/new.html.heex b/lib/epicenter_web/templates/user_session/new.html.heex index dc48e770..fd4c166b 100644 --- a/lib/epicenter_web/templates/user_session/new.html.heex +++ b/lib/epicenter_web/templates/user_session/new.html.heex @@ -3,14 +3,14 @@

    <%= login_icon() %>

    Log into your account

    - <%= if get_flash(@conn, :info) do %> -
    <%= get_flash(@conn, :info) %>
    + <%= if Phoenix.Flash.get(@flash, :info) do %> +
    <%= Phoenix.Flash.get(@flash, :info) %>
    <% end %> - <%= if get_flash(@conn, :extra) do %> -
    <%= get_flash(@conn, :extra) %>
    + <%= if Phoenix.Flash.get(@flash, :extra) do %> +
    <%= Phoenix.Flash.get(@flash, :extra) %>
    <% end %> - <%= if get_flash(@conn, :error) do %> - <% error = get_flash(@conn, :error) %> + <%= if Phoenix.Flash.get(@flash, :error) do %> + <% error = Phoenix.Flash.get(@flash, :error) %>
    <%= error %>
    <% end %> <%= if @error_message do %> From 41b4f3f5d496c42f78afa675102e79066f399113 Mon Sep 17 00:00:00 2001 From: Lei Zhou Date: Thu, 15 Aug 2024 00:41:55 -0400 Subject: [PATCH 14/27] use PhoenixHTMLHelpers --- lib/epicenter_web.ex | 8 ++++++-- .../presenters/case_investigation_presenter.ex | 2 +- lib/epicenter_web/presenters/people_presenter.ex | 4 ++-- lib/epicenter_web/views/error_helpers.ex | 3 ++- lib/epicenter_web/views/form.ex | 2 +- lib/epicenter_web/views/form_helpers.ex | 3 ++- lib/epicenter_web/views/multiselect.ex | 6 +++--- lib/epicenter_web/views/unknown.ex | 6 +++--- mix.exs | 5 +++-- mix.lock | 7 ++++--- test/epicenter_web/views/form_test.exs | 7 ++++--- test/epicenter_web/views/multiselect_test.exs | 7 ++++--- 12 files changed, 35 insertions(+), 25 deletions(-) diff --git a/lib/epicenter_web.ex b/lib/epicenter_web.ex index f28075c0..1da89524 100644 --- a/lib/epicenter_web.ex +++ b/lib/epicenter_web.ex @@ -44,7 +44,9 @@ defmodule EpicenterWeb do def live_view do quote do - use Phoenix.HTML + import Phoenix.HTML + import Phoenix.HTML.Form + use PhoenixHTMLHelpers use Phoenix.LiveView, layout: {EpicenterWeb.LayoutView, :live} use EpicenterWeb.SearchHandling @@ -82,7 +84,9 @@ defmodule EpicenterWeb do defp view_helpers do quote do # Use all HTML functionality (forms, tags, etc) - use Phoenix.HTML + import Phoenix.HTML +import Phoenix.HTML.Form +use PhoenixHTMLHelpers # Import LiveView helpers (live_render, component, live_patch, etc) import Phoenix.LiveView.Helpers diff --git a/lib/epicenter_web/presenters/case_investigation_presenter.ex b/lib/epicenter_web/presenters/case_investigation_presenter.ex index 309a1304..e33504c2 100644 --- a/lib/epicenter_web/presenters/case_investigation_presenter.ex +++ b/lib/epicenter_web/presenters/case_investigation_presenter.ex @@ -1,6 +1,6 @@ defmodule EpicenterWeb.Presenters.CaseInvestigationPresenter do import Phoenix.LiveView.Helpers - import Phoenix.HTML.Tag + import PhoenixHTMLHelpers.Tag alias Epicenter.Cases alias Epicenter.Cases.CaseInvestigation diff --git a/lib/epicenter_web/presenters/people_presenter.ex b/lib/epicenter_web/presenters/people_presenter.ex index ab90b3a8..95be7890 100644 --- a/lib/epicenter_web/presenters/people_presenter.ex +++ b/lib/epicenter_web/presenters/people_presenter.ex @@ -62,7 +62,7 @@ defmodule EpicenterWeb.Presenters.PeoplePresenter do person = person |> Cases.preload_demographics() |> Cases.preload_phones() |> Cases.preload_addresses() demographic = person |> Person.coalesce_demographics() - Phoenix.HTML.Tag.content_tag :ul do + PhoenixHTMLHelpers.Tag.content_tag :ul do [ Format.date(demographic.dob), Extra.String.capitalize(demographic.sex_at_birth), @@ -70,7 +70,7 @@ defmodule EpicenterWeb.Presenters.PeoplePresenter do Format.address(person.addresses) ] |> Enum.filter(&Euclid.Exists.present?/1) - |> Enum.map(&Phoenix.HTML.Tag.content_tag(:li, &1)) + |> Enum.map(&PhoenixHTMLHelpers.Tag.content_tag(:li, &1)) end end diff --git a/lib/epicenter_web/views/error_helpers.ex b/lib/epicenter_web/views/error_helpers.ex index 5a99d34c..0a88b564 100644 --- a/lib/epicenter_web/views/error_helpers.ex +++ b/lib/epicenter_web/views/error_helpers.ex @@ -3,7 +3,8 @@ defmodule EpicenterWeb.ErrorHelpers do Conveniences for translating and building error messages. """ - use Phoenix.HTML + import Phoenix.HTML.Form + use PhoenixHTMLHelpers @doc """ Generates tag for inlined form input errors. diff --git a/lib/epicenter_web/views/form.ex b/lib/epicenter_web/views/form.ex index 2a68eaf9..979277f2 100644 --- a/lib/epicenter_web/views/form.ex +++ b/lib/epicenter_web/views/form.ex @@ -1,5 +1,5 @@ defmodule EpicenterWeb.Form do - use Phoenix.HTML + use PhoenixHTMLHelpers import EpicenterWeb.ErrorHelpers diff --git a/lib/epicenter_web/views/form_helpers.ex b/lib/epicenter_web/views/form_helpers.ex index bf84b5cd..bde6e5ea 100644 --- a/lib/epicenter_web/views/form_helpers.ex +++ b/lib/epicenter_web/views/form_helpers.ex @@ -1,5 +1,6 @@ defmodule EpicenterWeb.FormHelpers do - use Phoenix.HTML + import Phoenix.HTML.Form + use PhoenixHTMLHelpers alias EpicenterWeb.IconView diff --git a/lib/epicenter_web/views/multiselect.ex b/lib/epicenter_web/views/multiselect.ex index 4fb80769..f2745f16 100644 --- a/lib/epicenter_web/views/multiselect.ex +++ b/lib/epicenter_web/views/multiselect.ex @@ -3,7 +3,7 @@ defmodule EpicenterWeb.Multiselect do alias Epicenter.Extra alias Phoenix.HTML.Form - alias Phoenix.HTML.Tag + alias PhoenixHTMLHelpers.Tag def multiselect_inputs(f, field, specs, level \\ :parent) do inputs = @@ -23,7 +23,7 @@ defmodule EpicenterWeb.Multiselect do def multiselect_input(f, field, {type, option_label, option_value} = _spec, level) do Tag.content_tag :div, class: "label-wrapper" do - Form.label data: [multiselect: level, role: Extra.String.dasherize([f.name, field])] do + PhoenixHTMLHelpers.Form.label data: [multiselect: level, role: Extra.String.dasherize([f.name, field])] do case type do :checkbox -> [multiselect_chradio(f, field, option_value, :checkbox), option_label] :radio -> [multiselect_chradio(f, field, option_value, :radio), option_label] @@ -58,7 +58,7 @@ defmodule EpicenterWeb.Multiselect do {field, _subfield, keypath} = field_info(field) Tag.content_tag :div, data: [multiselect: "text-wrapper"] do - Form.text_input( + PhoenixHTMLHelpers.Form.text_input( f, field, data: [role: "other-text"], diff --git a/lib/epicenter_web/views/unknown.ex b/lib/epicenter_web/views/unknown.ex index 964f40b1..8ae7e526 100644 --- a/lib/epicenter_web/views/unknown.ex +++ b/lib/epicenter_web/views/unknown.ex @@ -19,12 +19,12 @@ defmodule EpicenterWeb.Unknown do with true <- Euclid.Exists.present?(values), values <- Enum.filter(values, &Euclid.Exists.present?/1), true <- Euclid.Exists.present?(values) do - Phoenix.HTML.Tag.content_tag :ul do + PhoenixHTMLHelpers.Tag.content_tag :ul do values |> pre_fun.() |> Enum.map(transform_fun) |> post_fun.() - |> Enum.map(&Phoenix.HTML.Tag.content_tag(:li, &1)) + |> Enum.map(&PhoenixHTMLHelpers.Tag.content_tag(:li, &1)) end else _ -> @@ -33,6 +33,6 @@ defmodule EpicenterWeb.Unknown do end def unknown_value(text \\ @unknown_text) do - Phoenix.HTML.Tag.content_tag(:span, text, class: "unknown") + PhoenixHTMLHelpers.Tag.content_tag(:span, text, class: "unknown") end end diff --git a/mix.exs b/mix.exs index cacc62cc..de0bc19e 100644 --- a/mix.exs +++ b/mix.exs @@ -62,11 +62,12 @@ defmodule Epicenter.MixProject do {:number, "~> 1.0"}, {:phoenix, "~> 1.7.0"}, {:phoenix_ecto, "~> 4.1"}, - {:phoenix_html, "~> 3.1"}, - {:phoenix_integration, "~> 0.8", only: :test}, + {:phoenix_html, "~> 4.0"}, + {:phoenix_integration, git: "https://github.com/RatioPBC/phoenix_integration", ref: "82c94b3a09633ca8c6cda1354c4dad97065815f9", only: :test}, {:phoenix_live_dashboard, "~> 0.6"}, {:phoenix_live_reload, "~> 1.2", only: :dev}, {:phoenix_live_view, "~> 1.0.0-rc.6"}, + {:phoenix_html_helpers, "~> 1.0"}, {:phoenix_view, "~> 2.0"}, {:plug_cowboy, "~> 2.0"}, {:postgrex, ">= 0.0.0"}, diff --git a/mix.lock b/mix.lock index e97fffd8..5a201cbf 100644 --- a/mix.lock +++ b/mix.lock @@ -36,9 +36,10 @@ "number": {:hex, :number, "1.0.3", "932c8a2d478a181c624138958ca88a78070332191b8061717270d939778c9857", [:mix], [{:decimal, "~> 1.5 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}], "hexpm", "dd397bbc096b2ca965a6a430126cc9cf7b9ef7421130def69bcf572232ca0f18"}, "parse_trans": {:hex, :parse_trans, "3.3.1", "16328ab840cc09919bd10dab29e431da3af9e9e7e7e6f0089dd5a2d2820011d8", [:rebar3], [], "hexpm", "07cd9577885f56362d414e8c4c4e6bdf10d43a8767abb92d24cbe8b24c54888b"}, "phoenix": {:hex, :phoenix, "1.7.14", "a7d0b3f1bc95987044ddada111e77bd7f75646a08518942c72a8440278ae7825", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.1", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: true]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.7", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.2 or ~> 2.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:websock_adapter, "~> 0.5.3", [hex: :websock_adapter, repo: "hexpm", optional: false]}], "hexpm", "c7859bc56cc5dfef19ecfc240775dae358cbaa530231118a9e014df392ace61a"}, - "phoenix_ecto": {:hex, :phoenix_ecto, "4.4.0", "0672ed4e4808b3fbed494dded89958e22fb882de47a97634c0b13e7b0b5f7720", [:mix], [{:ecto, "~> 3.3", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.14.2 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:plug, "~> 1.9", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "09864e558ed31ee00bd48fcc1d4fc58ae9678c9e81649075431e69dbabb43cc1"}, - "phoenix_html": {:hex, :phoenix_html, "3.3.4", "42a09fc443bbc1da37e372a5c8e6755d046f22b9b11343bf885067357da21cb3", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "0249d3abec3714aff3415e7ee3d9786cb325be3151e6c4b3021502c585bf53fb"}, - "phoenix_integration": {:hex, :phoenix_integration, "0.9.2", "c84c6d30251fb45877bbbebee064412930133d6da5d75e0a4121583a6d37a6b3", [:mix], [{:floki, ">= 0.24.0", [hex: :floki, repo: "hexpm", optional: false]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.3", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.10 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: false]}], "hexpm", "bb1a7e3409606c612b76160e80f452caf08a33b5717e37cdb219539b7f024001"}, + "phoenix_ecto": {:hex, :phoenix_ecto, "4.6.2", "3b83b24ab5a2eb071a20372f740d7118767c272db386831b2e77638c4dcc606d", [:mix], [{:ecto, "~> 3.5", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.14.2 or ~> 3.0 or ~> 4.1", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:plug, "~> 1.9", [hex: :plug, repo: "hexpm", optional: false]}, {:postgrex, "~> 0.16 or ~> 1.0", [hex: :postgrex, repo: "hexpm", optional: true]}], "hexpm", "3f94d025f59de86be00f5f8c5dd7b5965a3298458d21ab1c328488be3b5fcd59"}, + "phoenix_html": {:hex, :phoenix_html, "4.1.1", "4c064fd3873d12ebb1388425a8f2a19348cef56e7289e1998e2d2fa758aa982e", [:mix], [], "hexpm", "f2f2df5a72bc9a2f510b21497fd7d2b86d932ec0598f0210fed4114adc546c6f"}, + "phoenix_html_helpers": {:hex, :phoenix_html_helpers, "1.0.1", "7eed85c52eff80a179391036931791ee5d2f713d76a81d0d2c6ebafe1e11e5ec", [:mix], [{:phoenix_html, "~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "cffd2385d1fa4f78b04432df69ab8da63dc5cf63e07b713a4dcf36a3740e3090"}, + "phoenix_integration": {:git, "https://github.com/RatioPBC/phoenix_integration", "82c94b3a09633ca8c6cda1354c4dad97065815f9", [ref: "82c94b3a09633ca8c6cda1354c4dad97065815f9"]}, "phoenix_live_dashboard": {:hex, :phoenix_live_dashboard, "0.8.4-rc.0", "3af26124c9bea60253db50360912cb59668580ede2e702e7324536fb9d1cb523", [:mix], [{:ecto, "~> 3.6.2 or ~> 3.7", [hex: :ecto, repo: "hexpm", optional: true]}, {:ecto_mysql_extras, "~> 0.5", [hex: :ecto_mysql_extras, repo: "hexpm", optional: true]}, {:ecto_psql_extras, "~> 0.7", [hex: :ecto_psql_extras, repo: "hexpm", optional: true]}, {:ecto_sqlite3_extras, "~> 1.1.7 or ~> 1.2.0", [hex: :ecto_sqlite3_extras, repo: "hexpm", optional: true]}, {:mime, "~> 1.6 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:phoenix_live_view, "~> 0.19 or ~> 1.0-rc", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}, {:telemetry_metrics, "~> 0.6 or ~> 1.0", [hex: :telemetry_metrics, repo: "hexpm", optional: false]}], "hexpm", "66885624771f1a59f5b0ed6c24cbcec70fb2544356cb8085fd85320e6593720a"}, "phoenix_live_reload": {:hex, :phoenix_live_reload, "1.3.3", "3a53772a6118d5679bf50fc1670505a290e32a1d195df9e069d8c53ab040c054", [:mix], [{:file_system, "~> 0.2.1 or ~> 0.3", [hex: :file_system, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.4", [hex: :phoenix, repo: "hexpm", optional: false]}], "hexpm", "766796676e5f558dbae5d1bdb066849673e956005e3730dfd5affd7a6da4abac"}, "phoenix_live_view": {:hex, :phoenix_live_view, "1.0.0-rc.6", "47d2669995ea326e5c71f5c1bc9177109cebf211385c638faa7b5862a401e516", [:mix], [{:floki, "~> 0.36", [hex: :floki, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix, "~> 1.6.15 or ~> 1.7.0", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 3.3 or ~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: true]}, {:plug, "~> 1.15", [hex: :plug, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "e56e4f1642a0b20edc2488cab30e5439595e0d8b5b259f76ef98b1c4e2e5b527"}, diff --git a/test/epicenter_web/views/form_test.exs b/test/epicenter_web/views/form_test.exs index f9b83133..1655c397 100644 --- a/test/epicenter_web/views/form_test.exs +++ b/test/epicenter_web/views/form_test.exs @@ -24,9 +24,10 @@ defmodule EpicenterWeb.FormTest do @genres [{"Comedy", "comedy"}, {"Drama", "drama"}, {"Musical", "musical"}] defp phx_form(data \\ %{}) do - %Movie{} - |> Ecto.Changeset.change(Enum.into(data, %{})) - |> Phoenix.HTML.Form.form_for("/url") + form_data = + %Movie{} + |> Ecto.Changeset.change(Enum.into(data, %{})) + %{Phoenix.HTML.FormData.to_form(form_data, []) | action: "/url"} end # Convert a form into HTML and then parse into a list of 3-tuples, each of which is in the form: diff --git a/test/epicenter_web/views/multiselect_test.exs b/test/epicenter_web/views/multiselect_test.exs index 2b811fff..771ca942 100644 --- a/test/epicenter_web/views/multiselect_test.exs +++ b/test/epicenter_web/views/multiselect_test.exs @@ -17,9 +17,10 @@ defmodule EpicenterWeb.MultiselectTest do end defp phx_form(data) do - %Movie{} - |> Ecto.Changeset.change(Enum.into(data, %{})) - |> Phoenix.HTML.Form.form_for("/url") + form_data = + %Movie{} + |> Ecto.Changeset.change(Enum.into(data, %{})) + %{Phoenix.HTML.FormData.to_form(form_data, []) | action: "/url"} end defp parse(safe), From 525710a56a83a895cf7e014bf4c3f05580e5b3a6 Mon Sep 17 00:00:00 2001 From: Lei Zhou Date: Thu, 15 Aug 2024 09:45:21 -0400 Subject: [PATCH 15/27] update ci and .tool-versions --- .github/workflows/main.yml | 11 ++++++++--- .tool-versions | 6 +++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a31357bf..83544d42 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,9 +18,13 @@ jobs: env: MIX_ENV: test + strategy: + matrix: + postgres-version: [16.4-alpine, 17-alpine] # Add PostgreSQL 17 + services: postgres: - image: postgres:12.5-alpine + image: postgres:${{ matrix.postgres-version }} env: POSTGRES_PASSWORD: postgres options: >- @@ -37,8 +41,8 @@ jobs: fetch-depth: 0 - uses: erlef/setup-beam@v1 with: - otp-version: '25.3.1' - elixir-version: '1.14.5' + otp-version: '27.0.1' + elixir-version: '1.17.2' - name: Install dependencies run: | @@ -59,3 +63,4 @@ jobs: POSTGRES_HOST: localhost POSTGRES_PORT: 5432 SECRET_KEY_BASE: iuJS3FLMrRqbKug/CE4zGGd31eY6FMdmpQGjy8RMaQoxk59wAvSxuUKM6c/uaOo4 + continue-on-error: ${{ matrix.postgres-version == '17-alpine' }} \ No newline at end of file diff --git a/.tool-versions b/.tool-versions index 3d42ded1..93d3930a 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,4 +1,4 @@ -elixir 1.14.5-otp-25 -erlang 25.3.1 +elixir 1.17.2-otp-27 +erlang 27.0.1 nodejs 18.18.2 -postgres 15.2 +postgres 16.4 From d137a4f59b97ec0f3ec2b2e2c94bb34566691856 Mon Sep 17 00:00:00 2001 From: Lei Zhou Date: Thu, 15 Aug 2024 09:50:53 -0400 Subject: [PATCH 16/27] remove LiveView.Helpers --- lib/epicenter_web.ex | 5 ++--- lib/epicenter_web/live_component/helpers.ex | 18 ------------------ test/support/component_embedding_live_view.ex | 1 - 3 files changed, 2 insertions(+), 22 deletions(-) delete mode 100644 lib/epicenter_web/live_component/helpers.ex diff --git a/lib/epicenter_web.ex b/lib/epicenter_web.ex index 1da89524..d1771844 100644 --- a/lib/epicenter_web.ex +++ b/lib/epicenter_web.ex @@ -85,13 +85,12 @@ defmodule EpicenterWeb do quote do # Use all HTML functionality (forms, tags, etc) import Phoenix.HTML -import Phoenix.HTML.Form -use PhoenixHTMLHelpers + import Phoenix.HTML.Form + use PhoenixHTMLHelpers # Import LiveView helpers (live_render, component, live_patch, etc) import Phoenix.LiveView.Helpers import Phoenix.Component - import EpicenterWeb.LiveComponent.Helpers # Import basic rendering functionality (render, render_layout, etc) import Phoenix.View diff --git a/lib/epicenter_web/live_component/helpers.ex b/lib/epicenter_web/live_component/helpers.ex deleted file mode 100644 index 97c4fd02..00000000 --- a/lib/epicenter_web/live_component/helpers.ex +++ /dev/null @@ -1,18 +0,0 @@ -defmodule EpicenterWeb.LiveComponent.Helpers do - require Phoenix.LiveView.Helpers - - defmacro l_component(module, id, opts \\ [], do_block \\ []) do - quote do - is_stateful = - Enum.member?(unquote(module).__info__(:functions), {:handle_event, 3}) || Enum.member?(unquote(module).__info__(:functions), {:preload, 1}) - - opts = - case is_stateful do - true -> [{:id, unquote(id)} | unquote(opts)] - false -> [{:key, unquote(id)} | unquote(opts)] - end - - Phoenix.LiveView.Helpers.live_component(unquote(module), opts, unquote(do_block)) - end - end -end diff --git a/test/support/component_embedding_live_view.ex b/test/support/component_embedding_live_view.ex index c6318f6d..af1d1f5b 100644 --- a/test/support/component_embedding_live_view.ex +++ b/test/support/component_embedding_live_view.ex @@ -5,7 +5,6 @@ defmodule EpicenterWeb.Test.ComponentEmbeddingLiveView do quote do use EpicenterWeb, :live_view - import EpicenterWeb.LiveComponent.Helpers import EpicenterWeb.LiveHelpers, only: [assign_defaults: 2, noreply: 1] def mount(_params, _session, socket) do From ad60757db6385137c6d40b8628a1fb4aa5f2fe17 Mon Sep 17 00:00:00 2001 From: Lei Zhou Date: Thu, 15 Aug 2024 09:51:50 -0400 Subject: [PATCH 17/27] format code --- lib/epicenter_web/live/contacts_live.ex | 1 - lib/epicenter_web/live/potential_duplicates_live.ex | 4 +--- .../live_component/investigation_note_component.ex | 4 ++-- .../presenters/case_investigation_presenter.ex | 12 +++--------- .../presenters/contact_investigation_presenter.ex | 12 +++--------- test/epicenter_web/live/profile_live_test.exs | 4 +++- test/epicenter_web/views/form_test.exs | 1 + test/epicenter_web/views/multiselect_test.exs | 1 + 8 files changed, 14 insertions(+), 25 deletions(-) diff --git a/lib/epicenter_web/live/contacts_live.ex b/lib/epicenter_web/live/contacts_live.ex index a0f60a31..a12cbf8e 100644 --- a/lib/epicenter_web/live/contacts_live.ex +++ b/lib/epicenter_web/live/contacts_live.ex @@ -42,7 +42,6 @@ defmodule EpicenterWeb.ContactsLive do alias Epicenter.ContactInvestigations alias Epicenter.ContactsFilterError - @clock Application.compile_env(:epicenter, :clock) def mount(_params, session, socket) do diff --git a/lib/epicenter_web/live/potential_duplicates_live.ex b/lib/epicenter_web/live/potential_duplicates_live.ex index 418fb15f..915c703b 100644 --- a/lib/epicenter_web/live/potential_duplicates_live.ex +++ b/lib/epicenter_web/live/potential_duplicates_live.ex @@ -46,9 +46,7 @@ defmodule EpicenterWeb.PotentialDuplicatesLive do socket |> push_navigate( to: - "#{Routes.resolve_conflicts_path(socket, EpicenterWeb.ResolveConflictsLive, socket.assigns[:person])}?duplicate_person_ids=#{ - duplicate_person_ids - }" + "#{Routes.resolve_conflicts_path(socket, EpicenterWeb.ResolveConflictsLive, socket.assigns[:person])}?duplicate_person_ids=#{duplicate_person_ids}" ) |> noreply end diff --git a/lib/epicenter_web/live_component/investigation_note_component.ex b/lib/epicenter_web/live_component/investigation_note_component.ex index 2f72bbda..c26304ad 100644 --- a/lib/epicenter_web/live_component/investigation_note_component.ex +++ b/lib/epicenter_web/live_component/investigation_note_component.ex @@ -11,7 +11,8 @@ defmodule EpicenterWeb.InvestigationNoteComponent do |> Enum.map(fn {assigns, socket} -> socket |> assign(assigns) - |> assign(:note, Cases.preload_author(assigns.note)) end) + |> assign(:note, Cases.preload_author(assigns.note)) + end) end def render(assigns) do @@ -44,5 +45,4 @@ defmodule EpicenterWeb.InvestigationNoteComponent do socket.assigns.on_delete.(socket.assigns.note) socket |> noreply() end - end diff --git a/lib/epicenter_web/presenters/case_investigation_presenter.ex b/lib/epicenter_web/presenters/case_investigation_presenter.ex index e33504c2..e0d59dc4 100644 --- a/lib/epicenter_web/presenters/case_investigation_presenter.ex +++ b/lib/epicenter_web/presenters/case_investigation_presenter.ex @@ -73,9 +73,7 @@ defmodule EpicenterWeb.Presenters.CaseInvestigationPresenter do [ %{ text: - "Discontinued interview on #{case_investigation.interview_discontinued_at |> Format.date_time_with_presented_time_zone()}: #{ - case_investigation.interview_discontinue_reason - }", + "Discontinued interview on #{case_investigation.interview_discontinued_at |> Format.date_time_with_presented_time_zone()}: #{case_investigation.interview_discontinue_reason}", link: link_if_editable( person, @@ -197,9 +195,7 @@ defmodule EpicenterWeb.Presenters.CaseInvestigationPresenter do [ %{ text: - "Isolation dates: #{Format.date(case_investigation.isolation_monitoring_starts_on)} - #{ - Format.date(case_investigation.isolation_monitoring_ends_on) - }", + "Isolation dates: #{Format.date(case_investigation.isolation_monitoring_starts_on)} - #{Format.date(case_investigation.isolation_monitoring_ends_on)}", link: link_if_editable( person, @@ -227,9 +223,7 @@ defmodule EpicenterWeb.Presenters.CaseInvestigationPresenter do [ %{ text: - "Concluded isolation monitoring on #{concluded_isolation_monitoring_date(case_investigation)}. #{ - Gettext.gettext(Epicenter.Gettext, case_investigation.isolation_conclusion_reason) - }", + "Concluded isolation monitoring on #{concluded_isolation_monitoring_date(case_investigation)}. #{Gettext.gettext(Epicenter.Gettext, case_investigation.isolation_conclusion_reason)}", link: link_if_editable( person, diff --git a/lib/epicenter_web/presenters/contact_investigation_presenter.ex b/lib/epicenter_web/presenters/contact_investigation_presenter.ex index 3b80ad0b..5f22c64e 100644 --- a/lib/epicenter_web/presenters/contact_investigation_presenter.ex +++ b/lib/epicenter_web/presenters/contact_investigation_presenter.ex @@ -90,9 +90,7 @@ defmodule EpicenterWeb.Presenters.ContactInvestigationPresenter do defp interview_discontinued_at_history(contact_investigation) do %{ text: - "Discontinued interview on #{format_date(contact_investigation.interview_discontinued_at)}: #{ - contact_investigation.interview_discontinue_reason - }", + "Discontinued interview on #{format_date(contact_investigation.interview_discontinued_at)}: #{contact_investigation.interview_discontinue_reason}", link: link_if_editable( contact_investigation.exposed_person, @@ -133,9 +131,7 @@ defmodule EpicenterWeb.Presenters.ContactInvestigationPresenter do defp quarantine_dates_history(contact_investigation) do %{ text: - "Quarantine dates: #{Format.date(contact_investigation.quarantine_monitoring_starts_on)} - #{ - Format.date(contact_investigation.quarantine_monitoring_ends_on) - }", + "Quarantine dates: #{Format.date(contact_investigation.quarantine_monitoring_starts_on)} - #{Format.date(contact_investigation.quarantine_monitoring_ends_on)}", link: link_if_editable( contact_investigation.exposed_person, @@ -159,9 +155,7 @@ defmodule EpicenterWeb.Presenters.ContactInvestigationPresenter do defp quarantine_conclusion(contact_investigation) do %{ text: - "Concluded quarantine monitoring on #{Format.date(contact_investigation.quarantine_concluded_at)}: #{ - Gettext.gettext(Epicenter.Gettext, contact_investigation.quarantine_conclusion_reason) - }", + "Concluded quarantine monitoring on #{Format.date(contact_investigation.quarantine_concluded_at)}: #{Gettext.gettext(Epicenter.Gettext, contact_investigation.quarantine_conclusion_reason)}", link: link_if_editable( contact_investigation.exposed_person, diff --git a/test/epicenter_web/live/profile_live_test.exs b/test/epicenter_web/live/profile_live_test.exs index 411f19ea..8ed952f0 100644 --- a/test/epicenter_web/live/profile_live_test.exs +++ b/test/epicenter_web/live/profile_live_test.exs @@ -1119,7 +1119,9 @@ defmodule EpicenterWeb.ProfileLiveTest do current_user: @admin ) - updated_socket = %Phoenix.LiveView.Socket{assigns: %{person: alice, current_user: user, __changed__: %{}}} |> ProfileLive.assign_updated_person(alice) + updated_socket = + %Phoenix.LiveView.Socket{assigns: %{person: alice, current_user: user, __changed__: %{}}} |> ProfileLive.assign_updated_person(alice) + assert updated_socket.assigns.person.addresses |> tids() == ["address1"] assert updated_socket.assigns.person.assigned_to.tid == "assignee" assert updated_socket.assigns.person.lab_results |> tids() == ["lab1"] diff --git a/test/epicenter_web/views/form_test.exs b/test/epicenter_web/views/form_test.exs index 1655c397..df1cf487 100644 --- a/test/epicenter_web/views/form_test.exs +++ b/test/epicenter_web/views/form_test.exs @@ -27,6 +27,7 @@ defmodule EpicenterWeb.FormTest do form_data = %Movie{} |> Ecto.Changeset.change(Enum.into(data, %{})) + %{Phoenix.HTML.FormData.to_form(form_data, []) | action: "/url"} end diff --git a/test/epicenter_web/views/multiselect_test.exs b/test/epicenter_web/views/multiselect_test.exs index 771ca942..adc021d9 100644 --- a/test/epicenter_web/views/multiselect_test.exs +++ b/test/epicenter_web/views/multiselect_test.exs @@ -20,6 +20,7 @@ defmodule EpicenterWeb.MultiselectTest do form_data = %Movie{} |> Ecto.Changeset.change(Enum.into(data, %{})) + %{Phoenix.HTML.FormData.to_form(form_data, []) | action: "/url"} end From 66ab466e84410c23c37e5b9288719d813749d88e Mon Sep 17 00:00:00 2001 From: Lei Zhou Date: Thu, 15 Aug 2024 10:14:26 -0400 Subject: [PATCH 18/27] fix ci --- .github/workflows/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 83544d42..5ca30999 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,7 +20,7 @@ jobs: strategy: matrix: - postgres-version: [16.4-alpine, 17-alpine] # Add PostgreSQL 17 + postgres-version: [16.4-alpine, 17beta3-alpine⁠] services: postgres: @@ -41,7 +41,7 @@ jobs: fetch-depth: 0 - uses: erlef/setup-beam@v1 with: - otp-version: '27.0.1' + otp-version: '27' elixir-version: '1.17.2' - name: Install dependencies @@ -63,4 +63,4 @@ jobs: POSTGRES_HOST: localhost POSTGRES_PORT: 5432 SECRET_KEY_BASE: iuJS3FLMrRqbKug/CE4zGGd31eY6FMdmpQGjy8RMaQoxk59wAvSxuUKM6c/uaOo4 - continue-on-error: ${{ matrix.postgres-version == '17-alpine' }} \ No newline at end of file + continue-on-error: ${{ matrix.postgres-version == '17beta3-alpine⁠' }} \ No newline at end of file From 7c78a74949b20cccf954a56132ce51129c03bdbd Mon Sep 17 00:00:00 2001 From: Lei Zhou Date: Thu, 15 Aug 2024 10:31:22 -0400 Subject: [PATCH 19/27] fix ci: not use matrix, try postgres 16 first --- .github/workflows/main.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5ca30999..88d2acd9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,13 +18,9 @@ jobs: env: MIX_ENV: test - strategy: - matrix: - postgres-version: [16.4-alpine, 17beta3-alpine⁠] - services: postgres: - image: postgres:${{ matrix.postgres-version }} + image: postgres:16.4-alpine env: POSTGRES_PASSWORD: postgres options: >- @@ -41,7 +37,7 @@ jobs: fetch-depth: 0 - uses: erlef/setup-beam@v1 with: - otp-version: '27' + otp-version: '27.0.1' elixir-version: '1.17.2' - name: Install dependencies @@ -63,4 +59,3 @@ jobs: POSTGRES_HOST: localhost POSTGRES_PORT: 5432 SECRET_KEY_BASE: iuJS3FLMrRqbKug/CE4zGGd31eY6FMdmpQGjy8RMaQoxk59wAvSxuUKM6c/uaOo4 - continue-on-error: ${{ matrix.postgres-version == '17beta3-alpine⁠' }} \ No newline at end of file From 12cc92af7720a8fa7a61a431143af694b92da958 Mon Sep 17 00:00:00 2001 From: Lei Zhou Date: Thu, 15 Aug 2024 10:34:40 -0400 Subject: [PATCH 20/27] remove unused deps --- mix.lock | 2 -- 1 file changed, 2 deletions(-) diff --git a/mix.lock b/mix.lock index 5a201cbf..dc2f3e42 100644 --- a/mix.lock +++ b/mix.lock @@ -4,7 +4,6 @@ "certifi": {:hex, :certifi, "2.8.0", "d4fb0a6bb20b7c9c3643e22507e42f356ac090a1dcea9ab99e27e0376d695eba", [:rebar3], [], "hexpm", "6ac7efc1c6f8600b08d625292d4bbf584e14847ce1b6b5c44d983d273e1097ea"}, "combine": {:hex, :combine, "0.10.0", "eff8224eeb56498a2af13011d142c5e7997a80c8f5b97c499f84c841032e429f", [:mix], [], "hexpm", "1b1dbc1790073076580d0d1d64e42eae2366583e7aecd455d1215b0d16f2451b"}, "comeonin": {:hex, :comeonin, "5.3.2", "5c2f893d05c56ae3f5e24c1b983c2d5dfb88c6d979c9287a76a7feb1e1d8d646", [:mix], [], "hexpm", "d0993402844c49539aeadb3fe46a3c9bd190f1ecf86b6f9ebd71957534c95f04"}, - "connection": {:hex, :connection, "1.1.0", "ff2a49c4b75b6fb3e674bfc5536451607270aac754ffd1bdfe175abe4a6d7a68", [:mix], [], "hexpm", "722c1eb0a418fbe91ba7bd59a47e28008a189d47e37e0e7bb85585a016b2869c"}, "cowboy": {:hex, :cowboy, "2.12.0", "f276d521a1ff88b2b9b4c54d0e753da6c66dd7be6c9fca3d9418b561828a3731", [:make, :rebar3], [{:cowlib, "2.13.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "8a7abe6d183372ceb21caa2709bec928ab2b72e18a3911aa1771639bef82651e"}, "cowboy_telemetry": {:hex, :cowboy_telemetry, "0.4.0", "f239f68b588efa7707abce16a84d0d2acf3a0f50571f8bb7f56a15865aae820c", [:rebar3], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7d98bac1ee4565d31b62d59f8823dfd8356a169e7fcbb83831b8a5397404c9de"}, "cowlib": {:hex, :cowlib, "2.13.0", "db8f7505d8332d98ef50a3ef34b34c1afddec7506e4ee4dd4a3a266285d282ca", [:make, :rebar3], [], "hexpm", "e1e1284dc3fc030a64b1ad0d8382ae7e99da46c3246b815318a4b848873800a4"}, @@ -20,7 +19,6 @@ "floki": {:hex, :floki, "0.36.2", "a7da0193538c93f937714a6704369711998a51a6164a222d710ebd54020aa7a3", [:mix], [], "hexpm", "a8766c0bc92f074e5cb36c4f9961982eda84c5d2b8e979ca67f5c268ec8ed580"}, "gettext": {:hex, :gettext, "0.23.1", "821e619a240e6000db2fc16a574ef68b3bd7fe0167ccc264a81563cc93e67a31", [:mix], [{:expo, "~> 0.4.0", [hex: :expo, repo: "hexpm", optional: false]}], "hexpm", "19d744a36b809d810d610b57c27b934425859d158ebd56561bc41f7eeb8795db"}, "hackney": {:hex, :hackney, "1.18.0", "c4443d960bb9fba6d01161d01cd81173089686717d9490e5d3606644c48d121f", [:rebar3], [{:certifi, "~>2.8.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "~>6.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "~>1.0.0", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.3.1", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "~>1.1.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}, {:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "9afcda620704d720db8c6a3123e9848d09c87586dc1c10479c42627b905b5c5e"}, - "html_entities": {:hex, :html_entities, "0.5.2", "9e47e70598da7de2a9ff6af8758399251db6dbb7eebe2b013f2bbd2515895c3c", [:mix], [], "hexpm", "c53ba390403485615623b9531e97696f076ed415e8d8058b1dbaa28181f4fdcc"}, "idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"}, "inflex": {:hex, :inflex, "2.1.0", "a365cf0821a9dacb65067abd95008ca1b0bb7dcdd85ae59965deef2aa062924c", [:mix], [], "hexpm", "14c17d05db4ee9b6d319b0bff1bdf22aa389a25398d1952c7a0b5f3d93162dd8"}, "jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"}, From 3eab93f5d8f8f6b9c3c8528510353e41bb629bfa Mon Sep 17 00:00:00 2001 From: Lei Zhou Date: Thu, 15 Aug 2024 10:48:59 -0400 Subject: [PATCH 21/27] add matrix --- .github/workflows/main.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 88d2acd9..53da274f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,10 +17,14 @@ jobs: env: MIX_ENV: test + + strategy: + matrix: + postgres-version: [16.4-alpine] services: postgres: - image: postgres:16.4-alpine + image: postgres:${{ matrix.postgres-version }} env: POSTGRES_PASSWORD: postgres options: >- From 5783e82acbfae75f5038f7fdbb7d3a02dff2ad0a Mon Sep 17 00:00:00 2001 From: Lei Zhou Date: Thu, 15 Aug 2024 10:58:32 -0400 Subject: [PATCH 22/27] add postgres 17, allow to error --- .github/workflows/main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 53da274f..ec323e01 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,7 +20,7 @@ jobs: strategy: matrix: - postgres-version: [16.4-alpine] + postgres-version: [16.4-alpine, 17-alpine] services: postgres: @@ -63,3 +63,4 @@ jobs: POSTGRES_HOST: localhost POSTGRES_PORT: 5432 SECRET_KEY_BASE: iuJS3FLMrRqbKug/CE4zGGd31eY6FMdmpQGjy8RMaQoxk59wAvSxuUKM6c/uaOo4 + continue-on-error: ${{ matrix.postgres-version == '17-alpine' }} From c6a32dc6c48b64ec33b5c2acbe89f585cc911457 Mon Sep 17 00:00:00 2001 From: Lei Zhou Date: Thu, 15 Aug 2024 22:47:29 -0400 Subject: [PATCH 23/27] use <.link>; all tests passed and no warnings; remove future postgres matrix in ci --- .github/workflows/main.yml | 3 +- .../live/contacts_live.html.heex | 9 +- lib/epicenter_web/live/profile_live.ex | 8 +- lib/epicenter_web/live/profile_live.html.heex | 33 +- .../live_component/contact_investigation.ex | 147 ++++---- .../contact_investigation.html.heex | 29 +- .../case_investigation_presenter.ex | 345 ++++++++++-------- .../contact_investigation_presenter.ex | 195 ++++++---- 8 files changed, 418 insertions(+), 351 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ec323e01..53da274f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,7 +20,7 @@ jobs: strategy: matrix: - postgres-version: [16.4-alpine, 17-alpine] + postgres-version: [16.4-alpine] services: postgres: @@ -63,4 +63,3 @@ jobs: POSTGRES_HOST: localhost POSTGRES_PORT: 5432 SECRET_KEY_BASE: iuJS3FLMrRqbKug/CE4zGGd31eY6FMdmpQGjy8RMaQoxk59wAvSxuUKM6c/uaOo4 - continue-on-error: ${{ matrix.postgres-version == '17-alpine' }} diff --git a/lib/epicenter_web/live/contacts_live.html.heex b/lib/epicenter_web/live/contacts_live.html.heex index 55d03517..2c75f73a 100644 --- a/lib/epicenter_web/live/contacts_live.html.heex +++ b/lib/epicenter_web/live/contacts_live.html.heex @@ -48,10 +48,11 @@ />
- <%= live_redirect(full_name(person), - to: Routes.profile_path(EpicenterWeb.Endpoint, EpicenterWeb.ProfileLive, person), - data: [role: "profile-link-#{person.id}"] - ) %> + <.link + navigate={Routes.profile_path(EpicenterWeb.Endpoint, EpicenterWeb.ProfileLive, person)} + data-role={"profile-link-#{person.id}"}> + <%= full_name(person) %> + <%= person.id %> <%= exposure_date(person) %>