Skip to content
Open
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
9 changes: 9 additions & 0 deletions assets/js/plugin-check-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
'plugin-check__export-controls'
);
const spinner = document.getElementById( 'plugin-check__spinner' );
const clientError = document.getElementById( 'plugin-check__client-error' );
const pluginsList = document.getElementById(
'plugin-check__plugins-dropdown'
);
Expand All @@ -21,6 +22,7 @@
! resultsContainer ||
! exportContainer ||
! spinner ||
! clientError ||
! categoriesList.length ||
! typesList.length
) {
Expand Down Expand Up @@ -83,6 +85,9 @@
checkItButton.disabled = true;
pluginsList.disabled = true;
spinner.classList.add( 'is-active' );
clientError.innerText = '';
clientError.classList.add( 'is-hidden' );

for ( let i = 0; i < categoriesList.length; i++ ) {
categoriesList[ i ].disabled = true;
}
Expand All @@ -106,6 +111,10 @@
resetForm();
} )
.catch( ( error ) => {
clientError.innerText = error.message;
clientError.classList.remove( 'is-hidden' );
clientError.focus();

console.error( error );

resetForm();
Expand Down
4 changes: 4 additions & 0 deletions includes/Admin/Admin_Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,10 @@ public function admin_footer() {
.plugin-check__export-controls.is-hidden {
display: none;
}
/** Plugin Check Client Errors **/
#plugin-check__client-error.is-hidden {
display: none;
}
</style>
<?php
}
Expand Down
1 change: 1 addition & 0 deletions templates/admin-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

<input type="submit" value="<?php esc_attr_e( 'Check it!', 'plugin-check' ); ?>" id="plugin-check__submit" class="button button-primary" />
<span id="plugin-check__spinner" class="spinner" style="float: none;"></span>
<div class="notice notice-error is-hidden" role="alert" tabindex="-1" id="plugin-check__client-error"></div>
<div class="plugin-check__options">
<div>
<h4><?php esc_attr_e( 'Categories', 'plugin-check' ); ?></h4>
Expand Down
Loading