Show the option value in the options table

This commit is contained in:
Rebecca Scott 2021-04-23 11:57:55 +10:00
parent a1e14c0490
commit bdbc583aa7
2 changed files with 21 additions and 4 deletions

View File

@ -58,7 +58,7 @@ function wca_test_helper_get_options( $request ) {
$search = $request->get_param( 'search' ); $search = $request->get_param( 'search' );
$query = " $query = "
select option_id, option_name, autoload select option_id, option_name, option_value, autoload
from {$wpdb->prefix}options from {$wpdb->prefix}options
"; ";

View File

@ -13,6 +13,14 @@ import { STORE_KEY } from './data/constants';
import { default as OptionEditor } from './OptionEditor'; import { default as OptionEditor } from './OptionEditor';
import './data'; import './data';
function shorten( input ) {
if ( input.length > 20 ) {
return input.substring( 0, 20 ) + '...';
}
return input;
}
function Options( { function Options( {
options, options,
getOptions, getOptions,
@ -51,7 +59,7 @@ function Options( {
const renderLoading = () => { const renderLoading = () => {
return ( return (
<tr> <tr>
<td colSpan="5" align="center"> <td colSpan="6" align="center">
Loading... Loading...
</td> </td>
</tr> </tr>
@ -62,7 +70,7 @@ function Options( {
if ( options.length === 0 ) { if ( options.length === 0 ) {
return ( return (
<tr> <tr>
<td colSpan="5" align="center"> <td colSpan="6" align="center">
No Options Found No Options Found
</td> </td>
</tr> </tr>
@ -71,17 +79,20 @@ function Options( {
return options.map( ( option ) => { return options.map( ( option ) => {
// eslint-disable-next-line camelcase // eslint-disable-next-line camelcase
const { option_id, option_name, autoload } = option; const { option_id, option_name, option_value, autoload } = option;
// eslint-disable-next-line camelcase // eslint-disable-next-line camelcase
const optionId = option_id; const optionId = option_id;
// eslint-disable-next-line camelcase // eslint-disable-next-line camelcase
const optionName = option_name; const optionName = option_name;
// eslint-disable-next-line camelcase
const optionValue = shorten( option_value );
return ( return (
<tr key={ optionId }> <tr key={ optionId }>
<td key={ 0 }>{ optionId }</td> <td key={ 0 }>{ optionId }</td>
<td key={ 1 }>{ optionName }</td> <td key={ 1 }>{ optionName }</td>
<td key={ 'optionValue' }>{ optionValue }</td>
<td className="align-center" key={ 2 }> <td className="align-center" key={ 2 }>
{ autoload } { autoload }
</td> </td>
@ -176,6 +187,12 @@ function Options( {
> >
Name Name
</td> </td>
<td
className="manage-column column-thumb"
key={ 'optionValue' }
>
Value
</td>
<td <td
className="manage-column column-thumb align-center" className="manage-column column-thumb align-center"
key={ 2 } key={ 2 }