Skip to content

Commit a0bc0e4

Browse files
author
songzou
committed
first commit
0 parents  commit a0bc0e4

File tree

9 files changed

+1770
-0
lines changed

9 files changed

+1770
-0
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.DS_Store
2+
phpunit.phar
3+
/vendor
4+
composer.phar
5+
composer.lock
6+
*.project
7+
.idea/

LICENSE

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2015 Jens Segers
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
this software and associated documentation files (the "Software"), to deal in
7+
the Software without restriction, including without limitation the rights to
8+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9+
the Software, and to permit persons to whom the Software is furnished to do so,
10+
subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
laravel-admin-ext/scheduling
2+
============================
3+
4+
A web interface for manage task scheduling in laravel.
5+
6+
## Installation
7+
8+
```
9+
$ composer require laravel-admin-ext/scheduling
10+
11+
```
12+
13+
Open `app/Providers/AppServiceProvider.php`, and call the `Scheduling::boot` method within the `boot` method:
14+
15+
```php
16+
<?php
17+
18+
namespace App\Providers;
19+
20+
use Encore\Admin\Scheduling\Scheduling;
21+
use Illuminate\Support\ServiceProvider;
22+
23+
class AppServiceProvider extends ServiceProvider
24+
{
25+
public function boot()
26+
{
27+
Scheduling::boot();
28+
}
29+
}
30+
```
31+
32+
then run:
33+
34+
```
35+
$ php artisan admin:import scheduling
36+
```
37+
38+
Open `http://your-host/admin/scheduling`.
39+
40+
License
41+
------------
42+
Licensed under [The MIT License (MIT)](LICENSE).

composer.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"name": "laravel-admin-ext/scheduling",
3+
"description": "Task scheduling extension for laravel-admin",
4+
"type": "library",
5+
"keywords": ["laravel-admin", "task", "Scheduling"],
6+
"homepage": "https://github.com/laravel-admin-extensions/scheduling",
7+
"license": "MIT",
8+
"authors": [
9+
{
10+
"name": "z-song",
11+
"email": "[email protected]"
12+
}
13+
],
14+
"require": {
15+
"php": ">=7.0.0",
16+
"laravel/framework": "5.5.*",
17+
"encore/laravel-admin": "1.5.*"
18+
},
19+
"require-dev": {
20+
"phpunit/phpunit": "~6.0",
21+
"laravel/laravel": "5.*"
22+
},
23+
"autoload": {
24+
"psr-4": {
25+
"Encore\\Admin\\Scheduling\\": "src/"
26+
}
27+
},
28+
"extra": {
29+
"laravel": {
30+
"providers": [
31+
"Encore\\Admin\\Scheduling\\SchedulingServiceProvider"
32+
]
33+
34+
}
35+
}
36+
}

resources/views/index.blade.php

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<script data-exec-on-popstate>
2+
$(function () {
3+
$('.run-task').click(function (e) {
4+
var id = $(this).data('id');
5+
NProgress.start();
6+
$.ajax({
7+
method: 'POST',
8+
url: '{{ route('scheduling-run') }}',
9+
data: {id: id, _token: LA.token},
10+
success: function (data) {
11+
if (typeof data === 'object') {
12+
$('.output-box').removeClass('hide');
13+
$('.output-box .output-body').html(data.data);
14+
}
15+
NProgress.done();
16+
}
17+
});
18+
});
19+
});
20+
</script>
21+
22+
<style>
23+
.output-body {
24+
white-space: pre-wrap;
25+
background: #000000;
26+
color: #00fa4a;
27+
padding: 10px;
28+
border-radius: 0;
29+
}
30+
31+
</style>
32+
33+
<div class="box">
34+
<!-- /.box-header -->
35+
<div class="box-body no-padding">
36+
<table class="table table-striped table-hover">
37+
<tbody>
38+
<tr>
39+
<th style="width: 10px">#</th>
40+
<th>Task</th>
41+
<th>Run at</th>
42+
<th>Next run time</th>
43+
<th>Description</th>
44+
<th>Run</th>
45+
</tr>
46+
@foreach($events as $index => $event)
47+
<tr>
48+
<td>{{ $index+1 }}.</td>
49+
<td><code>{{ $event['task']['name'] }}</code></td>
50+
<td><span class="label label-success">{{ $event['expression'] }}</span>&nbsp;{{ $event['readable'] }}</td>
51+
<td>{{ $event['nextRunDate'] }}</td>
52+
<td>{{ $event['description'] }}</td>
53+
<td><a class="btn btn-xs btn-primary run-task" data-id="{{ $index+1 }}">Run</a></td>
54+
</tr>
55+
@endforeach
56+
</tbody>
57+
</table>
58+
</div>
59+
<!-- /.box-body -->
60+
</div>
61+
62+
<div class="box box-default output-box hide">
63+
<div class="box-header with-border">
64+
<i class="fa fa-terminal"></i>
65+
66+
<h3 class="box-title">Output</h3>
67+
</div>
68+
<!-- /.box-header -->
69+
<div class="box-body">
70+
<pre class="output-body"></pre>
71+
</div>
72+
<!-- /.box-body -->
73+
</div>

0 commit comments

Comments
 (0)