Commit 71f9a006 authored by Stuart Langley's avatar Stuart Langley Committed by Commit Bot

Report debug status in a table for delta change list updates.

To enable useful formatting of the delta updates for the users default
corpus and each team drive we move the data into a table. This table
will have a row for the default corpus and then a row for each team drive.

Bug: 849813
Cq-Include-Trybots: luci.chromium.try:closure_compilation
Change-Id: I966917d845cd2fb239a53afe0b209a2832c6f582
Reviewed-on: https://chromium-review.googlesource.com/1124128Reviewed-by: default avatarSasha Morrissey <sashab@chromium.org>
Commit-Queue: Stuart Langley <slangley@chromium.org>
Cr-Commit-Position: refs/heads/master@{#572550}
parent c225e90e
......@@ -44,9 +44,6 @@
<span id="reset-status-text"></span>
</div>
<ul>
<li>Local Start Page Token:
<span id="account-start-page-token-local"></span>
</li>
<li>Local Free Space:
<span id="local-storage-freespace"></span> MB
</li>
......@@ -56,11 +53,18 @@
<ul>
<li>Push notification is enabled:
<span id="push-notification-enabled"></span></li>
<li>Last update check time:
<span id="last-update-check-time"></span></li>
<li>Last update check result:
<span id="last-update-check-error"></span></li>
</ul>
<table>
<tbody id="delta-update-status">
<tr>
<th>Source</th>
<th>Start Page Token</th>
<th>Last Update Check Time</th>
<th>Last Update Check Result</th>
<th>Refreshing</th>
</tr>
</tbody>
</table>
<h2 id="in-flight-operations-section">In-flight Operations</h2>
<table>
......
......@@ -185,29 +185,30 @@ function updateAppList(appList) {
}
}
/**
* Updates the local cache information about account metadata.
* @param {Object} localMetadata Dictionary describing account metadata.
*/
function updateLocalMetadata(localMetadata) {
var startPageToken = localMetadata['account-start-page-token-local'];
$('account-start-page-token-local').textContent = startPageToken +
(startPageToken ? ' (loaded)' : ' (not loaded)') +
(localMetadata['account-metadata-refreshing'] ? ' (refreshing)' : '');
}
/**
/*
* Updates the summary about delta update status.
* @param {Object} deltaUpdateStatus Dictionary describing delta update status.
*/
function updateDeltaUpdateStatus(deltaUpdateStatus) {
$('push-notification-enabled').textContent =
deltaUpdateStatus['push-notification-enabled'];
$('last-update-check-time').textContent =
deltaUpdateStatus['last-update-check-time'];
$('last-update-check-error').textContent =
deltaUpdateStatus['last-update-check-error'];
var itemContainer = $('delta-update-status');
for (var i = 0; i < deltaUpdateStatus['items'].length; i++) {
var update = deltaUpdateStatus['items'][i];
var tr = document.createElement('tr');
tr.className = 'delta-update';
tr.appendChild(createElementFromText('td', update.id));
var startPageToken = update.start_page_token;
tr.appendChild(createElementFromText(
'td',
startPageToken + (startPageToken ? ' (loaded)' : ' (not loaded)')));
tr.appendChild(createElementFromText('td', update.last_check_time));
tr.appendChild(createElementFromText('td', update.last_check_result));
tr.appendChild(createElementFromText('td', update.refreshing));
itemContainer.appendChild(tr);
}
}
/**
......
......@@ -246,8 +246,6 @@ class DriveInternalsWebUIHandler : public content::WebUIMessageHandler {
drive::DriveServiceInterface* drive_service);
void UpdateAppListSection(
drive::DriveServiceInterface* drive_service);
void UpdateLocalMetadataSection(
drive::DebugInfoCollector* debug_info_collector);
void UpdateDeltaUpdateStatusSection(
drive::DebugInfoCollector* debug_info_collector);
void UpdateInFlightOperationsSection(drive::JobListInterface* job_list);
......@@ -290,10 +288,6 @@ class DriveInternalsWebUIHandler : public content::WebUIMessageHandler {
void OnGetAppList(google_apis::DriveApiErrorCode status,
std::unique_ptr<google_apis::AppList> app_list);
// Callback for DebugInfoCollector::GetMetadata for local update.
void OnGetFilesystemMetadataForLocal(
const drive::FileSystemMetadata& metadata);
// Callback for DebugInfoCollector::GetMetadata for delta update.
void OnGetFilesystemMetadataForDeltaUpdate(
const drive::FileSystemMetadata& metadata);
......@@ -450,7 +444,6 @@ void DriveInternalsWebUIHandler::OnPageLoaded(const base::ListValue* args) {
drive::DebugInfoCollector* debug_info_collector =
integration_service->debug_info_collector();
if (debug_info_collector) {
UpdateLocalMetadataSection(debug_info_collector);
UpdateDeltaUpdateStatusSection(debug_info_collector);
UpdateCacheContentsSection(debug_info_collector);
}
......@@ -547,27 +540,6 @@ void DriveInternalsWebUIHandler::UpdateAppListSection(
weak_ptr_factory_.GetWeakPtr()));
}
void DriveInternalsWebUIHandler::UpdateLocalMetadataSection(
drive::DebugInfoCollector* debug_info_collector) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(debug_info_collector);
debug_info_collector->GetMetadata(
base::Bind(&DriveInternalsWebUIHandler::OnGetFilesystemMetadataForLocal,
weak_ptr_factory_.GetWeakPtr()));
}
void DriveInternalsWebUIHandler::OnGetFilesystemMetadataForLocal(
const drive::FileSystemMetadata& metadata) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
base::DictionaryValue local_metadata;
local_metadata.SetString("account-start-page-token-local",
metadata.start_page_token);
local_metadata.SetBoolean("account-metadata-refreshing", metadata.refreshing);
web_ui()->CallJavascriptFunctionUnsafe("updateLocalMetadata", local_metadata);
}
void DriveInternalsWebUIHandler::ClearAccessToken(const base::ListValue* args) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
......@@ -636,13 +608,24 @@ void DriveInternalsWebUIHandler::OnGetFilesystemMetadataForDeltaUpdate(
delta_update_status.SetBoolean(
"push-notification-enabled",
drive_notification_manager->push_notification_enabled());
delta_update_status.SetString(
"last-update-check-time",
google_apis::util::FormatTimeAsStringLocaltime(
metadata.last_update_check_time));
delta_update_status.SetString(
"last-update-check-error",
auto items = std::make_unique<base::ListValue>();
// Users default corpus first.
auto app_data = std::make_unique<base::DictionaryValue>();
app_data->SetString("id", "default corpus");
app_data->SetString("start_page_token", metadata.start_page_token);
app_data->SetString("last_check_time",
google_apis::util::FormatTimeAsStringLocaltime(
metadata.last_update_check_time));
app_data->SetString(
"last_check_result",
drive::FileErrorToString(metadata.last_update_check_error));
app_data->SetString("refreshing", metadata.refreshing ? "Yes" : "No");
items->Append(std::move(app_data));
// TODO(slangley): Add data for each team drive.
delta_update_status.Set("items", std::move(items));
web_ui()->CallJavascriptFunctionUnsafe("updateDeltaUpdateStatus",
delta_update_status);
......
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