mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-17 09:51:40 +00:00
Update strings and view for telemetry (inactive)
This commit is contained in:
@@ -21,7 +21,10 @@
|
||||
|
||||
namespace FireflyIII\Http\Controllers\Admin;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Jobs\SubmitTelemetryData;
|
||||
use FireflyIII\Repositories\Telemetry\TelemetryRepositoryInterface;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\View\View;
|
||||
|
||||
@@ -30,14 +33,18 @@ use Illuminate\View\View;
|
||||
*/
|
||||
class TelemetryController extends Controller
|
||||
{
|
||||
/** @var TelemetryRepositoryInterface */
|
||||
private $repository;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->middleware(
|
||||
static function ($request, $next) {
|
||||
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);
|
||||
}
|
||||
@@ -47,15 +54,43 @@ class TelemetryController extends Controller
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function delete()
|
||||
public function deleteSubmitted()
|
||||
{
|
||||
session()->flash('info', 'No telemetry to delete. Does not work yet.');
|
||||
$this->repository->deleteSubmitted();
|
||||
|
||||
return redirect(route('admin.telemetry.index'));
|
||||
session()->flash('success', trans('firefly.telemetry_submitted_deleted'));
|
||||
|
||||
return redirect(url()->previous(route('admin.telemetry.index')));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function deleteAll()
|
||||
{
|
||||
$this->repository->deleteAll();
|
||||
|
||||
session()->flash('success', trans('firefly.telemetry_all_deleted'));
|
||||
|
||||
return redirect(url()->previous(route('admin.telemetry.index')));
|
||||
}
|
||||
|
||||
/**
|
||||
* Run job to submit telemetry.
|
||||
*/
|
||||
public function submit()
|
||||
{
|
||||
$job = app(SubmitTelemetryData::class);
|
||||
$job->setDate(new Carbon);
|
||||
$job->setForce(true);
|
||||
$job->handle();
|
||||
session()->flash('info', trans('firefly.telemetry_submission_executed'));
|
||||
|
||||
return redirect(url()->previous(route('admin.telemetry.index')));
|
||||
}
|
||||
|
||||
/**
|
||||
* Index
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
@@ -63,16 +98,22 @@ class TelemetryController extends Controller
|
||||
app('view')->share('subTitle', (string) trans('firefly.telemetry_admin_index'));
|
||||
$version = config('firefly.version');
|
||||
$enabled = config('firefly.telemetry', false);
|
||||
$count = 1;
|
||||
$count = $this->repository->count();
|
||||
|
||||
return view('admin.telemetry.index', compact('version', 'enabled', 'count'));
|
||||
}
|
||||
|
||||
/**
|
||||
* View telemetry. Paginated because you never know how much will be collected.
|
||||
*
|
||||
* @return Factory|View
|
||||
*/
|
||||
public function view()
|
||||
{
|
||||
return view('admin.telemetry.view');
|
||||
$format = trans('config.date_time');
|
||||
$size = 100;
|
||||
$records = $this->repository->paginated($size);
|
||||
|
||||
return view('admin.telemetry.view', compact('records', 'format'));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user