Преглед на файлове

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 години
родител
ревизия
240b9650cd
променени са 8 файла, в които са добавени 45 реда и са изтрити 18 реда
  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
 ## 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**\
 **Version 3.2.0**\
 Updated ReactJS to latest and used minified versions and made slight improvement to sort option when no pagination is present.
 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.setState({realtime: true})
         this.polling = setInterval(() => {
         this.polling = setInterval(() => {
             this.setState({fetching: true, resetting: false});
             this.setState({fetching: true, resetting: false});
-            axios.get('?', {time: Date.now()})
+            axios.get(window.location.pathname, {time: Date.now()})
                 .then((response) => {
                 .then((response) => {
                     this.setState({opstate: response.data});
                     this.setState({opstate: response.data});
                 });
                 });
@@ -43,7 +43,7 @@ class Interface extends React.Component {
     resetHandler = () => {
     resetHandler = () => {
         if (this.state.realtime) {
         if (this.state.realtime) {
             this.setState({resetting: true});
             this.setState({resetting: true});
-            axios.get('?', {params: {reset: 1}})
+            axios.get(window.location.pathname, {params: {reset: 1}})
                 .then((response) => {
                 .then((response) => {
                     console.log('success: ', response.data);
                     console.log('success: ', response.data);
                 });
                 });
@@ -329,6 +329,16 @@ function GeneralInfo(props) {
 
 
 
 
 function Directives(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 directiveNodes = props.directives.map(function(directive) {
         let map = { 'opcache.':'', '_':' ' };
         let map = { 'opcache.':'', '_':' ' };
         let dShow = directive.k.replace(/opcache\.|_/gi, function(matched){
         let dShow = directive.k.replace(/opcache\.|_/gi, function(matched){
@@ -341,9 +351,7 @@ function Directives(props) {
             vShow = React.createElement('i', {}, 'no value');
             vShow = React.createElement('i', {}, 'no value');
         } else {
         } else {
             if (Array.isArray(directive.v)) {
             if (Array.isArray(directive.v)) {
-                vShow = directive.v.map((item, key) => {
-                    return <span key={key}>{item}<br/></span>
-                });
+                vShow = directiveList(directive);
             } else {
             } else {
                 vShow = directive.v;
                 vShow = directive.v;
             }
             }
@@ -677,7 +685,7 @@ class CachedFiles extends React.Component {
     handleInvalidate = e => {
     handleInvalidate = e => {
         e.preventDefault();
         e.preventDefault();
         if (this.props.realtime) {
         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) => {
                 .then((response) => {
                     console.log('success: ' , response.data);
                     console.log('success: ' , response.data);
                 });
                 });
@@ -799,7 +807,7 @@ class CachedFile extends React.Component {
     handleInvalidate = e => {
     handleInvalidate = e => {
         e.preventDefault();
         e.preventDefault();
         if (this.props.realtime) {
         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) => {
                 .then((response) => {
                     console.log('success: ' , response.data);
                     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 {
   .file-filter {
     width: 520px;
     width: 520px;
   }
   }
@@ -324,7 +338,6 @@ $footer-border-color: #CCC;
       display: inline-block;
       display: inline-block;
 
 
       a {
       a {
-        display: inline-block;
         display: inline-flex;
         display: inline-flex;
         align-items: center;
         align-items: center;
         white-space: nowrap;
         white-space: nowrap;

+ 1 - 1
build/build.php

@@ -4,7 +4,7 @@
  * OPcache GUI - build script
  * OPcache GUI - build script
  *
  *
  * @author Andrew Collington, andy@amnuts.com
  * @author Andrew Collington, andy@amnuts.com
- * @version 3.2.0
+ * @version 3.2.1
  * @link https://github.com/amnuts/opcache-gui
  * @link https://github.com/amnuts/opcache-gui
  * @license MIT, http://acollington.mit-license.org/
  * @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.
  * A simple but effective single-file GUI for the OPcache PHP extension.
  *
  *
  * @author Andrew Collington, andy@amnuts.com
  * @author Andrew Collington, andy@amnuts.com
- * @version 3.2.0
+ * @version 3.2.1
  * @link https://github.com/amnuts/opcache-gui
  * @link https://github.com/amnuts/opcache-gui
  * @license MIT, http://acollington.mit-license.org/
  * @license MIT, http://acollington.mit-license.org/
  */
  */

Файловите разлики са ограничени, защото са твърде много
+ 4 - 4
index.php


+ 1 - 1
package.json

@@ -1,7 +1,7 @@
 {
 {
   "name": "opcache-gui",
   "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).",
   "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",
   "main": "index.js",
   "devDependencies": {
   "devDependencies": {
     "@babel/cli": "^7.12.8",
     "@babel/cli": "^7.12.8",

+ 3 - 3
src/Opcache/Service.php

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

Някои файлове не бяха показани, защото твърде много файлове са промени