v1.18.x
Barış Soner Uşaklı 6 years ago
parent 7950b254a6
commit ab7657d445

@ -57,6 +57,7 @@
"section-advanced": "Advanced",
"advanced/database": "Database",
"advanced/events": "Events",
"advanced/hooks": "Hooks",
"advanced/logs": "Logs",
"advanced/errors": "Errors",
"advanced/cache": "Cache",

@ -25,6 +25,7 @@
@import "./advanced/database";
@import "./advanced/logs";
@import "./advanced/errors";
@import "./advanced/hooks";
@import "./settings";
@import "../flags";

@ -0,0 +1,3 @@
.admin .hooks-list .panel.panel-default .panel-heading {
text-transform: none;
}

@ -15,6 +15,7 @@ var adminController = {
rewards: require('./admin/rewards'),
},
events: require('./admin/events'),
hooks: require('./admin/hooks'),
logs: require('./admin/logs'),
errors: require('./admin/errors'),
database: require('./admin/database'),

@ -0,0 +1,32 @@
'use strict';
var plugins = require('../../plugins');
var hooksController = module.exports;
hooksController.get = function (req, res) {
var hooks = [];
Object.keys(plugins.loadedHooks).forEach(function (key, hookIndex) {
var current = {
hookName: key,
methods: [],
index: 'hook-' + hookIndex,
count: plugins.loadedHooks[key].length,
};
plugins.loadedHooks[key].forEach(function (hookData, methodIndex) {
current.methods.push({
id: hookData.id,
priority: hookData.priority,
method: hookData.method ? hookData.method.toString() : 'No plugin function!',
index: hookIndex + '-code-' + methodIndex,
});
});
hooks.push(current);
});
hooks.sort((a, b) => b.count - a.count);
res.render('admin/advanced/hooks', { hooks: hooks });
};

@ -90,6 +90,7 @@ function addRoutes(router, middleware, controllers) {
router.get('/advanced/database', middlewares, controllers.admin.database.get);
router.get('/advanced/events', middlewares, controllers.admin.events.get);
router.get('/advanced/hooks', middlewares, controllers.admin.hooks.get);
router.get('/advanced/logs', middlewares, controllers.admin.logs.get);
router.get('/advanced/errors', middlewares, controllers.admin.errors.get);
router.get('/advanced/errors/export', middlewares, controllers.admin.errors.export);

@ -0,0 +1,31 @@
<div class="hooks-list panel-group" id="accordion" role="tablist" aria-multiselectable="true">
<!-- BEGIN hooks -->
<div class="panel panel-default">
<div class="panel-heading" role="tab">
<div class="panel-title">
<a role="button" data-toggle="collapse" data-parent="#accordion" data-target="#{hooks.index}" aria-expanded="true" aria-controls="{hooks.index}">
{hooks.hookName}
</a>
<span class="pull-right">{hooks.count} hooks</span>
</div>
</div>
<div id="{hooks.index}" class="panel-collapse collapse" role="tabpanel">
<div class="panel-body clearfix">
<!-- BEGIN hooks.methods -->
<div class="clearfix">
<strong>{hooks.methods.id}</strong>
Priority: {hooks.methods.priority}
<button class="btn btn-primary btn-sm pull-right" type="button" data-toggle="collapse" data-target="#{hooks.methods.index}" aria-expanded="false" aria-controls="{hooks.methods.index}">
Show Code <i class="fa fa-eye"></i>
</button>
</div>
<div class="collapse" id="{hooks.methods.index}">
<pre>{hooks.methods.method}</pre>
</div>
<!-- END hooks.methods -->
</div>
</div>
</div>
<!-- END hooks -->
</div>

@ -8,7 +8,7 @@
<!-- IMPORT admin/partials/quick_actions/alerts.tpl -->
</ul>
</section>
<section class="menu-section">
<h3 class="menu-section-title">[[admin/menu:section-general]]</h3>
<ul class="menu-section-list">
@ -108,6 +108,7 @@
<ul class="menu-section-list">
<li><a href="{relative_path}/admin/advanced/database">[[admin/menu:advanced/database]]</a></li>
<li><a href="{relative_path}/admin/advanced/events">[[admin/menu:advanced/events]]</a></li>
<li><a href="{relative_path}/admin/advanced/hooks">[[admin/menu:advanced/hooks]]</a></li>
<li><a href="{relative_path}/admin/advanced/cache">[[admin/menu:advanced/cache]]</a></li>
<li><a href="{relative_path}/admin/advanced/errors">[[admin/menu:advanced/errors]]</a></li>
<li><a href="{relative_path}/admin/advanced/logs">[[admin/menu:advanced/logs]]</a></li>
@ -131,7 +132,7 @@
<ul class="quick-actions hidden-xs hidden-sm">
<!-- IMPORT admin/partials/quick_actions/buttons.tpl -->
<form role="search">
<div id="acp-search" >
<div class="dropdown">
@ -266,6 +267,7 @@
<ul class="dropdown-menu" role="menu">
<li><a href="{relative_path}/admin/advanced/database">[[admin/menu:advanced/database]]</a></li>
<li><a href="{relative_path}/admin/advanced/events">[[admin/menu:advanced/events]]</a></li>
<li><a href="{relative_path}/admin/advanced/hooks">[[admin/menu:advanced/hooks]]</a></li>
<li><a href="{relative_path}/admin/advanced/cache">[[admin/menu:advanced/cache]]</a></li>
<li><a href="{relative_path}/admin/advanced/errors">[[admin/menu:advanced/errors]]</a></li>
<li><a href="{relative_path}/admin/advanced/logs">[[admin/menu:advanced/logs]]</a></li>

Loading…
Cancel
Save