Make product name driven from config in the console

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135399007
This commit is contained in:
mmuller 2016-10-06 13:41:24 -07:00 committed by Ben McIlwain
parent 74369b69be
commit 129cbe8103
6 changed files with 42 additions and 21 deletions

View file

@ -40,11 +40,12 @@ goog.forwardDeclare('registry.Component');
* The Registrar Console. * The Registrar Console.
* @param {string} xsrfToken Populated by server-side soy template. * @param {string} xsrfToken Populated by server-side soy template.
* @param {string} clientId The logged in GAE user. * @param {string} clientId The logged in GAE user.
* @param {string} productName The software name displayed on the UI.
* @constructor * @constructor
* @extends {registry.Console} * @extends {registry.Console}
* @final * @final
*/ */
registry.registrar.Console = function(xsrfToken, clientId) { registry.registrar.Console = function(xsrfToken, clientId, productName) {
registry.registrar.Console.base( registry.registrar.Console.base(
this, 'constructor', this, 'constructor',
new registry.registrar.EppSession(this, xsrfToken, clientId)); new registry.registrar.EppSession(this, xsrfToken, clientId));
@ -66,6 +67,11 @@ registry.registrar.Console = function(xsrfToken, clientId) {
*/ */
this.xsrfToken_ = xsrfToken; this.xsrfToken_ = xsrfToken;
/**
* @type {string}
*/
this.productName = productName;
/** /**
* Last active nav element. * Last active nav element.
* @type {Element} * @type {Element}

View file

@ -54,7 +54,10 @@ registry.registrar.Dashboard.prototype.bindToDom = function(id) {
registry.registrar.Dashboard.base(this, 'bindToDom', ''); registry.registrar.Dashboard.base(this, 'bindToDom', '');
goog.dom.removeChildren(goog.dom.getRequiredElement('reg-appbar')); goog.dom.removeChildren(goog.dom.getRequiredElement('reg-appbar'));
goog.soy.renderElement(goog.dom.getElement('reg-content'), goog.soy.renderElement(goog.dom.getElement('reg-content'),
registry.soy.registrar.console.dashboard); registry.soy.registrar.console.dashboard,
{
productName: this.console.productName
});
goog.events.listen(goog.dom.getElement('rotate'), goog.events.listen(goog.dom.getElement('rotate'),
goog.events.EventType.CLICK, goog.events.EventType.CLICK,
goog.bind(this.rotate_, this)); goog.bind(this.rotate_, this));

View file

@ -28,8 +28,9 @@ goog.require('registry.registrar.Console');
* *
* @param {string} xsrfToken populated by server-side soy template. * @param {string} xsrfToken populated by server-side soy template.
* @param {string} clientId The registrar clientId. * @param {string} clientId The registrar clientId.
* @param {string} productName the product name displayed by the UI.
* @export * @export
*/ */
registry.registrar.main = function(xsrfToken, clientId) { registry.registrar.main = function(xsrfToken, clientId, productName) {
new registry.registrar.Console(xsrfToken, clientId); new registry.registrar.Console(xsrfToken, clientId, productName);
}; };

View file

@ -27,6 +27,7 @@
{@param isAdmin: bool} /** Is this user an App Engine account admin? */ {@param isAdmin: bool} /** Is this user an App Engine account admin? */
{@param logoutUrl: string} /** Generated URL for logging out of Google. */ {@param logoutUrl: string} /** Generated URL for logging out of Google. */
{@param showPaymentLink: bool} {@param showPaymentLink: bool}
{@param productName: string} /** Name to display for this software product. */
{call registry.soy.console.header} {call registry.soy.console.header}
{param app: 'registrar' /} {param app: 'registrar' /}
{param subtitle: 'Registrar Console' /} {param subtitle: 'Registrar Console' /}
@ -59,7 +60,9 @@
<script>goog.require('registry.registrar.main');</script> <script>goog.require('registry.registrar.main');</script>
{/switch} {/switch}
{if isNonnull(DEBUG)} {if isNonnull(DEBUG)}
<script>registry.registrar.main({$xsrfToken}, {$clientId});</script> <script>
registry.registrar.main({$xsrfToken}, {$clientId}, {$productName});
</script>
{/if} {/if}
{/template} {/template}
@ -110,8 +113,8 @@
</a> </a>
<h1>Console is disabled</h1> <h1>Console is disabled</h1>
<p> <p>
The Registrar Console of the Google Registry is temporarily disabled. Please contact your The {$productName} registrar console is temporarily disabled. Please
customer service representative for more information. contact your customer service representative for more information.
<p> <p>
<img src="/assets/images/android_sad.png"> <img src="/assets/images/android_sad.png">
</div> </div>
@ -136,9 +139,9 @@
</a> </a>
<h1>You need permission</h1> <h1>You need permission</h1>
<p> <p>
The account you are logged in as is not associated with Google The account you are logged in as is not associated with {$productName}.
Registry. Please contact your customer service representative or Please contact your customer service representative or
switch to an account associated with Google Registry. switch to an account associated with {$productName}.
<p> <p>
You are signed in as <strong>{$username}</strong>. You are signed in as <strong>{$username}</strong>.
<div> <div>
@ -152,10 +155,11 @@
/** Welcome text and nav. */ /** Welcome text and nav. */
{template .dashboard} {template .dashboard}
{@param productName: string}
<div id="domain-registrar-dashboard"> <div id="domain-registrar-dashboard">
<h1>Welcome to the Google Registry Registrar Console<super>BETA</super></h1> <h1>Welcome to the {$productName} Registrar Console<super>BETA</super></h1>
<p>This console can help you manage your relationship with Google <p>This console can help you manage your relationship with {$productName}
Registry and allow self-service for key operations.</p> and allow self-service for key operations.</p>
<table> <table>
<tr> <tr>
<td> <td>
@ -179,7 +183,7 @@
<h2>Contact Us</h2> <h2>Contact Us</h2>
View important phone &amp; email<br> View important phone &amp; email<br>
contact information for<br> contact information for<br>
Google Registry. {$productName}.
</div> </div>
</tr> </tr>
</table> </table>
@ -213,8 +217,8 @@
<p> <p>
<a href="mailto:registry-support@google.com"> <a href="mailto:registry-support@google.com">
registry-support@google.com</a><br> registry-support@google.com</a><br>
For general purpose questions once you are integrated with For general purpose questions once you are integrated
Google Registry. If the issue is urgent, please put with our registry system. If the issue is urgent, please put
&quot;Urgent&quot; in the email title. &quot;Urgent&quot; in the email title.
<p class="{css description}">Note: You may receive occasional service <p class="{css description}">Note: You may receive occasional service
@ -255,7 +259,8 @@
<div id="domain-registrar-resources"> <div id="domain-registrar-resources">
<h1>Resources &amp; billing</h1> <h1>Resources &amp; billing</h1>
<p> <p>
Google Registry uses <strong>Google Drive</strong> to share important documentation. The registry system uses <strong>Google Drive</strong> to share
important documentation.
<h2><img src="/assets/images/folder.png">TLD information</h2> <h2><img src="/assets/images/folder.png">TLD information</h2>
<p> <p>
Find onboarding FAQs &amp; technical documentation in this folder. Find onboarding FAQs &amp; technical documentation in this folder.

View file

@ -70,7 +70,9 @@ function tearDown() {
function testButter() { function testButter() {
registry.registrar.ConsoleTestUtil.visit(test); registry.registrar.ConsoleTestUtil.visit(test, {
productName: 'Foo Registry'
});
registry.util.butter('butter msg'); registry.util.butter('butter msg');
var butter = goog.dom.getElementByClass(goog.getCssName('kd-butterbar')); var butter = goog.dom.getElementByClass(goog.getCssName('kd-butterbar'));
assertNotNull(butter.innerHTML.match(/.*butter msg.*/)); assertNotNull(butter.innerHTML.match(/.*butter msg.*/));
@ -90,7 +92,8 @@ function testEppLogin() {
test, { test, {
isEppLoggedIn: true, isEppLoggedIn: true,
testClientId: test.testClientId, testClientId: test.testClientId,
testXsrfToken: test.testXsrfToken testXsrfToken: test.testXsrfToken,
productName: 'Foo Registry'
}, function() { }, function() {
test.sessionMock.login( test.sessionMock.login(
goog.testing.mockmatchers.isFunction).$does(function() { goog.testing.mockmatchers.isFunction).$does(function() {
@ -109,7 +112,9 @@ function testEppLogin() {
/** Authed user with no path op specified should nav to welcome page. */ /** Authed user with no path op specified should nav to welcome page. */
function testShowLoginOrDash() { function testShowLoginOrDash() {
registry.registrar.ConsoleTestUtil.visit(test); registry.registrar.ConsoleTestUtil.visit(test, {
productName: 'Foo Registry'
});
assertNotNull(goog.dom.getElement('domain-registrar-dashboard')); assertNotNull(goog.dom.getElement('domain-registrar-dashboard'));
} }

View file

@ -88,7 +88,8 @@ registry.registrar.ConsoleTestUtil.visit = function(
/** @type {!registry.registrar.Console} */ /** @type {!registry.registrar.Console} */
test.console = new registry.registrar.Console( test.console = new registry.registrar.Console(
opt_args.testXsrfToken, opt_args.testXsrfToken,
opt_args.testClientId); opt_args.testClientId,
opt_args.productName);
// XXX: Should be triggered via event passing. // XXX: Should be triggered via event passing.
test.console.handleHashChange(); test.console.handleHashChange();
test.mockControl.$verifyAll(); test.mockControl.$verifyAll();