Move message triggering into CloudOutputDevice so that the campaign link can include the cluster_id.

CURA-9221
This commit is contained in:
joeydelarago 2022-08-26 10:57:35 +02:00
parent 119fb32681
commit 9c599870e3
3 changed files with 8 additions and 5 deletions

View file

@ -13,7 +13,7 @@ I18N_CATALOG = i18nCatalog("cura")
class PrintJobPendingApprovalMessage(Message):
"""Message shown when waiting for approval on an uploaded print job."""
def __init__(self) -> None:
def __init__(self, cluster_id: str) -> None:
super().__init__(
text = I18N_CATALOG.i18nc("@info:status", "You will receive a confirmation via email when the print job is approved"),
title=I18N_CATALOG.i18nc("@info:title", "The print job was successfully submitted"),
@ -27,10 +27,12 @@ class PrintJobPendingApprovalMessage(Message):
self.actionTriggered.connect(self._onActionTriggered)
self.cluster_id = cluster_id
def _onActionTriggered(self, message: Message, action: str) -> None:
""" Callback function for the "Manage print jobs" button on the pending approval notification. """
match action:
case "manage_print_jobs":
QDesktopServices.openUrl(QUrl("https://digitalfactory.ultimaker.com/app/jobs/"))
QDesktopServices.openUrl(QUrl(f"https://digitalfactory.ultimaker.com/app/jobs/{self._cluster.cluster_id}?utm_source=cura&utm_medium=software&utm_campaign=message-printjob-sent"))
case "learn_more":
QDesktopServices.openUrl(QUrl("https://support.ultimaker.com/hc/en-us/articles/5329940078620"))
QDesktopServices.openUrl(QUrl("https://support.ultimaker.com/hc/en-us/articles/5329940078620?utm_source=cura&utm_medium=software&utm_campaign=message-printjob-sent"))