Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feat/handle-network-c…
Browse files Browse the repository at this point in the history
…hanges-apple
  • Loading branch information
jamilbk committed Mar 26, 2024
2 parents b99abe7 + ecce024 commit 1aec868
Show file tree
Hide file tree
Showing 29 changed files with 757 additions and 348 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Don't allow Git to mess up line endings, ever
# https://github.com/actions/checkout/issues/135#issuecomment-613329879
* -text
* -text eol=lf
8 changes: 8 additions & 0 deletions docs/MAINTAINERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ Table of Contents:

## Publish Clients

### Android Client

-

### Apple Client

- Log in to the following URL: https://appstoreconnect.apple.com/
Expand Down Expand Up @@ -65,3 +69,7 @@ Table of Contents:
the `+` icon
- From here it's the same as the instructions above to type a description,
etc...

## Breaking API changes

We should notify customers 2 weeks in advance for any API-breaking changes.
2 changes: 1 addition & 1 deletion elixir/apps/api/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ defmodule API.MixProject do
{:plug_cowboy, "~> 2.7"},

# Observability deps
{:telemetry_metrics, "~> 0.6"},
{:telemetry_metrics, "~> 1.0"},
{:telemetry_poller, "~> 1.0"},
{:opentelemetry_cowboy, "~> 0.3"},
{:opentelemetry_phoenix, "~> 1.1"},
Expand Down
2 changes: 1 addition & 1 deletion elixir/apps/domain/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ defmodule Domain.MixProject do
{:plug, "~> 1.15"},
{:telemetry, "~> 1.0"},
{:telemetry_poller, "~> 1.0"},
{:telemetry_metrics, "~> 0.6.2"},
{:telemetry_metrics, "~> 1.0"},
{:logger_json, "~> 5.1"},
{:recon, "~> 2.5"},
{:observer_cli, "~> 1.7"},
Expand Down
2 changes: 1 addition & 1 deletion elixir/apps/web/lib/web/components/core_components.ex
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ defmodule Web.CoreComponents do

