Browse Source

Release/3.2.1 (#68)

* Fixed spaceship operator regression
* Remove 'empty' get parameter (#66)
* Improved layout of arrays in directive list (eg, optimisation values) (#67)
* Added optimisation value to the list alongside text equivalent.
* Bumping version and updating readme
Andrew Collington 4 years ago
parent
commit
240b9650cd
8 changed files with 45 additions and 18 deletions
  1. 6 0
      README.md
  2. 15 7
      build/_frontend/interface.jsx
  3. 14 1
      build/_frontend/interface.scss
  4. 1 1
      build/build.php
  5. 1 1
      build/template.phps
  6. 4 4
      index.php
  7. 1 1
      package.json
  8. 3 3
      src/Opcache/Service.php

+ 6 - 0
README.md

@@ -158,6 +158,12 @@ When the real-time updates are active the interface will automatically update al
 
 ## Releases
 
+**Version 3.2.1**\
+Minor maintenance release to:
+* Put back "spaceship operator" so PHP8 doesn't give deprecation warnings (must have been accidentally removed in a previous commit)
+* More refined axios usage when it comes to parameters
+* A little extra formatting on the opcache optimization levels
+
 **Version 3.2.0**\
 Updated ReactJS to latest and used minified versions and made slight improvement to sort option when no pagination is present.
 

+ 15 - 7
build/_frontend/interface.jsx

@@ -17,7 +17,7 @@ class Interface extends React.Component {
         this.setState({realtime: true})
         this.polling = setInterval(() => {
             this.setState({fetching: true, resetting: false});
-            axios.get('?', {time: Date.now()})
+            axios.get(window.location.pathname, {time: Date.now()})
                 .then((response) => {
                     this.setState({opstate: response.data});
                 });
@@ -43,7 +43,7 @@ class Interface extends React.Component {
     resetHandler = () => {
         if (this.state.realtime) {
             this.setState({resetting: true});
-            axios.get('?', {params: {reset: 1}})
+            axios.get(window.location.pathname, {params: {reset: 1}})
                 .then((response) => {
                     console.log('success: ', response.data);
                 });
@@ -329,6 +329,16 @@ function GeneralInfo(props) {
 
 
 function Directives(props) {
+    let directiveList = (directive) => {
+        return (
+            <ul className="directive-list">{
+                directive.v.map((item, key) => {
+                    return <li key={key}>{item}</li>
+                })
+            }</ul>
+        );
+    };
+
     let directiveNodes = props.directives.map(function(directive) {
         let map = { 'opcache.':'', '_':' ' };
         let dShow = directive.k.replace(/opcache\.|_/gi, function(matched){
@@ -341,9 +351,7 @@ function Directives(props) {
             vShow = React.createElement('i', {}, 'no value');
         } else {
             if (Array.isArray(directive.v)) {
-                vShow = directive.v.map((item, key) => {
-                    return <span key={key}>{item}<br/></span>
-                });
+                vShow = directiveList(directive);
             } else {
                 vShow = directive.v;
             }
@@ -677,7 +685,7 @@ class CachedFiles extends React.Component {
     handleInvalidate = e => {
         e.preventDefault();
         if (this.props.realtime) {
-            axios.get('?', {params: { invalidate_searched: this.state.searchTerm }})
+            axios.get(window.location.pathname, {params: { invalidate_searched: this.state.searchTerm }})
                 .then((response) => {
                     console.log('success: ' , response.data);
                 });
@@ -799,7 +807,7 @@ class CachedFile extends React.Component {
     handleInvalidate = e => {
         e.preventDefault();
         if (this.props.realtime) {
-            axios.get('?', {params: { invalidate: e.currentTarget.getAttribute('data-file') }})
+            axios.get(window.location.pathname, {params: { invalidate: e.currentTarget.getAttribute('data-file') }})
                 .then((response) => {
                     console.log('success: ' , response.data);
                 });

+ 14 - 1
build/_frontend/interface.scss

@@ -249,6 +249,20 @@ $footer-border-color: #CCC;
     }
   }
 
+  .directive-list {
+    list-style-type: none;
+    padding: 0;
+    margin: 0;
+
+    li {
+      margin-bottom: 0.5em;
+
+      &:last-child {
+        margin-bottom: 0;
+      }
+    }
+  }
+
   .file-filter {
     width: 520px;
   }
@@ -324,7 +338,6 @@ $footer-border-color: #CCC;
       display: inline-block;
 
       a {
-        display: inline-block;
         display: inline-flex;
         align-items: center;
         white-space: nowrap;

+ 1 - 1
build/build.php

@@ -4,7 +4,7 @@
  * OPcache GUI - build script
  *
  * @author Andrew Collington, andy@amnuts.com
- * @version 3.2.0
+ * @version 3.2.1
  * @link https://github.com/amnuts/opcache-gui
  * @license MIT, http://acollington.mit-license.org/
  */

+ 1 - 1
build/template.phps

@@ -8,7 +8,7 @@ namespace Amnuts\Opcache;
  * A simple but effective single-file GUI for the OPcache PHP extension.
  *
  * @author Andrew Collington, andy@amnuts.com
- * @version 3.2.0
+ * @version 3.2.1
  * @link https://github.com/amnuts/opcache-gui
  * @license MIT, http://acollington.mit-license.org/
  */

File diff suppressed because it is too large
+ 4 - 4
index.php


+ 1 - 1
package.json

@@ -1,7 +1,7 @@
 {
   "name": "opcache-gui",
   "description": "A clean and responsive interface for Zend OPcache information, showing statistics, settings and cached files, and providing a real-time update for the information (using jQuery and React).",
-  "version": "3.2.0",
+  "version": "3.2.1",
   "main": "index.js",
   "devDependencies": {
     "@babel/cli": "^7.12.8",

+ 3 - 3
src/Opcache/Service.php

@@ -4,7 +4,7 @@ namespace Amnuts\Opcache;
 
 class Service
 {
-    const VERSION = '3.2.0';
+    const VERSION = '3.2.1';
 
     protected $data;
     protected $options;
@@ -210,7 +210,7 @@ class Service
         $files = [];
         if (!empty($status['scripts']) && $this->getOption('allow_filelist')) {
             uasort($status['scripts'], function ($a, $b) {
-                return $a['hits'] < $b['hits'];
+                return $a['hits'] <=> $b['hits'];
             });
             foreach ($status['scripts'] as &$file) {
                 $file['full_path'] = str_replace('\\', '/', $file['full_path']);
@@ -287,7 +287,7 @@ class Service
                 $levels = [];
                 foreach ($this->optimizationLevels as $level => $info) {
                     if ($level & $v) {
-                        $levels[] = $info;
+                        $levels[] = "{$info} [{$level}]";
                     }
                 }
                 $v = $levels ?: 'none';

Some files were not shown because too many files changed in this diff