Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(585)

Unified Diff: remoting/webapp/crd/js/host_list.js

Issue 848993002: Improve apps v2 upgrade UX (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactor + UT Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: remoting/webapp/crd/js/host_list.js
diff --git a/remoting/webapp/crd/js/host_list.js b/remoting/webapp/crd/js/host_list.js
index 2cf7628b325c420d0f9ada18168468c84a9e68e1..93b18ae52563bbf2330d850258bd47ffd71e2868 100644
--- a/remoting/webapp/crd/js/host_list.js
+++ b/remoting/webapp/crd/js/host_list.js
@@ -289,10 +289,45 @@ remoting.HostList.prototype.display = function() {
remoting.updateModalUi(enabled ? 'enabled' : 'disabled', 'data-daemon-state');
var element = document.getElementById('daemon-control');
element.hidden = !canChangeLocalHostState;
- element = document.getElementById('host-list-empty-hosting-supported');
- element.hidden = !canChangeLocalHostState;
- element = document.getElementById('host-list-empty-hosting-unsupported');
- element.hidden = canChangeLocalHostState;
+
+ if (noHostsRegistered) {
+ this.showHostListEmptyMessage_(canChangeLocalHostState);
+ }
+};
+
+/**
+ * Displays a message to the user when the host list is empty.
+ *
+ * @param {boolean} hostingSupported
+ * @return {void}
+ * @private
+ */
+remoting.HostList.prototype.showHostListEmptyMessage_ = function(
+ hostingSupported) {
+ var that = this;
+ remoting.AppsV2Migration.hasHostsInV1App().then(
+ /**
+ * @param {{ email: string, fullName: string}} previousIdentity
Jamie 2015/01/20 22:32:01 Nit: No space before "email". Or it might be clean
kelvinp 2015/01/21 21:16:21 Done.
+ * @this {remoting.HostList}
+ */
+ function(previousIdentity) {
+ that.noHosts_.innerHTML = remoting.AppsV2Migration.buildMigrationTips(
+ previousIdentity.email, previousIdentity.fullName);
+ },
+ function() {
+ var buttonLabel = l10n.getTranslationOrError(
+ /*i18n-content*/'HOME_DAEMON_START_BUTTON');
+ if (hostingSupported) {
+ that.noHosts_.innerText = l10n.getTranslationOrError(
+ /*i18n-content*/'HOST_LIST_EMPTY_HOSTING_SUPPORTED',
+ [buttonLabel]);
+ } else {
+ that.noHosts_.innerText = l10n.getTranslationOrError(
+ /*i18n-content*/'HOST_LIST_EMPTY_HOSTING_UNSUPPORTED',
+ [buttonLabel]);
+ }
+ }
+ );
};
/**
@@ -462,6 +497,7 @@ remoting.HostList.prototype.save_ = function() {
var items = {};
items[remoting.HostList.HOSTS_KEY] = JSON.stringify(this.hosts_);
chrome.storage.local.set(items);
+ remoting.AppsV2Migration.savePreferences(this.hosts_.length !== 0);
};
/**

Powered by Google App Engine
This is Rietveld 408576698