diff --git a/app/Models/ActivityLog.php b/app/Models/ActivityLog.php index 12fe092f9..f86826345 100644 --- a/app/Models/ActivityLog.php +++ b/app/Models/ActivityLog.php @@ -23,7 +23,6 @@ use Illuminate\Support\Str; * \App\Models\ActivityLog. * * @property int $id - * @property string|null $batch * @property string $event * @property string $ip * @property string|null $description @@ -45,7 +44,6 @@ use Illuminate\Support\Str; * @method static Builder|ActivityLog whereActorId($value) * @method static Builder|ActivityLog whereActorType($value) * @method static Builder|ActivityLog whereApiKeyId($value) - * @method static Builder|ActivityLog whereBatch($value) * @method static Builder|ActivityLog whereDescription($value) * @method static Builder|ActivityLog whereEvent($value) * @method static Builder|ActivityLog whereId($value) @@ -78,7 +76,6 @@ class ActivityLog extends Model implements HasIcon, HasLabel /** @var array */ public static array $validationRules = [ 'event' => ['required', 'string'], - 'batch' => ['nullable', 'uuid'], 'ip' => ['required', 'string'], 'description' => ['nullable', 'string'], 'properties' => ['array'], diff --git a/app/Models/ApiKey.php b/app/Models/ApiKey.php index 4c66c9fed..800351cbb 100644 --- a/app/Models/ApiKey.php +++ b/app/Models/ApiKey.php @@ -219,7 +219,7 @@ class ApiKey extends PersonalAccessToken { Assert::oneOf($type, [self::TYPE_ACCOUNT, self::TYPE_APPLICATION]); - return $type === self::TYPE_ACCOUNT ? 'plcn_' : 'peli_'; + return $type === self::TYPE_ACCOUNT ? 'pacc_' : 'papp_'; } /** diff --git a/app/Providers/ActivityLogServiceProvider.php b/app/Providers/ActivityLogServiceProvider.php index f783a3fd0..1bbb35c40 100644 --- a/app/Providers/ActivityLogServiceProvider.php +++ b/app/Providers/ActivityLogServiceProvider.php @@ -3,7 +3,6 @@ namespace App\Providers; use Illuminate\Support\ServiceProvider; -use App\Services\Activity\ActivityLogBatchService; use App\Services\Activity\ActivityLogTargetableService; class ActivityLogServiceProvider extends ServiceProvider @@ -14,7 +13,6 @@ class ActivityLogServiceProvider extends ServiceProvider */ public function register(): void { - $this->app->scoped(ActivityLogBatchService::class); $this->app->scoped(ActivityLogTargetableService::class); } } diff --git a/app/Services/Activity/ActivityLogBatchService.php b/app/Services/Activity/ActivityLogBatchService.php deleted file mode 100644 index 1db9cd5d1..000000000 --- a/app/Services/Activity/ActivityLogBatchService.php +++ /dev/null @@ -1,61 +0,0 @@ -uuid; - } - - /** - * Starts a new batch transaction. If there is already a transaction present - * this will be nested. - */ - public function start(): void - { - if ($this->transaction === 0) { - $this->uuid = Uuid::uuid4()->toString(); - } - - $this->transaction++; - } - - /** - * Ends a batch transaction, if this is the last transaction in the stack - * the UUID will be cleared out. - */ - public function end(): void - { - $this->transaction = max(0, $this->transaction - 1); - - if ($this->transaction === 0) { - $this->uuid = null; - } - } - - /** - * Executes the logic provided within the callback in the scope of an activity - * log batch transaction. - */ - public function transaction(Closure $callback): mixed - { - $this->start(); - $result = $callback($this->uuid()); - $this->end(); - - return $result; - } -} diff --git a/app/Services/Activity/ActivityLogService.php b/app/Services/Activity/ActivityLogService.php index b4ad9f361..213f97696 100644 --- a/app/Services/Activity/ActivityLogService.php +++ b/app/Services/Activity/ActivityLogService.php @@ -25,7 +25,6 @@ class ActivityLogService public function __construct( protected AuthFactory $manager, - protected ActivityLogBatchService $batch, protected ActivityLogTargetableService $targetable, protected ConnectionInterface $connection ) {} @@ -202,7 +201,6 @@ class ActivityLogService $this->activity = new ActivityLog([ 'ip' => Request::ip(), - 'batch_uuid' => $this->batch->uuid(), 'properties' => Collection::make([]), 'api_key_id' => $this->targetable->apiKeyId(), ]); diff --git a/app/Services/Nodes/NodeAutoDeployService.php b/app/Services/Nodes/NodeAutoDeployService.php index de2954cbb..5c50ddd13 100644 --- a/app/Services/Nodes/NodeAutoDeployService.php +++ b/app/Services/Nodes/NodeAutoDeployService.php @@ -50,7 +50,7 @@ class NodeAutoDeployService return sprintf( '%s wings configure --panel-url %s --token %s --node %d%s', - $docker ? 'docker compose exec -it' : 'sudo', + $docker ? 'docker compose exec -it $(docker ps --filter "name=wings" --format "{{.Names}}")' : 'sudo', config('app.url'), $token, $node->id, diff --git a/app/Transformers/Api/Client/ActivityLogTransformer.php b/app/Transformers/Api/Client/ActivityLogTransformer.php index 58388dec1..a5ee7493b 100644 --- a/app/Transformers/Api/Client/ActivityLogTransformer.php +++ b/app/Transformers/Api/Client/ActivityLogTransformer.php @@ -26,7 +26,6 @@ class ActivityLogTransformer extends BaseClientTransformer // the front-end for each entry to improve rendering performance since there // is nothing else sufficiently unique to key off at this point. 'id' => sha1((string) $model->id), - 'batch' => $model->batch, 'event' => $model->event, 'is_api' => !is_null($model->api_key_id), 'ip' => $this->canViewIP($model->actor) ? $model->ip : null, diff --git a/database/migrations/2025_09_03_080547_remove_batch_column_from_activity_logs.php b/database/migrations/2025_09_03_080547_remove_batch_column_from_activity_logs.php new file mode 100644 index 000000000..eda184e31 --- /dev/null +++ b/database/migrations/2025_09_03_080547_remove_batch_column_from_activity_logs.php @@ -0,0 +1,28 @@ +dropColumn('batch'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('activity_logs', function (Blueprint $table) { + $table->string('batch', 36)->nullable(); + }); + } +};