mirror of
https://git.meshkee.com/Meshkee/dashboards.git
synced 2026-08-11 22:30:58 +04:30
Add optional git repo URL on Add Domain for storefront wiring.
Super Admin can opt into websites VM provision so Deploy shows on Websites without manual slug maps. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
42cb8efc62
commit
7d6c1cd4e3
@@ -227,6 +227,7 @@ export function BusinessesPage() {
|
||||
const [domainBusiness, setDomainBusiness] = useState<BusinessListItem | null>(null)
|
||||
const [domainId, setDomainId] = useState<number | null>(null)
|
||||
const [domainHost, setDomainHost] = useState('')
|
||||
const [domainGitRepoUrl, setDomainGitRepoUrl] = useState('')
|
||||
const [domainSubmitting, setDomainSubmitting] = useState(false)
|
||||
const [domainError, setDomainError] = useState('')
|
||||
|
||||
@@ -595,6 +596,7 @@ export function BusinessesPage() {
|
||||
setDomainBusiness(b)
|
||||
setDomainId(b.domainId)
|
||||
setDomainHost(b.domain ?? '')
|
||||
setDomainGitRepoUrl('')
|
||||
setDomainError('')
|
||||
setDomainOpen(true)
|
||||
}
|
||||
@@ -728,6 +730,7 @@ export function BusinessesPage() {
|
||||
if (!domainBusiness) return
|
||||
const host = domainHost.trim()
|
||||
if (!host) return
|
||||
const gitRepoUrl = domainGitRepoUrl.trim()
|
||||
|
||||
setDomainSubmitting(true)
|
||||
setDomainError('')
|
||||
@@ -748,7 +751,14 @@ export function BusinessesPage() {
|
||||
const created = (await addBusinessDomain(domainBusiness.id, {
|
||||
host,
|
||||
isPrimary: true,
|
||||
})) as { id: number; host: string; sslEnabled: boolean }
|
||||
...(gitRepoUrl ? { gitRepoUrl } : {}),
|
||||
})) as {
|
||||
id: number
|
||||
host: string
|
||||
sslEnabled: boolean
|
||||
deploySlug?: string | null
|
||||
provisionError?: string | null
|
||||
}
|
||||
setData((prev) => {
|
||||
if (!prev) return prev
|
||||
return {
|
||||
@@ -765,11 +775,22 @@ export function BusinessesPage() {
|
||||
),
|
||||
}
|
||||
})
|
||||
showToast(`Domain "${host}" added.`, 'success')
|
||||
if (created.provisionError) {
|
||||
showToast(`Domain "${host}" added, but storefront setup failed.`, 'error')
|
||||
showToast(created.provisionError, 'error')
|
||||
} else if (gitRepoUrl && created.deploySlug) {
|
||||
showToast(
|
||||
`Domain "${host}" added. Storefront deploy is ready on Websites.`,
|
||||
'success',
|
||||
)
|
||||
} else {
|
||||
showToast(`Domain "${host}" added.`, 'success')
|
||||
}
|
||||
}
|
||||
setDomainOpen(false)
|
||||
setDomainBusiness(null)
|
||||
setDomainId(null)
|
||||
setDomainGitRepoUrl('')
|
||||
} catch (err) {
|
||||
setDomainError(err instanceof ApiError ? err.message : 'Unable to save domain.')
|
||||
} finally {
|
||||
@@ -1278,6 +1299,7 @@ export function BusinessesPage() {
|
||||
setDomainOpen(false)
|
||||
setDomainBusiness(null)
|
||||
setDomainId(null)
|
||||
setDomainGitRepoUrl('')
|
||||
setDomainError('')
|
||||
}}
|
||||
>
|
||||
@@ -1292,10 +1314,31 @@ export function BusinessesPage() {
|
||||
id="domain-host"
|
||||
value={domainHost}
|
||||
onChange={(e) => setDomainHost(e.target.value)}
|
||||
placeholder="shop-a.local"
|
||||
placeholder="oaktasty.com"
|
||||
disabled={domainSubmitting}
|
||||
/>
|
||||
</div>
|
||||
{!domainId ? (
|
||||
<>
|
||||
<div style={{ height: 12 }} />
|
||||
<div className={styles.field}>
|
||||
<label htmlFor="domain-git-repo">Git repo URL (optional)</label>
|
||||
<input
|
||||
id="domain-git-repo"
|
||||
value={domainGitRepoUrl}
|
||||
onChange={(e) => setDomainGitRepoUrl(e.target.value)}
|
||||
placeholder="git@git.meshkee.com:Meshkee-Websites/oaktasty.git"
|
||||
disabled={domainSubmitting}
|
||||
autoComplete="off"
|
||||
spellCheck={false}
|
||||
/>
|
||||
<p className={styles.subText} style={{ marginTop: 6 }}>
|
||||
Fill to enable storefront Deploy on Websites. Leave empty for domain-only
|
||||
(dashboards).
|
||||
</p>
|
||||
</div>
|
||||
</>
|
||||
) : null}
|
||||
<div style={{ height: 12 }} />
|
||||
<div className={styles.actionsRow}>
|
||||
<button
|
||||
|
||||
@@ -26,6 +26,8 @@ export interface UpdateBusinessPayload {
|
||||
export interface AddDomainPayload {
|
||||
host: string
|
||||
isPrimary?: boolean
|
||||
/** When set, provisions storefront deploy on the websites VM. */
|
||||
gitRepoUrl?: string
|
||||
}
|
||||
|
||||
export interface DisableBusinessPayload {
|
||||
|
||||
@@ -138,11 +138,11 @@ Add to `/etc/hosts` (one line per tenant):
|
||||
|------|------|
|
||||
| `/login` | Login |
|
||||
| `/` | Home |
|
||||
| `/businesses` | Businesses list (migrate-from-old + delete-data for portfolios/blogs(+news)/customers + categories; single-select) |
|
||||
| `/businesses` | Businesses list (migrate-from-old + delete-data for portfolios/blogs(+news)/customers + categories; single-select). **Add domain** accepts optional Git repo URL → provisions storefront on websites VM and sets `deploy_slug` |
|
||||
| `/businesses/:businessId/invoices` | Business invoices list |
|
||||
| `/businesses/:businessId/invoices/new` | Issue invoice (full page) |
|
||||
| `/users` | Users |
|
||||
| `/websites` | Websites / domains |
|
||||
| `/websites` | Websites / domains (Deploy when `deploy_slug` set) |
|
||||
| `/settings` | Platform settings (invoice templates + item templates) |
|
||||
| `/settings/invoice-templates/new` | Create invoice template |
|
||||
| `/settings/invoice-templates/:templateId` | Edit invoice template |
|
||||
|
||||
Reference in New Issue
Block a user