diff --git a/VERSION b/VERSION index c043eea7..ccbccc3d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.2.1 +2.2.0 diff --git a/src/Controller/InfoProviderController.php b/src/Controller/InfoProviderController.php index b79c307c..dae8213e 100644 --- a/src/Controller/InfoProviderController.php +++ b/src/Controller/InfoProviderController.php @@ -25,7 +25,6 @@ namespace App\Controller; use App\Entity\Parts\Manufacturer; use App\Entity\Parts\Part; -use App\Exceptions\OAuthReconnectRequiredException; use App\Form\InfoProviderSystem\PartSearchType; use App\Services\InfoProviderSystem\ExistingPartFinder; use App\Services\InfoProviderSystem\PartInfoRetriever; @@ -176,11 +175,8 @@ class InfoProviderController extends AbstractController $this->addFlash('error',$e->getMessage()); //Log the exception $exceptionLogger->error('Error during info provider search: ' . $e->getMessage(), ['exception' => $e]); - } catch (OAuthReconnectRequiredException $e) { - $this->addFlash('error', t('info_providers.search.error.oauth_reconnect', ['%provider%' => $e->getProviderName()])); } - // modify the array to an array of arrays that has a field for a matching local Part // the advantage to use that format even when we don't look for local parts is that we // always work with the same interface diff --git a/src/Exceptions/OAuthReconnectRequiredException.php b/src/Exceptions/OAuthReconnectRequiredException.php deleted file mode 100644 index 97abb19f..00000000 --- a/src/Exceptions/OAuthReconnectRequiredException.php +++ /dev/null @@ -1,48 +0,0 @@ -. - */ - -declare(strict_types=1); - - -namespace App\Exceptions; - -use Throwable; - -class OAuthReconnectRequiredException extends \RuntimeException -{ - private string $providerName = "unknown"; - - public function __construct(string $message = "You need to reconnect the OAuth connection for this provider!", int $code = 0, ?Throwable $previous = null) - { - parent::__construct($message, $code, $previous); - } - - public static function forProvider(string $providerName): self - { - $exception = new self("You need to reconnect the OAuth connection for the provider '$providerName'!"); - $exception->providerName = $providerName; - return $exception; - } - - public function getProviderName(): string - { - return $this->providerName; - } -} diff --git a/src/Services/InfoProviderSystem/Providers/DigikeyProvider.php b/src/Services/InfoProviderSystem/Providers/DigikeyProvider.php index 423b5244..51f460e4 100644 --- a/src/Services/InfoProviderSystem/Providers/DigikeyProvider.php +++ b/src/Services/InfoProviderSystem/Providers/DigikeyProvider.php @@ -24,7 +24,6 @@ declare(strict_types=1); namespace App\Services\InfoProviderSystem\Providers; use App\Entity\Parts\ManufacturingStatus; -use App\Exceptions\OAuthReconnectRequiredException; use App\Services\InfoProviderSystem\DTOs\FileDTO; use App\Services\InfoProviderSystem\DTOs\ParameterDTO; use App\Services\InfoProviderSystem\DTOs\PartDetailDTO; @@ -118,22 +117,12 @@ class DigikeyProvider implements InfoProviderInterface ]; //$response = $this->digikeyClient->request('POST', '/Search/v3/Products/Keyword', [ - try { - $response = $this->digikeyClient->request('POST', '/products/v4/search/keyword', [ - 'json' => $request, - 'auth_bearer' => $this->authTokenManager->getAlwaysValidTokenString(self::OAUTH_APP_NAME) - ]); - - $response_array = $response->toArray(); - } catch (\InvalidArgumentException $exception) { - //Check if the exception was caused by an invalid or expired token - if (str_contains($exception->getMessage(), 'access_token')) { - throw OAuthReconnectRequiredException::forProvider($this->getProviderKey()); - } - - throw $exception; - } + $response = $this->digikeyClient->request('POST', '/products/v4/search/keyword', [ + 'json' => $request, + 'auth_bearer' => $this->authTokenManager->getAlwaysValidTokenString(self::OAUTH_APP_NAME) + ]); + $response_array = $response->toArray(); $result = []; @@ -161,18 +150,9 @@ class DigikeyProvider implements InfoProviderInterface public function getDetails(string $id): PartDetailDTO { - try { - $response = $this->digikeyClient->request('GET', '/products/v4/search/' . urlencode($id) . '/productdetails', [ - 'auth_bearer' => $this->authTokenManager->getAlwaysValidTokenString(self::OAUTH_APP_NAME) - ]); - } catch (\InvalidArgumentException $exception) { - //Check if the exception was caused by an invalid or expired token - if (str_contains($exception->getMessage(), 'access_token')) { - throw OAuthReconnectRequiredException::forProvider($this->getProviderKey()); - } - - throw $exception; - } + $response = $this->digikeyClient->request('GET', '/products/v4/search/' . urlencode($id) . '/productdetails', [ + 'auth_bearer' => $this->authTokenManager->getAlwaysValidTokenString(self::OAUTH_APP_NAME) + ]); $response_array = $response->toArray(); $product = $response_array['Product']; diff --git a/templates/helper.twig b/templates/helper.twig index 66268a96..bd1d2aa7 100644 --- a/templates/helper.twig +++ b/templates/helper.twig @@ -214,11 +214,11 @@ {% endmacro %} {% macro parameters_table(parameters) %} - +
- + @@ -240,4 +240,4 @@ {% else %} {{ datetime|format_datetime }} {% endif %} -{% endmacro %} +{% endmacro %} \ No newline at end of file diff --git a/templates/label_system/dialog.html.twig b/templates/label_system/dialog.html.twig index b9149aa3..037b549e 100644 --- a/templates/label_system/dialog.html.twig +++ b/templates/label_system/dialog.html.twig @@ -10,9 +10,6 @@ {% block card_content %} {{ form_start(form) }} - {# Default submit to use when pressing enter. #} - -
{% trans %}specifications.property{% endtrans %}{% trans %}specifications.symbol{% endtrans %}{% trans %}specifications.symbol{% endtrans %} {% trans %}specifications.value{% endtrans %}