From 779da518dfb522f45e3915c20220178dfc17449d Mon Sep 17 00:00:00 2001 From: gbrodman Date: Mon, 16 Oct 2023 16:51:35 -0400 Subject: [PATCH] Pass name/email/phone info to the new console front end (#2180) --- .../widgets/contact-widget.component.html | 20 ++++++++++--------- .../home/widgets/contact-widget.component.ts | 3 ++- .../app/shared/services/userData.service.ts | 5 ++++- console-webapp/src/styles.scss | 4 ++++ .../server/console/ConsoleUserDataAction.java | 13 ++++++++++++ .../console/ConsoleUserDataActionTest.java | 17 ++++++++++++++-- 6 files changed, 49 insertions(+), 13 deletions(-) diff --git a/console-webapp/src/app/home/widgets/contact-widget.component.html b/console-webapp/src/app/home/widgets/contact-widget.component.html index 6511c6069..a42f21124 100644 --- a/console-webapp/src/app/home/widgets/contact-widget.component.html +++ b/console-webapp/src/app/home/widgets/contact-widget.component.html @@ -5,21 +5,23 @@ call

Contact Support

- View Google Registry support email and phone information + Let us know if you have any questions

- +
Give us a Call

- Call Google Registry support at +1 (404) 978 8419 + Call {{ userDataService.userData?.productName }} support at + {{ + userDataService.userData?.supportPhoneNumber + }}

- +
Send us an Email

- Email Google Registry at support@google.com + Email {{ userDataService.userData?.productName }} at + {{ + userDataService.userData?.supportEmail + }}

diff --git a/console-webapp/src/app/home/widgets/contact-widget.component.ts b/console-webapp/src/app/home/widgets/contact-widget.component.ts index 2d279bfaa..3deea5443 100644 --- a/console-webapp/src/app/home/widgets/contact-widget.component.ts +++ b/console-webapp/src/app/home/widgets/contact-widget.component.ts @@ -13,11 +13,12 @@ // limitations under the License. import { Component } from '@angular/core'; +import { UserDataService } from 'src/app/shared/services/userData.service'; @Component({ selector: '[app-contact-widget]', templateUrl: './contact-widget.component.html', }) export class ContactWidgetComponent { - constructor() {} + constructor(public userDataService: UserDataService) {} } diff --git a/console-webapp/src/app/shared/services/userData.service.ts b/console-webapp/src/app/shared/services/userData.service.ts index 23dc0a79d..0930cafbd 100644 --- a/console-webapp/src/app/shared/services/userData.service.ts +++ b/console-webapp/src/app/shared/services/userData.service.ts @@ -19,8 +19,11 @@ import { MatSnackBar } from '@angular/material/snack-bar'; import { GlobalLoader, GlobalLoaderService } from './globalLoader.service'; export interface UserData { - isAdmin: boolean; globalRole: string; + isAdmin: boolean; + productName: string; + supportEmail: string; + supportPhoneNumber: string; technicalDocsUrl: string; } diff --git a/console-webapp/src/styles.scss b/console-webapp/src/styles.scss index 1af5a15fe..8013c9e79 100644 --- a/console-webapp/src/styles.scss +++ b/console-webapp/src/styles.scss @@ -47,6 +47,10 @@ body { min-width: auto !important; height: min-content !important; } + &-section-header { + font-weight: 500; + color: var(--primary) !important; + } &-title { color: var(--primary) !important; text-align: center; diff --git a/core/src/main/java/google/registry/ui/server/console/ConsoleUserDataAction.java b/core/src/main/java/google/registry/ui/server/console/ConsoleUserDataAction.java index 1fbbd82cb..da76c870b 100644 --- a/core/src/main/java/google/registry/ui/server/console/ConsoleUserDataAction.java +++ b/core/src/main/java/google/registry/ui/server/console/ConsoleUserDataAction.java @@ -40,15 +40,24 @@ public class ConsoleUserDataAction implements JsonGetAction { private final AuthResult authResult; private final Response response; + private final String productName; + private final String supportPhoneNumber; + private final String supportEmail; private final String technicalDocsUrl; @Inject public ConsoleUserDataAction( AuthResult authResult, Response response, + @Config("productName") String productName, + @Config("supportEmail") String supportEmail, + @Config("supportPhoneNumber") String supportPhoneNumber, @Config("technicalDocsUrl") String technicalDocsUrl) { this.response = response; this.authResult = authResult; + this.productName = productName; + this.supportEmail = supportEmail; + this.supportPhoneNumber = supportPhoneNumber; this.technicalDocsUrl = technicalDocsUrl; } @@ -74,6 +83,10 @@ public class ConsoleUserDataAction implements JsonGetAction { // auth checks. "isAdmin", user.getUserRoles().isAdmin(), "globalRole", user.getUserRoles().getGlobalRole(), + // Include static contact resources in this call to minimize round trips + "productName", productName, + "supportEmail", supportEmail, + "supportPhoneNumber", supportPhoneNumber, // Is used by UI to construct a link to registry resources "technicalDocsUrl", technicalDocsUrl)); diff --git a/core/src/test/java/google/registry/ui/server/console/ConsoleUserDataActionTest.java b/core/src/test/java/google/registry/ui/server/console/ConsoleUserDataActionTest.java index 30b61b81b..f7bbdda82 100644 --- a/core/src/test/java/google/registry/ui/server/console/ConsoleUserDataActionTest.java +++ b/core/src/test/java/google/registry/ui/server/console/ConsoleUserDataActionTest.java @@ -54,7 +54,19 @@ class ConsoleUserDataActionTest { assertThat(response.getStatus()).isEqualTo(HttpStatusCodes.STATUS_CODE_OK); Map jsonObject = GSON.fromJson(response.getPayload(), Map.class); assertThat(jsonObject) - .containsExactly("isAdmin", false, "technicalDocsUrl", "test", "globalRole", "FTE"); + .containsExactly( + "isAdmin", + false, + "technicalDocsUrl", + "test", + "globalRole", + "FTE", + "productName", + "Nomulus", + "supportPhoneNumber", + "+1 (212) 867 5309", + "supportEmail", + "support@example.com"); } @Test @@ -71,6 +83,7 @@ class ConsoleUserDataActionTest { } private ConsoleUserDataAction createAction(AuthResult authResult) throws IOException { - return new ConsoleUserDataAction(authResult, response, "test"); + return new ConsoleUserDataAction( + authResult, response, "Nomulus", "support@example.com", "+1 (212) 867 5309", "test"); } }