Skip to content

Commit

Permalink
Merge pull request #1703 from Logflare/feat/display-endpoints-auth
Browse files Browse the repository at this point in the history
feat: display whether endpoints auth is enabled on index page
  • Loading branch information
Ziinc authored Oct 2, 2023
2 parents 5c5b9c6 + a55893f commit 4991fc9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/logflare_web/live/endpoints/actions/index.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@
<%= endpoint.description %>
</p>
<div class="tw-text-sm">
<span :if={endpoint.enable_auth} title="Auth enabled">
<i class="fas fa-lock"></i>
</span>

<span :if={!endpoint.enable_auth} title="Auth disabled">
<i class="fas fa-lock-open"></i>
</span>
<span>caches: <%= endpoint.metrics.cache_count %></span>
</div>
</li>
Expand Down
7 changes: 7 additions & 0 deletions lib/logflare_web/live/endpoints/endpoints_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ defmodule LogflareWeb.EndpointsLive do
# set changeset
|> assign(:endpoint_changeset, Endpoints.change_query(endpoint, %{}))

# index page
%{assigns: %{live_action: :index}} = socket ->
socket
|> refresh_endpoints()
|> assign(:endpoint_changeset, nil)
|> assign(:query_result_rows, nil)

other ->
other
# reset the changeset
Expand Down
1 change: 1 addition & 0 deletions test/logflare_web/live_views/endpoints_live_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ defmodule LogflareWeb.EndpointsLiveTest do

# description
assert has_element?(view, "ul li p", endpoint.description)
assert has_element?(view, "ul li *[title='Auth enabled']")

# link to show
view
Expand Down

0 comments on commit 4991fc9

Please sign in to comment.