restore translated strings
This commit is contained in:
parent
3c270d9c12
commit
9317547630
3 changed files with 23 additions and 13 deletions
|
@ -79,7 +79,9 @@ class Organization(ServalaModelMixin, models.Model):
|
|||
support_message = _(
|
||||
"Need help? We're happy to help via the <a href='{support_url}'>support form</a>."
|
||||
).format(support_url=self.urls.support)
|
||||
return mark_safe(f"{message} {support_message}")
|
||||
return mark_safe(
|
||||
f'{message} <i class="bi bi-person-raised-hand"></i> {support_message}'
|
||||
)
|
||||
|
||||
@classmethod
|
||||
@transaction.atomic
|
||||
|
|
|
@ -616,7 +616,9 @@ class ServiceInstance(ServalaModelMixin, models.Model):
|
|||
context=context,
|
||||
)
|
||||
except IntegrityError:
|
||||
message = "An instance with this name already exists in this organization. Please choose a different name."
|
||||
message = _(
|
||||
"An instance with this name already exists in this organization. Please choose a different name."
|
||||
)
|
||||
raise ValidationError(organization.add_support_message(message))
|
||||
|
||||
try:
|
||||
|
@ -655,12 +657,12 @@ class ServiceInstance(ServalaModelMixin, models.Model):
|
|||
try:
|
||||
error_body = json.loads(e.body)
|
||||
reason = error_body.get("message", str(e))
|
||||
message = f"Kubernetes API error: {reason}."
|
||||
message = _(f"Kubernetes API error: {reason}.")
|
||||
raise ValidationError(organization.add_support_message(message))
|
||||
except (ValueError, TypeError):
|
||||
message = f"Kubernetes API error: {str(e)}."
|
||||
message = _(f"Kubernetes API error: {str(e)}.")
|
||||
raise ValidationError(organization.add_support_message(message))
|
||||
message = f"Error creating instance: {str(e)}."
|
||||
message = _(f"Error creating instance: {str(e)}.")
|
||||
raise ValidationError(organization.add_support_message(message))
|
||||
return instance
|
||||
|
||||
|
@ -682,18 +684,20 @@ class ServiceInstance(ServalaModelMixin, models.Model):
|
|||
self.save() # Updates updated_at timestamp
|
||||
except ApiException as e:
|
||||
if e.status == 404:
|
||||
message = "Service instance not found in Kubernetes. It may have been deleted externally."
|
||||
message = _(
|
||||
"Service instance not found in Kubernetes. It may have been deleted externally."
|
||||
)
|
||||
raise ValidationError(self.organization.add_support_message(message))
|
||||
try:
|
||||
error_body = json.loads(e.body)
|
||||
reason = error_body.get("message", str(e))
|
||||
message = f"Kubernetes API error updating instance: {reason}."
|
||||
message = _(f"Kubernetes API error updating instance: {reason}.")
|
||||
raise ValidationError(self.organization.add_support_message(message))
|
||||
except (ValueError, TypeError):
|
||||
message = f"Kubernetes API error updating instance: {str(e)}."
|
||||
message = _(f"Kubernetes API error updating instance: {str(e)}.")
|
||||
raise ValidationError(self.organization.add_support_message(message))
|
||||
except Exception as e:
|
||||
message = f"Error updating instance: {str(e)}."
|
||||
message = _(f"Error updating instance: {str(e)}.")
|
||||
raise ValidationError(self.organization.add_support_message(message))
|
||||
|
||||
@transaction.atomic
|
||||
|
|
|
@ -146,7 +146,9 @@ class ServiceOfferingDetailView(OrganizationViewMixin, HtmxViewMixin, DetailView
|
|||
if not form: # Should not happen if context_object is valid, but as a safeguard
|
||||
messages.error(
|
||||
self.request,
|
||||
self.organization.add_support_message("Could not initialize service form."),
|
||||
self.organization.add_support_message(
|
||||
_("Could not initialize service form.")
|
||||
),
|
||||
)
|
||||
return self.render_to_response(context)
|
||||
|
||||
|
@ -166,7 +168,7 @@ class ServiceOfferingDetailView(OrganizationViewMixin, HtmxViewMixin, DetailView
|
|||
messages.error(
|
||||
self.request,
|
||||
self.organization.add_support_message(
|
||||
f"Error creating instance: {str(e)}."
|
||||
_(f"Error creating instance: {str(e)}.")
|
||||
),
|
||||
)
|
||||
|
||||
|
@ -374,7 +376,7 @@ class ServiceInstanceUpdateView(
|
|||
messages.error(
|
||||
self.request,
|
||||
self.organization.add_support_message(
|
||||
f"Error updating instance: {str(e)}."
|
||||
_(f"Error updating instance: {str(e)}.")
|
||||
),
|
||||
)
|
||||
return self.form_invalid(form)
|
||||
|
@ -445,7 +447,9 @@ class ServiceInstanceDeleteView(
|
|||
messages.error(
|
||||
self.request,
|
||||
self.organization.add_support_message(
|
||||
f"An error occurred while trying to delete instance '{self.object.name}': {str(e)}."
|
||||
_(
|
||||
f"An error occurred while trying to delete instance '{self.object.name}': {str(e)}."
|
||||
)
|
||||
),
|
||||
)
|
||||
response = HttpResponse()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue