feat/047-inventory-foundations-nodes #51
@ -90,6 +90,13 @@ protected function getHeaderActions(): array
|
|||||||
new \App\Rules\SupportedPolicyTypesRule,
|
new \App\Rules\SupportedPolicyTypesRule,
|
||||||
])
|
])
|
||||||
->columnSpanFull(),
|
->columnSpanFull(),
|
||||||
|
Toggle::make('include_foundations')
|
||||||
|
->label('Include foundation types')
|
||||||
|
->helperText('Include scope tags, assignment filters, and notification templates.')
|
||||||
|
->default(true)
|
||||||
|
->dehydrated()
|
||||||
|
->rules(['boolean'])
|
||||||
|
->columnSpanFull(),
|
||||||
Toggle::make('include_dependencies')
|
Toggle::make('include_dependencies')
|
||||||
->label('Include dependencies')
|
->label('Include dependencies')
|
||||||
->helperText('Include dependency extraction where supported.')
|
->helperText('Include dependency extraction where supported.')
|
||||||
@ -135,6 +142,9 @@ protected function getHeaderActions(): array
|
|||||||
if (array_key_exists('policy_types', $data)) {
|
if (array_key_exists('policy_types', $data)) {
|
||||||
$selectionPayload['policy_types'] = $data['policy_types'];
|
$selectionPayload['policy_types'] = $data['policy_types'];
|
||||||
}
|
}
|
||||||
|
if (array_key_exists('include_foundations', $data)) {
|
||||||
|
$selectionPayload['include_foundations'] = (bool) $data['include_foundations'];
|
||||||
|
}
|
||||||
if (array_key_exists('include_dependencies', $data)) {
|
if (array_key_exists('include_dependencies', $data)) {
|
||||||
$selectionPayload['include_dependencies'] = (bool) $data['include_dependencies'];
|
$selectionPayload['include_dependencies'] = (bool) $data['include_dependencies'];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,7 +17,8 @@
|
|||||||
|
|
||||||
$this->actingAs($user)
|
$this->actingAs($user)
|
||||||
->get(InventoryLanding::getUrl(tenant: $tenant))
|
->get(InventoryLanding::getUrl(tenant: $tenant))
|
||||||
->assertOk();
|
->assertOk()
|
||||||
|
->assertSee('Run Inventory Sync');
|
||||||
|
|
||||||
$this->actingAs($user)
|
$this->actingAs($user)
|
||||||
->get(InventoryCoverage::getUrl(tenant: $tenant))
|
->get(InventoryCoverage::getUrl(tenant: $tenant))
|
||||||
|
|||||||
@ -95,6 +95,31 @@
|
|||||||
expect((bool) ($run->selection_payload['include_dependencies'] ?? true))->toBeFalse();
|
expect((bool) ($run->selection_payload['include_dependencies'] ?? true))->toBeFalse();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('defaults include foundations toggle to true and persists it into the run selection payload', function () {
|
||||||
|
Queue::fake();
|
||||||
|
|
||||||
|
[$user, $tenant] = createUserWithTenant(role: 'owner');
|
||||||
|
$this->actingAs($user);
|
||||||
|
|
||||||
|
$tenant->makeCurrent();
|
||||||
|
Filament::setTenant($tenant, true);
|
||||||
|
|
||||||
|
$sync = app(InventorySyncService::class);
|
||||||
|
$allTypes = $sync->defaultSelectionPayload()['policy_types'];
|
||||||
|
$selectedTypes = array_slice($allTypes, 0, min(2, count($allTypes)));
|
||||||
|
|
||||||
|
Livewire::test(InventoryLanding::class)
|
||||||
|
->mountAction('run_inventory_sync')
|
||||||
|
->set('mountedActions.0.data.policy_types', $selectedTypes)
|
||||||
|
->assertActionDataSet(['include_foundations' => true])
|
||||||
|
->callMountedAction()
|
||||||
|
->assertHasNoActionErrors();
|
||||||
|
|
||||||
|
$run = InventorySyncRun::query()->where('tenant_id', $tenant->id)->latest('id')->first();
|
||||||
|
expect($run)->not->toBeNull();
|
||||||
|
expect((bool) ($run->selection_payload['include_foundations'] ?? false))->toBeTrue();
|
||||||
|
});
|
||||||
|
|
||||||
it('rejects cross-tenant initiation attempts (403) with no side effects', function () {
|
it('rejects cross-tenant initiation attempts (403) with no side effects', function () {
|
||||||
Queue::fake();
|
Queue::fake();
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user