Skip to content

Commit 087d4c0

Browse files
authored
Merge pull request #2008 from zainforbjs/fix/fixes-for-cli
commit: fixes for wheels cli loading issues
2 parents 7b6f0a2 + fbaabd5 commit 087d4c0

8 files changed

Lines changed: 100 additions & 126 deletions

File tree

‎cli/src/commands/wheels/assets/init.cfc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ component extends="../base" {
247247
if (len(content) && right(content, 1) != chr(10)) {
248248
content &= chr(10);
249249
}
250-
content &= chr(10) & "# Vite build output" & chr(10);
250+
content = content & chr(10) & "## Vite build output" & chr(10);
251251
content &= arguments.entry & chr(10);
252252
fileWrite(gitignorePath, content);
253253
detailOutput.update(".gitignore", true);

‎cli/src/commands/wheels/jobs/monitor.cfc‎

Lines changed: 26 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
* wheels jobs monitor --queue=mailers
99
* {code}
1010
*/
11-
component extends="../../base" {
11+
component extends="../base" {
12+
13+
property name="detailOutput" inject="DetailOutputService@wheels-cli";
1214

1315
/**
1416
* @interval Refresh interval in seconds (default: 3)
@@ -25,10 +27,9 @@ component extends="../../base" {
2527
return;
2628
}
2729

28-
print.line();
29-
print.boldMagentaLine("Wheels Job Monitor");
30-
print.line("Press Ctrl+C to stop");
31-
print.line();
30+
detailOutput.header("Wheels Job Monitor");
31+
detailOutput.output("Press Ctrl+C to stop");
32+
detailOutput.line();
3233

3334
while (true) {
3435
// Build URL parameters
@@ -42,77 +43,54 @@ component extends="../../base" {
4243

4344
if (StructKeyExists(local.result, "success") && local.result.success) {
4445
// Clear previous output with separator
45-
print.line(RepeatString("=", 60));
46-
print.boldCyanLine("Job Queue Dashboard - #TimeFormat(Now(), "HH:mm:ss")#");
47-
print.line(RepeatString("-", 60));
46+
detailOutput.divider("=", 60);
47+
detailOutput.getPrint().boldCyanLine("Job Queue Dashboard - #TimeFormat(Now(), "HH:mm:ss")#");
48+
detailOutput.divider("-", 60);
4849

4950
// Queue statistics
5051
if (StructKeyExists(local.result, "stats") && StructKeyExists(local.result.stats, "totals")) {
5152
local.t = local.result.stats.totals;
52-
print.line();
53-
print.boldLine("Queue Summary:");
54-
print.yellowLine(" Pending: #local.t.pending#");
55-
print.cyanLine(" Processing: #local.t.processing#");
56-
print.greenLine(" Completed: #local.t.completed#");
57-
if (local.t.failed > 0) {
58-
print.redLine(" Failed: #local.t.failed#");
59-
} else {
60-
print.line(" Failed: #local.t.failed#");
61-
}
62-
print.line(" Total: #local.t.total#");
53+
detailOutput.subHeader("Queue Summary");
54+
detailOutput.metric("Pending", local.t.pending);
55+
detailOutput.metric("Processing", local.t.processing);
56+
detailOutput.metric("Completed", local.t.completed);
57+
detailOutput.metric("Failed", local.t.failed);
58+
detailOutput.metric("Total", local.t.total);
6359
}
6460

6561
// Throughput
6662
if (StructKeyExists(local.result, "monitor")) {
6763
local.m = local.result.monitor;
6864

69-
print.line();
70-
print.boldLine("Throughput (last 60 min):");
71-
print.greenLine(" Completed: #local.m.throughput.completed#");
72-
if (local.m.throughput.failed > 0) {
73-
print.redLine(" Failed: #local.m.throughput.failed#");
74-
} else {
75-
print.line(" Failed: #local.m.throughput.failed#");
76-
}
77-
if (local.m.errorRate > 0) {
78-
print.redLine(" Error rate: #local.m.errorRate#%");
79-
} else {
80-
print.greenLine(" Error rate: 0%");
81-
}
65+
detailOutput.subHeader("Throughput (last 60 min)");
66+
detailOutput.metric("Completed", local.m.throughput.completed);
67+
detailOutput.metric("Failed", local.m.throughput.failed);
68+
detailOutput.metric("Error rate", "#local.m.errorRate#%");
8269

8370
if (Len(local.m.oldestPending)) {
84-
print.line();
85-
print.line("Oldest pending job: #DateTimeFormat(local.m.oldestPending, 'yyyy-mm-dd HH:mm:ss')#");
71+
detailOutput.line();
72+
detailOutput.output("Oldest pending job: #DateTimeFormat(local.m.oldestPending, 'yyyy-mm-dd HH:mm:ss')#");
8673
}
8774

8875
// Recent jobs
8976
if (ArrayLen(local.m.recentJobs)) {
90-
print.line();
91-
print.boldLine("Recent Jobs:");
77+
detailOutput.subHeader("Recent Jobs");
9278
local.count = Min(ArrayLen(local.m.recentJobs), 5);
9379
for (local.i = 1; local.i <= local.count; local.i++) {
9480
local.job = local.m.recentJobs[local.i];
95-
local.statusColor = "line";
96-
if (local.job.status == "completed") local.statusColor = "greenLine";
97-
else if (local.job.status == "failed") local.statusColor = "redLine";
98-
else if (local.job.status == "processing") local.statusColor = "cyanLine";
99-
else if (local.job.status == "pending") local.statusColor = "yellowLine";
100-
101-
print["#local.statusColor#"](
102-
" [#local.job.status#] #local.job.jobClass# (#local.job.queue#) - #DateTimeFormat(local.job.updatedAt, 'HH:mm:ss')#"
103-
);
81+
detailOutput.output(" [#local.job.status#] #local.job.jobClass# (#local.job.queue#) - #DateTimeFormat(local.job.updatedAt, 'HH:mm:ss')#");
10482
}
10583
}
10684
}
10785

10886
// Timeout recoveries
10987
if (StructKeyExists(local.result, "timeoutsRecovered") && local.result.timeoutsRecovered > 0) {
110-
print.line();
111-
print.yellowLine("Recovered #local.result.timeoutsRecovered# timed-out job(s)");
88+
detailOutput.line();
89+
detailOutput.statusWarning("Recovered #local.result.timeoutsRecovered# timed-out job(s)");
11290
}
11391
}
11492
} catch (any e) {
115-
print.redLine("[#TimeFormat(Now(), "HH:mm:ss")#] Monitor error: #e.message#");
93+
detailOutput.error("[#TimeFormat(Now(), "HH:mm:ss")#] Monitor error: #e.message#");
11694
}
11795

11896
sleep(arguments.interval * 1000);

‎cli/src/commands/wheels/jobs/purge.cfc‎

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
* wheels jobs purge --completed --failed --force
99
* {code}
1010
*/
11-
component extends="../../base" {
11+
component extends="../base" {
12+
13+
property name="detailOutput" inject="DetailOutputService@wheels-cli";
1214

1315
/**
1416
* @completed Purge completed jobs (default: true)
@@ -31,9 +33,7 @@ component extends="../../base" {
3133
return;
3234
}
3335

34-
print.line();
35-
print.boldBlueLine("Purge Jobs");
36-
print.line();
36+
detailOutput.header("Purge Jobs");
3737

3838
local.totalPurged = 0;
3939

@@ -48,9 +48,9 @@ component extends="../../base" {
4848
if (StructKeyExists(local.result, "success") && local.result.success && StructKeyExists(local.result, "purged")) {
4949
local.totalPurged += local.result.purged;
5050
if (local.result.purged > 0) {
51-
print.greenLine("Purged #local.result.purged# completed job(s) older than #arguments.olderThan# day(s).");
51+
detailOutput.success("Purged #local.result.purged# completed job(s) older than #arguments.olderThan# day(s).");
5252
} else {
53-
print.line("No completed jobs to purge.");
53+
detailOutput.output("No completed jobs to purge.");
5454
}
5555
}
5656
}
@@ -66,19 +66,16 @@ component extends="../../base" {
6666
if (StructKeyExists(local.result, "success") && local.result.success && StructKeyExists(local.result, "purged")) {
6767
local.totalPurged += local.result.purged;
6868
if (local.result.purged > 0) {
69-
print.greenLine("Purged #local.result.purged# failed job(s) older than #arguments.olderThan# day(s).");
69+
detailOutput.success("Purged #local.result.purged# failed job(s) older than #arguments.olderThan# day(s).");
7070
} else {
71-
print.line("No failed jobs to purge.");
71+
detailOutput.output("No failed jobs to purge.");
7272
}
7373
}
7474
}
7575

7676
if (local.totalPurged > 0) {
77-
print.line();
78-
print.boldGreenLine("Total purged: #local.totalPurged# job(s)");
77+
detailOutput.success("Total purged: #local.totalPurged# job(s)");
7978
}
80-
81-
print.line();
8279
}
8380

8481
}

‎cli/src/commands/wheels/jobs/retry.cfc‎

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
* wheels jobs retry --limit=10
88
* {code}
99
*/
10-
component extends="../../base" {
10+
component extends="../base" {
11+
12+
property name="detailOutput" inject="DetailOutputService@wheels-cli";
1113

1214
/**
1315
* @queue Filter by queue name (default: all queues)
@@ -24,9 +26,7 @@ component extends="../../base" {
2426
return;
2527
}
2628

27-
print.line();
28-
print.boldBlueLine("Retry Failed Jobs");
29-
print.line();
29+
detailOutput.header("Retry Failed Jobs");
3030

3131
// Build URL parameters
3232
local.urlParams = "&command=jobsRetry";
@@ -44,14 +44,12 @@ component extends="../../base" {
4444

4545
if (StructKeyExists(local.result, "retried")) {
4646
if (local.result.retried > 0) {
47-
print.greenLine("Retried #local.result.retried# failed job(s).");
48-
print.line("Jobs have been reset to 'pending' and will be processed on the next cycle.");
47+
detailOutput.success("Retried #local.result.retried# failed job(s).");
48+
detailOutput.output("Jobs have been reset to 'pending' and will be processed on the next cycle.");
4949
} else {
50-
print.line("No failed jobs to retry.");
50+
detailOutput.output("No failed jobs to retry.");
5151
}
5252
}
53-
54-
print.line();
5553
}
5654

5755
}

‎cli/src/commands/wheels/jobs/status.cfc‎

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
* wheels jobs status --format=json
88
* {code}
99
*/
10-
component extends="../../base" {
10+
component extends="../base" {
11+
12+
property name="detailOutput" inject="DetailOutputService@wheels-cli";
1113

1214
/**
1315
* @queue Filter by queue name (default: all queues)
@@ -24,9 +26,7 @@ component extends="../../base" {
2426
return;
2527
}
2628

27-
print.line();
28-
print.boldBlueLine("Job Queue Status");
29-
print.line();
29+
detailOutput.header("Job Queue Status");
3030

3131
// Build URL parameters
3232
local.urlParams = "&command=jobsStatus";
@@ -40,7 +40,7 @@ component extends="../../base" {
4040
}
4141

4242
if (arguments.format == "json") {
43-
print.line(SerializeJSON(local.result.stats));
43+
detailOutput.output(SerializeJSON(local.result.stats));
4444
return;
4545
}
4646

@@ -49,8 +49,8 @@ component extends="../../base" {
4949
local.queues = local.result.stats.queues;
5050

5151
if (StructCount(local.queues) == 0) {
52-
print.line("No jobs found.");
53-
print.line();
52+
detailOutput.output("No jobs found.");
53+
detailOutput.line();
5454
return;
5555
}
5656

@@ -63,47 +63,47 @@ component extends="../../base" {
6363
PadRight("Total", 10) & " |";
6464
local.separator = RepeatString("-", Len(local.header));
6565

66-
print.line(local.separator);
67-
print.line(local.header);
68-
print.line(local.separator);
66+
detailOutput.getPrint().line(local.separator);
67+
detailOutput.getPrint().line(local.header);
68+
detailOutput.getPrint().line(local.separator);
6969

7070
for (local.queueName in local.queues) {
7171
local.q = local.queues[local.queueName];
72-
print.text("| " & PadRight(local.queueName, 20) & " | ");
73-
print.yellowText(PadRight(local.q.pending, 10));
74-
print.text(" | ");
75-
print.cyanText(PadRight(local.q.processing, 12));
76-
print.text(" | ");
77-
print.greenText(PadRight(local.q.completed, 12));
78-
print.text(" | ");
72+
detailOutput.getPrint().text("| " & PadRight(local.queueName, 20) & " | ");
73+
detailOutput.getPrint().yellowText(PadRight(local.q.pending, 10));
74+
detailOutput.getPrint().text(" | ");
75+
detailOutput.getPrint().cyanText(PadRight(local.q.processing, 12));
76+
detailOutput.getPrint().text(" | ");
77+
detailOutput.getPrint().greenText(PadRight(local.q.completed, 12));
78+
detailOutput.getPrint().text(" | ");
7979
if (local.q.failed > 0) {
80-
print.redText(PadRight(local.q.failed, 10));
80+
detailOutput.getPrint().redText(PadRight(local.q.failed, 10));
8181
} else {
82-
print.text(PadRight(local.q.failed, 10));
82+
detailOutput.getPrint().text(PadRight(local.q.failed, 10));
8383
}
84-
print.line(" | " & PadRight(local.q.total, 10) & " |");
84+
detailOutput.getPrint().line(" | " & PadRight(local.q.total, 10) & " |");
8585
}
8686

8787
// Totals row
8888
local.totals = local.result.stats.totals;
89-
print.line(local.separator);
90-
print.text("| " & PadRight("TOTAL", 20) & " | ");
91-
print.boldYellowText(PadRight(local.totals.pending, 10));
92-
print.text(" | ");
93-
print.boldCyanText(PadRight(local.totals.processing, 12));
94-
print.text(" | ");
95-
print.boldGreenText(PadRight(local.totals.completed, 12));
96-
print.text(" | ");
89+
detailOutput.getPrint().line(local.separator);
90+
detailOutput.getPrint().text("| " & PadRight("TOTAL", 20) & " | ");
91+
detailOutput.getPrint().boldYellowText(PadRight(local.totals.pending, 10));
92+
detailOutput.getPrint().text(" | ");
93+
detailOutput.getPrint().boldCyanText(PadRight(local.totals.processing, 12));
94+
detailOutput.getPrint().text(" | ");
95+
detailOutput.getPrint().boldGreenText(PadRight(local.totals.completed, 12));
96+
detailOutput.getPrint().text(" | ");
9797
if (local.totals.failed > 0) {
98-
print.boldRedText(PadRight(local.totals.failed, 10));
98+
detailOutput.getPrint().boldRedText(PadRight(local.totals.failed, 10));
9999
} else {
100-
print.boldText(PadRight(local.totals.failed, 10));
100+
detailOutput.getPrint().boldText(PadRight(local.totals.failed, 10));
101101
}
102-
print.line(" | " & PadRight(local.totals.total, 10) & " |");
103-
print.line(local.separator);
102+
detailOutput.getPrint().line(" | " & PadRight(local.totals.total, 10) & " |");
103+
detailOutput.getPrint().line(local.separator);
104104
}
105105

106-
print.line();
106+
detailOutput.line();
107107
}
108108

109109
private string function PadRight(required string text, required numeric length) {

0 commit comments

Comments
 (0)