mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-08-29 14:28:42 +02:00
Fixed disable logic and disable hints for info providers
This commit is contained in:
parent
a48490ac1a
commit
eaaf44b391
9 changed files with 28 additions and 27 deletions
|
@ -78,7 +78,7 @@ class DigikeyProvider implements InfoProviderInterface
|
||||||
'description' => 'This provider uses the DigiKey API to search for parts.',
|
'description' => 'This provider uses the DigiKey API to search for parts.',
|
||||||
'url' => 'https://www.digikey.com/',
|
'url' => 'https://www.digikey.com/',
|
||||||
'oauth_app_name' => self::OAUTH_APP_NAME,
|
'oauth_app_name' => self::OAUTH_APP_NAME,
|
||||||
'disabled_help' => 'Set the PROVIDER_DIGIKEY_CLIENT_ID and PROVIDER_DIGIKEY_SECRET env option and connect OAuth to enable.'
|
'disabled_help' => 'Set the Client ID and Secret in provider settings and connect OAuth to enable.'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ class DigikeyProvider implements InfoProviderInterface
|
||||||
public function isActive(): bool
|
public function isActive(): bool
|
||||||
{
|
{
|
||||||
//The client ID has to be set and a token has to be available (user clicked connect)
|
//The client ID has to be set and a token has to be available (user clicked connect)
|
||||||
return $this->settings->clientId !== '' && $this->authTokenManager->hasToken(self::OAUTH_APP_NAME);
|
return $this->settings->clientId !== null && $this->settings->clientId !== '' && $this->authTokenManager->hasToken(self::OAUTH_APP_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function searchByKeyword(string $keyword): array
|
public function searchByKeyword(string $keyword): array
|
||||||
|
|
|
@ -66,7 +66,7 @@ class Element14Provider implements InfoProviderInterface
|
||||||
'name' => 'Farnell element14',
|
'name' => 'Farnell element14',
|
||||||
'description' => 'This provider uses the Farnell element14 API to search for parts.',
|
'description' => 'This provider uses the Farnell element14 API to search for parts.',
|
||||||
'url' => 'https://www.element14.com/',
|
'url' => 'https://www.element14.com/',
|
||||||
'disabled_help' => 'Configure the API key in the PROVIDER_ELEMENT14_KEY environment variable to enable.'
|
'disabled_help' => 'Configure the API key in the provider settings to enable.'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ class LCSCProvider implements InfoProviderInterface
|
||||||
'name' => 'LCSC',
|
'name' => 'LCSC',
|
||||||
'description' => 'This provider uses the (unofficial) LCSC API to search for parts.',
|
'description' => 'This provider uses the (unofficial) LCSC API to search for parts.',
|
||||||
'url' => 'https://www.lcsc.com/',
|
'url' => 'https://www.lcsc.com/',
|
||||||
'disabled_help' => 'Set PROVIDER_LCSC_ENABLED to 1 (or true) in your environment variable config.'
|
'disabled_help' => 'Enable this provider in the provider settings.'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ class MouserProvider implements InfoProviderInterface
|
||||||
'name' => 'Mouser',
|
'name' => 'Mouser',
|
||||||
'description' => 'This provider uses the Mouser API to search for parts.',
|
'description' => 'This provider uses the Mouser API to search for parts.',
|
||||||
'url' => 'https://www.mouser.com/',
|
'url' => 'https://www.mouser.com/',
|
||||||
'disabled_help' => 'Configure the API key in the PROVIDER_MOUSER_KEY environment variable to enable.'
|
'disabled_help' => 'Configure the API key in the provider settings to enable.'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -246,7 +246,7 @@ class OEMSecretsProvider implements InfoProviderInterface
|
||||||
'name' => 'OEMSecrets',
|
'name' => 'OEMSecrets',
|
||||||
'description' => 'This provider uses the OEMSecrets API to search for parts.',
|
'description' => 'This provider uses the OEMSecrets API to search for parts.',
|
||||||
'url' => 'https://www.oemsecrets.com/',
|
'url' => 'https://www.oemsecrets.com/',
|
||||||
'disabled_help' => 'Configure the API key in the PROVIDER_OEMSECRETS_KEY environment variable to enable.'
|
'disabled_help' => 'Configure the API key in the provider settings to enable.'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -265,7 +265,7 @@ class OEMSecretsProvider implements InfoProviderInterface
|
||||||
*/
|
*/
|
||||||
public function isActive(): bool
|
public function isActive(): bool
|
||||||
{
|
{
|
||||||
return $this->settings->apiKey !== '';
|
return $this->settings->apiKey !== null && $this->settings->apiKey !== '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -170,7 +170,7 @@ class OctopartProvider implements InfoProviderInterface
|
||||||
'name' => 'Octopart',
|
'name' => 'Octopart',
|
||||||
'description' => 'This provider uses the Nexar/Octopart API to search for parts on Octopart.',
|
'description' => 'This provider uses the Nexar/Octopart API to search for parts on Octopart.',
|
||||||
'url' => 'https://www.octopart.com/',
|
'url' => 'https://www.octopart.com/',
|
||||||
'disabled_help' => 'Set the PROVIDER_OCTOPART_CLIENT_ID and PROVIDER_OCTOPART_SECRET env option.'
|
'disabled_help' => 'Set the Client ID and Secret in provider settings.'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,7 +183,8 @@ class OctopartProvider implements InfoProviderInterface
|
||||||
{
|
{
|
||||||
//The client ID has to be set and a token has to be available (user clicked connect)
|
//The client ID has to be set and a token has to be available (user clicked connect)
|
||||||
//return /*!empty($this->clientId) && */ $this->authTokenManager->hasToken(self::OAUTH_APP_NAME);
|
//return /*!empty($this->clientId) && */ $this->authTokenManager->hasToken(self::OAUTH_APP_NAME);
|
||||||
return $this->settings->clientId !== '' && $this->settings->secret !== '';
|
return $this->settings->clientId !== null && $this->settings->clientId !== ''
|
||||||
|
&& $this->settings->secret !== null && $this->settings->secret !== '';
|
||||||
}
|
}
|
||||||
|
|
||||||
private function mapLifeCycleStatus(?string $value): ?ManufacturingStatus
|
private function mapLifeCycleStatus(?string $value): ?ManufacturingStatus
|
||||||
|
|
|
@ -51,7 +51,7 @@ class PollinProvider implements InfoProviderInterface
|
||||||
'name' => 'Pollin',
|
'name' => 'Pollin',
|
||||||
'description' => 'Webscraping from pollin.de to get part information',
|
'description' => 'Webscraping from pollin.de to get part information',
|
||||||
'url' => 'https://www.pollin.de/',
|
'url' => 'https://www.pollin.de/',
|
||||||
'disabled_help' => 'Set PROVIDER_POLLIN_ENABLED env to 1'
|
'disabled_help' => 'Enable the provider in provider settings'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ class ReicheltProvider implements InfoProviderInterface
|
||||||
'name' => 'Reichelt',
|
'name' => 'Reichelt',
|
||||||
'description' => 'Webscraping from reichelt.com to get part information',
|
'description' => 'Webscraping from reichelt.com to get part information',
|
||||||
'url' => 'https://www.reichelt.com/',
|
'url' => 'https://www.reichelt.com/',
|
||||||
'disabled_help' => 'Set PROVIDER_REICHELT_ENABLED env to 1'
|
'disabled_help' => 'Enable provider in provider settings.'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ class TMEProvider implements InfoProviderInterface
|
||||||
'name' => 'TME',
|
'name' => 'TME',
|
||||||
'description' => 'This provider uses the API of TME (Transfer Multipart).',
|
'description' => 'This provider uses the API of TME (Transfer Multipart).',
|
||||||
'url' => 'https://tme.eu/',
|
'url' => 'https://tme.eu/',
|
||||||
'disabled_help' => 'Configure the PROVIDER_TME_KEY and PROVIDER_TME_SECRET environment variables to use this provider.'
|
'disabled_help' => 'Configure the API Token and secret in provider settings to use this provider.'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue