mirror of
https://github.com/henrywhitaker3/Speedtest-Tracker.git
synced 2025-12-21 13:23:04 +01:00
Added field for manual/scheduled tests
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
# Speedtest Tracker
|
# Speedtest Tracker
|
||||||
|
|
||||||
[](https://hub.docker.com/r/henrywhitaker3/speedtest-tracker) [](https://github.com/henrywhitaker3/Speedtest-Tracker/commits) [](https://github.com/henrywhitaker3/Speedtest-Tracker/issues) [](https://github.com/henrywhitaker3/Speedtest-Tracker/commits)  [](https://github.com/henrywhitaker3/Speedtest-Tracker/blob/master/LICENSE)
|
[](https://hub.docker.com/r/henrywhitaker3/speedtest-tracker) [](https://github.com/henrywhitaker3/Speedtest-Tracker/commits) [](https://github.com/henrywhitaker3/Speedtest-Tracker/issues) [](https://github.com/henrywhitaker3/Speedtest-Tracker/commits)  [](https://github.com/henrywhitaker3/Speedtest-Tracker/blob/master/LICENSE)
|
||||||
|
|
||||||
This program runs a speedtest check every hour and graphs the results. The back-end is written in [Laravel](https://laravel.com/) and the front-end uses [React](https://reactjs.org/). It uses the [Ookla's speedtest cli](https://www.speedtest.net/apps/cli) package to get the data and uses [Chart.js](https://www.chartjs.org/) to plot the results.
|
This program runs a speedtest check every hour and graphs the results. The back-end is written in [Laravel](https://laravel.com/) and the front-end uses [React](https://reactjs.org/). It uses the [Ookla's speedtest cli](https://www.speedtest.net/apps/cli) package to get the data and uses [Chart.js](https://www.chartjs.org/) to plot the results.
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class SpeedtestCommand extends Command
|
|||||||
{
|
{
|
||||||
$this->info('Running speedtest, this might take a while...');
|
$this->info('Running speedtest, this might take a while...');
|
||||||
|
|
||||||
$results = SpeedtestHelper::runSpeedtest();
|
$results = SpeedtestHelper::runSpeedtest(false, false);
|
||||||
|
|
||||||
if(!is_object($results)) {
|
if(!is_object($results)) {
|
||||||
$this->error('Something went wrong running the speedtest.');
|
$this->error('Something went wrong running the speedtest.');
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class SpeedtestHelper {
|
|||||||
* @param boolean|string $output If false, new speedtest runs. If anything else, will try to parse as JSON for speedtest results.
|
* @param boolean|string $output If false, new speedtest runs. If anything else, will try to parse as JSON for speedtest results.
|
||||||
* @return \App\Speedtest|boolean
|
* @return \App\Speedtest|boolean
|
||||||
*/
|
*/
|
||||||
public static function runSpeedtest($output = false)
|
public static function runSpeedtest($output = false, $scheduled = true)
|
||||||
{
|
{
|
||||||
if($output === false) {
|
if($output === false) {
|
||||||
$output = SpeedtestHelper::output();
|
$output = SpeedtestHelper::output();
|
||||||
@@ -38,6 +38,7 @@ class SpeedtestHelper {
|
|||||||
'server_name' => $output['server']['name'],
|
'server_name' => $output['server']['name'],
|
||||||
'server_host' => $output['server']['host'] . ':' . $output['server']['port'],
|
'server_host' => $output['server']['host'] . ':' . $output['server']['port'],
|
||||||
'url' => $output['result']['url'],
|
'url' => $output['result']['url'],
|
||||||
|
'scheduled' => $scheduled
|
||||||
]);
|
]);
|
||||||
} catch(JsonException $e) {
|
} catch(JsonException $e) {
|
||||||
Log::error('Failed to parse speedtest JSON');
|
Log::error('Failed to parse speedtest JSON');
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ class SpeedtestController extends Controller
|
|||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$data = SpeedtestJob::dispatch();
|
$data = SpeedtestJob::dispatch(false);
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'method' => 'run speedtest',
|
'method' => 'run speedtest',
|
||||||
'data' => 'a new speedtest has been added to the queue'
|
'data' => 'a new speedtest has been added to the queue'
|
||||||
|
|||||||
@@ -14,14 +14,16 @@ class SpeedtestJob implements ShouldQueue
|
|||||||
{
|
{
|
||||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||||
|
|
||||||
|
private $scheduled;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new job instance.
|
* Create a new job instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct($scheduled = true)
|
||||||
{
|
{
|
||||||
//
|
$this->scheduled = $scheduled;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -32,7 +34,7 @@ class SpeedtestJob implements ShouldQueue
|
|||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
$output = SpeedtestHelper::output();
|
$output = SpeedtestHelper::output();
|
||||||
$speedtest = SpeedtestHelper::runSpeedtest($output);
|
$speedtest = SpeedtestHelper::runSpeedtest($output, $this->scheduled);
|
||||||
event(new SpeedtestCompleteEvent($speedtest));
|
event(new SpeedtestCompleteEvent($speedtest));
|
||||||
return $speedtest;
|
return $speedtest;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ class Speedtest extends Model
|
|||||||
'server_name',
|
'server_name',
|
||||||
'server_host',
|
'server_host',
|
||||||
'url',
|
'url',
|
||||||
|
'scheduled',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $table = 'speedtests';
|
protected $table = 'speedtests';
|
||||||
|
|||||||
@@ -1,4 +1,14 @@
|
|||||||
{
|
{
|
||||||
|
"1.7.2": [
|
||||||
|
{
|
||||||
|
"description": "Updated UI for speedtest info",
|
||||||
|
"link": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Added field to track manual vs scheduled tests",
|
||||||
|
"link": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
"1.7.1": [
|
"1.7.1": [
|
||||||
{
|
{
|
||||||
"description": "Updated dependencies",
|
"description": "Updated dependencies",
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ return [
|
|||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'version' => '1.7.1',
|
'version' => '1.7.2',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class UpdateSpeedtestsAddManualColumn extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('speedtests', function($table) {
|
||||||
|
$table->boolean('scheduled')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('speedtests', function($table) {
|
||||||
|
$table->dropColumn('scheduled');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
5
resources/js/components/Graphics/TableRow.js
vendored
5
resources/js/components/Graphics/TableRow.js
vendored
@@ -47,7 +47,10 @@ export default class TableRow extends Component {
|
|||||||
<p>Server ID: {e.server_id}</p>
|
<p>Server ID: {e.server_id}</p>
|
||||||
<p>Name: {e.server_name}</p>
|
<p>Name: {e.server_name}</p>
|
||||||
<p>Host: {e.server_host}</p>
|
<p>Host: {e.server_host}</p>
|
||||||
<a href={e.url} target="_blank" rel="noopener noreferer">Speedtest.net</a>
|
<p>URL: <a href={e.url} target="_blank" rel="noopener noreferer">Speedtest.net</a></p>
|
||||||
|
{e.scheduled != undefined &&
|
||||||
|
<p>Type: {e.scheduled == true ? 'scheduled' : 'manual'}</p>
|
||||||
|
}
|
||||||
</Modal.Body>
|
</Modal.Body>
|
||||||
</Modal>
|
</Modal>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
Reference in New Issue
Block a user