<commit_before><?php 
/*
*Project:IoT-Connected-valves-for-irrigation-of-greenhouse
*File name: deviceStatus.php
*Author: <NAME>
*It is for displaying devices information
*/
include_once 'settings/iotdb.php';
ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(-1); //for suppressing errors and notices
?>
<!DOCTYPE html>
<html lang="en" ng-app="IOT-App">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Device responses</title>

    <!-- Bootstrap Core CSS -->
    <link href="../bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">

    <!-- MetisMenu CSS -->
    <link href="../bower_components/metisMenu/dist/metisMenu.min.css" rel="stylesheet">

    <!-- Custom CSS -->
    <link href="../dist/css/sb-admin-2.css" rel="stylesheet">

    <!-- Custom Fonts -->
    <link href="../bower_components/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href="../bower_components/angular-growl-v2/build/angular-growl.min.css" rel="stylesheet" type="text/css">
    <link href="../bower_components/angular-dropdowns/angular-dropdowns.css" rel="stylesheet" type="text/css">
    <link rel="stylesheet" type="text/css" href="../dist/css/bootstrap-fullscreen-select.css" />

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <noscript>
        Your browser doesnt support javascript
    </noscript>
</head>

<body>

    <div id="wrapper">

        <!-- Navigation -->
        <?php include_once "layouts/navigation.php";?>

        <!-- Page Content -->
        <div id="page-wrapper">
            <div id="automate" class="container-fluid" ng-controller="automat">
                <div class="row">
                    <div class="col-lg-12">
                        <h1 class="page-header text-info">System Health and Automation Control</h1>
                    </div>
                    <!-- /.col-lg-12 -->
                </div>
                <div class="row">
                        <div class="well col-md-4">
                            <span ng-show="errors!=null" class="row" ng-repeat="error in errors">
                                <li class='text-danger'><strong>{{error.type}}:</strong> {{error.value}}</li>
                            </span>
                            <form ng-submit="formsubmit()">
                                <fieldset class='form-group'>
                                  <label for='name'>Name</label>
                                  <input type='text' class='form-control' id='name' ng-model=name placeholder='Name of Task' value='{{name}}'>
                                </fieldset>
                                <fieldset class='form-group'>
                                  <label for='group'>Select Group</label><br/>
                                  <div class="pull-left" dropdown-select="groups" dropdown-model="group"  dropdown-item-label="text" >
                                  </div>
                                </fieldset>
                                <fieldset class='form-group'>
                                  <label for='field'>Select Field to monitor</label><br/>
                                  <div class="pull-left" dropdown-select="fields" dropdown-model="field"  dropdown-item-label="text" >
                                  </div>
                                </fieldset>
                                <fieldset class='form-group'>
                                  <label for='action'>Select Action to perform</label><br/>
                                  <div class="pull-left" dropdown-select="actions" dropdown-model="actionSelect"  dropdown-item-label="text" >
                                  </div>
                                </fieldset>
                                <fieldset ng-show="field.text!='Online/Offline'" class='form-group'>
                                  <label for='condition'>Select Condition case</label><br/>
                                  <div class="pull-left" dropdown-select="conditionCases" dropdown-model="conditionCase"  dropdown-item-label="text" >
                                  </div>
                                </fieldset>
                                <fieldset ng-show="field.text!='Online/Offline'" class='form-group'>
                                  <label for='conditionVal'>Select Condition value</label>
                                  <input type='text' class='form-control' id='conditionVal' ng-model=conditionVal placeholder='Condition Value' value='{{conditionVal}}'>
                                </fieldset>
                                <span ng-if="group.text!=null" class='alert alert-warning pull-right'>If <strong class="text-info">{{field.text}} {{conditionCase.text}} {{conditionVal}}</strong> in Group <strong class="text-info">{{group.text}}</strong> then do  <strong class="text-info">{{actionSelect.text}}</strong></span></br>
                                <button class="btn btn-success" id="button" type="submit" value="add">Add</button>
                            </form>
                        </div><!-- ending well-->
                        <div class=" small well col-md-7 col-md-offset-1" style="height:490px; overflow-y: scroll;">
                            <table class='table table-striped'>                                       
                                <caption class="text-info text-center">Device Health (Valves)</caption>
                                <thead>
                                  <th>DeviceId</th><th>PBat</th><th>SBat</th><th>Connection</th>
                                </thead>
                                <tbody>
                                    <tr ng-repeat="deviceNotif in deviceNotifs | filter:{deviceType:'1'}">
                                        <td>{{deviceNotif.deviceId}}</td>
                                        <td>{{deviceNotif.Field1}}</td>
                                        <td>{{deviceNotif.Field2}}</td>
                                        <td align="center">{{deviceNotif.Field6}}</td>   
                                    </tr><!-- loop ends here -->
                                <tbody>
                            </table>
                            <table class='table table-striped'>                                       
                                <caption class="text-info text-center">Device Health (Sensors)</caption>
                                <thead>
                                  <th>DeviceId</th><th>Bat</th><th>Temp</th><th>Moisture</th><th>Humidity</th><th>Connection</th>
                                </thead>
                                <tbody>
                                    <tr ng-repeat="deviceNotif in deviceNotifs | filter:{deviceType:'2'}">
                                        <td align="center">{{deviceNotif.deviceId}}</td>
                                        <td>{{deviceNotif.Field1}}</td>
                                        <td>{{deviceNotif.Field2}}</td>
                                        <td>{{deviceNotif.Field3}}</td>
                                        <td align="center">{{deviceNotif.Field4}}</td> 
                                        <td align="center">{{deviceNotif.Field6}}</td>   
                                    </tr><!-- loop ends here -->
                                <tbody>
                            </table>
                        </div>
                      
                </div>
                <div class="row">
                    <table class='table table-striped'>                                       
                        <caption class="text-info text-center">Monitoring List</caption>
                        <thead>
                          <th>Name</th><th>Group</th><th>Field</th><th>Action</th><th>Condition</th><th>Threshold</th><th></th>
                        </thead>
                        <tbody>
                            <tr ng-repeat="task in tasks">
                                <td align="center">{{task.name}}</td>
                                <td>{{task.groupName}}</td>
                                <td>{{task.field}}</td>
                                <td>{{task.actionName}}</td><commit_msg>improved the automat page<commit_after><?php 
