From 9b7fee03c754c34410b88c8d98bf698228a798d7 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 19 Jan 2018 11:00:46 -0800 Subject: [PATCH] Add Server auto-selection --- web/includes/actions.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/web/includes/actions.php b/web/includes/actions.php index 384953940..6f25a40d0 100644 --- a/web/includes/actions.php +++ b/web/includes/actions.php @@ -485,6 +485,9 @@ if ( canEdit( 'Monitors' ) ) { $columns = getTableColumns( 'Monitors' ); $changes = getFormChanges( $monitor, $_REQUEST['newMonitor'], $types, $columns ); + if ( isset($changes['ServerId']) and $changes['ServerId'] == 'auto' ) { + $changes['ServerId'] = dbFetchOne( 'SELECT Id FROM Servers WHERE Status=\'Running\' ORDER BY FreeMem, CpuLoad LIMIT 1', 'Id' ); + } if ( count( $changes ) ) { if ( $mid ) {