-
Notifications
You must be signed in to change notification settings - Fork 75
feat: account level default ingestion #2839
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
5440302
6fd9a98
3acafdd
4bee600
717b55c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -29,47 +29,57 @@ | |||||
| </section> | ||||||
|
|
||||||
| <section :if={@flag_multibackend == true and Logflare.Backends.Adaptor.supports_default_ingest?(@backend)} class="mx-auto container pt-3 tw-flex tw-flex-col tw-gap-4"> | ||||||
| <h4>Default Ingest Sources</h4> | ||||||
| <p> | ||||||
| Sources configured to use this backend as a default ingest destination. | ||||||
| </p> | ||||||
| <h4>Ingest Configuration</h4> | ||||||
|
|
||||||
| <div :if={not Enum.empty?(@available_sources || [])}> | ||||||
| <.button phx-click="toggle_default_ingest_form" variant="secondary"> | ||||||
| <%= if @show_default_ingest_form? do %> | ||||||
| Cancel | ||||||
| <% else %> | ||||||
| Add a Source | ||||||
| <% end %> | ||||||
| </.button> | ||||||
| </div> | ||||||
| <%= if @backend.default_ingest? do %> | ||||||
| <div class="alert alert-info"> | ||||||
| <i class="fas fa-info-circle"></i> | ||||||
| <strong>Ingest from all sources:</strong> This backend is configured to receive logs from ALL your sources automatically. | ||||||
| To limit this backend to specific sources, disable the "Ingest from all sources" option in the backend settings. | ||||||
| </div> | ||||||
| <% else %> | ||||||
| <p> | ||||||
| This backend only receives logs from sources explicitly configured below. | ||||||
| To make this backend receive logs from ALL your sources, enable the "Ingest from all sources" option in the backend settings. | ||||||
| </p> | ||||||
|
|
||||||
| <.form :let={f} :if={@show_default_ingest_form?} id="default_ingest" for={%{}} as={:default_ingest} action="#" phx-submit="save_default_ingest"> | ||||||
| <div class="form-group"> | ||||||
| <%= label(f, :source_id, "Source") %> | ||||||
| <%= select(f, :source_id, Enum.map(@available_sources || [], fn s -> {s.name, s.id} end), | ||||||
| class: "form-control", | ||||||
| prompt: [key: "Choose a source"] | ||||||
| ) %> | ||||||
| <small id="source_id" class="form-text text-muted">This source will use this backend as its default ingest destination. Only sources with default ingest backend support enabled are shown.</small> | ||||||
| <div :if={length(@available_sources || []) > 0}> | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| <.button phx-click="toggle_default_ingest_form" variant="secondary"> | ||||||
| <%= if @show_default_ingest_form? do %> | ||||||
| Cancel | ||||||
| <% else %> | ||||||
| Add a Source | ||||||
| <% end %> | ||||||
| </.button> | ||||||
| </div> | ||||||
|
|
||||||
| <%= hidden_input(f, :backend_id, value: @backend.id) %> | ||||||
| <%= submit("Save", class: "btn btn-primary") %> | ||||||
| </.form> | ||||||
| <.form :let={f} :if={@show_default_ingest_form?} id="default_ingest" for={%{}} as={:default_ingest} action="#" phx-submit="save_default_ingest"> | ||||||
| <div class="form-group"> | ||||||
| <%= label(f, :source_id, "Source") %> | ||||||
| <%= select(f, :source_id, Enum.map(@available_sources || [], fn s -> {s.name, s.id} end), | ||||||
| class: "form-control", | ||||||
| prompt: [key: "Choose a source"] | ||||||
| ) %> | ||||||
| <small id="source_id" class="form-text text-muted">Select a source to send its logs to this backend.</small> | ||||||
| </div> | ||||||
|
|
||||||
| <p :if={Enum.empty?(@default_ingest_sources || [])}>No sources configured for default ingest</p> | ||||||
| <ul :for={source <- @default_ingest_sources || []} class="tw-flex tw-flex-row tw-gap-4"> | ||||||
| <li class="list-group-item tw-pointer-none tw-w-full tw-flex tw-flex-row tw-justify-between"> | ||||||
| <span> | ||||||
| Source <code><%= source.name %></code> uses this backend as default ingest | ||||||
| </span> | ||||||
| <%= hidden_input(f, :backend_id, value: @backend.id) %> | ||||||
| <%= submit("Save", class: "btn btn-primary") %> | ||||||
| </.form> | ||||||
|
|
||||||
| <.button phx-click="remove_default_ingest" phx-value-source_id={source.id} variant="danger"> | ||||||
| Remove | ||||||
| </.button> | ||||||
| </li> | ||||||
| </ul> | ||||||
| <p :if={Enum.empty?(@backend.sources || [])}>No sources configured yet</p> | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems this is a pattern from before this pull request, but it would be great to remove the conditionals such as |
||||||
| <ul :for={source <- @backend.sources || []} class="tw-flex tw-flex-row tw-gap-4"> | ||||||
| <li class="list-group-item tw-pointer-none tw-w-full tw-flex tw-flex-row tw-justify-between"> | ||||||
| <span> | ||||||
| Source <code><%= source.name %></code> sends logs to this backend | ||||||
| </span> | ||||||
|
|
||||||
| <.button phx-click="remove_source" phx-value-source_id={source.id} variant="danger"> | ||||||
| Remove | ||||||
| </.button> | ||||||
| </li> | ||||||
| </ul> | ||||||
| <% end %> | ||||||
| </section> | ||||||
|
|
||||||
| <section class="mx-auto container pt-3 tw-flex tw-flex-col tw-gap-4"> | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if you folks decide the UI but I wonder if you should move the toggle here, so someone who wants to manage sources does not need to go to another page, then come back here, to control them.