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
This commit is contained in:
Andrew Collington 2020-12-16 11:10:48 +00:00 committed by GitHub
parent d07fa78798
commit 240b9650cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 61 additions and 28 deletions

View file

@ -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.

View file

@ -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);
});

View file

@ -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;

View file

@ -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/
*/

View file

@ -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 one or more lines are too long

View file

@ -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",

View file

@ -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';