Skip to content

Commit ac13943

Browse files
authored
Merge pull request #4 from laravel-workflow/fix/dashboard
Fix dashboard ordering
2 parents 3c0b973 + 6c85a38 commit ac13943

File tree

7 files changed

+85
-36
lines changed

7 files changed

+85
-36
lines changed

app/Http/Controllers/WorkflowsController.php

+13-8
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@ class WorkflowsController extends Controller
99
{
1010
public function completed() {
1111
return StoredWorkflow::whereStatus('completed')
12+
->orderByDesc('id')
1213
->paginate(50);
1314
}
1415

1516
public function failed() {
1617
return StoredWorkflow::whereStatus('failed')
18+
->orderByDesc('id')
1719
->paginate(50);
18-
}
20+
}
1921

2022
public function running() {
2123
return StoredWorkflow::whereIn('status', [
@@ -24,6 +26,7 @@ public function running() {
2426
'running',
2527
'waiting',
2628
])
29+
->orderByDesc('id')
2730
->paginate(50);
2831
}
2932

@@ -32,14 +35,16 @@ public function show($id) {
3235

3336
$flow->exceptions = $flow->exceptions->map(function ($exception) {
3437
$unserialized = unserialize($exception->exception);
35-
$file = new SplFileObject($unserialized->getFile());
36-
$file->seek($unserialized->getLine() - 4);
37-
for ($line = 0; $line < 7; ++$line) {
38-
$exception->code .= $file->current();
39-
$file->next();
40-
if ($file->eof()) break;
38+
if (is_object($unserialized) && method_exists($unserialized, 'getFile')) {
39+
$file = new SplFileObject($unserialized->getFile());
40+
$file->seek($unserialized->getLine() - 4);
41+
for ($line = 0; $line < 7; ++$line) {
42+
$exception->code .= $file->current();
43+
$file->next();
44+
if ($file->eof()) break;
45+
}
46+
$exception->code = rtrim($exception->code);
4147
}
42-
$exception->code = rtrim($exception->code);
4348
return $exception;
4449
});
4550

package-lock.json

+61-19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/app.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/mix-manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"/app.js": "/app.js?id=8ac2ac0fcdb0b0cf7ee244d2a0e393eb",
2+
"/app.js": "/app.js?id=2cc20d4b72226021ffad651f80cc7963",
33
"/app-dark.css": "/app-dark.css?id=f522096d329c54701f099916e0416c38",
44
"/app.css": "/app.css?id=768ca5ff3a1358fcfb02f40296b64d0b",
55
"/img/favicon.png": "/img/favicon.png?id=7c006241b093796d6abfa3049df93a59",

resources/js/screens/flows/flow-row.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
{{ timestamp(flow.created_at) }}
1717
</td>
1818

19-
<td v-if="$route.params.type=='completed'" class="table-fit">
19+
<td v-if="$route.params.type=='completed' || $route.params.type=='failed'" class="table-fit">
2020
{{ timestamp(flow.updated_at) }}
2121
</td>
2222

23-
<td v-if="$route.params.type=='completed'" class="table-fit">
23+
<td v-if="$route.params.type=='completed' || $route.params.type=='failed'" class="table-fit">
2424
<span>{{ duration(flow.created_at, flow.updated_at) }}</span>
2525
</td>
2626
</tr>

resources/js/screens/flows/flow.vue

+6-4
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
</div>
8080
</div>
8181

82-
<div class="card mt-4" v-if="ready">
82+
<div class="card mt-4" v-if="ready && flow.logs && flow.logs.length">
8383
<div class="card-header d-flex align-items-center justify-content-between">
8484
<h5>Timeline</h5>
8585

@@ -93,7 +93,7 @@
9393
</div>
9494
</div>
9595

96-
<div class="card mt-4" v-if="ready">
96+
<div class="card mt-4" v-if="ready && flow.logs && flow.logs.length">
9797
<div class="card-header d-flex align-items-center justify-content-between">
9898
<h5>Activities</h5>
9999

@@ -123,7 +123,7 @@
123123
</div>
124124
</div>
125125

126-
<div class="card mt-4" v-if="ready">
126+
<div class="card mt-4" v-if="ready && flow.exceptions && flow.exceptions.length">
127127
<div class="card-header d-flex align-items-center justify-content-between">
128128
<h5>Exceptions</h5>
129129

@@ -145,9 +145,10 @@
145145
<template v-for="exception in flow.exceptions">
146146
<tr>
147147
<td>{{ exception.class }}</td>
148-
<td><button title="View Exception" class="btn btn-outline-primary ml-auto"
148+
<td v-if="exception.code"><button title="View Exception" class="btn btn-outline-primary ml-auto"
149149
data-toggle="collapse" :href="'#collapse' + exception.id" aria-expanded="false"
150150
:aria-controls="'collapse' + exception.id">View</button></td>
151+
<td v-else>-</td>
151152
<td>{{ timestamp(exception.created_at) }}</td>
152153
</tr>
153154
<tr :id="'collapse' + exception.id" class="collapse">
@@ -237,6 +238,7 @@ export default {
237238
}
238239
if (seriesIndex === 1) {
239240
let exception = phpunserialize(this.flow.exceptions[dataPointIndex].exception)
241+
if (typeof exception !== 'object') return '';
240242
exception.__constructor = this.flow.exceptions[dataPointIndex].exception.split('"')[1]
241243
242244
return '<div style="padding: 1em">' +

resources/js/screens/flows/index.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@
168168
<tr>
169169
<th>Flow</th>
170170
<th v-if="$route.params.type=='running'" class="text-right">Started At</th>
171-
<th v-if="$route.params.type=='completed'">Started At</th>
171+
<th v-if="$route.params.type=='completed' || $route.params.type=='failed'">Started At</th>
172172
<th v-if="$route.params.type=='completed'">Completed At</th>
173173
<th v-if="$route.params.type=='failed'">Failed At</th>
174174
<th v-if="$route.params.type=='completed' || $route.params.type=='failed'" class="text-right">Duration</th>

0 commit comments

Comments
 (0)