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 [domainBusiness, setDomainBusiness] = useState<BusinessListItem | null>(null)
|
||||||
const [domainId, setDomainId] = useState<number | null>(null)
|
const [domainId, setDomainId] = useState<number | null>(null)
|
||||||
const [domainHost, setDomainHost] = useState('')
|
const [domainHost, setDomainHost] = useState('')
|
||||||
|
const [domainGitRepoUrl, setDomainGitRepoUrl] = useState('')
|
||||||
const [domainSubmitting, setDomainSubmitting] = useState(false)
|
const [domainSubmitting, setDomainSubmitting] = useState(false)
|
||||||
const [domainError, setDomainError] = useState('')
|
const [domainError, setDomainError] = useState('')
|
||||||
|
|
||||||
@@ -595,6 +596,7 @@ export function BusinessesPage() {
|
|||||||
setDomainBusiness(b)
|
setDomainBusiness(b)
|
||||||
setDomainId(b.domainId)
|
setDomainId(b.domainId)
|
||||||
setDomainHost(b.domain ?? '')
|
setDomainHost(b.domain ?? '')
|
||||||
|
setDomainGitRepoUrl('')
|
||||||
setDomainError('')
|
setDomainError('')
|
||||||
setDomainOpen(true)
|
setDomainOpen(true)
|
||||||
}
|
}
|
||||||
@@ -728,6 +730,7 @@ export function BusinessesPage() {
|
|||||||
if (!domainBusiness) return
|
if (!domainBusiness) return
|
||||||
const host = domainHost.trim()
|
const host = domainHost.trim()
|
||||||
if (!host) return
|
if (!host) return
|
||||||
|
const gitRepoUrl = domainGitRepoUrl.trim()
|
||||||
|
|
||||||
setDomainSubmitting(true)
|
setDomainSubmitting(true)
|
||||||
setDomainError('')
|
setDomainError('')
|
||||||
@@ -748,7 +751,14 @@ export function BusinessesPage() {
|
|||||||
const created = (await addBusinessDomain(domainBusiness.id, {
|
const created = (await addBusinessDomain(domainBusiness.id, {
|
||||||
host,
|
host,
|
||||||
isPrimary: true,
|
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) => {
|
setData((prev) => {
|
||||||
if (!prev) return prev
|
if (!prev) return prev
|
||||||
return {
|
return {
|
||||||
@@ -765,11 +775,22 @@ export function BusinessesPage() {
|
|||||||
),
|
),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
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')
|
showToast(`Domain "${host}" added.`, 'success')
|
||||||
}
|
}
|
||||||
|
}
|
||||||
setDomainOpen(false)
|
setDomainOpen(false)
|
||||||
setDomainBusiness(null)
|
setDomainBusiness(null)
|
||||||
setDomainId(null)
|
setDomainId(null)
|
||||||
|
setDomainGitRepoUrl('')
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
setDomainError(err instanceof ApiError ? err.message : 'Unable to save domain.')
|
setDomainError(err instanceof ApiError ? err.message : 'Unable to save domain.')
|
||||||
} finally {
|
} finally {
|
||||||
@@ -1278,6 +1299,7 @@ export function BusinessesPage() {
|
|||||||
setDomainOpen(false)
|
setDomainOpen(false)
|
||||||
setDomainBusiness(null)
|
setDomainBusiness(null)
|
||||||
setDomainId(null)
|
setDomainId(null)
|
||||||
|
setDomainGitRepoUrl('')
|
||||||
setDomainError('')
|
setDomainError('')
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -1292,10 +1314,31 @@ export function BusinessesPage() {
|
|||||||
id="domain-host"
|
id="domain-host"
|
||||||
value={domainHost}
|
value={domainHost}
|
||||||
onChange={(e) => setDomainHost(e.target.value)}
|
onChange={(e) => setDomainHost(e.target.value)}
|
||||||
placeholder="shop-a.local"
|
placeholder="oaktasty.com"
|
||||||
disabled={domainSubmitting}
|
disabled={domainSubmitting}
|
||||||
/>
|
/>
|
||||||
</div>
|
</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 style={{ height: 12 }} />
|
||||||
<div className={styles.actionsRow}>
|
<div className={styles.actionsRow}>
|
||||||
<button
|
<button
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ export interface UpdateBusinessPayload {
|
|||||||
export interface AddDomainPayload {
|
export interface AddDomainPayload {
|
||||||
host: string
|
host: string
|
||||||
isPrimary?: boolean
|
isPrimary?: boolean
|
||||||
|
/** When set, provisions storefront deploy on the websites VM. */
|
||||||
|
gitRepoUrl?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DisableBusinessPayload {
|
export interface DisableBusinessPayload {
|
||||||
|
|||||||
@@ -138,11 +138,11 @@ Add to `/etc/hosts` (one line per tenant):
|
|||||||
|------|------|
|
|------|------|
|
||||||
| `/login` | Login |
|
| `/login` | Login |
|
||||||
| `/` | Home |
|
| `/` | 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` | Business invoices list |
|
||||||
| `/businesses/:businessId/invoices/new` | Issue invoice (full page) |
|
| `/businesses/:businessId/invoices/new` | Issue invoice (full page) |
|
||||||
| `/users` | Users |
|
| `/users` | Users |
|
||||||
| `/websites` | Websites / domains |
|
| `/websites` | Websites / domains (Deploy when `deploy_slug` set) |
|
||||||
| `/settings` | Platform settings (invoice templates + item templates) |
|
| `/settings` | Platform settings (invoice templates + item templates) |
|
||||||
| `/settings/invoice-templates/new` | Create invoice template |
|
| `/settings/invoice-templates/new` | Create invoice template |
|
||||||
| `/settings/invoice-templates/:templateId` | Edit invoice template |
|
| `/settings/invoice-templates/:templateId` | Edit invoice template |
|
||||||
|
|||||||
Reference in New Issue
Block a user