Updated SCSI table list to show all SCSI IDs

This commit is contained in:
akuker 2020-08-01 19:22:07 -05:00
parent 4c135d7791
commit 9d94cdeec6

View File

@ -34,10 +34,6 @@ function remove_device(id){
alert("OK"); alert("OK");
} }
function delete_file(f){ function delete_file(f){
if(confirm("Are you sure you want to delete "+f+"?")) if(confirm("Are you sure you want to delete "+f+"?"))
alert("OK"); alert("OK");
@ -121,6 +117,8 @@ function current_rascsi_config() {
echo ' <td><b>Actions</b></td>'; echo ' <td><b>Actions</b></td>';
echo ' </tr>'; echo ' </tr>';
$scsi_ids = array();
foreach ($rasctl_lines as $current_line) foreach ($rasctl_lines as $current_line)
{ {
if(strlen($current_line) === 0){ if(strlen($current_line) === 0){
@ -135,18 +133,39 @@ function current_rascsi_config() {
} }
$segments = explode("|", $current_line); $segments = explode("|", $current_line);
$id_config = array();
$id_config['id'] = trim($segments[1]);
$id_config['type'] = trim($segments[3]);
$id_config['file'] = trim($segments[4]);
$scsi_ids[$id_config['id']] = $id_config;
}
foreach (range(0,7) as $id){
echo ' <tr>'; echo ' <tr>';
echo ' <form>'; echo ' <form>';
echo ' <td>'.trim($segments[1]).'</td>'; echo ' <td style="text-align:center">'.$id.'</td>';
echo ' <td>'.trim($segments[3]).'</td>'; if(isset($scsi_ids[$id]))
echo ' <td>'.trim($segments[4]).'</td>'; {
echo ' <td style="text-align:center">'.$scsi_ids[$id]['type'].'</td>';
echo ' <td>'.$scsi_ids[$id]['file'].'</td>';
echo ' <td>'; echo ' <td>';
echo ' <input type="button" value="Eject" onClick="eject_image(\''.trim($segments[1]).'\',\''.trim($segments[4]).'\')"/>'; echo ' <input type="button" value="Eject" onClick="eject_image(\''.$id.'\',\''.$scsi_ids[$id]['file'].'\')"/>';
echo ' <input type="button" value="Disconnect" onClick="remove_device('.trim($segments[1]).')"/>'; echo ' <input type="button" value="Disconnect" onClick="remove_device('.$id.')"/>';
echo ' </td>'; echo ' </td>';
}
else
{
echo ' <td style="text-align:center">-</td>';
echo ' <td>-</td>';
echo ' <td>';
echo ' <input type="button" value="Connect New Device" onClick="attach_device('.$id.')"/>';
echo ' </td>';
}
echo ' </form>'; echo ' </form>';
echo ' </tr>'; echo ' </tr>';
} }
echo '</table>'; echo '</table>';
} }