added ability to clear history

pull/57/head
trashbo4t 2019-04-13 12:46:03 -04:00
parent f12bcf4989
commit bcd558283d
3 changed files with 42 additions and 0 deletions

View File

@ -14,6 +14,9 @@ class InternetSpeedTest extends Module
public function route()
{
switch ($this->request->action) {
case 'clearTests':
$this->clearTests();
break;
case 'clearLogFile':
$this->clearLogFile();
break;
@ -73,6 +76,17 @@ class InternetSpeedTest extends Module
}
}
//
// clearTests
// this function will wipe all of the tests and test file inside the IST directory
//
private function clearTests()
{
exec("rm {$this->ALL_TESTS_FILE}");
exec("rm -rf {$this->SPEED_TEST_DIR}");
$this->makeSpeedTestsDir();
}
//
// runSpeedTest
// this function will execute a wget command and download 50 MB worth of data

View File

@ -38,6 +38,17 @@ registerController("InternetSpeedTestController", ['$api', '$scope','$window','$
});
};
$scope.clearTests = function () {
$api.request({
module: "InternetSpeedTest",
action: "clearTests",
}, function (response) {
});
$window.location.reload()
};
$scope.reloadPage = function () {
$api.request({
module: "InternetSpeedTest",

View File

@ -26,10 +26,18 @@
</span>
</div>
<div id="collapseLibrary" class="panel-collapse collapse in">
<div class="panel-body">
<div class="input-group" ng-show="currentSpeedTest == false">
</div>
<hr ng-show="currentSpeedTest == false"/>
<div ng-show="previous.length > 0 && currentSpeedTest == false">
<div class="table-responsive">
<table class="table table-striped" align="center">
<thead>
<th>History</th>
@ -46,6 +54,15 @@
</tbody>
</table>
</div>
<span class="input-group-btn">
<button ng-disabled="fileToLookup != ''"
data-toggle="modal"
data-target="#loadingModal"
class="btn btn-default"
type="button"
ng-click="clearTests()">Clear History
</button>
</span>
</div>
<div ng-hide="previous.length != 0">