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: 1 addition & 1 deletion assets/css/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@

.stellarwp-migration-card__description {
color: #50575e;
font-size: 14px;
font-size: 12px;
line-height: 1.5;
margin: 0 0 16px;
}
Expand Down
2 changes: 1 addition & 1 deletion assets/js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
// Add loading state to clicked button
button.classList.add( 'stellarwp-migration-btn--loading' );
const originalText = button.textContent;
button.textContent = action === 'run' ? __( 'Running...', 'stellarwp-migrations' ) : __( 'Rolling back...', 'stellarwp-migrations' );
button.textContent = action === 'run' ? __( 'Adding to queue...', 'stellarwp-migrations' ) : __( 'Rolling back...', 'stellarwp-migrations' );

// Build the endpoint path (relative to REST root)
const endpoint = restUrl + '/migrations/' + encodeURIComponent( migrationId ) + '/' + action;
Expand Down
2 changes: 1 addition & 1 deletion src/Admin/UI.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ private function parse_filters(): array {
"stellarwp_migrations_{$prefix}_filters",
[
'tags' => $tags,
'show_completed' => ! empty( filter_input( INPUT_GET, 'show_completed', FILTER_SANITIZE_NUMBER_INT ) ),
'show_completed' => filter_input( INPUT_GET, 'show_completed', FILTER_SANITIZE_NUMBER_INT ) !== '0',
'show_non_applicable' => ! empty( filter_input( INPUT_GET, 'show_non_applicable', FILTER_SANITIZE_NUMBER_INT ) ),
]
);
Expand Down
4 changes: 2 additions & 2 deletions src/Enums/Status.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ class Status extends Enum {
public function get_label(): string {
switch ( $this->getValue() ) {
case self::PENDING:
return _x( 'Pending', 'Migration status', 'stellarwp-migrations' );
return _x( 'Not started', 'Migration status', 'stellarwp-migrations' );
case self::RUNNING:
return _x( 'Running', 'Migration status', 'stellarwp-migrations' );
return _x( 'Migration in progress', 'Migration status', 'stellarwp-migrations' );
case self::COMPLETED:
return _x( 'Completed', 'Migration status', 'stellarwp-migrations' );
case self::FAILED:
Expand Down
27 changes: 0 additions & 27 deletions src/Utilities/Migration_UI.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,33 +137,6 @@ public function get_run_action_label(): string {
return __( 'Start', 'stellarwp-migrations' );
}

/**
* Returns the run action icon name for the migration.
*
* @since 0.0.1
*
* @return string Icon name (e.g. 'start', 'retry').
*/
public function get_run_action_icon(): string {
$status_value = $this->get_display_status()->getValue();

if (
in_array(
$status_value,
[
Status::COMPLETED()->getValue(),
Status::REVERTED()->getValue(),
Status::FAILED()->getValue(),
],
true
)
) {
return 'retry';
}

return 'start';
}

/**
* Whether the run button should be shown for the migration.
*
Expand Down
3 changes: 1 addition & 2 deletions src/views/components/migration-actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
$show_run = $migration_ui->show_run();
$show_rollback = $migration_ui->show_rollback();
$run_migration_label = $migration_ui->get_run_action_label();
$run_migration_icon = $migration_ui->get_run_action_icon();

$template = Config::get_template_engine();

Expand Down Expand Up @@ -63,7 +62,7 @@ class="stellarwp-migration-btn stellarwp-migration-btn--primary"
>
<?php
$template->template(
'icons/' . $run_migration_icon,
'icons/start',
[
'is_aria_hidden' => true,
]
Expand Down
43 changes: 0 additions & 43 deletions src/views/icons/retry.php

This file was deleted.

1 change: 1 addition & 0 deletions src/views/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class="stellarwp-migrations-select2"
</div>

<div class="stellarwp-migrations-filters__checkboxes">
<input type="hidden" name="show_completed" value="0" />
<label>
<input
type="checkbox"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<div class="wrap">
<form method="get" class="stellarwp-migrations-filters">


<div class="stellarwp-migrations-filters__row">

<div class="stellarwp-migrations-filters__actions">
Expand All @@ -11,12 +12,13 @@
</div>

<div class="stellarwp-migrations-filters__checkboxes">
<input type="hidden" name="show_completed" value="0" />
<label>
<input
type="checkbox"
name="show_completed"
value="1"
onchange="this.form.submit();"
checked='checked' onchange="this.form.submit();"
/>
Show Completed </label>
<label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@
</div>

<div class="stellarwp-migrations-filters__checkboxes">
<input type="hidden" name="show_completed" value="0" />
<label>
<input
type="checkbox"
name="show_completed"
value="1"
onchange="this.form.submit();"
checked='checked' onchange="this.form.submit();"
/>
Show Completed </label>
<label>
Expand Down Expand Up @@ -61,7 +62,7 @@ <h3 class="stellarwp-migration-card__label">
<div class="stellarwp-migration-card__footer">
<div class="stellarwp-migration-card__status">
<span class="stellarwp-migration-card__status-label stellarwp-migration-card__status-label--pending">
Pending </span>
Not started </span>

<span class="stellarwp-migration-card__progress-text">
0 / 1</span>
Expand Down Expand Up @@ -121,7 +122,7 @@ <h3 class="stellarwp-migration-card__label">
<div class="stellarwp-migration-card__footer">
<div class="stellarwp-migration-card__status">
<span class="stellarwp-migration-card__status-label stellarwp-migration-card__status-label--pending">
Pending </span>
Not started </span>

<span class="stellarwp-migration-card__progress-text">
0 / 3</span>
Expand Down Expand Up @@ -185,7 +186,7 @@ <h3 class="stellarwp-migration-card__label">
<div class="stellarwp-migration-card__footer">
<div class="stellarwp-migration-card__status">
<span class="stellarwp-migration-card__status-label stellarwp-migration-card__status-label--pending">
Pending </span>
Not started </span>

<span class="stellarwp-migration-card__progress-text">
0 / 1</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@
</div>

<div class="stellarwp-migrations-filters__checkboxes">
<input type="hidden" name="show_completed" value="0" />
<label>
<input
type="checkbox"
name="show_completed"
value="1"
onchange="this.form.submit();"
checked='checked' onchange="this.form.submit();"
/>
Show Completed </label>
<label>
Expand Down Expand Up @@ -45,7 +46,7 @@ <h3 class="stellarwp-migration-card__label">
<div class="stellarwp-migration-card__footer">
<div class="stellarwp-migration-card__status">
<span class="stellarwp-migration-card__status-label stellarwp-migration-card__status-label--pending">
Pending </span>
Not started </span>

<span class="stellarwp-migration-card__progress-text">
0 / 1</span>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="wrap stellarwp-migration-single" data-rest-url="http://wordpress.test/index.php?rest_route=/foobar/migrations/v1" data-migration-id="tests_multi_batch_migration">
<header class="stellarwp-migration-single__header">
<header class="stellarwp-migration-single__header">
<h1 class="stellarwp-migration-single__label">Multi Batch Migration</h1>
<p class="stellarwp-migration-single__description">This migration runs multiple batches to complete.</p>
</header>
Expand All @@ -10,7 +10,7 @@ <h2 id="stellarwp-migration-status-title" class="stellarwp-migration-single__sec
<div class="stellarwp-migration-status-card__content">
<div class="stellarwp-migration-status-card__status">
<span class="stellarwp-migration-card__status-label stellarwp-migration-card__status-label--pending">
Pending </span>
Not started </span>

<span class="stellarwp-migration-card__progress-text">
0 / 3</span>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="wrap stellarwp-migration-single" data-rest-url="http://wordpress.test/index.php?rest_route=/foobar/migrations/v1" data-migration-id="tests_simple_migration">
<header class="stellarwp-migration-single__header">
<header class="stellarwp-migration-single__header">
<h1 class="stellarwp-migration-single__label">Simple Migration</h1>
<p class="stellarwp-migration-single__description">This is a simple migration that runs a single batch.</p>
</header>
Expand All @@ -10,7 +10,7 @@ <h2 id="stellarwp-migration-status-title" class="stellarwp-migration-single__sec
<div class="stellarwp-migration-status-card__content">
<div class="stellarwp-migration-status-card__status">
<span class="stellarwp-migration-card__status-label stellarwp-migration-card__status-label--pending">
Pending </span>
Not started </span>

<span class="stellarwp-migration-card__progress-text">
0 / 1</span>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="wrap stellarwp-migration-single" data-rest-url="http://wordpress.test/index.php?rest_route=/foobar/migrations/v1" data-migration-id="tests_tagged_migration">
<header class="stellarwp-migration-single__header">
<header class="stellarwp-migration-single__header">
<h1 class="stellarwp-migration-single__label">Tagged Migration</h1>
<p class="stellarwp-migration-single__description">A migration with tags for testing tag-based filtering.</p>
</header>
Expand All @@ -10,7 +10,7 @@ <h2 id="stellarwp-migration-status-title" class="stellarwp-migration-single__sec
<div class="stellarwp-migration-status-card__content">
<div class="stellarwp-migration-status-card__status">
<span class="stellarwp-migration-card__status-label stellarwp-migration-card__status-label--pending">
Pending </span>
Not started </span>

<span class="stellarwp-migration-card__progress-text">
0 / 1</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ <h2 id="stellarwp-migration-status-title" class="stellarwp-migration-single__sec
<div class="stellarwp-migration-status-card__content">
<div class="stellarwp-migration-status-card__status">
<span class="stellarwp-migration-card__status-label stellarwp-migration-card__status-label--pending">
Pending </span>
Not started </span>

<span class="stellarwp-migration-card__progress-text">
0 / 1</span>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="wrap stellarwp-migration-single" data-rest-url="http://wordpress.test/index.php?rest_route=/foobar/migrations/v1" data-migration-id="tests_simple_migration">
<header class="stellarwp-migration-single__header">
<header class="stellarwp-migration-single__header">
<h1 class="stellarwp-migration-single__label">Simple Migration</h1>
<p class="stellarwp-migration-single__description">This is a simple migration that runs a single batch.</p>
</header>
Expand Down Expand Up @@ -42,16 +42,16 @@ <h2 id="stellarwp-migration-status-title" class="stellarwp-migration-single__sec
aria-label="Re-run Migration Simple Migration"
>
<svg
aria-label="Retry icon"
class="stellarwp-migration-icon stellarwp-migration-icon__retry"
aria-label="Start icon"
class="stellarwp-migration-icon stellarwp-migration-icon__start"
height="16"
role="img"
viewBox="0 0 16 16"
width="16"
xmlns="http://www.w3.org/2000/svg"
>

<path d="M8.32875 3.42651C10.854 3.42681 12.9012 5.47471 12.9014 7.99995C12.9011 10.5252 10.854 12.5731 8.32875 12.5734C6.77358 12.5734 5.39914 11.7957 4.57412 10.6121C4.34137 10.2777 4.4236 9.81786 4.75781 9.58484C5.09221 9.3518 5.55194 9.43418 5.78502 9.76854C6.34585 10.573 7.27669 11.0972 8.32875 11.0972C10.0387 11.0969 11.425 9.70992 11.4252 7.99995C11.425 6.28997 10.0387 4.90379 8.32875 4.90349C7.47072 4.90349 6.98243 5.09218 6.59147 5.39691C6.43591 5.51822 6.2884 5.66289 6.13759 5.8368L7.21999 6.92002C7.61853 7.31856 7.33631 7.99995 6.77269 7.99995H3.73307C3.38368 7.99995 3.09962 7.71671 3.09961 7.36732V4.32687C3.09968 3.7633 3.78185 3.48105 4.18036 3.87957L5.09308 4.79229C5.27826 4.58622 5.47275 4.39721 5.68453 4.23214C6.38803 3.68388 7.21666 3.42651 8.32875 3.42651Z" fill="currentColor" />
<path d="M12.6608 7.78802C12.8175 7.88594 12.8175 8.1141 12.6608 8.21202L5.3825 12.7609C5.21599 12.865 5 12.7453 5 12.5489V3.45108C5 3.25472 5.21599 3.13501 5.3825 3.23908L12.6608 7.78802Z" fill="currentColor" />

</svg>
Re-run </button>
Expand Down Expand Up @@ -143,9 +143,9 @@ <h2 id="stellarwp-migration-logs-title" class="stellarwp-migration-single__secti
selected='selected' data-start=""
data-end=""
data-status="completed"
data-download-url="http://wordpress.test/wp-admin/admin-post.php?action=stellarwp_migrations_foobar_log_download&#038;migration_execution_id=728366&#038;nonce=657f613275"
data-download-url="http://wordpress.test/wp-admin/admin-post.php?action=stellarwp_migrations_foobar_log_download&#038;migration_execution_id=728366&#038;nonce=7d801987f9"
>
#728366 - Feb 9, 2026 1:56 pm (Completed) </option>
#728366 - Feb 16, 2026 1:19 pm (Completed) </option>
</select>
</div>

Expand All @@ -154,7 +154,7 @@ <h2 id="stellarwp-migration-logs-title" class="stellarwp-migration-single__secti
type="button"
id="stellarwp-download-logs-link"
class="button button-secondary stellarwp-migration-logs__download-btn"
data-download-url="http://wordpress.test/wp-admin/admin-post.php?action=stellarwp_migrations_foobar_log_download&#038;migration_execution_id=728366&#038;nonce=657f613275"
data-download-url="http://wordpress.test/wp-admin/admin-post.php?action=stellarwp_migrations_foobar_log_download&#038;migration_execution_id=728366&#038;nonce=7d801987f9"
aria-label="Download logs for selected execution as CSV"
>
<svg
Expand Down
32 changes: 0 additions & 32 deletions tests/wpunit/Utilities/Migration_UI_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -339,38 +339,6 @@ public static function run_action_label_provider(): array {
];
}

// -------------------------------------------------------------------------
// get_run_action_icon()
// -------------------------------------------------------------------------

/**
* @test
*/
public function it_should_return_retry_icon_for_completed_reverted_or_failed(): void {
$statuses = [ Status::COMPLETED(), Status::REVERTED(), Status::FAILED() ];

foreach ( $statuses as $status ) {
$migration = $this->create_migration_mock( [ 'get_status' => $status ] );
$ui = new Migration_UI( $migration );

$result = $ui->get_run_action_icon();

$this->assertSame( 'retry', $result, 'Expected retry for status: ' . $status->getValue() );
}
}

/**
* @test
*/
public function it_should_return_start_icon_for_pending(): void {
$migration = $this->create_migration_mock( [ 'get_status' => Status::PENDING() ] );
$ui = new Migration_UI( $migration );

$result = $ui->get_run_action_icon();

$this->assertSame( 'start', $result );
}

// -------------------------------------------------------------------------
// show_run()
// -------------------------------------------------------------------------
Expand Down
Loading