def logo(assigns) do
~H"""
<a href="https://www.firezone.dev/?utm_source=product" class="flex items-center mb-6 text-2xl">
<a href={~p"/"} class="flex items-center mb-6 text-2xl">
<img src={~p"/images/logo.svg"} class="mr-3 h-8" alt="Firezone Logo" />
<span class="self-center text-2xl font-medium whitespace-nowrap">
Firezone
Expand Down
61 changes: 11 additions & 50 deletions elixir/apps/web/lib/web/components/form_components.ex
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ defmodule Web.FormComponents do
value={@value}
checked={@checked}
class={[
"rounded border-zinc-300 text-zinc-900",
"bg-neutral-50",
"border border-neutral-300 text-neutral-900 rounded",
"checked:bg-accent-500 checked:hover:bg-accent-500",
@class
]}
Expand All @@ -142,7 +143,8 @@ defmodule Web.FormComponents do
class={[
"text-sm bg-neutral-50",
"border border-neutral-300 text-neutral-900 rounded",
"block w-full p-2.5"
"block w-full p-2.5",
@errors != [] && "border-rose-400"
]}
multiple={@multiple}
{@rest}
Expand Down Expand Up @@ -174,7 +176,8 @@ defmodule Web.FormComponents do
class={[
"text-sm bg-neutral-50",
"border border-neutral-300 text-neutral-900 rounded",
"block w-full p-2.5"
"block w-full p-2.5",
@errors != [] && "border-rose-400"
]}
multiple={@multiple}
{@rest}
Expand All @@ -195,9 +198,11 @@ defmodule Web.FormComponents do
id={@id}
name={@name}
class={[
"mt-2 block w-full rounded text-zinc-900 sm:text-sm sm:leading-6",
"phx-no-feedback:border-zinc-300",
"min-h-[6rem] border-zinc-300",
"mt-2 block w-full rounded sm:text-sm sm:leading-6",
"bg-neutral-50",
"border border-neutral-300 text-neutral-900 rounded",
"phx-no-feedback:border-neutral-300",
"min-h-[6rem] border-neutral-300",
@errors != [] && "border-rose-400"
]}
{@rest}
Expand Down Expand Up @@ -551,48 +556,4 @@ defmodule Web.FormComponents do

[text[size], spacing[size]]
end

### Forms ###

@doc """
Renders a simple form.
## Examples
<.simple_form for={@form} phx-change="validate" phx-submit="save">
<.input field={@form[:email]} label="Email"/>
<.input field={@form[:username]} label="Username" />
<:actions>
<.button>Save</.button>
</:actions>
</.simple_form>
"""
attr :for, :any, required: true, doc: "the datastructure for the form"
attr :as, :any, default: nil, doc: "the server side parameter to collect all input under"

attr :rest, :global,
include: ~w(autocomplete name rel action enctype method novalidate target),
doc: "the arbitrary HTML attributes to apply to the form tag"

slot :inner_block, required: true
slot :actions, doc: "the slot for form actions, such as a submit button"

def simple_form(assigns) do
~H"""
<.form :let={f} for={@for} as={@as} {@rest}>
<div class="space-y-8 bg-white">
<%= render_slot(@inner_block, f) %>
<div
:for={action <- @actions}
class={[
"mt-2 flex items-center gap-6",
(length(@actions) > 1 && "justify-between") || "justify-end"
]}
>
<%= render_slot(action, f) %>
</div>
</div>
</.form>
"""
end
end
19 changes: 14 additions & 5 deletions elixir/apps/web/lib/web/components/layouts/app.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,20 @@

<:bottom>
<div class="absolute bottom-0 left-0 justify-left p-4 space-x-4 w-full lg:flex bg-white z-20">
<.link target="_blank" href="https://firezone.statuspage.io">
<.badge>
Platform status
</.badge>
</.link>
<a
target="_blank"
href="https://www.firezone.dev/kb?utm_source=product"
class="text-neutral-700 hover:text-neutral-900 md:hidden"
>
Docs
</a>
<a
target="_blank"
href="https://firezone.statuspage.io"
class="text-neutral-700 hover:text-neutral-900 md:hidden"
>
Status
</a>
</div>
</:bottom>
</.sidebar>
Expand Down
20 changes: 16 additions & 4 deletions elixir/apps/web/lib/web/components/navigation_components.ex
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,29 @@ defmodule Web.NavigationComponents do
<.icon name="hero-bars-3-center-left" class="w-6 h-6" />
<span class="sr-only">Toggle sidebar</span>
</button>
<a
href="https://www.firezone.dev/?utm_source=product"
class="flex items-center justify-between mr-4"
>
<a href={~p"/"} class="flex items-center justify-between mr-4">
<img src={~p"/images/logo.svg"} class="mr-3 h-8" alt="Firezone Logo" />
<span class="self-center text-2xl font-medium whitespace-nowrap">
Firezone
</span>
</a>
</div>
<div class="flex items-center lg:order-2">
<a
target="_blank"
href="https://www.firezone.dev/kb?utm_source=product"
class="mr-6 mt-1 text-neutral-700 hover:text-neutral-900 md:ml-2 hidden md:block"
>
Docs
</a>
<a
target="_blank"
href="https://firezone.statuspage.io"
class="mr-6 mt-1 text-neutral-700 hover:text-neutral-900 md:ml-2 hidden md:block"
>
Status
</a>
<.dropdown id="user-menu">
<:button>
<span class="sr-only">Open user menu</span>
Expand Down
2 changes: 1 addition & 1 deletion elixir/apps/web/lib/web/live/clients/show.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ defmodule Web.Clients.Show do
def mount(%{"id" => id}, _session, socket) do
with {:ok, client} <-
Clients.fetch_client_by_id(id, socket.assigns.subject,
preload: [:actor, last_used_token: [identity: [:provider]]]
preload: [:online?, :actor, last_used_token: [identity: [:provider]]]
) do
if connected?(socket) do
:ok = Clients.subscribe_to_clients_presence_for_actor(client.actor)
Expand Down
38 changes: 17 additions & 21 deletions elixir/apps/web/lib/web/live/policies/edit.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ defmodule Web.Policies.Edit do

socket =
assign(socket,
page_title: "Edit #{policy.id}",
page_title: "Edit Policy #{policy.id}",
policy: policy,
form: form
)
Expand All @@ -37,29 +37,25 @@ defmodule Web.Policies.Edit do
</.breadcrumbs>
<.section>
<:title><%= "#{@page_title}: #{@policy.id}" %></:title>
<:title><%= @page_title %></:title>
<:content>
<div class="max-w-2xl px-4 py-8 mx-auto lg:py-16">
<h2 class="mb-4 text-xl text-neutral-900">Edit Policy details</h2>
<.simple_form
for={@form}
class="space-y-4 lg:space-y-6"
phx-submit="submit"
phx-change="validate"
>
<.input
field={@form[:description]}
type="textarea"
label="Policy Description"
placeholder="Enter a policy description here"
phx-debounce="300"
/>
<:actions>
<.submit_button phx-disable-with="Updating Policy...">
Save
</.submit_button>
</:actions>
</.simple_form>
<.form for={@form} class="space-y-4 lg:space-y-6" phx-submit="submit" phx-change="validate">
<div class="grid gap-4 mb-4 sm:grid-cols-1 sm:gap-6 sm:mb-6">
<.input
field={@form[:description]}
type="textarea"
label="Policy Description"
placeholder="Enter a policy description here"
phx-debounce="300"
/>
</div>
<.submit_button phx-disable-with="Updating Policy...">
Save
</.submit_button>
</.form>
</div>
</:content>
</.section>
Expand Down
86 changes: 41 additions & 45 deletions elixir/apps/web/lib/web/live/policies/new.ex
Original file line number Diff line number Diff line change
Expand Up @@ -53,53 +53,49 @@ defmodule Web.Policies.New do
</p>
</div>
<.simple_form
:if={@actor_groups != []}
for={@form}
phx-submit="submit"
phx-change="validate"
>
<.form :if={@actor_groups != []} for={@form} phx-submit="submit" phx-change="validate">
<.base_error form={@form} field={:base} />
<.input
field={@form[:actor_group_id]}
label="Group"
type="group_select"
options={Web.Groups.Components.select_options(@actor_groups)}
value={@actor_group_id || @form[:actor_group_id].value}
disabled={not is_nil(@actor_group_id)}
required
/>
<.input
field={@form[:resource_id]}
label="Resource"
type="select"
options={
Enum.map(@resources, fn resource ->
group_names = resource.gateway_groups |> Enum.map(& &1.name)
<div class="grid gap-4 mb-4 sm:grid-cols-1 sm:gap-6 sm:mb-6">
<.input
field={@form[:actor_group_id]}
label="Group"
type="group_select"
options={Web.Groups.Components.select_options(@actor_groups)}
value={@actor_group_id || @form[:actor_group_id].value}
disabled={not is_nil(@actor_group_id)}
required
/>
<.input
field={@form[:resource_id]}
label="Resource"
type="select"
options={
Enum.map(@resources, fn resource ->
group_names = resource.gateway_groups |> Enum.map(& &1.name)
[
key: "#{resource.name} - #{Enum.join(group_names, ",")}",
value: resource.id
]
end)
}
value={@resource_id || @form[:resource_id].value}
disabled={not is_nil(@resource_id)}
required
/>
<.input
field={@form[:description]}
type="textarea"
label="Description"
placeholder="Enter a reason for creating a policy here"
phx-debounce="300"
/>
</div>
[
key: "#{resource.name} - #{Enum.join(group_names, ",")}",
value: resource.id
]
end)
}
value={@resource_id || @form[:resource_id].value}
disabled={not is_nil(@resource_id)}
required
/>
<.input
field={@form[:description]}
type="textarea"
label="Description"
placeholder="Enter a reason for creating a policy here"
phx-debounce="300"
/>
<:actions>
<.button phx-disable-with="Creating Policy..." class="w-full">
Create Policy
</.button>
</:actions>
</.simple_form>
<.submit_button phx-disable-with="Creating Policy..." class="w-full">
Create Policy
</.submit_button>
</.form>
</div>
</:content>
</.section>
Expand Down

0 comments on commit 1aec868

Please sign in to comment.