Skip to content

Commit

Permalink
⚡ Demo changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jaydeeptrivedi13 committed Jan 9, 2025
1 parent 93cd7d4 commit c1f2b1d
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 8 deletions.
9 changes: 7 additions & 2 deletions edwiser-bridge/admin/assets/js/eb-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -788,21 +788,26 @@
});

async function start_diagnostics(url, token, $this, checks) {
let completed = 0;
jQuery('.run-diagnostics-start').html('<h2>' + eb_admin_js_object.running_diagnostics + '</h2>');
checks.forEach( async(check) => {
const res = await single_diagnostic(url, token, $this, check);
// jQuery('.run-diagnostics-start img.' + check + '_loader + .diagnostic_check_name').after( '<span class="auto_fix_issue eb_' + check + '_fix">Fix Now</span><div class="autofix_custom_message"></div>' );
if ( res ) {
jQuery('.run-diagnostics-start img.' + check + '_loader').attr('src', eb_admin_js_object.plugin_url + 'images/success.png');
} else {
if ( check == 'json_valid' || check == 'token_validation' ) {
if ( check == 'token_validation' ) {
jQuery('.run-diagnostics-start img.' + check + '_loader').attr('src', eb_admin_js_object.plugin_url + 'images/error.png');
jQuery('.run-diagnostics-start img.' + check + '_loader + .diagnostic_check_name').after( '<span class="auto_fix_issue eb_' + check + '_fix">' + eb_admin_js_object.eb_fix_now + '</span><div class="autofix_custom_message"></div>' );
} else {
jQuery('.run-diagnostics-start img.' + check + '_loader').attr('src', eb_admin_js_object.plugin_url + 'images/error.png');
jQuery('.run-diagnostics-start img.' + check + '_loader + .diagnostic_check_name').after( '<span class="auto_fix_issue eb_' + check + '_fix">' + eb_admin_js_object.get_more_details + '</span><div class="autofix_custom_message"></div>' );
}
}
completed++;
if (completed == 6) {// checks count
jQuery('.run-diagnostics-start h2').html(eb_admin_js_object.diagnostics_completed);
}
console.log('--->', check + res);
});
}
Expand Down Expand Up @@ -994,7 +999,7 @@
return;
}
if ( response.data.permalink_setting_issue ) {
jQuery('.eb_permalink_setting_fix + .autofix_custom_message').html("<span>" + eb_admin_js_object.permalink_setting_issue + "</span><span class='eb_permalink_setting_fix_save auto_fix_issue'> Fix Now </span>");
jQuery('.eb_permalink_setting_fix + .autofix_custom_message').html("<span>" + eb_admin_js_object.permalink_setting_issue + "</span>");
jQuery('.eb_permalink_setting_fix + .autofix_custom_message').slideDown();
return;
}
Expand Down
9 changes: 7 additions & 2 deletions edwiser-bridge/admin/assets/js/eb-setup-wizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -663,21 +663,26 @@
});

