You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by GitBox <gi...@apache.org> on 2022/11/14 07:14:16 UTC

[GitHub] [incubator-devlake] likyh opened a new pull request, #3730: feat: add "enable graphql" in config-ui

likyh opened a new pull request, #3730:
URL: https://github.com/apache/incubator-devlake/pull/3730

   # Summary
   
   <!--
   Thanks for submitting a pull request!
   
   We appreciate you spending the time to work on these changes.
   Please fill out as many sections below as possible.
   -->
   1. add enableGraphql in config-ui
   2. display repo name for github graphql
   3. add domain_entity for github graphql
   
   I add a column for github connection `enable_graphql`. `Github.makePipelinePlan` will return github_graphql or github by enable_graphql.
   
   ### Does this close any open issues?
   Closes #3528
   Related #2529
   
   ### Screenshots
   
   ![image](https://user-images.githubusercontent.com/3294100/201596776-5b34e73a-cea7-45d8-8112-4c83149e09ea.png)
   ![image](https://user-images.githubusercontent.com/3294100/201596877-ade85ca4-e388-42cc-a8c6-84c1cbb13566.png)
   


-- 
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: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] likyh commented on a diff in pull request #3730: feat: add "enable graphql" in config-ui

Posted by GitBox <gi...@apache.org>.
likyh commented on code in PR #3730:
URL: https://github.com/apache/incubator-devlake/pull/3730#discussion_r1028011280


##########
config-ui/src/components/pipelines/StageTaskName.jsx:
##########
@@ -61,14 +61,16 @@ const StageTaskName = (props) => {
           ref={popoverTriggerRef}
           style={{ display: 'block', margin: '5px 0 5px 0' }}
         >
-          <strong>Task ID {task.id}</strong>{' '}
-          {ProviderLabels[task?.plugin?.toUpperCase()]}{' '}
-          {task.plugin === Providers.GITHUB &&
-            task.plugin !== Providers.JENKINS && (
-              <>
-                @{task.options.owner}/{task.options.repo}
-              </>
-            )}
+          <strong>Task#{task.id}</strong>{' '}
+          {ProviderLabels[task?.plugin?.toUpperCase()] ||
+            task?.plugin?.toUpperCase()}{' '}
+          {(task.plugin === Providers.GITHUB ||
+            task.plugin === 'github_graphql') && (

Review Comment:
   fixed



-- 
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: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] likyh commented on a diff in pull request #3730: feat: add "enable graphql" in config-ui

Posted by GitBox <gi...@apache.org>.
likyh commented on code in PR #3730:
URL: https://github.com/apache/incubator-devlake/pull/3730#discussion_r1028011939


##########
config-ui/src/pages/configure/connections/ConnectionForm.jsx:
##########
@@ -807,108 +809,152 @@ export default function ConnectionForm(props) {
           Providers.BITBUCKET,
           Providers.GITEE
         ].includes(activeProvider?.id) && (
-          <>
-            <div className='formContainer'>
-              <FormGroup
+          <div className='formContainer'>
+            <FormGroup
+              disabled={isTesting || isSaving || isLocked}
+              inline={true}
+              labelFor='connection-proxy'
+              className={formGroupClassName}
+              contentClassName='formGroupContent'
+            >
+              <Label>{labels ? labels.proxy : <>Proxy&nbsp;URL</>}</Label>
+              <InputGroup
+                id='connection-proxy'
+                inputRef={connectionProxyRef}
+                tabIndex={3}
+                placeholder={
+                  placeholders.proxy
+                    ? placeholders.proxy
+                    : 'http://proxy.localhost:8080'
+                }
+                defaultValue={proxy}
+                onChange={(e) => onProxyChange(e.target.value)}
                 disabled={isTesting || isSaving || isLocked}
-                inline={true}
-                labelFor='connection-proxy'
-                className={formGroupClassName}
-                contentClassName='formGroupContent'
+                className={`input input-proxy ${
+                  fieldHasError('Proxy') ? 'invalid-field' : ''
+                }`}
+                rightElement={
+                  <InputValidationError error={getFieldError('Proxy')} />
+                }
+              />
+            </FormGroup>
+          </div>
+        )}
+        {[Providers.GITHUB].includes(activeProvider?.id) && (
+          <div className='formContainer'>
+            <FormGroup
+              disabled={isTesting || isSaving || isLocked}
+              inline={true}
+              labelFor='connection-ratelimit'
+              className={formGroupClassName}
+              contentClassName='formGroupContent'
+            >
+              <Label>
+                {labels?.enableGraphql || <>Use Graphql APIs</>}
+                {tooltips?.enableGraphql ? (
+                  <Tooltip
+                    className='connection-tooltip'
+                    intent={Intent.PRIMARY}
+                    content={tooltips?.enableGraphql}
+                  >
+                    <TooltipIcon />
+                  </Tooltip>
+                ) : null}
+              </Label>
+              <div
+                className='ratelimit-options'
+                style={{ display: 'flex', float: 'left' }}
               >
-                <Label>{labels ? labels.proxy : <>Proxy&nbsp;URL</>}</Label>
-                <InputGroup
-                  id='connection-proxy'
-                  inputRef={connectionProxyRef}
-                  tabIndex={3}
-                  placeholder={
-                    placeholders.proxy
-                      ? placeholders.proxy
-                      : 'http://proxy.localhost:8080'
-                  }
-                  defaultValue={proxy}
-                  onChange={(e) => onProxyChange(e.target.value)}
-                  disabled={isTesting || isSaving || isLocked}
-                  className={`input input-proxy ${
-                    fieldHasError('Proxy') ? 'invalid-field' : ''
-                  }`}
-                  rightElement={
-                    <InputValidationError error={getFieldError('Proxy')} />
-                  }
+                <Switch
+                  checked={enableGraphql}
+                  label={enableGraphql ? 'Enabled' : 'Disabled'}
+                  onChange={() => onEnableGraphqlChange(!enableGraphql)}
+                  style={{ marginBottom: '0' }}
                 />
-              </FormGroup>
-            </div>
-            <div className='formContainer'>
-              <FormGroup
-                disabled={isTesting || isSaving || isLocked}
-                inline={true}
-                labelFor='connection-ratelimit'
-                className={formGroupClassName}
-                contentClassName='formGroupContent'
+              </div>
+            </FormGroup>
+          </div>
+        )}
+        {[
+          Providers.GITHUB,

Review Comment:
   No, That's not all. Just the connections with `ratelimit`



-- 
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: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] mintsweet commented on a diff in pull request #3730: feat: add "enable graphql" in config-ui

Posted by GitBox <gi...@apache.org>.
mintsweet commented on code in PR #3730:
URL: https://github.com/apache/incubator-devlake/pull/3730#discussion_r1022352641


##########
config-ui/src/pages/configure/connections/ConnectionForm.jsx:
##########
@@ -807,108 +809,152 @@ export default function ConnectionForm(props) {
           Providers.BITBUCKET,
           Providers.GITEE
         ].includes(activeProvider?.id) && (
-          <>
-            <div className='formContainer'>
-              <FormGroup
+          <div className='formContainer'>
+            <FormGroup
+              disabled={isTesting || isSaving || isLocked}
+              inline={true}
+              labelFor='connection-proxy'
+              className={formGroupClassName}
+              contentClassName='formGroupContent'
+            >
+              <Label>{labels ? labels.proxy : <>Proxy&nbsp;URL</>}</Label>
+              <InputGroup
+                id='connection-proxy'
+                inputRef={connectionProxyRef}
+                tabIndex={3}
+                placeholder={
+                  placeholders.proxy
+                    ? placeholders.proxy
+                    : 'http://proxy.localhost:8080'
+                }
+                defaultValue={proxy}
+                onChange={(e) => onProxyChange(e.target.value)}
                 disabled={isTesting || isSaving || isLocked}
-                inline={true}
-                labelFor='connection-proxy'
-                className={formGroupClassName}
-                contentClassName='formGroupContent'
+                className={`input input-proxy ${
+                  fieldHasError('Proxy') ? 'invalid-field' : ''
+                }`}
+                rightElement={
+                  <InputValidationError error={getFieldError('Proxy')} />
+                }
+              />
+            </FormGroup>
+          </div>
+        )}
+        {[Providers.GITHUB].includes(activeProvider?.id) && (
+          <div className='formContainer'>
+            <FormGroup
+              disabled={isTesting || isSaving || isLocked}
+              inline={true}
+              labelFor='connection-ratelimit'
+              className={formGroupClassName}
+              contentClassName='formGroupContent'
+            >
+              <Label>
+                {labels?.enableGraphql || <>Use Graphql APIs</>}
+                {tooltips?.enableGraphql ? (
+                  <Tooltip
+                    className='connection-tooltip'
+                    intent={Intent.PRIMARY}
+                    content={tooltips?.enableGraphql}
+                  >
+                    <TooltipIcon />
+                  </Tooltip>
+                ) : null}
+              </Label>
+              <div
+                className='ratelimit-options'
+                style={{ display: 'flex', float: 'left' }}
               >
-                <Label>{labels ? labels.proxy : <>Proxy&nbsp;URL</>}</Label>
-                <InputGroup
-                  id='connection-proxy'
-                  inputRef={connectionProxyRef}
-                  tabIndex={3}
-                  placeholder={
-                    placeholders.proxy
-                      ? placeholders.proxy
-                      : 'http://proxy.localhost:8080'
-                  }
-                  defaultValue={proxy}
-                  onChange={(e) => onProxyChange(e.target.value)}
-                  disabled={isTesting || isSaving || isLocked}
-                  className={`input input-proxy ${
-                    fieldHasError('Proxy') ? 'invalid-field' : ''
-                  }`}
-                  rightElement={
-                    <InputValidationError error={getFieldError('Proxy')} />
-                  }
+                <Switch
+                  checked={enableGraphql}
+                  label={enableGraphql ? 'Enabled' : 'Disabled'}
+                  onChange={() => onEnableGraphqlChange(!enableGraphql)}
+                  style={{ marginBottom: '0' }}
                 />
-              </FormGroup>
-            </div>
-            <div className='formContainer'>
-              <FormGroup
-                disabled={isTesting || isSaving || isLocked}
-                inline={true}
-                labelFor='connection-ratelimit'
-                className={formGroupClassName}
-                contentClassName='formGroupContent'
+              </div>
+            </FormGroup>
+          </div>
+        )}
+        {[
+          Providers.GITHUB,

Review Comment:
   `Object.keys(Providers).includes()`?



##########
config-ui/src/components/pipelines/StageTaskName.jsx:
##########
@@ -61,14 +61,16 @@ const StageTaskName = (props) => {
           ref={popoverTriggerRef}
           style={{ display: 'block', margin: '5px 0 5px 0' }}
         >
-          <strong>Task ID {task.id}</strong>{' '}
-          {ProviderLabels[task?.plugin?.toUpperCase()]}{' '}
-          {task.plugin === Providers.GITHUB &&
-            task.plugin !== Providers.JENKINS && (
-              <>
-                @{task.options.owner}/{task.options.repo}
-              </>
-            )}
+          <strong>Task#{task.id}</strong>{' '}
+          {ProviderLabels[task?.plugin?.toUpperCase()] ||
+            task?.plugin?.toUpperCase()}{' '}
+          {(task.plugin === Providers.GITHUB ||
+            task.plugin === 'github_graphql') && (

Review Comment:
   Why is this not part of the `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: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] klesh merged pull request #3730: feat: add "enable graphql" in config-ui

Posted by GitBox <gi...@apache.org>.
klesh merged PR #3730:
URL: https://github.com/apache/incubator-devlake/pull/3730


-- 
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: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] likyh commented on a diff in pull request #3730: feat: add "enable graphql" in config-ui

Posted by GitBox <gi...@apache.org>.
likyh commented on code in PR #3730:
URL: https://github.com/apache/incubator-devlake/pull/3730#discussion_r1028012218


##########
plugins/github/api/blueprint.go:
##########
@@ -114,20 +114,42 @@ func makePipelinePlan(subtaskMetas []core.SubTaskMeta, scope []*core.BlueprintSc
 			return repo, err
 		}
 
-		// construct subtasks
-		subtasks, err := helper.MakePipelinePlanSubtasks(subtaskMetas, scopeElem.Entities)
-		if err != nil {
-			return nil, err
-		}
 		stage := plan[i]
 		if stage == nil {
 			stage = core.PipelineStage{}
 		}
-		stage = append(stage, &core.PipelineTask{
-			Plugin:   "github",
-			Subtasks: subtasks,
-			Options:  options,
-		})
+
+		// construct github(graphql) task
+		if connection.EnableGraphql {
+			// FIXME this need fix when 2 plugins merged
+			plugin, err := core.GetPlugin(`github_graphql`)
+			if err != nil {
+				return nil, err
+			}
+			if pluginGq, ok := plugin.(core.PluginTask); ok {
+				subtasks, err := helper.MakePipelinePlanSubtasks(pluginGq.SubTaskMetas(), scopeElem.Entities)
+				if err != nil {
+					return nil, err
+				}
+				stage = append(stage, &core.PipelineTask{
+					Plugin:   "github_graphql",
+					Subtasks: subtasks,
+					Options:  options,
+				})
+			} else {
+				return nil, errors.Default.New("plugin github_graphql does not support SubTaskMetas")

Review Comment:
   Although here will never reach, but fixed.



-- 
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: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] keon94 commented on a diff in pull request #3730: feat: add "enable graphql" in config-ui

Posted by GitBox <gi...@apache.org>.
keon94 commented on code in PR #3730:
URL: https://github.com/apache/incubator-devlake/pull/3730#discussion_r1022291610


##########
plugins/github/api/blueprint.go:
##########
@@ -114,20 +114,42 @@ func makePipelinePlan(subtaskMetas []core.SubTaskMeta, scope []*core.BlueprintSc
 			return repo, err
 		}
 
-		// construct subtasks
-		subtasks, err := helper.MakePipelinePlanSubtasks(subtaskMetas, scopeElem.Entities)
-		if err != nil {
-			return nil, err
-		}
 		stage := plan[i]
 		if stage == nil {
 			stage = core.PipelineStage{}
 		}
-		stage = append(stage, &core.PipelineTask{
-			Plugin:   "github",
-			Subtasks: subtasks,
-			Options:  options,
-		})
+
+		// construct github(graphql) task
+		if connection.EnableGraphql {
+			// FIXME this need fix when 2 plugins merged
+			plugin, err := core.GetPlugin(`github_graphql`)
+			if err != nil {
+				return nil, err
+			}
+			if pluginGq, ok := plugin.(core.PluginTask); ok {
+				subtasks, err := helper.MakePipelinePlanSubtasks(pluginGq.SubTaskMetas(), scopeElem.Entities)
+				if err != nil {
+					return nil, err
+				}
+				stage = append(stage, &core.PipelineTask{
+					Plugin:   "github_graphql",
+					Subtasks: subtasks,
+					Options:  options,
+				})
+			} else {
+				return nil, errors.Default.New("plugin github_graphql does not support SubTaskMetas")

Review Comment:
   It looks like BadInput may be a better error type for this. "Default" translates to err 500 for new errors



-- 
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: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org