-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
big wip. Update the ssh service so it works properly again. Update cr…
…ud view. add pulse and telescope. Rework the design for navigation. add several new pages
- Loading branch information
1 parent
d70ff4e
commit 522d544
Showing
71 changed files
with
1,796 additions
and
590 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace App\Console\Commands; | ||
|
||
use App\Services\Code; | ||
use Illuminate\Console\Command; | ||
use Illuminate\Support\Facades\Artisan; | ||
use Laravel\Scout\Searchable; | ||
use Spatie\Activitylog\Traits\LogsActivity; | ||
|
||
class BulkScoutImport extends Command | ||
{ | ||
protected $signature = 'app:bulk-scout-import'; | ||
|
||
protected $description = 'Command description'; | ||
|
||
public function handle() | ||
{ | ||
$searchableModels = Code::instancesOf(Searchable::class) | ||
->getClasses(); | ||
|
||
foreach($searchableModels as $model) { | ||
Artisan::call('scout:import', [ | ||
'model' => $model, | ||
]); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
namespace App\Console\Commands; | ||
|
||
use App\Models\Credential; | ||
use App\Models\User; | ||
use App\Services\SshKeyGeneratorService; | ||
use Illuminate\Console\Command; | ||
use Illuminate\Support\Str; | ||
|
||
class Initialize extends Command | ||
{ | ||
protected $signature = 'app:initialize'; | ||
|
||
protected $description = 'Initialize the application'; | ||
public function handle() | ||
{ | ||
if (Credential::where('type', Credential::TYPE_SSH)->exists()) { | ||
$this->info('SSH key already exists'); | ||
return; | ||
} | ||
|
||
if (! User::exists()) { | ||
$this->call('make:user'); | ||
} | ||
|
||
$randomName = Str::random(16); | ||
$passKey = Str::random(16); | ||
|
||
[$privateKey, $publicKey] = SshKeyGeneratorService::generate($passKey); | ||
|
||
$publicKeyFile = storage_path('app/keys/'.$randomName.'.pub'); | ||
$privateKeyFile = storage_path('app/keys/'.$randomName); | ||
|
||
file_put_contents($publicKeyFile, $publicKey); | ||
chmod($publicKeyFile, 0600); | ||
file_put_contents($privateKeyFile, $privateKey); | ||
chmod($privateKeyFile, 0600); | ||
|
||
Credential::create([ | ||
'service' => Credential::TYPE_SSH, | ||
'type' => Credential::TYPE_SSH, | ||
'name' => 'SSH', | ||
'user_id' => User::first()->id, | ||
'settings' => [ | ||
'pub_key' => $publicKey, | ||
'pub_key_file' => $publicKeyFile, | ||
'private_key' => $privateKey, | ||
'private_key_file' => $privateKeyFile, | ||
'pass_key' => !empty($passKey) ? encrypt($passKey) : '', | ||
], | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,4 +80,9 @@ public function email() | |
'mail' => '', | ||
]); | ||
} | ||
|
||
public function index() | ||
{ | ||
return | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Spork; | ||
|
||
use App\Http\Controllers\Controller; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Pagination\LengthAwarePaginator; | ||
use Inertia\Inertia; | ||
use Kregel\ExceptionProbe\Stacktrace; | ||
|
||
class BatchJobController extends Controller | ||
{ | ||
public function index() | ||
{ | ||
$batches = \DB::table('job_batches') | ||
->select('*') | ||
->orderByDesc('created_at') | ||
->paginate(); | ||
|
||
$paginator = new LengthAwarePaginator( | ||
array_map(function ($batch) { | ||
$batch->jobs = \DB::table('failed_jobs') | ||
->select('*') | ||
->whereIn('uuid', json_decode($batch->failed_job_ids, true)) | ||
->orderByDesc('failed_at') | ||
->get() | ||
->map(function ($job) { | ||
$job->parsed_exception = (new Stacktrace)->parse($job->exception); | ||
$job->payload = json_decode($job->payload, true); | ||
|
||
return $job; | ||
}); | ||
$batch->failed_at = $batch->jobs->max('failed_at'); | ||
|
||
return $batch; | ||
}, $batches->items()), | ||
$batches->total(), | ||
$batches->perPage(), | ||
$batches->currentPage() | ||
); | ||
|
||
return Inertia::render('Admin/BatchJob/Index', [ | ||
'title' => 'Batch Jobs', | ||
'paginator' => $paginator, | ||
]); | ||
} | ||
|
||
public function show(Request $request, $batch) | ||
{ | ||
$batches = \DB::table('job_batches') | ||
->select('*') | ||
->orderByDesc('created_at') | ||
->where('id', $batch) | ||
->paginate(); | ||
|
||
$paginator = new LengthAwarePaginator( | ||
array_map(function ($batch) { | ||
$batch->jobs = \DB::table('failed_jobs') | ||
->select('*') | ||
->whereIn('uuid', json_decode($batch->failed_job_ids, true)) | ||
->orderByDesc('failed_at') | ||
->get() | ||
->map(function ($job) { | ||
$job->parsed_exception = (new Stacktrace)->parse($job->exception); | ||
$job->payload = json_decode($job->payload, true); | ||
|
||
return $job; | ||
}); | ||
$batch->failed_at = $batch->jobs->max('failed_at'); | ||
|
||
return $batch; | ||
}, $batches->items()), | ||
$batches->total(), | ||
$batches->perPage(), | ||
$batches->currentPage() | ||
); | ||
|
||
return Inertia::render('Admin/BatchJob/Show', [ | ||
'title' => 'Batch Jobs', | ||
'paginator' => $paginator, | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.