Skip to content

Per-domain SMTP gateway tab in the domain details - #20

Closed
gott-alexander wants to merge 11 commits into
grommunio:masterfrom
gott-alexander:feature/per-domain-smtp-gateway
Closed

gott-alexander wants to merge 11 commits into
grommunio:masterfrom
gott-alexander:feature/per-domain-smtp-gateway

Conversation

@gott-alexander

@gott-alexander gott-alexander commented Sep 3, 2026 •

Copy link
Copy Markdown

Summary

Adds an "SMTP gateway" tab to the domain details view, allowing
administrators to configure a per-domain outbound relay (smart-host):
host, port, encryption mode, credentials, description and an
enable/disable toggle.

Changes

  • src/containers/SmtpGateway.tsx (new): the gateway form. It is a
    controlled component that exposes its data buffer to the parent via an
    imperative handle (forwardRef/useImperativeHandle) — the same
    pattern as the "Disabled plugins" tab, so the domain details' existing
    Save button drives persistence and no separate save flow is introduced.
    The password field follows the common password-field UX: it is sent
    only when edited; leaving it empty keeps the stored password, and a
    passwordSet flag from the API indicates whether one is stored.
  • src/containers/DomainDetails.tsx: register the fourth tab and route
    the Save button to a PUT /api/v1/domains/<ID>/smtpGateway request
    when the tab is active; errors from the backend are surfaced through
    the existing snackbar.

Verification

Built and verified the production bundle contains the gateway tab; form
round-trip against the API (save, reload, password-keep behaviour,
backend validation errors shown on invalid input).

image

Alexander and others added 4 commits September 3, 2026 13:21
Adds a new 'SMTP gateway' tab to the domain details view that lets
admins configure the per-domain outbound SMTP server (smart-host)
without leaving the web UI.

Changes:

  * `src/containers/SmtpGateway.tsx` — new component that renders
    the form (host, port, encryption, username, password, from
    address, description) and uses the `useAPI` hook to talk to
    the new REST endpoint mounted by grommunio-admin-api. Password
    field is masked and only sent on save when populated.
  * `src/containers/DomainDetails.tsx` — fourth tab is rendered
    conditionally and a ref-based handle lets the parent page
    invoke `saveSmtpGateway` from the toolbar Save button, so the
    existing save flow keeps working.

Companion changes: grommunio/gromox#<PR> and
grommunio/admin-api#<PR>.
from_address is no longer consumed anywhere (smart-host routing is
handled by the MTA); the form field had no effect.
Fix the header comment that still described an onSave prop from an
earlier iteration (the component uses an imperative handle), and drop
the unused isValid() handle export.
@StefanAkie

Copy link
Copy Markdown
Member

Could you please not commit the tinymce folder?

@StefanAkie

Copy link
Copy Markdown
Member

Really impressive code - but way too obfuscated. Why are you using a forward ref and imperative handle if you can simply use props and/or define necessary components in the child component.

image

Second, why are your request functions in the components? Use api.js, they don't need to be recreated every single time.

@StefanAkie

Copy link
Copy Markdown
Member

Also i'm 99% convinced that this is AI slop and you can tell.

@gott-alexander

gott-alexander commented Sep 14, 2026 •

Copy link
Copy Markdown
Author

Fuck. I accidentally committed the wrong changes in the last commit. It was supposed to be just a few files. I'm not a programmer. I've mostly done things by try and error and google. How do I undo this? I'll fix that.

@gott-alexander

Copy link
Copy Markdown
Author

Should I withdraw the pull request and create a new one once I've properly integrated the SMTP gateway into the DomainDetails, or should I just post a note here saying that it's done? It'll take a few days for me to fix and test this again.

@StefanAkie

Copy link
Copy Markdown
Member

No need for another PR and you did remove the tinymce files, but your integration is still unacceptable.

API calls are not supposed to be part of a component and 2. useImperativeHandle is a terrible design choice here

@gott-alexander

gott-alexander commented Sep 14, 2026 •

Copy link
Copy Markdown
Author

In which JavaScript file should I add the API call instead of the TSX file? I don't understand how else I can get those values. If I knew how DomainDetailsState gets its values, I could adjust it accordingly.

@StefanAkie

StefanAkie commented Sep 14, 2026 •

Copy link
Copy Markdown
Member

You should use the entire redux boilerplate:
src/actions/ src/reducers/ src/api.ts

@gott-alexander
gott-alexander deleted the feature/per-domain-smtp-gateway branch September 15, 2026 20:31
@gott-alexander
gott-alexander restored the feature/per-domain-smtp-gateway branch September 15, 2026 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants