Merge pull request 'fix(ui): show subscription status on domains list' (#11) from feature/cl4-domain-status-from-subscription into master
Reviewed-on: http://gitea.lan:3000/robbond/pleskSaas/pulls/11
This commit was merged in pull request #11.
This commit is contained in:
@@ -50,7 +50,7 @@ export default async function DashboardPage() {
|
|||||||
supabase
|
supabase
|
||||||
.from("plesk_domains")
|
.from("plesk_domains")
|
||||||
.select(
|
.select(
|
||||||
"id, plesk_instance_id, subscription_id, domain_name, status, hosting_type, source_created_at, aliases_count, updated_at",
|
"id, plesk_instance_id, subscription_id, status, domain_name, hosting_type, source_created_at, aliases_count, updated_at, subscription:plesk_subscriptions(status)",
|
||||||
)
|
)
|
||||||
.eq("agency_id", context.agencyId)
|
.eq("agency_id", context.agencyId)
|
||||||
.order("updated_at", { ascending: false })
|
.order("updated_at", { ascending: false })
|
||||||
@@ -107,6 +107,9 @@ export default async function DashboardPage() {
|
|||||||
source_created_at: string | null;
|
source_created_at: string | null;
|
||||||
aliases_count: number | null;
|
aliases_count: number | null;
|
||||||
updated_at: string;
|
updated_at: string;
|
||||||
|
subscription: {
|
||||||
|
status: string | null;
|
||||||
|
} | null;
|
||||||
}> | null;
|
}> | null;
|
||||||
},
|
},
|
||||||
{ data: BillingSummary | null },
|
{ data: BillingSummary | null },
|
||||||
@@ -167,7 +170,16 @@ export default async function DashboardPage() {
|
|||||||
<DashboardControls
|
<DashboardControls
|
||||||
instances={instances ?? []}
|
instances={instances ?? []}
|
||||||
subscriptions={subscriptions ?? []}
|
subscriptions={subscriptions ?? []}
|
||||||
domains={domains ?? []}
|
domains={(domains ?? []).map((domain) => {
|
||||||
|
const joinedStatus = Array.isArray(domain.subscription)
|
||||||
|
? domain.subscription[0]?.status
|
||||||
|
: domain.subscription?.status;
|
||||||
|
|
||||||
|
return {
|
||||||
|
...domain,
|
||||||
|
status: joinedStatus ?? "unknown",
|
||||||
|
};
|
||||||
|
})}
|
||||||
autoSyncByInstance={Object.fromEntries(autoSyncByInstance.entries())}
|
autoSyncByInstance={Object.fromEntries(autoSyncByInstance.entries())}
|
||||||
/>
|
/>
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
Reference in New Issue
Block a user