Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -972,4 +972,29 @@ describe('ProductActionScreenComponent', () => {
expect(toastServiceSpy.showToast).not.toHaveBeenCalled();
expect(routerSpy.navigate).toHaveBeenCalledWith(['/project 1/components']);
});

it('should not include parameters with visible set to false in actionParams', () => {
catalogServiceSpy.getProjectProduct.and.returnValue(of({
title: 'fakeProduct',
actions: [
{
id: 'fakeAction',
label: 'Fake Action',
requestable: true,
parameters: [
{ name: 'visible_param', required: true, type: 'string', visible: true },
{ name: 'hidden_param', required: false, type: 'string', visible: false },
{ name: 'another_visible_param', required: false, type: 'string' }
]
}
]
} as AppProduct));

activatedRouteSubject.next({ 'id': 'fakeId', 'catalogSlug': 'catalog', 'action': 'fakeAction' });

const paramNames = component.actionParams.map(p => p.name);
expect(paramNames).not.toContain('hidden_param');
expect(paramNames).toContain('visible_param');
expect(paramNames).toContain('another_visible_param');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export class ProductActionScreenComponent implements OnInit, OnDestroy {
}

private setupActionParameters(productAction: ProductAction): void {
const productActionParams = productAction.parameters?.filter(param => param.name !== 'project_key') || [];
const productActionParams = productAction.parameters?.filter(param => param.name !== 'project_key' && param.visible !== false) || [];

if (productActionParams.length > 0) {
this.addProjectKeyParameter(productActionParams);
Expand Down
Loading