Skip to content

Commit

Permalink
Merge pull request #1324 from SURFnet/feature/temp-disable-type-of-se…
Browse files Browse the repository at this point in the history
…rvice

Temporarily hide the TypeOfService selector and allow empty values to…
  • Loading branch information
johanib authored Nov 28, 2024
2 parents a8db8ab + ae723f5 commit 24d9cc3
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 14 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
2 changes: 1 addition & 1 deletion tests/webtests/EntityCreateOidcngTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ private function buildValidFormData()
'dashboard_bundle_entity_type[metadata][isPublicClient]' => true,
'dashboard_bundle_entity_type[metadata][grants]' => ['authorization_code'],
'dashboard_bundle_entity_type[metadata][accessTokenValidity]' => '3600',
'dashboard_bundle_entity_type[metadata][typeOfService][]' => 'Research',
// 'dashboard_bundle_entity_type[metadata][typeOfService][]' => 'Research',
'dashboard_bundle_entity_type[attributes][displayNameAttribute][requested]' => true,
'dashboard_bundle_entity_type[attributes][displayNameAttribute][motivation]' => 'We really need it!',
'dashboard_bundle_entity_type[contactInformation][administrativeContact][firstName]' => 'John',
Expand Down
2 changes: 1 addition & 1 deletion tests/webtests/EntityCreateSamlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ private function buildValidFormData(): array
'dashboard_bundle_entity_type[metadata][nameNl]' => 'The A Team',
'dashboard_bundle_entity_type[metadata][metadataUrl]' => 'https://metadata-url.net',
'dashboard_bundle_entity_type[metadata][entityId]' => 'https://entity-id.url',
'dashboard_bundle_entity_type[metadata][typeOfService][]' => 'Research',
// 'dashboard_bundle_entity_type[metadata][typeOfService][]' => 'Research',
'dashboard_bundle_entity_type[metadata][logoUrl]' =>
'https://spdasboarddev.openconext.local/images/surfconext-logo.png',
'dashboard_bundle_entity_type[contactInformation][administrativeContact][firstName]' => 'John',
Expand Down
2 changes: 1 addition & 1 deletion tests/webtests/EntityEditTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public function test_it_loads_xml_from_textarea()
self::fillFormField($formElement, '#dashboard_bundle_entity_type_attributes_organizationAttribute_motivation', 'foo');
self::fillFormField($formElement, '#dashboard_bundle_entity_type_attributes_personalCodeAttribute_motivation', 'foo');
// Also check a type of service (as they are mandatory)
self::findBy('option.decorated:nth-child(4)')->click();
// self::findBy('option.decorated:nth-child(4)')->click();
self::findBy('#dashboard_bundle_entity_type_publishButton')->click();

$pageTitle = self::$pantherClient->refreshCrawler()->filter('h1')->first()->text();
Expand Down

0 comments on commit 24d9cc3

Please sign in to comment.