mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 08:35:00 +00:00
Limit some collection features.
This commit is contained in:
@@ -25,21 +25,15 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Http\Controllers\Admin;
|
||||
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Jobs\SubmitTelemetryData;
|
||||
use FireflyIII\Repositories\Telemetry\TelemetryRepositoryInterface;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Routing\Redirector;
|
||||
use Illuminate\View\View;
|
||||
|
||||
/**
|
||||
* Class TelemetryController
|
||||
*/
|
||||
class TelemetryController extends Controller
|
||||
{
|
||||
/** @var TelemetryRepositoryInterface */
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* TelemetryController constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
if (false === config('firefly.feature_flags.telemetry')) {
|
||||
@@ -51,37 +45,12 @@ class TelemetryController extends Controller
|
||||
function ($request, $next) {
|
||||
app('view')->share('title', (string)trans('firefly.administration'));
|
||||
app('view')->share('mainTitleIcon', 'fa-hand-spock-o');
|
||||
$this->repository = app(TelemetryRepositoryInterface::class);
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return RedirectResponse|Redirector
|
||||
*/
|
||||
public function deleteAll()
|
||||
{
|
||||
$this->repository->deleteAll();
|
||||
|
||||
session()->flash('success', trans('firefly.telemetry_all_deleted'));
|
||||
|
||||
return redirect(url()->previous(route('admin.telemetry.index')));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return RedirectResponse|Redirector
|
||||
*/
|
||||
public function deleteSubmitted()
|
||||
{
|
||||
$this->repository->deleteSubmitted();
|
||||
|
||||
session()->flash('success', trans('firefly.telemetry_submitted_deleted'));
|
||||
|
||||
return redirect(url()->previous(route('admin.telemetry.index')));
|
||||
}
|
||||
|
||||
/**
|
||||
* Index
|
||||
*/
|
||||
@@ -91,37 +60,7 @@ class TelemetryController extends Controller
|
||||
app('view')->share('subTitle', (string)trans('firefly.telemetry_admin_index'));
|
||||
$version = config('firefly.version');
|
||||
$enabled = config('firefly.send_telemetry', false) && config('firefly.feature_flags.telemetry');
|
||||
|
||||
$count = $this->repository->count();
|
||||
|
||||
return prefixView('admin.telemetry.index', compact('version', 'enabled', 'count'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Run job to submit telemetry.
|
||||
*/
|
||||
public function submit()
|
||||
{
|
||||
$job = app(SubmitTelemetryData::class);
|
||||
$job->setDate(today(config('app.timezone')));
|
||||
$job->setForce(true);
|
||||
$job->handle();
|
||||
session()->flash('info', trans('firefly.telemetry_submission_executed'));
|
||||
|
||||
return redirect(url()->previous(route('admin.telemetry.index')));
|
||||
}
|
||||
|
||||
/**
|
||||
* View telemetry. Paginated because you never know how much will be collected.
|
||||
*
|
||||
* @return Factory|View
|
||||
*/
|
||||
public function view()
|
||||
{
|
||||
$format = trans('config.date_time');
|
||||
$size = 100;
|
||||
$records = $this->repository->paginated($size);
|
||||
|
||||
return prefixView('admin.telemetry.view', compact('records', 'format'));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user