Skip to content
This repository has been archived by the owner on Jun 2, 2024. It is now read-only.

Commit

Permalink
fix: Don't display sync info when the sync mode is none (#1410)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpuncle authored and fengmk2 committed Nov 20, 2018
1 parent a4a25f9 commit 6a8434e
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions public/js/readme.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,28 @@ $(function () {
$('#node-version').html(data.node_version || 'v0.10.22');
$('#app-version').html(data.app_version || '0.0.0');

if (data.sync_model === 'all') {
$('#sync-model').html('This registry will sync all packages from official registry.');
$('#last-sync-time').html(new Date(data.last_sync_time));
} else if (data.sync_model === 'exist') {
$('#sync-model').html('This registry will only update exist packages from official registry.');
$('#last-sync-time').html(new Date(data.last_exist_sync_time));
}
if (data.sync_model !== 'none') {
if (data.sync_model === 'all') {
$('#sync-model').html('This registry will sync all packages from official registry.');
$('#last-sync-time').html(new Date(data.last_sync_time));
} else if (data.sync_model === 'exist') {
$('#sync-model').html('This registry will only update exist packages from official registry.');
$('#last-sync-time').html(new Date(data.last_exist_sync_time));
}

$('#need-sync').html(data.need_sync_num);
$('#success-sync').html(data.success_sync_num);
$('#fail-sync').html(data.fail_sync_num);
$('#left-sync').html(data.left_sync_num);
$('#percent-sync').html(Math.floor(data.success_sync_num / data.need_sync_num * 100));
$('#last-success-name').html('<a target="_blank" href="/package/' + data.last_sync_module + '">' +
data.last_sync_module + '</a>');
$('#need-sync').html(data.need_sync_num);
$('#success-sync').html(data.success_sync_num);
$('#fail-sync').html(data.fail_sync_num);
$('#left-sync').html(data.left_sync_num);
$('#percent-sync').html(Math.floor(data.success_sync_num / data.need_sync_num * 100));
$('#last-success-name').html('<a target="_blank" href="/package/' + data.last_sync_module + '">' +
data.last_sync_module + '</a>');

if (!data.sync_status) {
$('.syncing').remove();
}
if (!data.sync_status) {
$('.syncing').remove();
}

$('.sync').show();
$('.sync').show();
}
});
});

0 comments on commit 6a8434e

Please sign in to comment.