diff --git a/Block/Tab/Event.php b/Block/Tab/Content/Event.php old mode 100755 new mode 100644 similarity index 79% rename from Block/Tab/Event.php rename to Block/Tab/Content/Event.php index 6776671..e3fb063 --- a/Block/Tab/Event.php +++ b/Block/Tab/Content/Event.php @@ -1,8 +1,10 @@ _storeManager->getStore(); + } + + public function getStore() + { + return $this->_storeManager->getWebsite(); + } +} \ No newline at end of file diff --git a/Block/Tab/Layout.php b/Block/Tab/Content/Layout.php old mode 100755 new mode 100644 similarity index 71% rename from Block/Tab/Layout.php rename to Block/Tab/Content/Layout.php index 17c0694..f47552d --- a/Block/Tab/Layout.php +++ b/Block/Tab/Content/Layout.php @@ -1,8 +1,8 @@ _structure = $structure; - $this->setTemplate('ADM_QuickDevBar::tab/layout.phtml'); + //$this->setTemplate('ADM_QuickDevBar::tab/layout.phtml'); parent::__construct($context, $data); } @@ -29,23 +29,11 @@ public function getHandles() return $this->getLayout()->getUpdate()->getHandles(); } - public function getContent() + public function getHtmlBlocksHierarchy() { $html = ''; $layout = $this->getLayout(); -// $xml = $layout->getUpdate()->asSimplexml(); -// $html .= ''; - - $html .= 'Blocks hierarchy
'; $blocks = $layout->getAllBlocks(); $containers = array('CONTAINER'=>array()); foreach ($blocks as $alias=>$block) { @@ -59,9 +47,6 @@ public function getContent() } $containers[$type][$parentName] = $parentName; -// $ancestortName = $this->getAncestor($alias); -// $containers['CONTAINER'][$ancestortName] = $ancestortName; - } $html .= ''; - //Other blocks - $html .= 'Other block
'; - $html .= ''; - return $html; } + public function getContainers() + { + $containers = $this->getLayout()->getUpdate()->getContainers(); + + return $containers; + } + + public function getAncestor($alias) { $parentName = $this->getLayout()->getParentName($alias); diff --git a/Block/Tab/Log.php b/Block/Tab/Content/Log.php similarity index 92% rename from Block/Tab/Log.php rename to Block/Tab/Content/Log.php index 709fdf0..eedd091 100644 --- a/Block/Tab/Log.php +++ b/Block/Tab/Content/Log.php @@ -1,8 +1,8 @@ \\1', $sql); - $htmlSql = preg_replace('/\b(UNION ALL)\b/', '
\\1', $htmlSql); + $htmlSql = preg_replace('/\b(SET|AS|ASC|COUNT|DESC|IN|LIKE|DISTINCT|INTO|VALUES|LIMIT)\b/', '\\1', $sql); + $htmlSql = preg_replace('/\b(UNION ALL|DESCRIBE|SHOW|connect|begin|commit)\b/', '
\\1', $htmlSql); $htmlSql = preg_replace('/\b(UPDATE|SELECT|FROM|WHERE|LEFT JOIN|INNER JOIN|RIGHT JOIN|ORDER BY|GROUP BY|DELETE|INSERT)\b/', '
\\1', $htmlSql); $htmlSql = preg_replace('/^/', '', $htmlSql); return $htmlSql; diff --git a/Block/Tab/DefaultTab.php b/Block/Tab/DefaultContent.php similarity index 50% rename from Block/Tab/DefaultTab.php rename to Block/Tab/DefaultContent.php index 0595783..c0b9a15 100644 --- a/Block/Tab/DefaultTab.php +++ b/Block/Tab/DefaultContent.php @@ -2,9 +2,28 @@ namespace ADM\QuickDevBar\Block\Tab; -class DefaultTab extends \Magento\Framework\View\Element\Template +class DefaultContent extends \Magento\Framework\View\Element\Template { +// protected $_jsonHelper; + +// /** +// * @param \Magento\Framework\View\Element\Template\Context $context +// * @param \Magento\Framework\Json\EncoderInterface $jsonEncoder +// * @param array $data +// */ +// public function __construct( +// \Magento\Framework\View\Element\Template\Context $context, +// \Magento\Framework\Json\Helper\Data $jsonHelper, +// array $data = [] +// ) { +// $this->_jsonHelper = $jsonHelper; + +// parent::__construct($context, $data); +// } + + + public function getTitle() { return ($this->getData('title')) ? $this->getData('title') : $this->getNameInLayout(); @@ -17,12 +36,22 @@ public function getId() public function getClass() { - return str_replace('.', '-', $this->getId()); + $class = str_replace('.', '-', $this->getId()); + if ($this->isAjax(false)) { + $class .= ' use-ajax'; + } + + return $class; } - public function isAjax() + public function isAjax($asString=true) { - return (($this->hasData('ajax_url') || $this->hasData('is_ajax'))? "true" : "false"); + $return = (($this->hasData('ajax_url') || $this->hasData('is_ajax'))? true : false); + if ($asString) { + $return = ($return) ? "true" : "false"; + } + + return $return; } public function getTabUrl() @@ -64,4 +93,31 @@ public function getHtmlLoader($imgSrc, $class, $showText = true) return $html; } + + protected $_mainTabs; + + public function getTabBlocks() + { + if (is_null($this->_mainTabs)) { + $this->_mainTabs = $this->getLayout()->getChildBlocks($this->getNameInLayout()); + } + + return $this->_mainTabs; + } + + public function getStore() + { + return $this->_storeManager->getStore(); + } + + public function getWebsite() + { + return $this->_storeManager->getWebsite(); + } + + public function getGroup() + { + return $this->_storeManager->getGroup(); + } + } \ No newline at end of file diff --git a/Block/Tab/Main.php b/Block/Tab/Main.php new file mode 100644 index 0000000..f2b65e6 --- /dev/null +++ b/Block/Tab/Main.php @@ -0,0 +1,69 @@ +_jsonHelper = $jsonHelper; + + parent::__construct($context, $data); + } + + public function getTabBlocks() + { + if (is_null($this->_mainTabs)) { + $this->_mainTabs = $this->getLayout()->getChildBlocks($this->getNameInLayout()); + } + + return $this->_mainTabs; + } + + public function getSubTabSuffix() + { + return ''; + } + + public function getUiTabClass() + { + return 'qdb-ui-tabs'; + } + + protected function _getTabConfig() + { + $config = array( "active"=>$this->_tab_active, + "openedState"=>$this->_tab_openState, + "collapsibleElement"=>"[data-role=collapsible".$this->getSubTabSuffix()."]", + "content"=>"[data-role=content".$this->getSubTabSuffix()."]", + "collapsible" => $this->_tab_collapsible, + "ajaxContent" => true + ); + + return $config; + } + + + public function getJsonTabConfig() + { + return $this->_jsonHelper->jsonEncode($this->_getTabConfig()); + } +} \ No newline at end of file diff --git a/Block/Tab/Sub.php b/Block/Tab/Sub.php new file mode 100644 index 0000000..ece657e --- /dev/null +++ b/Block/Tab/Sub.php @@ -0,0 +1,31 @@ +getNameInLayout())); + } + + public function getUiTabClass() + { + return 'qdb-ui-subtabs'; + } + + public function getIndexActiveTab() + { + return 0; + } +} \ No newline at end of file diff --git a/view/frontend/layout/quickdevbar.xml b/view/frontend/layout/quickdevbar.xml old mode 100755 new mode 100644 index 3f2fc57..14a4bc2 --- a/view/frontend/layout/quickdevbar.xml +++ b/view/frontend/layout/quickdevbar.xml @@ -1,34 +1,58 @@ - - - - - - - Profiler - - - - - - - - - - 1 - - - + + + + + + Info + + + + + + Store + + + + + + + + Profiler + + + + + + 1 + + + + + + + + + Dispatching + + + + + + + - - - + \ No newline at end of file diff --git a/view/frontend/templates/tab/info/general.phtml b/view/frontend/templates/tab/info/general.phtml new file mode 100644 index 0000000..b863a81 --- /dev/null +++ b/view/frontend/templates/tab/info/general.phtml @@ -0,0 +1,27 @@ +getWebsite(); +$_store = $this->getStore(); +?> + + + + + + + + + + + + + + + + + + + + + + +
getId(); ?>
getName(); ?>
getId(); ?>
getName(); ?>
getCode(); ?>
\ No newline at end of file diff --git a/view/frontend/templates/tab/info/layout.phtml b/view/frontend/templates/tab/info/layout.phtml new file mode 100644 index 0000000..0192ee9 --- /dev/null +++ b/view/frontend/templates/tab/info/layout.phtml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + +
+ getHandles() as $handle): ?> +
+ +
+ WARNING: This is an indicative tree list could not be the reality. +
+ getHtmlBlocksHierarchy(); ?>
+
+
    + getContainers() as $containerAlias=>$containerLable): ?> +
  • + +
