Commit aed534e9 authored by Yann Dago's avatar Yann Dago Committed by Commit Bot

Policy Webui: notify invalidations are available with 'On push' label

Bug: 933791
Change-Id: I987b1e0732d208c54bcfd0434408f1f0c4bad6a0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1497334Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Reviewed-by: default avatarSergey Poromov <poromov@chromium.org>
Commit-Queue: Yann Dago <ydago@chromium.org>
Cr-Commit-Position: refs/heads/master@{#637984}
parent 3c9b9d99
......@@ -101,6 +101,10 @@
<div class="label">$i18n{labelRefreshInterval}</div>
<div class="refresh-interval"></div>
</div>
<div class="status-entry">
<div class="label">$i18n{labelPoliciesPush}</div>
<div class="policy-push"></div>
</div>
<div class="status-entry">
<div class="label">$i18n{labelStatus}</div>
<div class="status"></div>
......
......@@ -149,6 +149,11 @@ cr.define('policy', function() {
'.time-since-last-refresh', status.timeSinceLastRefresh, false);
this.setLabelAndShow_('.refresh-interval', status.refreshInterval, false);
this.setLabelAndShow_('.status', status.status, false);
this.setLabelAndShow_(
'.policy-push',
loadTimeData.getString(
status.policiesPushAvailable ? 'policiesPushOn' :
'policiesPushOff'));
},
};
......
......@@ -52,6 +52,10 @@ content::WebUIDataSource* CreatePolicyUIHtmlSource() {
source->AddLocalizedString("labelRefreshInterval",
IDS_POLICY_LABEL_REFRESH_INTERVAL);
source->AddLocalizedString("labelStatus", IDS_POLICY_LABEL_STATUS);
source->AddLocalizedString("labelPoliciesPush",
IDS_POLICY_LABEL_PUSH_POLICIES);
source->AddLocalizedString("policiesPushOn", IDS_POLICY_PUSH_POLICIES_ON);
source->AddLocalizedString("policiesPushOff", IDS_POLICY_PUSH_POLICIES_OFF);
source->AddLocalizedString("showUnset", IDS_POLICY_SHOW_UNSET);
source->AddLocalizedString("noPoliciesSet", IDS_POLICY_NO_POLICIES_SET);
source->AddLocalizedString("showMore", IDS_POLICY_SHOW_MORE);
......
......@@ -150,6 +150,8 @@ void GetStatusFromCore(const policy::CloudPolicyCore* core,
bool no_error = store->status() == policy::CloudPolicyStore::STATUS_OK &&
client && client->status() == policy::DM_STATUS_SUCCESS;
dict->SetBoolean("error", !no_error);
dict->SetBoolean("policiesPushAvailable",
refresh_scheduler->invalidations_available());
dict->SetString("status", status);
dict->SetString("clientId", client_id);
dict->SetString("username", username);
......
......@@ -74,9 +74,7 @@ class POLICY_EXPORT CloudPolicyRefreshScheduler
// Whether the invalidations service is available and receiving notifications
// of policy updates.
bool invalidations_available() {
return invalidations_available_;
}
bool invalidations_available() const { return invalidations_available_; }
// CloudPolicyClient::Observer:
void OnPolicyFetched(CloudPolicyClient* client) override;
......
......@@ -313,6 +313,15 @@ Additional details:
<message name="IDS_POLICY_NOT_SPECIFIED" desc="Indicates if that device attribute has not specified yet.">
Not Specified
</message>
<message name="IDS_POLICY_LABEL_PUSH_POLICIES" desc="Label to indicates the policies can be pushed or not to chrome.">
Policies push:
</message>
<message name="IDS_POLICY_PUSH_POLICIES_ON" desc="Indicates the policies can be pushed to chrome.">
On
</message>
<message name="IDS_POLICY_PUSH_POLICIES_OFF" desc="Indicates the policies cannot be pushed to chrome.">
Off
</message>
<message name="IDS_POLICY_NEVER_FETCHED" desc="Indicates that a policy fetch was never performed before.">
Never
</message>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment