Compare commits
4 Commits
feature/cl
...
hotfix/dom
| Author | SHA1 | Date | |
|---|---|---|---|
| 0d914f5973 | |||
| fbeb089b9e | |||
| 269c9e47c9 | |||
| c9e3fe1dbc |
@@ -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",
|
||||||
)
|
)
|
||||||
.eq("agency_id", context.agencyId)
|
.eq("agency_id", context.agencyId)
|
||||||
.order("updated_at", { ascending: false })
|
.order("updated_at", { ascending: false })
|
||||||
@@ -113,6 +113,30 @@ export default async function DashboardPage() {
|
|||||||
{ data: ActionLogSummary[] | null },
|
{ data: ActionLogSummary[] | null },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const domainSubscriptionIds = Array.from(
|
||||||
|
new Set(
|
||||||
|
(domains ?? [])
|
||||||
|
.map((domain) => domain.subscription_id)
|
||||||
|
.filter((id): id is string => Boolean(id)),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
const { data: domainSubscriptions } =
|
||||||
|
domainSubscriptionIds.length > 0
|
||||||
|
? await supabase
|
||||||
|
.from("plesk_subscriptions")
|
||||||
|
.select("id, status")
|
||||||
|
.eq("agency_id", context.agencyId)
|
||||||
|
.in("id", domainSubscriptionIds)
|
||||||
|
: { data: [] };
|
||||||
|
|
||||||
|
const subscriptionStatusById = new Map<string, string | null>(
|
||||||
|
(domainSubscriptions ?? []).map((subscription: any) => [
|
||||||
|
String(subscription.id),
|
||||||
|
subscription?.status ? String(subscription.status) : null,
|
||||||
|
]),
|
||||||
|
);
|
||||||
|
|
||||||
const autoSyncByInstance = new Map<
|
const autoSyncByInstance = new Map<
|
||||||
string,
|
string,
|
||||||
{ status: string; created_at: string; error_message: string | null }
|
{ status: string; created_at: string; error_message: string | null }
|
||||||
@@ -167,7 +191,16 @@ export default async function DashboardPage() {
|
|||||||
<DashboardControls
|
<DashboardControls
|
||||||
instances={instances ?? []}
|
instances={instances ?? []}
|
||||||
subscriptions={subscriptions ?? []}
|
subscriptions={subscriptions ?? []}
|
||||||
domains={domains ?? []}
|
domains={(domains ?? []).map((domain) => {
|
||||||
|
const joinedStatus = domain.subscription_id
|
||||||
|
? subscriptionStatusById.get(domain.subscription_id)
|
||||||
|
: null;
|
||||||
|
|
||||||
|
return {
|
||||||
|
...domain,
|
||||||
|
status: joinedStatus ?? "unknown",
|
||||||
|
};
|
||||||
|
})}
|
||||||
autoSyncByInstance={Object.fromEntries(autoSyncByInstance.entries())}
|
autoSyncByInstance={Object.fromEntries(autoSyncByInstance.entries())}
|
||||||
/>
|
/>
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
Reference in New Issue
Block a user