升级核心版本
This commit is contained in:
52
catch/monitor/tables/Crontab.php
Normal file
52
catch/monitor/tables/Crontab.php
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
namespace catchAdmin\monitor\tables;
|
||||||
|
|
||||||
|
use catcher\CatchTable;
|
||||||
|
use catchAdmin\monitor\tables\forms\Factory;
|
||||||
|
use catcher\library\table\Actions;
|
||||||
|
use catcher\library\table\HeaderItem;
|
||||||
|
use catcher\library\table\Search;
|
||||||
|
|
||||||
|
class Crontab extends CatchTable
|
||||||
|
{
|
||||||
|
public function table()
|
||||||
|
{
|
||||||
|
// TODO: Implement table() method.
|
||||||
|
return $this->getTable('Crontab')
|
||||||
|
->header([
|
||||||
|
HeaderItem::label('')->selection(),
|
||||||
|
HeaderItem::label('编号')->prop('id')->width(80),
|
||||||
|
HeaderItem::label('名称')->prop('name'),
|
||||||
|
HeaderItem::label('分组')->prop('group')->withSelectComponent([
|
||||||
|
['value' => 1, 'label' => '默认'],
|
||||||
|
['value' => 2, 'label' => '系统'],
|
||||||
|
]),
|
||||||
|
HeaderItem::label('指令')->prop('task')->width(120),
|
||||||
|
HeaderItem::label('cron表达式')->prop('cron')->width(120),
|
||||||
|
HeaderItem::label('状态')->prop('status')->withSwitchComponent(),
|
||||||
|
HeaderItem::label('创建时间')->prop('created_at'),
|
||||||
|
HeaderItem::label('操作')->actions([
|
||||||
|
Actions::update(),
|
||||||
|
Actions::delete(),
|
||||||
|
Actions::normal('日志')->to('/monitor/crontab/log'),
|
||||||
|
])->width(260)
|
||||||
|
])
|
||||||
|
->withBind()
|
||||||
|
->withSearch([
|
||||||
|
Search::label('任务名称')->name('请填写任务名称'),
|
||||||
|
Search::label('状态')->status()
|
||||||
|
])
|
||||||
|
->selectionChange()
|
||||||
|
->withApiRoute('monitor/crontab')
|
||||||
|
->withActions([
|
||||||
|
Actions::create()
|
||||||
|
])
|
||||||
|
->render();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function form()
|
||||||
|
{
|
||||||
|
// TODO: Implement form() method.
|
||||||
|
return Factory::create('Crontab');
|
||||||
|
}
|
||||||
|
}
|
56
catch/monitor/tables/CrontabLog.php
Normal file
56
catch/monitor/tables/CrontabLog.php
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
namespace catchAdmin\monitor\tables;
|
||||||
|
|
||||||
|
use catcher\CatchTable;
|
||||||
|
use catchAdmin\monitor\tables\forms\Factory;
|
||||||
|
use catcher\library\table\Actions;
|
||||||
|
use catcher\library\table\HeaderItem;
|
||||||
|
use catcher\library\table\Search;
|
||||||
|
|
||||||
|
class CrontabLog extends CatchTable
|
||||||
|
{
|
||||||
|
public function table()
|
||||||
|
{
|
||||||
|
// TODO: Implement table() method.
|
||||||
|
return $this->getTable('CrontabLog')
|
||||||
|
->header([
|
||||||
|
HeaderItem::label('')->selection(),
|
||||||
|
HeaderItem::label('编号')->prop('id'),
|
||||||
|
HeaderItem::label('名称')->prop('name'),
|
||||||
|
// HeaderItem::label('分组')->prop('group'),
|
||||||
|
HeaderItem::label('调用目标类')->prop('task'),
|
||||||
|
HeaderItem::label('耗时/ms')->prop('used_time'),
|
||||||
|
HeaderItem::label('错误日志')->prop('error_message'),
|
||||||
|
HeaderItem::label('状态')->prop('status')->component('status'),
|
||||||
|
HeaderItem::label('创建时间')->prop('created_at'),
|
||||||
|
HeaderItem::label('操作')->actions([
|
||||||
|
Actions::delete()
|
||||||
|
])
|
||||||
|
])
|
||||||
|
->withSearch([
|
||||||
|
Search::label('任务名称')->name('请填写任务名称'),
|
||||||
|
Search::label('分组')->select('group', '请选择分组',
|
||||||
|
Search::options()->add('默认', 1)->add('系统', 1)->render()
|
||||||
|
),
|
||||||
|
Search::label('状态')->status(),
|
||||||
|
Search::label('开始时间')->startAt(),
|
||||||
|
Search::label('结束时间')->endAt(),
|
||||||
|
Search::hidden('crontab_id', 0),
|
||||||
|
])
|
||||||
|
->withDefaultQueryParams([
|
||||||
|
'crontab_id'
|
||||||
|
])
|
||||||
|
->withBind()
|
||||||
|
->withApiRoute('monitor/crontab/log/list')
|
||||||
|
->selectionChange()
|
||||||
|
->render();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function form()
|
||||||
|
{
|
||||||
|
// TODO: Implement form() method.
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
37
catch/monitor/tables/forms/Crontab.php
Normal file
37
catch/monitor/tables/forms/Crontab.php
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
namespace catchAdmin\monitor\tables\forms;
|
||||||
|
|
||||||
|
use catcher\library\form\Form;
|
||||||
|
|
||||||
|
class Crontab extends Form
|
||||||
|
{
|
||||||
|
public function fields(): array
|
||||||
|
{
|
||||||
|
// TODO: Implement fields() method.
|
||||||
|
return [
|
||||||
|
self::input('name', '任务名称')->required(),
|
||||||
|
|
||||||
|
self::radio('group', '分组', 1)->options(
|
||||||
|
self::options()->add('默认', 1)->add('系统', 2)->render()
|
||||||
|
),
|
||||||
|
|
||||||
|
self::input('task', 'command指令')->required(),
|
||||||
|
|
||||||
|
self::input('cron', 'cron表达式')->required(),
|
||||||
|
|
||||||
|
self::radio('tactics', '执行策略', 1)->options(
|
||||||
|
self::options()
|
||||||
|
->add('立即执行', 1)
|
||||||
|
->add('执行一次', 2)
|
||||||
|
->add('正常执行', 3)
|
||||||
|
->render()
|
||||||
|
),
|
||||||
|
|
||||||
|
self::radio('status', '状态', 1)->options(
|
||||||
|
self::options()->add('启用', 1)->add('禁用', 2)->render()
|
||||||
|
),
|
||||||
|
|
||||||
|
self::textarea('remark', '备注')
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
12
catch/monitor/tables/forms/Factory.php
Normal file
12
catch/monitor/tables/forms/Factory.php
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
namespace catchAdmin\monitor\tables\forms;
|
||||||
|
|
||||||
|
use catcher\library\form\FormFactory;
|
||||||
|
|
||||||
|
class Factory extends FormFactory
|
||||||
|
{
|
||||||
|
public static function from(): string
|
||||||
|
{
|
||||||
|
return __NAMESPACE__;
|
||||||
|
}
|
||||||
|
}
|
@@ -18,7 +18,7 @@
|
|||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=7.1.0",
|
"php": ">=7.1.0",
|
||||||
"topthink/framework": "6.0.6",
|
"topthink/framework": "6.0.8",
|
||||||
"topthink/think-orm": "2.0.36",
|
"topthink/think-orm": "2.0.36",
|
||||||
"topthink/think-migration": "^3.0",
|
"topthink/think-migration": "^3.0",
|
||||||
"thans/tp-jwt-auth": "^1.1",
|
"thans/tp-jwt-auth": "^1.1",
|
||||||
|
Reference in New Issue
Block a user