Skip to content

Commit 7c19c7b

Browse files
authored
Merge pull request #27 from stellarwp/feat/dqa-items
Apply some DQA changes
2 parents b68fc95 + 9afd7f2 commit 7c19c7b

17 files changed

Lines changed: 32 additions & 130 deletions

assets/css/admin.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@
178178

179179
.stellarwp-migration-card__description {
180180
color: #50575e;
181-
font-size: 14px;
181+
font-size: 12px;
182182
line-height: 1.5;
183183
margin: 0 0 16px;
184184
}

assets/js/admin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@
162162
// Add loading state to clicked button
163163
button.classList.add( 'stellarwp-migration-btn--loading' );
164164
const originalText = button.textContent;
165-
button.textContent = action === 'run' ? __( 'Running...', 'stellarwp-migrations' ) : __( 'Rolling back...', 'stellarwp-migrations' );
165+
button.textContent = action === 'run' ? __( 'Adding to queue...', 'stellarwp-migrations' ) : __( 'Rolling back...', 'stellarwp-migrations' );
166166

167167
// Build the endpoint path (relative to REST root)
168168
const endpoint = restUrl + '/migrations/' + encodeURIComponent( migrationId ) + '/' + action;

src/Admin/UI.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ private function parse_filters(): array {
220220
"stellarwp_migrations_{$prefix}_filters",
221221
[
222222
'tags' => $tags,
223-
'show_completed' => ! empty( filter_input( INPUT_GET, 'show_completed', FILTER_SANITIZE_NUMBER_INT ) ),
223+
'show_completed' => filter_input( INPUT_GET, 'show_completed', FILTER_SANITIZE_NUMBER_INT ) !== '0',
224224
'show_non_applicable' => ! empty( filter_input( INPUT_GET, 'show_non_applicable', FILTER_SANITIZE_NUMBER_INT ) ),
225225
]
226226
);

src/Enums/Status.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ class Status extends Enum {
106106
public function get_label(): string {
107107
switch ( $this->getValue() ) {
108108
case self::PENDING:
109-
return _x( 'Pending', 'Migration status', 'stellarwp-migrations' );
109+
return _x( 'Not started', 'Migration status', 'stellarwp-migrations' );
110110
case self::RUNNING:
111-
return _x( 'Running', 'Migration status', 'stellarwp-migrations' );
111+
return _x( 'Migration in progress', 'Migration status', 'stellarwp-migrations' );
112112
case self::COMPLETED:
113113
return _x( 'Completed', 'Migration status', 'stellarwp-migrations' );
114114
case self::FAILED:

src/Utilities/Migration_UI.php

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -137,33 +137,6 @@ public function get_run_action_label(): string {
137137
return __( 'Start', 'stellarwp-migrations' );
138138
}
139139

140-
/**
141-
* Returns the run action icon name for the migration.
142-
*
143-
* @since 0.0.1
144-
*
145-
* @return string Icon name (e.g. 'start', 'retry').
146-
*/
147-
public function get_run_action_icon(): string {
148-
$status_value = $this->get_display_status()->getValue();
149-
150-
if (
151-
in_array(
152-
$status_value,
153-
[
154-
Status::COMPLETED()->getValue(),
155-
Status::REVERTED()->getValue(),
156-
Status::FAILED()->getValue(),
157-
],
158-
true
159-
)
160-
) {
161-
return 'retry';
162-
}
163-
164-
return 'start';
165-
}
166-
167140
/**
168141
* Whether the run button should be shown for the migration.
169142
*

src/views/components/migration-actions.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
$show_run = $migration_ui->show_run();
3333
$show_rollback = $migration_ui->show_rollback();
3434
$run_migration_label = $migration_ui->get_run_action_label();
35-
$run_migration_icon = $migration_ui->get_run_action_icon();
3635

3736
$template = Config::get_template_engine();
3837

@@ -63,7 +62,7 @@ class="stellarwp-migration-btn stellarwp-migration-btn--primary"
6362
>
6463
<?php
6564
$template->template(
66-
'icons/' . $run_migration_icon,
65+
'icons/start',
6766
[
6867
'is_aria_hidden' => true,
6968
]

src/views/icons/retry.php

Lines changed: 0 additions & 43 deletions
This file was deleted.

src/views/list.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ class="stellarwp-migrations-select2"
6868
</div>
6969

7070
<div class="stellarwp-migrations-filters__checkboxes">
71+
<input type="hidden" name="show_completed" value="0" />
7172
<label>
7273
<input
7374
type="checkbox"

tests/wpunit/Admin/__snapshots__/UI_Test__it_should_render_empty_list_when_no_migrations__0.snapshot.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<div class="wrap">
22
<form method="get" class="stellarwp-migrations-filters">
33

4+
45
<div class="stellarwp-migrations-filters__row">
56

67
<div class="stellarwp-migrations-filters__actions">
@@ -11,12 +12,13 @@
1112
</div>
1213

1314
<div class="stellarwp-migrations-filters__checkboxes">
15+
<input type="hidden" name="show_completed" value="0" />
1416
<label>
1517
<input
1618
type="checkbox"
1719
name="show_completed"
1820
value="1"
19-
onchange="this.form.submit();"
21+
checked='checked' onchange="this.form.submit();"
2022
/>
2123
Show Completed </label>
2224
<label>

tests/wpunit/Admin/__snapshots__/UI_Test__it_should_render_list_with_migrations__0.snapshot.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,13 @@
2828
</div>
2929

3030
<div class="stellarwp-migrations-filters__checkboxes">
31+
<input type="hidden" name="show_completed" value="0" />
3132
<label>
3233
<input
3334
type="checkbox"
3435
name="show_completed"
3536
value="1"
36-
onchange="this.form.submit();"
37+
checked='checked' onchange="this.form.submit();"
3738
/>
3839
Show Completed </label>
3940
<label>
@@ -61,7 +62,7 @@ <h3 class="stellarwp-migration-card__label">
6162
<div class="stellarwp-migration-card__footer">
6263
<div class="stellarwp-migration-card__status">
6364
<span class="stellarwp-migration-card__status-label stellarwp-migration-card__status-label--pending">
64-
Pending </span>
65+
Not started </span>
6566

6667
<span class="stellarwp-migration-card__progress-text">
6768
0 / 1</span>
@@ -121,7 +122,7 @@ <h3 class="stellarwp-migration-card__label">
121122
<div class="stellarwp-migration-card__footer">
122123
<div class="stellarwp-migration-card__status">
123124
<span class="stellarwp-migration-card__status-label stellarwp-migration-card__status-label--pending">
124-
Pending </span>
125+
Not started </span>
125126

126127
<span class="stellarwp-migration-card__progress-text">
127128
0 / 3</span>
@@ -185,7 +186,7 @@ <h3 class="stellarwp-migration-card__label">
185186
<div class="stellarwp-migration-card__footer">
186187
<div class="stellarwp-migration-card__status">
187188
<span class="stellarwp-migration-card__status-label stellarwp-migration-card__status-label--pending">
188-
Pending </span>
189+
Not started </span>
189190

190191
<span class="stellarwp-migration-card__progress-text">
191192
0 / 1</span>

0 commit comments

Comments
 (0)