async function start_diagnostics(url, token, $this, checks) {
let completed = 0;
jQuery('.run-diagnostics-start').html('<h2>' + eb_setup_wizard.running_diagnostics + '</h2>');
checks.forEach( async(check) => {
const res = await single_diagnostic(url, token, $this, check);
// jQuery('.run-diagnostics-start img.' + check + '_loader + .diagnostic_check_name').after( '<span class="auto_fix_issue eb_' + check + '_fix">Fix Now</span><div class="autofix_custom_message"></div>' );
if ( res ) {
jQuery('.run-diagnostics-start img.' + check + '_loader').attr('src', eb_setup_wizard.plugin_url + 'images/success.png');
} else {
if ( check == 'json_valid' || check == 'token_validation' ) {
if ( check == 'token_validation' ) {
jQuery('.run-diagnostics-start img.' + check + '_loader').attr('src', eb_setup_wizard.plugin_url + 'images/error.png');
jQuery('.run-diagnostics-start img.' + check + '_loader + .diagnostic_check_name').after( '<span class="auto_fix_issue eb_' + check + '_fix">' + eb_setup_wizard.eb_fix_now + '</span><div class="autofix_custom_message"></div>' );
} else {
jQuery('.run-diagnostics-start img.' + check + '_loader').attr('src', eb_setup_wizard.plugin_url + 'images/error.png');
jQuery('.run-diagnostics-start img.' + check + '_loader + .diagnostic_check_name').after( '<span class="auto_fix_issue eb_' + check + '_fix">' + eb_setup_wizard.get_more_details + '</span><div class="autofix_custom_message"></div>' );
}
}
completed++;
if (completed == 6) {// checks count
jQuery('.run-diagnostics-start h2').html(eb_setup_wizard.diagnostics_completed);
}
console.log('--->', check + res);
});
}
Expand Down Expand Up @@ -868,7 +873,7 @@
return;
}
if ( response.data.permalink_setting_issue ) {
jQuery('.eb_permalink_setting_fix + .autofix_custom_message').html("<span>" + eb_setup_wizard.permalink_setting_issue + "</span><span class='eb_permalink_setting_fix_save auto_fix_issue'> Fix Now </span>");
jQuery('.eb_permalink_setting_fix + .autofix_custom_message').html("<span>" + eb_setup_wizard.permalink_setting_issue + "</span>");
jQuery('.eb_permalink_setting_fix + .autofix_custom_message').slideDown();
return;
}
Expand Down
5 changes: 3 additions & 2 deletions edwiser-bridge/admin/class-eb-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,11 @@ public function admin_enqueue_scripts() {
'contact_hosting' => esc_html__( 'The plugin is receiving an invalid response code from Moodle website or is unable to connect. Please contact your hosting provider.', 'edwiser-bridge' ),
'turn_off_debug_log' => esc_html__( 'Please turn off debug display(WP_DEBUG & WP_DEBUG_DISPLAY) in wp-config.php and disable debug mode on Moodle website as well to fix this issue.', 'edwiser-bridge' ),
'token_mismatch' => esc_html__( 'Token added does not match the token configured on the moodle site.', 'edwiser-bridge' ),
'not_authorized' => esc_html__( 'The user used to create token on Moodle is not an site administrator or manager and therefore has limited access.', 'edwiser-bridge' ),
'not_authorized' => esc_html__( 'The user(s) used to create token on Moodle is(are) not site administrator(s) or manager(s) and therefore has limited access. This might lead to some issues with data synchronization.', 'edwiser-bridge' ),
'please_refresh' => esc_html__( 'Please refresh the page and check again. If the issue is still not resolved please contact support.', 'edwiser-bridge' ),
'wp_version_issue' => esc_html__( 'Your WordPress version is not supported. Please upgrade to the latest version.', 'edwiser-bridge' ),
'rest_disable_issue' => esc_html__( 'The REST API is disabled by either a Security plugin or some other plugin using hooks. It might also have been disabled in your server configuration. Please disable any security plugins and search for conflicts. If the issue doesnt get resolved contact the hosting provider to confirm that server configuration is not causing any issues.', 'edwiser-bridge' ),
'permalink_setting_issue' => esc_html__( 'Please click Fix now link shown or change your permalink settings manually to Post Name by navigating in Settings > Permalink Settings.', 'edwiser-bridge' ),
'permalink_setting_issue' => sprintf( esc_html__( 'Please change your permalink settings manually to Post Name by navigating in Settings > %s Permalink Settings %s and check again.', 'edwiser-bridge' ), '<a href="/wp-admin/options-permalink.php" target="_blank">', '</a>' ),
'htaccess_file_missing' => esc_html__( 'The .htaccess file is missing. Please click Fix now link shown to create the file.', 'edwiser-bridge' ),
'htaccess_rule_missing' => esc_html__( 'The .htaccess file is missing the required rewrite rule. Please click Fix now link shown to add the rule.', 'edwiser-bridge' ),
'htaccess_rule_instructions' => esc_html__( 'Please add the following rule to the .htaccess file located in the root of your website or create the file to add the rules. "# BEGIN WordPress
Expand All @@ -238,6 +238,7 @@ public function admin_enqueue_scripts() {
'contact_support_post' => esc_html__( 'The POST endpoint seems to be missing please contact our support team to check the issue.', 'edwiser-bridge' ),
'check_mdl_config' => esc_html__( 'Please check the moodle configuration and make sure the webservice is enabled and the user has the required permissions.', 'edwiser-bridge' ),
'running_diagnostics' => esc_html__( 'Running Diagnostics', 'edwiser-bridge' ),
'diagnostics_completed' => esc_html__( 'Diagnostics Completed', 'edwiser-bridge' ),
'eb_fix_now' => esc_html__( 'Fix Now', 'edwiser-bridge' ),
'get_more_details' => esc_html__( 'Get More Details', 'edwiser-bridge' ),
)
Expand Down
6 changes: 6 additions & 0 deletions edwiser-bridge/admin/class-eb-settings-ajax-initiater.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,12 @@ public function check_moodle_webservice_accessible() {
$connection_helper = new Eb_Connection_Helper( $this->plugin_name, $this->version );
$response = $connection_helper->connection_test_status( $url, $token );
$validate_access = $connection_helper->connectMoodleWithArgsHelper( 'eb_validate_token', array( 'wp_url' => $url, 'wp_token' => $token ) );
if ( empty( $validate_access['success'] ) && $validate_access['response_body']->exception == 'webservice_access_exception' ) {
$validate_access['response_data'] = array(
'is_authorized' => false,
'token_mismatch' => false
);
}
echo wp_send_json_success( array( 'correct' => $response, 'validate_access' => $validate_access['response_data'] ) );
die();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -921,12 +921,12 @@ public function enqueue_scripts() {
'contact_support' => esc_html__( 'Invalid response from server. Please contact plugin support', 'edwiser-bridge' ),
'contact_hosting' => esc_html__( 'The plugin is receiving an invalid response code from Moodle website or is unable to connect. Please contact your hosting provider.', 'edwiser-bridge' ),
'token_mismatch' => esc_html__( 'Token added does not match the token configured on the moodle site.', 'edwiser-bridge' ),
'not_authorized' => esc_html__( 'The user used to create token on Moodle is not an site administrator or manager and therefore has limited access.', 'edwiser-bridge' ),
'not_authorized' => esc_html__( 'The user(s) used to create token on Moodle is(are) not site administrator(s) or manager(s) and therefore has limited access. This might lead to some issues with data synchronization.', 'edwiser-bridge' ),
'turn_off_debug_log' => esc_html__( 'Please turn off debug display(WP_DEBUG & WP_DEBUG_DISPLAY) in wp-config.php and disable debug mode on Moodle website as well to fix this issue.', 'edwiser-bridge' ),
'please_refresh' => esc_html__( 'Please refresh the page and check again. If the issue is still not resolved please contact support.', 'edwiser-bridge' ),
'wp_version_issue' => esc_html__( 'Your WordPress version is not supported. Please upgrade to the latest version.', 'edwiser-bridge' ),
'rest_disable_issue' => esc_html__( 'The REST API is disabled by either a Security plugin or some other plugin using hooks. It might also have been disabled in your server configuration. Please disable any security plugins and search for conflicts. If the issue doesnt get resolved contact the hosting provider to confirm that server configuration is not causing any issues.', 'edwiser-bridge' ),
'permalink_setting_issue' => esc_html__( 'Please click Fix now link shown or change your permalink settings manually to Post Name by navigating in Settings > Permalink Settings.', 'edwiser-bridge' ),
'permalink_setting_issue' => sprintf( esc_html__( 'Please change your permalink settings manually to Post Name by navigating in Settings > %s Permalink Settings %s and click Test Connection again after refreshing the page.', 'edwiser-bridge' ), '<a href="/wp-admin/options-permalink.php" target="_blank">', '</a>' ),
'htaccess_file_missing' => esc_html__( 'The .htaccess file is missing. Please click Fix now link shown to create the file.', 'edwiser-bridge' ),
'htaccess_rule_missing' => esc_html__( 'The .htaccess file is missing the required rewrite rule. Please click Fix now link shown to add the rule.', 'edwiser-bridge' ),
'htaccess_rule_instructions' => esc_html__( 'Please add the following rule to the .htaccess file located in the root of your website or create the file to add the rules. "# BEGIN WordPress
Expand All @@ -944,6 +944,7 @@ public function enqueue_scripts() {
'contact_support_post' => esc_html__( 'The POST endpoint seems to be missing please contact our support team to check the issue.', 'edwiser-bridge' ),
'check_mdl_config' => esc_html__( 'Please check the moodle configuration and make sure the webservice is enabled and the user has the required permissions.', 'edwiser-bridge' ),
'running_diagnostics' => esc_html__( 'Running Diagnostics', 'edwiser-bridge' ),
'diagnostics_completed' => esc_html__( 'Diagnostics Completed', 'edwiser-bridge' ),
'eb_fix_now' => esc_html__( 'Fix Now', 'edwiser-bridge' ),
'get_more_details' => esc_html__( 'Get More Details', 'edwiser-bridge' ),
)
Expand Down
3 changes: 3 additions & 0 deletions edwiser-bridge/includes/api/class-eb-connection-helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,9 @@ public function create_response_message( $url, $message ) {
<div>
<div><b>' . esc_html__( 'Response : ', 'edwiser-bridge' ) . '</b></div>
<div>' . $message . '</div>
</div>
<div>
<div>' . sprintf( esc_html__( "Click %s Run Diagnostics %s button to get more details.", "edwiser-bridge" ), '<strong>', '</strong>' ) . '</div>
</div>
</div>
Expand Down

0 comments on commit c1f2b1d

Please sign in to comment.