If running a custom run state, show the state instead of Running. Also select the running state in the state change popup. (#2604)

This commit is contained in:
Isaac Connor 2019-05-16 15:37:37 -04:00 committed by GitHub
parent eb005e8b9c
commit 96f578f1bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 4 deletions

View File

@ -233,7 +233,12 @@ function getNavBarHTML($reload = null) {
ob_start(); ob_start();
if ( $running == null ) if ( $running == null )
$running = daemonCheck(); $running = daemonCheck();
$status = $running?translate('Running'):translate('Stopped'); if ( $running ) {
$state = dbFetchOne('SELECT Name FROM States WHERE isActive=1', 'Name');
if ( $state == 'default' )
$state = '';
}
$status = $running ? ($state ? $state : translate('Running')) : translate('Stopped');
?> ?>
<div class="navbar navbar-inverse navbar-static-top"> <div class="navbar navbar-inverse navbar-static-top">
<div class="container-fluid"> <div class="container-fluid">
@ -244,7 +249,9 @@ function getNavBarHTML($reload = null) {
<span class="icon-bar"></span> <span class="icon-bar"></span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
</button> </button>
<div class="navbar-brand"><a href="<?php echo validHtmlStr(ZM_HOME_URL); ?>" target="<?php echo validHtmlStr(ZM_WEB_TITLE); ?>"><?php echo ZM_HOME_CONTENT ?></a></div> <div class="navbar-brand">
<a href="<?php echo validHtmlStr(ZM_HOME_URL); ?>" target="<?php echo validHtmlStr(ZM_WEB_TITLE); ?>"><?php echo ZM_HOME_CONTENT ?></a>
</div>
</div> </div>
<div class="collapse navbar-collapse" id="main-header-nav"> <div class="collapse navbar-collapse" id="main-header-nav">
@ -326,7 +333,7 @@ if (isset($_REQUEST['filter']['Query']['terms']['attr'])) {
<button type="button" class="btn btn-default navbar-btn" data-toggle="modal" data-target="#modalState"><?php echo $status ?></button> <button type="button" class="btn btn-default navbar-btn" data-toggle="modal" data-target="#modalState"><?php echo $status ?></button>
<?php } else if ( canView('System') ) { ?> <?php } else if ( canView('System') ) { ?>
<p class="navbar-text"> <?php echo $status ?></p> <p class="navbar-text"><?php echo $status ?></p>
<?php } ?> <?php } ?>
</div> </div>
<?php } # end if !$user or $user['Id'] meaning logged in ?> <?php } # end if !$user or $user['Id'] meaning logged in ?>

View File

@ -54,7 +54,9 @@ if ( $running ) {
$states = dbFetchAll('SELECT * FROM States'); $states = dbFetchAll('SELECT * FROM States');
foreach ( $states as $state ) { foreach ( $states as $state ) {
?> ?>
<option value="<?php echo validHtmlStr($state['Name']) ?>"><?php echo validHtmlStr($state['Name']); ?></option> <option value="<?php echo validHtmlStr($state['Name']) ?>" <?php echo $state['IsActive'] ? 'selected="selected"' : '' ?>>
<?php echo validHtmlStr($state['Name']); ?>
</option>
<?php <?php
} }
?> ?>