Skip to content

Commit

Permalink
Merge branch 'master' into m-series-get-app-fail
Browse files Browse the repository at this point in the history
  • Loading branch information
arunmathaisk authored Jul 4, 2024
2 parents 3a3fb12 + f61ae16 commit 46d2fdd
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 10 deletions.
9 changes: 3 additions & 6 deletions dashboard/src2/components/ObjectList.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
<template>
<div>
<AlertBanner
v-if="banner"
:title="banner.title"
:type="banner.type"
class="mb-4"
/>
<AlertBanner v-if="banner" v-bind="banner" class="mb-4">
<Button v-if="banner.button" v-bind="banner.button" class="ml-auto" />
</AlertBanner>
<div class="flex items-center justify-between">
<slot name="header-left" v-bind="context">
<div v-if="showControls" class="flex items-center space-x-2">
Expand Down
37 changes: 37 additions & 0 deletions dashboard/src2/objects/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,43 @@ export default {
type: 'Badge'
}
],
banner({ documentResource: site }) {
if (site.doc.broken_domain_error) {
return {
title:
'There was an error fetching an https certificate for your domain.',
type: 'error',
button: {
label: 'View Error',
variant: 'outline',
onClick() {
renderDialog(
h(
GenericDialog,
{
options: {
title: 'Error fetching certificate',
size: 'xl'
}
},
{
default: () => {
return h('pre', {
class:
'whitespace-pre-wrap text-sm rounded border-2 p-3 border-gray-200 bg-gray-100',
innerHTML: site.doc.broken_domain_error
});
}
}
)
);
}
}
};
} else {
return null;
}
},
primaryAction({ listResource: domains, documentResource: site }) {
return {
label: 'Add Domain',
Expand Down
5 changes: 3 additions & 2 deletions press/press/doctype/invoice/invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,8 @@ def finalize_invoice(self):
)
)

self.save()

if self.amount_due > 0:
if self.payment_mode == "Prepaid Credits":
self.add_comment(
Expand All @@ -287,8 +289,6 @@ def finalize_invoice(self):
if self.payment_mode == "Card":
self.create_stripe_invoice()

self.save()

if self.status == "Paid":
self.submit()
self.unsuspend_sites_if_applicable()
Expand Down Expand Up @@ -385,6 +385,7 @@ def create_stripe_invoice(self):
)
self.stripe_invoice_id = ""
self.stripe_invoice_url = ""
self.save()

if self.amount_due_with_tax <= 0:
return
Expand Down
8 changes: 8 additions & 0 deletions press/press/doctype/site/site.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,14 @@ def get_doc(self, doc):
doc.server_title = server.title
doc.inbound_ip = self.inbound_ip
doc.is_dedicated_server = is_dedicated_server(self.server)

if broken_domain_tls_certificate := frappe.db.get_value(
"Site Domain", {"site": self.name, "status": "Broken"}, "tls_certificate"
):
doc.broken_domain_error = frappe.db.get_value(
"TLS Certificate", broken_domain_tls_certificate, "error"
)

return doc

def site_action(allowed_status: List[str]):
Expand Down
2 changes: 1 addition & 1 deletion press/press/doctype/virtual_machine/virtual_machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ def update_servers(self):
"Pending": "Pending",
"Running": "Active",
"Terminated": "Archived",
"Stopped": "Archived",
"Stopped": "Pending",
}
for doctype in self.server_doctypes:
server = frappe.get_all(doctype, {"virtual_machine": self.name}, pluck="name")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"platform",
"series",
"copied_from",
"public",
"credentials_section",
"mariadb_root_password"
],
Expand Down Expand Up @@ -121,11 +122,17 @@
"fieldtype": "Data",
"label": "Snapshot ID",
"read_only": 1
},
{
"default": "1",
"fieldname": "public",
"fieldtype": "Check",
"label": "Public"
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-12-11 18:02:20.719052",
"modified": "2024-07-04 12:26:14.185070",
"modified_by": "Administrator",
"module": "Press",
"name": "Virtual Machine Image",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class VirtualMachineImage(Document):
instance_id: DF.Data
mariadb_root_password: DF.Password | None
platform: DF.Data | None
public: DF.Check
region: DF.Link
series: DF.Literal["n", "f", "m", "c", "p", "e", "r"]
size: DF.Int
Expand Down Expand Up @@ -170,6 +171,7 @@ def get_available_for_series(
frappe.qb.from_(images)
.select("name")
.where(images.status == "Available")
.where(images.public == 1)
.where(
images.series == series,
)
Expand Down

0 comments on commit 46d2fdd

Please sign in to comment.