Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions class-plugin-report.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ public function enqueue_assets( $hook ) {
'export_btn' => __( 'Export .csv file', 'plugin-report' ),
'plugin_url_header' => __( 'Plugin URL', 'plugin-report' ),
'author_url_header' => __( 'Author URL', 'plugin-report' ),
'ajax_error' => __( 'Error fetching plugin info.', 'plugin-report' ),
'cols_per_row' => self::COLS_PER_ROW,
);
wp_localize_script( 'plugin-report-js', 'plugin_report_vars', $vars );
// Enqueue admin CSS file.
Expand Down
14 changes: 13 additions & 1 deletion js/plugin-report.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,19 @@ jQuery(document).ready( function( $ ){
$('#plugin-report-table .plugin-report-row-temp-' + slug ).replaceWith( response.html );
// on to the next...
rtpr_process_next_plugin();
}, 'json' );
}, 'json' ).fail( function() {
rtpr_replace_with_error( slug );
rtpr_process_next_plugin();
} );
}


function rtpr_replace_with_error( slug ){
const cols = plugin_report_vars.cols_per_row || 9;
const msg = plugin_report_vars.ajax_error || 'Error';
$('#plugin-report-table .plugin-report-row-temp-' + slug ).replaceWith(
'<tr class="pluginreport-row-error"><td colspan="' + cols + '">' + msg + '</td></tr>'
);
}

// kick things off
Expand Down
Loading