Skip to content

Commit

Permalink
Merge branch 'upkeep/670' of github.com:10up/classifai into upkeep/670
Browse files Browse the repository at this point in the history
  • Loading branch information
Sidsector9 committed Feb 19, 2024
2 parents 2102179 + 6c26aec commit 78b1b53
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 29 deletions.
2 changes: 1 addition & 1 deletion includes/Classifai/Features/Classification.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public function run( ...$args ) {
*/
public function migrate_settings() {
$old_settings = get_option( 'classifai_watson_nlu', array() );
$new_settings = array();;
$new_settings = array();

if ( isset( $old_settings['authenticated'] ) && $old_settings['authenticated'] ) {
$new_settings['provider'] = 'ibm_watson_nlu';
Expand Down
51 changes: 23 additions & 28 deletions src/js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,6 @@ document.addEventListener( 'DOMContentLoaded', function () {
} );
} )( jQuery );


/**
* Feature-first migration routine:
* @param {Object} $ jQuery object
Expand All @@ -379,40 +378,36 @@ document.addEventListener( 'DOMContentLoaded', function () {
const migrateSettingsBtn = $( '#classifai-migrate-settings' );
const skipMigrationBtn = $( '#classifai-skip-migration-settings' );

skipMigrationBtn.on( 'click', function ( e ) {
$.ajax(
ajaxurl,
{
type: 'POST',
data: {
action: 'v3_migration_script',
routine: 'skip',
nonce: ClassifAI.ajax_nonce,
},
}
).done( function () {
skipMigrationBtn.on( 'click', function () {
$.ajax( ajaxurl, {
type: 'POST',
data: {
action: 'v3_migration_script',
routine: 'skip',
nonce: ClassifAI.ajax_nonce,
},
} ).done( function () {
noticeWrapper.slideUp();
} );
} );

migrateSettingsBtn.on( 'click', function ( e ) {
migrateSettingsBtn.on( 'click', function () {
const ogText = migrateSettingsBtn.text();
skipMigrationBtn.hide();
migrateSettingsBtn.text( ClassifAI.migrating_progress );

$.ajax(
ajaxurl,
{
type: 'POST',
data: {
action: 'v3_migration_script',
routine: 'migrate',
nonce: ClassifAI.ajax_nonce,
},
}
).done( function () {
migrateSettingsBtn.prop( 'disabled', true );

$.ajax( ajaxurl, {
type: 'POST',
data: {
action: 'v3_migration_script',
routine: 'migrate',
nonce: ClassifAI.ajax_nonce,
},
} ).done( function () {
migrateSettingsBtn.text( ogText );
noticeWrapper.html( `<p>${ClassifAI.migration_complete}</p>` );
noticeWrapper.html( `<p>${ ClassifAI.migration_complete }</p>` );
window.location.reload();
} );
} );
} )( jQuery );
} )( jQuery );

0 comments on commit 78b1b53

Please sign in to comment.