+
diff --git a/view/frontend/templates/tab/profiler.phtml b/view/frontend/templates/tab/info/profiler.phtml similarity index 100% rename from view/frontend/templates/tab/profiler.phtml rename to view/frontend/templates/tab/info/profiler.phtml diff --git a/view/frontend/templates/tab/request.phtml b/view/frontend/templates/tab/info/request.phtml old mode 100755 new mode 100644 similarity index 100% rename from view/frontend/templates/tab/request.phtml rename to view/frontend/templates/tab/info/request.phtml diff --git a/view/frontend/templates/tab/info/store.phtml b/view/frontend/templates/tab/info/store.phtml new file mode 100644 index 0000000..8009b30 --- /dev/null +++ b/view/frontend/templates/tab/info/store.phtml @@ -0,0 +1,27 @@ +getWebsite(); +$_store = $this->getStore(); +?> + + + + + + + + + + + + + + + + + + + + + + +
getId(); ?>
getName(); ?>
getId(); ?>
getName(); ?>
getCode(); ?>
\ No newline at end of file diff --git a/view/frontend/templates/tab/layout.phtml b/view/frontend/templates/tab/layout.phtml deleted file mode 100755 index 7ace37a..0000000 --- a/view/frontend/templates/tab/layout.phtml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - -
Handles - getHandles() as $handle): ?> -
- -
- -getContent() ?> diff --git a/view/frontend/templates/tabs.phtml b/view/frontend/templates/tabs.phtml new file mode 100644 index 0000000..949f959 --- /dev/null +++ b/view/frontend/templates/tabs.phtml @@ -0,0 +1,21 @@ + + +
+ + getTabBlocks() as $tabBlock): ?> +
+ isAjax(false)) ? $tabBlock->getHtmlBigLoader() : $tabBlock->toHtml(); ?> +
+ +
\ No newline at end of file diff --git a/view/frontend/templates/toolbar.phtml b/view/frontend/templates/toolbar.phtml index 946fc50..dca344d 100644 --- a/view/frontend/templates/toolbar.phtml +++ b/view/frontend/templates/toolbar.phtml @@ -1,22 +1,7 @@ isUserAllowed()):?>
<?php echo __('QuickDevBar'); ?>  diff --git a/view/frontend/web/css/quickdevbar.css b/view/frontend/web/css/quickdevbar.css index 369847f..5d4f5f8 100644 --- a/view/frontend/web/css/quickdevbar.css +++ b/view/frontend/web/css/quickdevbar.css @@ -17,6 +17,10 @@ font-size: 12px; } +#qdb-bar input { + width: auto; +} + #qdb-bar-anchor { position: absolute; top: 1px; @@ -45,33 +49,53 @@ div.qdb-panel { * Tabs * --------------- */ -#qdb-bar div.ui-tabs { +div.qdb-ui-tabs, div.qdb-ui-subtabs { padding: 0 0 20px 0; } -#qdb-bar div.ui-tabs > ul { +div.qdb-ui-tabs > ul, div.qdb-ui-subtabs > ul { padding-left: 5px; } -#qdb-bar div.ui-tabs > ul > li { + +div.qdb-ui-tabs > ul > li, div.qdb-ui-subtabs > ul > li { position: relative; z-index: 98; display:inline-block; - border: 1px solid #ccc; + background-color: #f7f7f7; +} + +div.qdb-ui-tabs > ul > li { margin-bottom: 3px; padding: 5px 10px; -webkit-border-radius: 10px; -moz-border-radius: 10px; - border-radius: 10px; - background-color: #f7f7f7; + border-radius: 10px; + border: 1px solid #ccc; box-shadow: none; } -#qdb-bar div.ui-tabs li.ui-tabs-active { + +div.qdb-ui-subtabs > ul > li { + margin: 0 3px; + padding: 7px 10px; + -webkit-border-top-left-radius: 4px; + -webkit-border-top-right-radius: 4px; + -moz-border-radius-topleft: 4px; + -moz-border-radius-topright: 4px; + border-top-left-radius: 4px; + border-top-right-radius: 4px; +} + + +div.qdb-ui-tabs li.ui-tabs-active, div.qdb-ui-subtabs li.ui-tabs-active { background-color: #fff; - /* border-bottom: 1px solid #fff; */ z-index: 100; } -#qdb-bar div.ui-tabs > ul a { +div.qdb-ui-subtabs li.ui-tabs-active { + border-bottom: 1px solid #fff; +} + +div.qdb-ui-tabs > ul a, div.qdb-ui-subtabs > ul a { text-decoration: none; color: #004276; font-weight: bold; @@ -79,23 +103,31 @@ div.qdb-panel { box-shadow: none; } -#qdb-bar div.ui-tabs .ui-state-hover > a { +div.qdb-ui-tabs .ui-state-hover > a, div.qdb-ui-subtabs .ui-state-hover > a { box-shadow: none; } -#qdb-bar div.ui-tabs .ui-tabs-active > a { +div.qdb-ui-tabs .ui-tabs-active > a, div.qdb-ui-subtabs .ui-tabs-active > a { color: #cc0000; box-shadow: none; } -#qdb-bar div.ui-tabs > div { +div.qdb-ui-tabs > div, div.qdb-ui-subtabs > div { position: relative; border: 1px solid #CCC; - padding: 20px; z-index: 99; font-size: 1.1em; } +div.qdb-ui-tabs > div { + padding: 10px; + box-shadow: -1px 10px 15px 0 rgba(0, 0, 0, 0.7); +} + +div.qdb-ui-subtabs > div { + padding: 10px; +} + /** * Loader * --------------- @@ -120,6 +152,7 @@ div.qdb-panel { */ table.qdn_table { + border-collapse: collapse; border: 1px solid #ccc; width: 100%; } @@ -170,7 +203,7 @@ table.qdn_table_2col tr th{ * SQL * --------------- */ -span.sqlmain, span.sqlword, span.sqljoin { +span.sqlmain, span.sqlword, span.sqlother { font-weight:bold; } @@ -182,7 +215,7 @@ span.sqlword { color:#cc00c0; } -span.sqljoin { +span.sqlother { color:#FF5200; } diff --git a/view/frontend/web/js/quickdevbar.js b/view/frontend/web/js/quickdevbar.js index 8238d77..ac10c7b 100644 --- a/view/frontend/web/js/quickdevbar.js +++ b/view/frontend/web/js/quickdevbar.js @@ -34,6 +34,16 @@ define(["jquery", table.find('tr').removeClass(this.options.stripedClassname).filter(':visible:even').addClass(this.options.stripedClassname); }, this) }); + + + var loadedTab = {}; + $('.ui-tabs-nav li.use-ajax').on( "beforeOpen", function( event) { + if (!loadedTab[event.target]) { + loadedTab[event.target] = true; + console.log(event.target, 'loaded'); + } + }); + } }); }); \ No newline at end of file