/*
*Project:IoT-Connected-valves-for-irrigation-of-greenhouse
*File name: deviceStatus.php
*Author: <NAME>
*It is for displaying devices information
*/
include_once 'settings/iotdb.php';
ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(-1); //for suppressing errors and notices
?>
<!DOCTYPE html>
<html lang="en" ng-app="IOT-App">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Device responses</title>

    <!-- Bootstrap Core CSS -->
    <link href="../bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">

    <!-- MetisMenu CSS -->
    <link href="../bower_components/metisMenu/dist/metisMenu.min.css" rel="stylesheet">

    <!-- Custom CSS -->
    <link href="../dist/css/sb-admin-2.css" rel="stylesheet">

    <!-- Custom Fonts -->
    <link href="../bower_components/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href="../bower_components/angular-growl-v2/build/angular-growl.min.css" rel="stylesheet" type="text/css">
    <link href="../bower_components/angular-dropdowns/angular-dropdowns.css" rel="stylesheet" type="text/css">
    <link rel="stylesheet" type="text/css" href="../dist/css/bootstrap-fullscreen-select.css" />

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <noscript>
        Your browser doesnt support javascript
    </noscript>
</head>

<body>

    <div id="wrapper">

        <!-- Navigation -->
        <?php include_once "layouts/navigation.php";?>

        <!-- Page Content -->
        <div id="page-wrapper">
            <div id="automate" class="container-fluid" ng-controller="automat">
                <div class="row">
                    <div class="col-lg-12">
                        <h1 class="page-header text-info">System Health and Automation Control</h1>
                    </div>
                    <!-- /.col-lg-12 -->
                </div>
                <div class="row">
                        <div class="well col-md-4">
                            <span ng-show="errors!=null" class="row" ng-repeat="error in errors">
                                <li class='text-danger'><strong>{{error.type}}:</strong> {{error.value}}</li>
                            </span>
                            <form ng-submit="formsubmit()">
                                <fieldset class='form-group'>
                                  <label for='name'>Name</label>
                                  <input type='text' class='form-control' id='name' ng-model=name placeholder='Name of Task' value='{{name}}'>
                                </fieldset>
                                <fieldset class='form-group'>
                                  <label for='group'>Select Group</label><br/>
                                  <div class="pull-left" dropdown-select="groups" dropdown-model="group"  dropdown-item-label="text" >
                                  </div>
                                </fieldset>
                                <fieldset class='form-group'>
                                  <label for='field'>Select Field to monitor</label><br/>
                                  <div class="pull-left" dropdown-select="fields" dropdown-model="field"  dropdown-item-label="text" >
                                  </div>
                                </fieldset>
                                <fieldset class='form-group'>
                                  <label for='action'>Select Action to perform</label><br/>
                                  <div class="pull-left" dropdown-select="actions" dropdown-model="actionSelect"  dropdown-item-label="text" >
                                  </div>
                                </fieldset>
                                <fieldset ng-show="field.text!='Online/Offline'" class='form-group'>
                                  <label for='condition'>Select Condition case</label><br/>
                                  <div class="pull-left" dropdown-select="conditionCases" dropdown-model="conditionCase"  dropdown-item-label="text" >
                                  </div>
                                </fieldset>
                                <fieldset ng-show="field.text!='Online/Offline'" class='form-group'>
                                  <label for='conditionVal'>Select Condition value</label>
                                  <input type='text' class='form-control' id='conditionVal' ng-model=conditionVal placeholder='Condition Value' value='{{conditionVal}}'>
                                </fieldset>
                                <span ng-if="group.text!=null" class='alert alert-warning pull-right'>If <strong class="text-info">{{field.text}} {{conditionCase.text}} {{conditionVal}}</strong> in Group <strong class="text-info">{{group.text}}</strong> then do  <strong class="text-info">{{actionSelect.text}}</strong></span></br>
                                <button class="btn btn-success" id="button" type="submit" value="add">Add</button>
                            </form>
                        </div><!-- ending well-->
                        <div class=" small well col-md-7 col-md-offset-1" style="height:490px; overflow-y: scroll;">
                            <table class='table table-striped'>                                       
                                <caption class="text-info text-center">Device Health (Valves)</caption>
                                <thead>
                                  <th>DeviceId</th><th>PBat</th><th>SBat</th><th>Connection</th>
                                </thead>
                                <tbody>
                                    <tr ng-repeat="deviceNotif in deviceNotifs | filter:{deviceType:'1'}">
                                        <td>{{deviceNotif.deviceId}}</td>
                                        <td>
                                            <span ng-if='deviceNotif.field1==0' class='glyphicon glyphicon-ok label label-success' data-toggle="tooltip" title="Primary Battery level Healthy">
                                            </span>
                                            <span ng-if='deviceNotif.field1==1' class='glyphicon glyphicon-remove label label-danger' data-toggle="tooltip" title="Primary Battery level Critical">
                                            </span>
                                        </td>
                                        <td>
                                            <span ng-if='deviceNotif.field2==0' class='glyphicon glyphicon-ok label label-success' data-toggle="tooltip" title="Secondary Battery level Healthy">
                                            </span>
                                            <span ng-if='deviceNotif.field2==1' class='glyphicon glyphicon-remove label label-danger' data-toggle="tooltip" title="Secondary Battery level Critical">
                                            </span>
                                        </td>
                                        <td align="center">
                                            <span ng-if='deviceNotif.field6==0' class='glyphicon glyphicon-ok label label-success' data-toggle="tooltip" title="Connection Normal">
                                            </span>
                                            <span ng-if='deviceNotif.field6==1' class='glyphicon glyphicon-remove label label-danger' data-toggle="tooltip" title="Device Unavailable">
                                            </span>
                                        </td>   
                                    </tr><!-- loop ends here -->
                                <tbody>
                            </table>
                            <table class='table table-striped'>                                       
                                <caption class="text-info text-center">Device Health (Sensors)</caption>
                                <thead>
                                  <th>DeviceId</th><th>Bat</th><th>Temp</th><th>Moisture</th><th>Humidity</th><th>Connection</th>
                                </thead>
                                <tbody>
                                    <tr ng-repeat="deviceNotif in deviceNotifs | filter:{deviceType:'2'}">
                                        <td align="center">{{deviceNotif.deviceId}}</td>
                                        <td>
                                            <span ng-if='deviceNotif.field1==0' class='glyphicon glyphicon-ok label label-success' data-toggle="tooltip" title="Primary Battery level Healthy">
                                            </span>
                                            <span ng-if='deviceNotif.field1==1' class='glyphicon glyphicon-remove label label-danger' data-toggle="tooltip" title="Primary Battery level Critical">
                                            </span>
                                        </td>
                                        <td>
                                            <span ng-if='deviceNotif.field2==0' class='glyphicon glyphicon-ok label label-success' data-toggle="tooltip" title="Temperature Normal">
                                            </span>
                                            <span ng-if='deviceNotif.field2==1' class='glyphicon glyphicon-remove label label-danger' data-toggle="tooltip" title="Temperature High">
                                            </span>
                                            <span ng-if='deviceNotif.field2!=1 && deviceNotif.field2!=0 '>
                                                Null
                                            </span>
                                        </td>
                                        <td>
                                            <span ng-if='deviceNotif.field3==0' class='glyphicon glyphicon-ok label label-success' data-toggle="tooltip" title="Soil Moisture Normal">
                                            </span>
                                            <span ng-if='deviceNotif.field3==1' class='glyphicon glyphicon-remove label label-danger' data-toggle="tooltip" title="Soil Moisture Low">
                                            </span>
                                            <span ng-if='deviceNotif.field3!=1 && deviceNotif.field3!=0 '>
                                                Null
                                            </span>
                                        </td>
                                        <td align="center">
                                            <span ng-if='deviceNotif.field4==0' class='glyphicon glyphicon-ok label label-success' data-toggle="tooltip" title="Humidity Normal">
                                            </span>
                                            <span ng-if='deviceNotif.field4==1' class='glyphicon glyphicon-remove label label-danger' data-toggle="tooltip" title="Humidity Low">
                                            </span>
                                            <span ng-if='deviceNotif.field4!=1 && deviceNotif.field4!=0 '>
                                                Null
                                            </span>
                                        </td> 
                                        <td align="center">
                                            <span ng-if='deviceNotif.field6==0' class='glyphicon glyphicon-ok label label-success' data-toggle="tooltip" title="Connection Normal">
                                            </span>
                                            <span ng-if='deviceNotif.field6==1' class='glyphicon glyphicon-remove label label-danger' data-toggle="tooltip" title="Device Unavailable">
                                            </span>
                                        </td>   
                                    </tr><!-- loop ends here -->
                                <tbody>
                            </table>
                        </div>
                      
                </div>
                <div class="row">
                    <table class='table table-striped'>                                       
                        <caption class="text-info text-center">Monitoring List</caption>
                        <thead>
                          <th>Name</th><th>Group</th><th>Field</th><th>Action</th><th>Condition</th><th>Threshold</th><th></th>
                        </thead>
                        <tbody>
                            <tr ng-repeat="task in tasks">
                                <td align="center">{{task.name}}</td>
                                <td>{{task.groupName}}</td>
                                <td>{{task.field}}</td>
                                <td>{{task.actionName}}</td>
{'fraction_non_alphanumeric': 0.13447388615537398, 'fraction_numerical': 0.005326592335123911, 'mean_word_length': 1.1980355193967656, 'pattern_counts': {'":': 0, '<': 449, '<?xml version=': 0, '>': 449, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 172, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5677507', 'n_tokens_mistral': 5370, 'n_tokens_neox': 4991, 'n_words': 939}