Skip to content

Commit

Permalink
Merge pull request #903 from laravel/batches
Browse files Browse the repository at this point in the history
Batches
  • Loading branch information
taylorotwell authored Jun 10, 2020
2 parents 087a8ef + 1cb0dd4 commit cd9aa4a
Show file tree
Hide file tree
Showing 29 changed files with 106,536 additions and 78 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [7.2, 7.3, 7.4]
laravel: [^7.0]
php: [7.3, 7.4]
laravel: [^8.0]

name: P${{ matrix.php }} - L${{ matrix.laravel }}

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
"require": {
"php": "^7.2",
"ext-json": "*",
"laravel/framework": "^7.0",
"laravel/framework": "^8.0",
"symfony/var-dumper": "^5.0"
},
"require-dev": {
"ext-gd": "*",
"orchestra/testbench": "^5.0"
"orchestra/testbench": "^6.0"
},
"autoload": {
"psr-4": {
Expand Down
1 change: 1 addition & 0 deletions config/telescope.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
*/

'watchers' => [
Watchers\BatchWatcher::class => env('TELESCOPE_BATCH_WATCHER', true),
Watchers\CacheWatcher::class => env('TELESCOPE_CACHE_WATCHER', true),

Watchers\CommandWatcher::class => [
Expand Down
11,205 changes: 11,203 additions & 2 deletions public/app-dark.css

Large diffs are not rendered by default.

11,205 changes: 11,203 additions & 2 deletions public/app.css

Large diffs are not rendered by default.

77,487 changes: 77,485 additions & 2 deletions public/app.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions public/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"/app.js": "/app.js?id=2cc598321134a0bcfac1",
"/app.css": "/app.css?id=d79fb7e75cd04c97ef92",
"/app-dark.css": "/app-dark.css?id=af37df8013614303ea68"
"/app.js": "/app.js?id=baadf232dd8610dba988",
"/app.css": "/app.css?id=4fe6de748c534e14b1eb",
"/app-dark.css": "/app-dark.css?id=14e81c67874cbab6abff"
}
6 changes: 3 additions & 3 deletions resources/js/components/IndexScreen.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
export default {
props: [
'resource', 'title'
'resource', 'title', 'showAllFamily', 'hideSearch'
],
Expand Down Expand Up @@ -119,7 +119,7 @@
if (_.isFunction(after)) {
after(
this.familyHash ? response.data.entries : _.uniqBy(response.data.entries, entry => entry.family_hash || _.uniqueId())
this.familyHash || this.showAllFamily ? response.data.entries : _.uniqBy(response.data.entries, entry => entry.family_hash || _.uniqueId())
);
}
})
Expand Down Expand Up @@ -270,7 +270,7 @@
<h5>{{this.title}}</h5>

<input type="text" class="form-control w-25"
v-if="tag || entries.length > 0"
v-if="!hideSearch && (tag || entries.length > 0)"
id="searchInput"
placeholder="Search Tag" v-model="tag" @input.stop="search">
</div>
Expand Down
12 changes: 12 additions & 0 deletions resources/js/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,18 @@ export default [
component: require('./screens/jobs/index').default,
},

{
path: '/batches/:id',
name: 'batch-preview',
component: require('./screens/batches/preview').default,
},

{
path: '/batches',
name: 'batches',
component: require('./screens/batches/index').default,
},

{
path: '/events/:id',
name: 'event-preview',
Expand Down
58 changes: 58 additions & 0 deletions resources/js/screens/batches/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<script type="text/ecmascript-6">
import StylesMixin from './../../mixins/entriesStyles';
export default {
mixins: [
StylesMixin,
],
}
</script>

<template>
<index-screen title="Batches" resource="batches" hide-search="true">
<tr slot="table-header">
<th scope="col">Batch</th>
<th scope="col">Status</th>
<th scope="col">Size</th>
<th scope="col">Completion</th>
<th scope="col">Happened</th>
<th scope="col"></th>
</tr>


<template slot="row" slot-scope="slotProps">
<td>
<span :title="slotProps.entry.content.name">{{truncate(slotProps.entry.content.name || slotProps.entry.content.id, 68)}}</span><br>
<small class="text-muted">
Connection: {{slotProps.entry.content.connection}} | Queue: {{slotProps.entry.content.queue}}
</small>
</td>

<td>
<small class="badge badge-danger badge-sm" v-if="slotProps.entry.content.failedJobs > 0 && slotProps.entry.content.progress < 100">
Failures
</small>
<small class="badge badge-success badge-sm" v-if="slotProps.entry.content.progress == 100">
Finished
</small>
<small class="badge badge-secondary badge-sm" v-if="slotProps.entry.content.totalJobs == 0 || (slotProps.entry.content.pendingJobs > 0 && !slotProps.entry.content.failedJobs)">
Pending
</small>
</td>
<td>{{slotProps.entry.content.totalJobs}}</td>
<td>{{slotProps.entry.content.progress}}%</td>

<td class="table-fit" :data-timeago="slotProps.entry.created_at" :title="slotProps.entry.created_at">
{{ timeAgo(slotProps.entry.created_at) }}
</td>

<td class="table-fit">
<router-link :to="{name:'batch-preview', params:{id: slotProps.entry.id}}" class="control-action">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 16">
<path d="M16.56 13.66a8 8 0 0 1-11.32 0L.3 8.7a1 1 0 0 1 0-1.42l4.95-4.95a8 8 0 0 1 11.32 0l4.95 4.95a1 1 0 0 1 0 1.42l-4.95 4.95-.01.01zm-9.9-1.42a6 6 0 0 0 8.48 0L19.38 8l-4.24-4.24a6 6 0 0 0-8.48 0L2.4 8l4.25 4.24h.01zM10.9 12a4 4 0 1 1 0-8 4 4 0 0 1 0 8zm0-2a2 2 0 1 0 0-4 2 2 0 0 0 0 4z"></path>
</svg>
</router-link>
</td>
</template>
</index-screen>
</template>
106 changes: 106 additions & 0 deletions resources/js/screens/batches/preview.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<script type="text/ecmascript-6">
import axios from 'axios';
import StylesMixin from './../../mixins/entriesStyles';
export default {
components: {},
mixins: [
StylesMixin,
],
data() {
return {
entry: null,
batch: [],
currentTab: 'data'
};
}
}
</script>

<template>
<preview-screen title="Batch Details" resource="batches" :id="$route.params.id" entry-point="true">
<template slot="table-parameters" slot-scope="slotProps">
<tr>
<td class="table-fit font-weight-bold">Status</td>
<td>
<small class="badge badge-danger badge-sm" v-if="slotProps.entry.content.failedJobs > 0 && slotProps.entry.content.progress < 100">
Failures
</small>
<small class="badge badge-success badge-sm" v-if="slotProps.entry.content.progress == 100">
Finished
</small>
<small class="badge badge-secondary badge-sm" v-if="slotProps.entry.content.totalJobs == 0 || (slotProps.entry.content.pendingJobs > 0 && !slotProps.entry.content.failedJobs)">
Pending
</small>
</td>
</tr>

<tr v-if="slotProps.entry.content.cancelledAt">
<td class="table-fit font-weight-bold">Cancelled At</td>
<td>
{{localTime(slotProps.entry.content.cancelledAt)}} ({{timeAgo(slotProps.entry.content.cancelledAt)}})
</td>
</tr>

<tr v-if="slotProps.entry.content.finishedAt">
<td class="table-fit font-weight-bold">Finished At</td>
<td>
{{localTime(slotProps.entry.content.finishedAt)}} ({{timeAgo(slotProps.entry.content.finishedAt)}})
</td>
</tr>

<tr>
<td class="table-fit font-weight-bold">Batch</td>
<td>
{{slotProps.entry.content.name || slotProps.entry.content.id}}
</td>
</tr>

<tr>
<td class="table-fit font-weight-bold">Connection</td>
<td>
{{slotProps.entry.content.connection}}
</td>
</tr>

<tr>
<td class="table-fit font-weight-bold">Queue</td>
<td>
{{slotProps.entry.content.queue}}
</td>
</tr>

<tr>
<td class="table-fit font-weight-bold">Size</td>
<td>
<router-link :to="{name:'jobs', query: {family_hash: slotProps.entry.family_hash}}" class="control-action">
{{slotProps.entry.content.totalJobs}} Jobs
</router-link>
</td>
</tr>

<tr>
<td class="table-fit font-weight-bold">Pending</td>
<td>
{{slotProps.entry.content.pendingJobs}}
</td>
</tr>

<tr>
<td class="table-fit font-weight-bold">Progress</td>
<td>
{{slotProps.entry.content.progress}}%
</td>
</tr>

</template>
</preview-screen>
</template>

<style scoped>
</style>
2 changes: 1 addition & 1 deletion resources/js/screens/jobs/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</script>

<template>
<index-screen title="Jobs" resource="jobs">
<index-screen title="Jobs" resource="jobs" show-all-family="true">
<tr slot="table-header">
<th scope="col">Job</th>
<th scope="col">Status</th>
Expand Down
9 changes: 9 additions & 0 deletions resources/js/screens/jobs/preview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,15 @@
</td>
</tr>

<tr v-if="slotProps.entry.content.data.batchId">
<td class="table-fit font-weight-bold">Batch</td>
<td>
<router-link :to="{name:'batch-preview', params:{id: slotProps.entry.content.data.batchId}}" class="control-action">
{{slotProps.entry.content.data.batchId}}
</router-link>
</td>
</tr>

</template>

<div slot="after-attributes-card" slot-scope="slotProps">
Expand Down
Loading

0 comments on commit cd9aa4a

Please sign in to comment.