mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-12-08 03:59:30 +00:00
Add makefile to help with development setup, change part_ids in bulk import jobs to junction table and implement filtering based on bulk import jobs status and its associated parts' statuses.
This commit is contained in:
parent
9b4d5e9c27
commit
cc9d50a8fe
22 changed files with 1357 additions and 120 deletions
|
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
* Copyright (C) 2019 - 2023 Jan Böhmer (https://github.com/jbtronics)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace App\Form\Filters\Constraints;
|
||||
|
||||
use App\DataTables\Filters\Constraints\Part\BulkImportJobExistsConstraint;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\Form\FormView;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class BulkImportJobExistsConstraintType extends AbstractType
|
||||
{
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'compound' => true,
|
||||
'data_class' => BulkImportJobExistsConstraint::class,
|
||||
]);
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$choices = [
|
||||
'' => '',
|
||||
'part.filter.in_bulk_import_job.yes' => true,
|
||||
'part.filter.in_bulk_import_job.no' => false,
|
||||
];
|
||||
|
||||
$builder->add('value', ChoiceType::class, [
|
||||
'label' => 'part.filter.in_bulk_import_job',
|
||||
'choices' => $choices,
|
||||
'required' => false,
|
||||
]);
|
||||
}
|
||||
|
||||
public function buildView(FormView $view, FormInterface $form, array $options): void
|
||||
{
|
||||
parent::buildView($view, $form, $options);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
* Copyright (C) 2019 - 2023 Jan Böhmer (https://github.com/jbtronics)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace App\Form\Filters\Constraints;
|
||||
|
||||
use App\DataTables\Filters\Constraints\Part\BulkImportJobStatusConstraint;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\Form\FormView;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class BulkImportJobStatusConstraintType extends AbstractType
|
||||
{
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'compound' => true,
|
||||
'data_class' => BulkImportJobStatusConstraint::class,
|
||||
]);
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$statusChoices = [
|
||||
'bulk_import.status.pending' => 'pending',
|
||||
'bulk_import.status.in_progress' => 'in_progress',
|
||||
'bulk_import.status.completed' => 'completed',
|
||||
'bulk_import.status.stopped' => 'stopped',
|
||||
'bulk_import.status.failed' => 'failed',
|
||||
];
|
||||
|
||||
$operatorChoices = [
|
||||
'filter.choice_constraint.operator.ANY' => 'ANY',
|
||||
'filter.choice_constraint.operator.NONE' => 'NONE',
|
||||
];
|
||||
|
||||
$builder->add('operator', ChoiceType::class, [
|
||||
'label' => 'filter.operator',
|
||||
'choices' => $operatorChoices,
|
||||
'required' => false,
|
||||
]);
|
||||
|
||||
$builder->add('values', ChoiceType::class, [
|
||||
'label' => 'part.filter.bulk_import_job_status',
|
||||
'choices' => $statusChoices,
|
||||
'required' => false,
|
||||
'multiple' => true,
|
||||
'attr' => [
|
||||
'data-controller' => 'elements--select-multiple',
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
public function buildView(FormView $view, FormInterface $form, array $options): void
|
||||
{
|
||||
parent::buildView($view, $form, $options);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
* Copyright (C) 2019 - 2023 Jan Böhmer (https://github.com/jbtronics)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace App\Form\Filters\Constraints;
|
||||
|
||||
use App\DataTables\Filters\Constraints\Part\BulkImportPartStatusConstraint;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\Form\FormView;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class BulkImportPartStatusConstraintType extends AbstractType
|
||||
{
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'compound' => true,
|
||||
'data_class' => BulkImportPartStatusConstraint::class,
|
||||
]);
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$statusChoices = [
|
||||
'bulk_import.part_status.pending' => 'pending',
|
||||
'bulk_import.part_status.completed' => 'completed',
|
||||
'bulk_import.part_status.skipped' => 'skipped',
|
||||
'bulk_import.part_status.failed' => 'failed',
|
||||
];
|
||||
|
||||
$operatorChoices = [
|
||||
'filter.choice_constraint.operator.ANY' => 'ANY',
|
||||
'filter.choice_constraint.operator.NONE' => 'NONE',
|
||||
];
|
||||
|
||||
$builder->add('operator', ChoiceType::class, [
|
||||
'label' => 'filter.operator',
|
||||
'choices' => $operatorChoices,
|
||||
'required' => false,
|
||||
]);
|
||||
|
||||
$builder->add('values', ChoiceType::class, [
|
||||
'label' => 'part.filter.bulk_import_part_status',
|
||||
'choices' => $statusChoices,
|
||||
'required' => false,
|
||||
'multiple' => true,
|
||||
'attr' => [
|
||||
'data-controller' => 'elements--select-multiple',
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
public function buildView(FormView $view, FormInterface $form, array $options): void
|
||||
{
|
||||
parent::buildView($view, $form, $options);
|
||||
}
|
||||
}
|
||||
|
|
@ -100,7 +100,7 @@ class LogFilterType extends AbstractType
|
|||
]);
|
||||
|
||||
$builder->add('user', UserEntityConstraintType::class, [
|
||||
'label' => 'log.user',
|
||||
'label' => 'log.user',
|
||||
]);
|
||||
|
||||
$builder->add('targetType', EnumConstraintType::class, [
|
||||
|
|
@ -129,11 +129,12 @@ class LogFilterType extends AbstractType
|
|||
LogTargetType::LABEL_PROFILE => 'label_profile.label',
|
||||
LogTargetType::PART_ASSOCIATION => 'part_association.label',
|
||||
LogTargetType::BULK_INFO_PROVIDER_IMPORT_JOB => 'bulk_info_provider_import_job.label',
|
||||
LogTargetType::BULK_INFO_PROVIDER_IMPORT_JOB_PART => 'bulk_info_provider_import_job_part.label',
|
||||
},
|
||||
]);
|
||||
|
||||
$builder->add('targetId', NumberConstraintType::class, [
|
||||
'label' => 'log.target_id',
|
||||
'label' => 'log.target_id',
|
||||
'min' => 1,
|
||||
'step' => 1,
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -32,7 +32,11 @@ use App\Entity\Parts\MeasurementUnit;
|
|||
use App\Entity\Parts\StorageLocation;
|
||||
use App\Entity\Parts\Supplier;
|
||||
use App\Entity\ProjectSystem\Project;
|
||||
use App\Entity\BulkInfoProviderImportJob;
|
||||
use App\Form\Filters\Constraints\BooleanConstraintType;
|
||||
use App\Form\Filters\Constraints\BulkImportJobExistsConstraintType;
|
||||
use App\Form\Filters\Constraints\BulkImportJobStatusConstraintType;
|
||||
use App\Form\Filters\Constraints\BulkImportPartStatusConstraintType;
|
||||
use App\Form\Filters\Constraints\ChoiceConstraintType;
|
||||
use App\Form\Filters\Constraints\DateTimeConstraintType;
|
||||
use App\Form\Filters\Constraints\NumberConstraintType;
|
||||
|
|
@ -298,6 +302,23 @@ class PartFilterType extends AbstractType
|
|||
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* Bulk Import Job tab
|
||||
**************************************************************************/
|
||||
if ($this->security->isGranted('@info_providers.create_parts')) {
|
||||
$builder
|
||||
->add('inBulkImportJob', BulkImportJobExistsConstraintType::class, [
|
||||
'label' => 'part.filter.in_bulk_import_job',
|
||||
])
|
||||
->add('bulkImportJobStatus', BulkImportJobStatusConstraintType::class, [
|
||||
'label' => 'part.filter.bulk_import_job_status',
|
||||
])
|
||||
->add('bulkImportPartStatus', BulkImportPartStatusConstraintType::class, [
|
||||
'label' => 'part.filter.bulk_import_part_status',
|
||||
])
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
$builder->add('submit', SubmitType::class, [
|
||||
'label' => 'filter.submit',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue