Skip to content

Commit

Permalink
Temporarily hide the TypeOfService selector and allow empty values to…
Browse files Browse the repository at this point in the history
… prevent unsubmittable forms

Resolves #1321
  • Loading branch information
johanib committed Nov 27, 2024
1 parent a8db8ab commit 5d9e984
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
4 changes: 4 additions & 0 deletions assets/scss/pages/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,7 @@
.hidden {
display: none;
}

div.form-row:has(#dashboard_bundle_entity_type_metadata_typeOfService) {
display: none;
}
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,16 @@ class SaveOidcngEntityCommand implements SaveEntityCommandInterface
#[Assert\Length(max: 300)]
private $applicationUrl;

/**
* // phpcs:ignore
* `new Assert\NotBlank(),` TODO enable in https://github.com/SURFnet/sp-dashboard/issues/1322
*/
/** @var TypeOfService[] */
#[Assert\All([
new Assert\NotBlank(),
new Assert\Type(type: TypeOfService::class),
])]
#[Assert\Count(
min: 1,
max: 3,
minMessage: 'validator.type-of-service.min',
maxMessage: 'validator.type-of-service.max',
)]
private array $typeOfService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,16 @@ class SaveSamlEntityCommand implements SaveEntityCommandInterface
#[Assert\Length(max: 300)]
private ?string $applicationUrl = null;

/** @var TypeOfService[] */
/**
* // phpcs:ignore
* `new Assert\NotBlank(),` TODO enable in https://github.com/SURFnet/sp-dashboard/issues/1322
* @var TypeOfService[]
*/
#[Assert\All([
new Assert\NotBlank(),
new Assert\Type(type: TypeOfService::class),
])]
#[Assert\Count(
min: 1,
max: 3,
minMessage: 'validator.type-of-service.min',
maxMessage: 'validator.type-of-service.max',
)]
private array $typeOfService = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,13 +263,12 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
'typeOfService',
ChoiceType::class,
[
'required' => true,
'required' => false,
'choices' => $this->typeOfServiceProvider->getTypesOfServiceChoices(),
'choice_value' => fn(TypeOfService $tos): string => $tos->typeEn,
'choice_label' => fn(TypeOfService $tos): string => $tos->typeEn,
'choice_attr' => fn(): array => [
'class' => 'decorated',
'data-parsley-mincheck' => 1,
'data-parsley-maxcheck' => 3,
],
'autocomplete' => true, // Enables the UX-Autocomplete
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,13 +245,12 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
'typeOfService',
ChoiceType::class,
[
'required' => true,
'required' => false,
'choices' => $this->typeOfServiceProvider->getTypesOfServiceChoices(),
'choice_value' => fn(TypeOfService $tos): string => $tos->typeEn,
'choice_label' => fn(TypeOfService $tos): string => $tos->typeEn,
'choice_attr' => fn(): array => [
'class' => 'decorated',
'data-parsley-mincheck' => 1,
'data-parsley-maxcheck' => 3,
],
'autocomplete' => true, // Enables the UX-Autocomplete
Expand Down

0 comments on commit 5d9e984

Please sign in to comment.