File tree Expand file tree Collapse file tree 6 files changed +92
-31
lines changed
Expand file tree Collapse file tree 6 files changed +92
-31
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import moment from 'moment';
44import UIkit from 'uikit' ;
55import Icons from 'uikit/dist/js/uikit-icons' ;
66import UIKitAlert from './components/UiKitAlert.vue' ;
7+ import TaskRow from './tasks/components/TaskRow.vue' ;
78import TaskType from './tasks/components/TaskType.vue' ;
89import TaskOutput from './tasks/components/TaskOutput.vue' ;
910import StatusButton from './tasks/components/StatusButton.vue' ;
@@ -53,6 +54,7 @@ new Vue({
5354 'import-button' : ImportButton ,
5455 'task-type' : TaskType ,
5556 'task-output' : TaskOutput ,
57+ 'task-row' : TaskRow ,
5658 'click-to-close' : ClickToClose ,
5759 'command-list' : CommandList
5860 } ,
Original file line number Diff line number Diff line change 4747 .then (response => {
4848 this .task = response .data ;
4949 this .running = false ;
50+ this .$emit (' taskExecuted' , this .task );
5051 })
5152 }
5253 },
5354 mounted () {
5455 }
5556 }
56- </script >
57+ </script >
Original file line number Diff line number Diff line change 1+ <template >
2+ <tr :class =" task.is_active ? '' : 'uk-text-danger'" >
3+ <td >
4+ <a :href =" showHref" >
5+ {{ description }}
6+ </a >
7+ <span class =" uk-float-right uk-hidden@s uk-text-muted" >Command</span >
8+ </td >
9+ <td >
10+ {{ task.average_runtime ? averageDurationInSeconds : 0 }} seconds
11+ <span class =" uk-float-right uk-hidden@s uk-text-muted" >Avg. Runtime</span >
12+ </td >
13+ <td >
14+ {{ task.last_result ? lastRunDate : 'N/A' }}
15+ <span class =" uk-float-right uk-hidden@s uk-text-muted" >Last Run</span >
16+ </td >
17+ <td >
18+ {{task.upcoming}}
19+ <span class =" uk-float-right uk-hidden@s uk-text-muted" >Next Run</span >
20+ </td >
21+ <td class =" uk-text-center@m" >
22+ <execute-button
23+ :data-task =" task"
24+ :url =" executeHref"
25+ v-on:taskExecuted =" refreshTask"
26+ icon-name =" play"
27+ button-class =" uk-button-link"
28+ />
29+ </td >
30+ </tr >
31+ </template >
32+
33+ <script >
34+ import moment from ' moment'
35+ import ExecuteButton from ' ./ExecuteButton'
36+
37+ export default {
38+ components: {
39+ ExecuteButton
40+ },
41+
42+ props: {
43+ dataTask: {},
44+ },
45+
46+ data () {
47+ return {
48+ task: this .dataTask
49+ }
50+ },
51+
52+ computed: {
53+ description () {
54+ return this .task .description .substring (0 ,29 );
55+ },
56+
57+ averageDurationInSeconds () {
58+ return this .task .average_runtime > 0 ? (this .task .average_runtime / 1000 ).toFixed (2 ) : 0 ;
59+ },
60+
61+ lastRunDate () {
62+ return moment (this .task .last_result .ran_at ).format (' YYYY-MM-DD hh:mm:ss' );
63+ },
64+
65+ showHref () {
66+ return this .$attrs .showhref ;
67+ },
68+
69+ executeHref () {
70+ return this .$attrs .executehref ;
71+ }
72+ },
73+
74+ methods: {
75+ refreshTask (task ) {
76+ this .task = task;
77+ }
78+ }
79+ }
80+ </script >
Original file line number Diff line number Diff line change 3030 </thead >
3131 <tbody >
3232 @forelse ($tasks as $task )
33- <tr class =" {{ $task -> is_active ?: ' uk-text-danger' } }" >
34- <td >
35- <a href =" {{ route (' totem.task.view' , $task )} }" >
36- {{ str_limit ($task -> description , 30 )} }
37- </a >
38- <span class =" uk-float-right uk-hidden@s uk-text-muted" >Command</span >
39- </td >
40- <td >
41- {{ number_format ( $task -> averageRuntime / 1000 , 2 ) } } seconds
42- <span class =" uk-float-right uk-hidden@s uk-text-muted" >Avg. Runtime</span >
43- </td >
44- @if ($last = $task -> lastResult )
45- <td >
46- {{ $last -> ran_at -> toDateTimeString ()} }
47- <span class =" uk-float-right uk-hidden@s uk-text-muted" >Last Run</span >
48- </td >
49- @else
50- <td >
51- N/A
52- <span class =" uk-float-right uk-hidden@s uk-text-muted" >Last Run</span >
53- </td >
54- @endif
55- <td >
56- {{ $task -> upcoming } }
57- <span class =" uk-float-right uk-hidden@s uk-text-muted" >Next Run</span >
58- </td >
59- <td class =" uk-text-center@m" >
60- <execute-button :data-task =" {{ $task } }" url =" {{ route (' totem.task.execute' , $task )} }" icon-name =" play" button-class =" uk-button-link" ></execute-button >
61- </td >
33+ <tr is =" task-row"
34+ :data-task =" {{ $task } }"
35+ showHref =" {{ route (' totem.task.view' , $task )} }"
36+ executeHref =" {{ route (' totem.task.execute' , $task )} }" >
6237 </tr >
6338 @empty
6439 <tr >
Original file line number Diff line number Diff line change 22
33namespace Studio \Totem \Http \Controllers ;
44
5+ use Studio \Totem \Task ;
56use Studio \Totem \Contracts \TaskInterface ;
67
78class ExecuteTasksController extends Controller
@@ -29,6 +30,6 @@ public function index($task)
2930 {
3031 $ this ->tasks ->execute ($ task );
3132
32- return redirect ()-> back ( );
33+ return Task:: find ( $ task -> id );
3334 }
3435}
Original file line number Diff line number Diff line change @@ -43,6 +43,8 @@ class Task extends TotemModel
4343 protected $ appends = [
4444 'activated ' ,
4545 'upcoming ' ,
46+ 'last_result ' ,
47+ 'average_runtime ' ,
4648 ];
4749
4850 /**
You can’t perform that action at this time.
0 commit comments