Use message to report plugin errors
Instead of `notification`
This commit is contained in:
parent
d232bb4672
commit
bb898ea2e4
|
|
@ -9,17 +9,17 @@ class NotifyFailedPlugin
|
||||||
public function handle($event)
|
public function handle($event)
|
||||||
{
|
{
|
||||||
$plugin = $event->plugin;
|
$plugin = $event->plugin;
|
||||||
$user = auth()->user();
|
Event::listen(\App\Events\RenderingFooter::class, function ($event) use ($plugin) {
|
||||||
if ($user && $user->isAdmin()) {
|
$user = auth()->user();
|
||||||
Event::listen(\App\Events\RenderingFooter::class, function ($event) use ($plugin) {
|
if ($user && $user->isAdmin()) {
|
||||||
$options = json_encode([
|
$options = json_encode([
|
||||||
'type' => 'warning',
|
'type' => 'error',
|
||||||
'title' => trans('errors.plugins.boot.title'),
|
'message' => trans('errors.plugins.boot', ['plugin' => trans($plugin->title)]),
|
||||||
'message' => trans('errors.plugins.boot.message', ['plugin' => trans($plugin->title)]),
|
|
||||||
'duration' => 0,
|
'duration' => 0,
|
||||||
|
'showClose' => true,
|
||||||
]);
|
]);
|
||||||
$event->addContent('<script>blessing.ui.notify('.$options.')</script>');
|
$event->addContent('<script>blessing.ui.message('.$options.')</script>');
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ import {
|
||||||
Message,
|
Message,
|
||||||
MessageBox,
|
MessageBox,
|
||||||
Switch,
|
Switch,
|
||||||
Notification,
|
|
||||||
} from 'element-ui'
|
} from 'element-ui'
|
||||||
|
|
||||||
Vue.use(Button)
|
Vue.use(Button)
|
||||||
|
|
@ -26,5 +25,4 @@ blessing.ui = {
|
||||||
alert: MessageBox.alert,
|
alert: MessageBox.alert,
|
||||||
confirm: MessageBox.confirm,
|
confirm: MessageBox.confirm,
|
||||||
prompt: MessageBox.prompt,
|
prompt: MessageBox.prompt,
|
||||||
notify: Notification,
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,5 +2,4 @@
|
||||||
@import '~element-theme-chalk/src/input.scss';
|
@import '~element-theme-chalk/src/input.scss';
|
||||||
@import '~element-theme-chalk/src/message.scss';
|
@import '~element-theme-chalk/src/message.scss';
|
||||||
@import '~element-theme-chalk/src/message-box.scss';
|
@import '~element-theme-chalk/src/message-box.scss';
|
||||||
@import '~element-theme-chalk/src/notification.scss';
|
|
||||||
@import '~element-theme-chalk/src/switch.scss';
|
@import '~element-theme-chalk/src/switch.scss';
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,7 @@ exception:
|
||||||
plugins:
|
plugins:
|
||||||
duplicate: The plugin [:dir1] has a duplicated plugin name definition which is same to plugin [:dir2]. Please check your plugins directory, remove one of them or use another name definition.
|
duplicate: The plugin [:dir1] has a duplicated plugin name definition which is same to plugin [:dir2]. Please check your plugins directory, remove one of them or use another name definition.
|
||||||
directory: We can't approach the path for loading plugins specified by the PLUGINS_DIR in .env file. Please check your configuration. Error :msg
|
directory: We can't approach the path for loading plugins specified by the PLUGINS_DIR in .env file. Please check your configuration. Error :msg
|
||||||
boot:
|
boot: There is something wrong with plugin ":plugin".
|
||||||
title: Failed to boot plugin.
|
|
||||||
message: There is something wrong with plugin ":plugin". Please check logs for detail.
|
|
||||||
|
|
||||||
cipher:
|
cipher:
|
||||||
unsupported: Unsupported password hashing method `:cipher`, please check your `.env` configuration
|
unsupported: Unsupported password hashing method `:cipher`, please check your `.env` configuration
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,7 @@ exception:
|
||||||
plugins:
|
plugins:
|
||||||
duplicate: 【插件定义重复】:dir1 目录下的插件与 :dir2 目录下的插件使用了相同的 name 定义并造成了冲突。请检查你的插件目录,移除其中一个插件或者使用不同的 name 属性。
|
duplicate: 【插件定义重复】:dir1 目录下的插件与 :dir2 目录下的插件使用了相同的 name 定义并造成了冲突。请检查你的插件目录,移除其中一个插件或者使用不同的 name 属性。
|
||||||
directory: 配置文件 .env 中指定的插件加载目录(PLUGINS_DIR)不存在或无法打开,请检查你的配置。错误信息::msg
|
directory: 配置文件 .env 中指定的插件加载目录(PLUGINS_DIR)不存在或无法打开,请检查你的配置。错误信息::msg
|
||||||
boot:
|
boot: 「:plugin」插件存在错误,无法加载。
|
||||||
title: 插件加载失败
|
|
||||||
message: 「:plugin」插件存在错误,无法加载。详细信息请见日志。
|
|
||||||
|
|
||||||
cipher:
|
cipher:
|
||||||
unsupported: 不支持的密码加密方式 `:cipher`,请检查你的 .env 配置文件
|
unsupported: 不支持的密码加密方式 `:cipher`,请检查你的 .env 配置文件
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ class NotifyFailedPluginTest extends TestCase
|
||||||
$this->actAs('admin');
|
$this->actAs('admin');
|
||||||
event(new Events\PluginBootFailed($plugin));
|
event(new Events\PluginBootFailed($plugin));
|
||||||
event(new Events\RenderingFooter($content));
|
event(new Events\RenderingFooter($content));
|
||||||
$this->assertCount(1, $content);
|
$this->assertStringContainsString('blessing.ui.message', $content[0]);
|
||||||
$this->assertStringContainsString('blessing.ui.notify', $content[0]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user