e2corporation commented on code in PR #3496:
URL: 
https://github.com/apache/incubator-devlake/pull/3496#discussion_r1013003855


##########
config-ui/src/components/blueprints/DataScopesGrid.jsx:
##########
@@ -144,39 +144,29 @@ const DataScopesGrid = (props) => {
                 whiteSpace: 'nowrap'
               }}
             >
-              {[Providers.GITLAB, Providers.GITHUB].includes(
-                c.provider?.id
-              ) && (
+              {[

Review Comment:
   In this particular scenario it's not related to multi-connection, we mainly 
need to know If this provider has a concept of Entity. So this is why we can 
simply call a check for the `coniguredEntityId()` or extend the models with a 
new prop to represent this trait.
   
   Another refactor idea for replacing all of these is to add set of memo 
consts to **Integrations Manager Hook** that represents groups of Providers 
that **Have** certain traits or that **Can** do certain actions or **Use** 
certain features, this way the arrays are centralized in one place. Ideally we 
should stop using these types of arrays except in limited feature scenarios, 
and resort to other alternatives that can work dynamically for all plugins in 
the Registry. This would also be done by extending the Entity Data Model props 
where needed to add more prop checks.
   
   ```jsx
   // Sample Array Replacements for Provider Grouped Traits (Abstract)
   // @hooks/useIntegrations.jsx
   function useIntegrations() {
   ....
   
   // Grouped Entity Traits & Behaviors
   
   const ProvidersThatHaveEntities = useMemo(() => [Providers.GITHUB, 
Providers.JIRA], [Providers])
   const ProvidersThatHaveWebhooks = useMemo(() => [Providers.DORA], 
[Providers])
   const ProvidersThatCanDeploy = useMemo(() => [Providers.GITHUB, 
Providers.GITLAB], [Providers])
   const ProvidersThatCanExpire = useMemo(() => [Providers.GITEE, 
Providers.TAPD], [Providers])
   
   
   
   ....
   }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to