summaryrefslogtreecommitdiffstats
path: root/controller-server
diff options
context:
space:
mode:
authorØyvind Grønnesby <oyving@yahooinc.com>2022-11-24 11:02:28 +0100
committerØyvind Grønnesby <oyving@yahooinc.com>2022-11-24 11:02:28 +0100
commit5a6b8f759f5d41ee9c7801f57e205d1499df84fd (patch)
treecaded1d6f96a6a8d887c9359f7a4d75c91e9bb69 /controller-server
parent2e32f5a0c8969bf60209823e9480ab35b992c615 (diff)
Use dashboardUri for all console links
Diffstat (limited to 'controller-server')
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/Notifier.java24
-rw-r--r--controller-server/src/test/resources/mail/notification.txt4
2 files changed, 17 insertions, 11 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/Notifier.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/Notifier.java
index b0e08ab0208..526bf0c53b3 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/Notifier.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/Notifier.java
@@ -3,6 +3,7 @@ package com.yahoo.vespa.hosted.controller.notification;
import com.google.common.annotations.VisibleForTesting;
import com.yahoo.config.provision.Environment;
+import com.yahoo.config.provision.TenantName;
import com.yahoo.restapi.UriBuilder;
import com.yahoo.text.Text;
import com.yahoo.vespa.flags.FetchVector;
@@ -131,22 +132,16 @@ public class Notifier {
var notification = content.notification();
var subject = Text.format("[%s] %s Vespa Notification for %s", notification.level().toString().toUpperCase(), content.prettyType(), applicationIdSource(notification.source()));
var template = uncheck(() -> Notifier.class.getResourceAsStream("/mail/mail-notification.tmpl").readAllBytes());
- var notificationsUri = new UriBuilder(dashboardUri)
- .append("tenant/")
- .append(content.notification().source().tenant().value())
- .append("account/notifications")
- .toURI()
- .toString();
var html = new String(template)
.replace("[[NOTIFICATION_HEADER]]", content.messagePrefix())
.replace("[[NOTIFICATION_ITEMS]]", notification.messages().stream()
.map(Notifier::linkify)
.map(m -> "<li>" + m + "</li>")
.collect(Collectors.joining()))
- .replace("[[LINK_TO_ACCOUNT_NOTIFICATIONS]]", notificationsUri)
+ .replace("[[LINK_TO_ACCOUNT_NOTIFICATIONS]]", accountNotificationsUri(content.notification().source().tenant()))
.replace("[[LINK_TO_PRIVACY_POLICY]]", "https://legal.yahoo.com/xw/en/yahoo/privacy/topic/b2bprivacypolicy/index.html")
- .replace("[[LINK_TO_TERMS_OF_SERVICE]]", "https://console.vespa-cloud.com/terms-of-service-trial.html")
- .replace("[[LINK_TO_SUPPORT]]", "https://console.vespa-cloud.com/support");
+ .replace("[[LINK_TO_TERMS_OF_SERVICE]]", consoleUri("terms-of-service-trial.html"))
+ .replace("[[LINK_TO_SUPPORT]]", consoleUri("support"));
return new Mail(recipients, subject, "", html);
}
@@ -163,5 +158,16 @@ public class Notifier {
return sb.toString();
}
+ private String accountNotificationsUri(TenantName tenant) {
+ return new UriBuilder(dashboardUri)
+ .append("tenant/")
+ .append(tenant.value())
+ .append("account/notifications")
+ .toString();
+ }
+
+ private String consoleUri(String path) {
+ return new UriBuilder(dashboardUri).append(path).toString();
+ }
}
diff --git a/controller-server/src/test/resources/mail/notification.txt b/controller-server/src/test/resources/mail/notification.txt
index af3a9b14a01..5ca26cb4753 100644
--- a/controller-server/src/test/resources/mail/notification.txt
+++ b/controller-server/src/test/resources/mail/notification.txt
@@ -604,7 +604,7 @@
target="_blank"
rel="noopener noreferrer"
style="color: #005a8e"
- href="https://console.vespa-cloud.com/terms-of-service-trial.html"
+ href="https://dashboard.tld/terms-of-service-trial.html"
><span style="color: #005a8e"
>Terms of Service</span
></a
@@ -614,7 +614,7 @@
target="_blank"
rel="noopener noreferrer"
style="color: #005a8e"
- href="https://console.vespa-cloud.com/support"
+ href="https://dashboard.tld/support"
><span style="color: #005a8e">Support</span></a
>
</p>