Skip to content

Commit 7e2a472

Browse files
committed
add satis config options abandoned and blacklist
1 parent 4e03248 commit 7e2a472

12 files changed

Lines changed: 477 additions & 13 deletions

File tree

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@
4848
"laminas/laminas-diactoros": "^2.3",
4949
"symfony/monolog-bundle": "^3.8",
5050
"symfony/dependency-injection": "^5.4",
51-
"symfony/event-dispatcher": "^5.4"
51+
"symfony/event-dispatcher": "^5.4",
52+
"symfony/proxy-manager-bridge": "^6.0"
5253
},
5354
"require-dev": {
5455
"mikey179/vfsstream": "^1.6",

composer.lock

Lines changed: 221 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
3+
namespace Playbloom\Satisfy\Form\Type;
4+
5+
use Playbloom\Satisfy\Model\Abandoned;
6+
use Symfony\Component\Form\AbstractType;
7+
use Symfony\Component\Form\Extension\Core\Type\TextType;
8+
use Symfony\Component\Form\FormBuilderInterface;
9+
use Symfony\Component\OptionsResolver\OptionsResolver;
10+
use Symfony\Component\Validator\Constraints as Assert;
11+
12+
class AbandonedType extends AbstractType
13+
{
14+
public function buildForm(FormBuilderInterface $builder, array $options)
15+
{
16+
$builder
17+
->add(
18+
'package',
19+
TextType::class,
20+
[
21+
'required' => true,
22+
'empty_data' => '',
23+
'constraints' => [
24+
new Assert\NotBlank(),
25+
],
26+
'attr' => [
27+
'placeholder' => 'Abandoned package name',
28+
],
29+
]
30+
)
31+
->add('replacement', TextType::class, [
32+
'required' => true,
33+
'empty_data' => '',
34+
'attr' => [
35+
'placeholder' => 'Package name/URL pointing to a recommended alternative(can be empty)',
36+
],
37+
]);
38+
}
39+
40+
public function configureOptions(OptionsResolver $resolver)
41+
{
42+
$resolver->setDefaults([
43+
'data_class' => Abandoned::class,
44+
'empty_data' => new Abandoned('', null),
45+
]);
46+
}
47+
48+
public function getBlockPrefix()
49+
{
50+
return 'AbandonedType';
51+
}
52+
}

src/Playbloom/Satisfy/Form/Type/ConfigurationType.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Playbloom\Satisfy\Form\Type;
44

55
use Playbloom\Satisfy\Form\DataTransformer\JsonTextTransformer;
6+
use Playbloom\Satisfy\Model\Abandoned;
67
use Playbloom\Satisfy\Model\Configuration;
78
use Playbloom\Satisfy\Model\PackageStability;
89
use Symfony\Component\Form\AbstractType;
@@ -57,6 +58,38 @@ public function buildForm(FormBuilderInterface $builder, array $options)
5758
new Assert\Valid(),
5859
],
5960
])
61+
->add('blacklist', CollectionType::class, [
62+
'required' => false,
63+
'allow_add' => true,
64+
'allow_delete' => true,
65+
'delete_empty' => true,
66+
'entry_type' => PackageConstraintType::class,
67+
'prototype' => true,
68+
'attr' => [
69+
'class' => 'collection_require',
70+
'rel' => 'tooltip',
71+
'data-title' => 'Package name (keys) and version constraints (values) to exclude after selecting packages',
72+
],
73+
'constraints' => [
74+
new Assert\Valid(),
75+
],
76+
])
77+
->add('abandoned', CollectionType::class, [
78+
'required' => false,
79+
'allow_add' => true,
80+
'allow_delete' => true,
81+
'delete_empty' => true,
82+
'entry_type' => AbandonedType::class,
83+
'prototype' => true,
84+
'attr' => [
85+
'class' => 'collection_require',
86+
'rel' => 'tooltip',
87+
'data-title' => 'List of packages marked as abandoned for this repository',
88+
],
89+
'constraints' => [
90+
new Assert\Valid(),
91+
],
92+
])
6093
->add('requireAll', Type\CheckboxType::class, [
6194
'required' => false,
6295
'attr' => [

0 commit comments

Comments
 (0)