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/09/01 16:06:05 UTC

[GitHub] [incubator-devlake] likyh opened a new pull request, #2926: feat: add projects selector fetching by api for gitlab when adding bl…

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

   …ueprint
   
   ### ⚠️ &nbsp;&nbsp;Pre Checklist
   
   > Please complete _ALL_ items in this checklist, and remove before submitting
   
   - [ ] I have read through the [Contributing Documentation](https://devlake.apache.org/community/).
   - [ ] I have added relevant tests.
   - [ ] I have added relevant documentation.
   - [ ] I will add labels to the PR, such as `pr-type/bug-fix`, `pr-type/feature-development`, etc.
   
   
   
   # 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.
   -->
   
   ### Does this close any open issues?
   Closes xx
   
   ### Screenshots
   Include any relevant screenshots here.
   
   ### Other Information
   Any other information that is important to this PR.
   


-- 
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] e2corporation commented on pull request #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

Posted by GitBox <gi...@apache.org>.
e2corporation commented on PR #2926:
URL: https://github.com/apache/incubator-devlake/pull/2926#issuecomment-1239449709

   > All of review if fixed. Can it merge? @e2corporation
   
   @likyh It's looking good and will be merge ready soon, see my last comment about Long Project Name/Path.


-- 
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] e2corporation commented on a diff in pull request #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/components/blueprints/GitlabProjectsSelector.jsx:
##########
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+import React, { useEffect, useState } from 'react'
+import { Checkbox, Intent, MenuItem, } from '@blueprintjs/core'
+import { MultiSelect } from '@blueprintjs/select'
+
+const GitlabProjectsSelector = (props) => {
+  const {
+    fetchGitlabProjects = () => [],

Review Comment:
   This should be refactored to something more generic to the component, `onFetch` or `onProjectsFetch`
   
   ```suggestion
       onFetch = () => [],
   ```



-- 
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] e2corporation commented on a diff in pull request #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/components/blueprints/GitlabProjectsSelector.jsx:
##########
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+import React, { useEffect, useState } from 'react'
+import { Checkbox, Intent, MenuItem, } from '@blueprintjs/core'
+import { MultiSelect } from '@blueprintjs/select'
+
+const GitlabProjectsSelector = (props) => {
+  const {
+    fetchGitlabProjects = () => [],
+    isFetchingGitlab = false,
+    configuredConnection,
+    placeholder = 'Select Projects',
+    items = [],
+    selectedItems = [],
+    activeItem = null,
+    disabled = false,
+    isLoading = false,
+    isSaving = false,
+    onItemSelect = () => {},
+    onRemove = () => {},
+    onClear = () => {},
+    itemRenderer = (item, { handleClick, modifiers }) => (
+      <MenuItem
+        active={modifiers.active}
+        disabled={
+          selectedItems.find(i => i?.id === item?.id)
+        }
+        key={item.value}
+        onClick={handleClick}
+        text={
+          selectedItems.find(i => i?.id === item?.id)
+            ? (
+              <>
+                <input type='checkbox' checked readOnly /> {item?.title}
+              </>
+              )
+            : (
+              <span style={{ fontWeight: 700 }}>
+                <input type='checkbox' readOnly /> {item?.title}
+              </span>
+              )
+        }
+        style={{
+          marginBottom: '2px',
+          fontWeight: items.includes(item) ? 700 : 'normal',
+        }}
+      />
+    ),
+    tagRenderer = (item) => item?.title,
+  } = props
+
+  const [query, setQuery] = useState('')
+  const [onlyQueryMemberRepo, setOnlyQueryMemberRepo] = useState(true)
+
+  useEffect(() => {
+    if (query.length <= 2) {

Review Comment:
   The min query check should be handled in the `useGitlab` Hook for better control, add it as an `if-else` condition to the existing chain and `Throw` a new error that query length is too short (like we do when connection id is null). Then it can be removed from being duplicated here.
   
   Then again, we may not want to throw a fatal error there either. The issue I want to solve for is using a return to bypass the effect.



-- 
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] e2corporation commented on a diff in pull request #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/pages/blueprints/blueprint-settings.jsx:
##########
@@ -579,20 +590,45 @@ const BlueprintSettings = (props) => {
   useEffect(() => {
     console.log('>>> ACTIVE BLUEPRINT ....', activeBlueprint)
     const getGithubProjects = (c) => [Providers.GITHUB].includes(c.plugin)
-      ? c.scope.map((s) => `${s.options.owner}/${s.options?.repo}`)
+      ? c.scope.map((s) => ({
+        id: `${s.options.owner}/${s.options?.repo}`,
+        key: `${s.options.owner}/${s.options?.repo}`,
+        value: `${s.options.owner}/${s.options?.repo}`,
+        title: `${s.options.owner}/${s.options?.repo}`,
+      }))
       : []
     const getGitlabProjects = (c) => [Providers.GITLAB].includes(c.plugin)
-      ? c.scope.map((s) => s.options?.projectId)
+      ? c.scope.map((s) => ({
+        id: s.options?.projectId,
+        key: s.options?.projectId,
+        value: s.options?.projectId,
+        title: s.options?.title || `Project ${s.options?.projectId}`,
+      }))
       : []
     // @todo: handle multi-stage
     const getAdvancedGithubProjects = (t, providerId) => [Providers.GITHUB].includes(providerId)
-      ? [`${t.options?.owner}/${t.options?.repo}`]
+      ? [{
+          id: `${t.options.owner}/${t.options?.repo}`,

Review Comment:
   We should add optional chaining (`?`) for `owner` here too like all the other props.
   ```suggestion
             id: `${t.options?.owner}/${t.options?.repo}`,
   ```



-- 
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] e2corporation commented on pull request #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

Posted by GitBox <gi...@apache.org>.
e2corporation commented on PR #2926:
URL: https://github.com/apache/incubator-devlake/pull/2926#issuecomment-1239437333

   @likyh Functional tests looking good, the selector operates nicely so far. I think there are some visual tweaks we may want to consider. I do like that Full Repository Path is shown, but maybe we want to consider shortening the nodes displayed to just the repo name and it's immediate parent for multi-level scenarios? **-or-** we need some CSS tweaks on the Stacked Project List selector to handle lengthy project paths, mainly by css truncation+ellipsis to prevent a rendering bug.
   
   The other useful thing that can be done, is for the TagItem renderer callback we can customize the selector tags that get inserted into the widget. We could wrap them with a tooltip or popover that contains the full repository path and other project details. This way we can just show the Project Name alone for the tag.
   
   <img width="794" alt="Screen Shot 2022-09-07 at 9 57 56 AM" src="https://user-images.githubusercontent.com/1742233/188897907-0176402a-0c96-49d0-8df3-20e125dfb5c9.png">
   
   <img width="825" alt="Screen Shot 2022-09-07 at 9 57 48 AM" src="https://user-images.githubusercontent.com/1742233/188897873-2c5c3c6c-6508-4468-b06f-e397b616cdb9.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 pull request #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

Posted by GitBox <gi...@apache.org>.
likyh commented on PR #2926:
URL: https://github.com/apache/incubator-devlake/pull/2926#issuecomment-1239428807

   All of review if fixed. Can it merge? @e2corporation 


-- 
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] e2corporation commented on a diff in pull request #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/components/blueprints/DataScopesGrid.jsx:
##########
@@ -169,8 +169,8 @@ const DataScopesGrid = (props) => {
                     padding: 0,
                   }}
                 >
-                  {c.boards.map((board, bIdx) => (
-                    <li key={`list-item-key-${bIdx}`}>{board}</li>
+                  {c.boardsList.map((board, bIdx) => (

Review Comment:
   Whether you interact with an array of Objects, Strings or Integers, it shouldn't be a problem for you. The differences and needs for rendering in Normal Mode vs Advanced mode created the scenario for mixed types, not so much the lack of good practices. Making them Objects in all scenarios wouldn't be a problem either and things will most likely gravitate to that anyway.



-- 
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] e2corporation commented on a diff in pull request #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/components/blueprints/DataScopesGrid.jsx:
##########
@@ -169,8 +169,8 @@ const DataScopesGrid = (props) => {
                     padding: 0,
                   }}
                 >
-                  {c.boards.map((board, bIdx) => (
-                    <li key={`list-item-key-${bIdx}`}>{board}</li>
+                  {c.boardsList.map((board, bIdx) => (

Review Comment:
   Had I known backend is storing everything submitted in transformations as raw json we could have potentially stored board metadata much sooner and not have to refetch it from Proxy all the time. However if the board data is updated by the user it would be out of sync and we'd still have to re-associate the stored board IDs against the live list to ensure the metadata was up to date.



-- 
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] e2corporation commented on a diff in pull request #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/components/blueprints/GitlabProjectsSelector.jsx:
##########
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+import React, { useEffect, useState } from 'react'
+import { Checkbox, Intent, MenuItem, } from '@blueprintjs/core'
+import { MultiSelect } from '@blueprintjs/select'
+
+const GitlabProjectsSelector = (props) => {
+  const {
+    fetchGitlabProjects = () => [],
+    isFetchingGitlab = false,
+    configuredConnection,
+    placeholder = 'Select Projects',
+    items = [],
+    selectedItems = [],
+    activeItem = null,
+    disabled = false,
+    isLoading = false,
+    isSaving = false,
+    onItemSelect = () => {},
+    onRemove = () => {},
+    onClear = () => {},
+    itemRenderer = (item, { handleClick, modifiers }) => (
+      <MenuItem
+        active={modifiers.active}
+        disabled={
+          selectedItems.find(i => i?.id === item?.id)
+        }
+        key={item.value}
+        onClick={handleClick}
+        text={
+          selectedItems.find(i => i?.id === item?.id)
+            ? (
+              <>
+                <input type='checkbox' checked readOnly /> {item?.title}
+              </>
+              )
+            : (
+              <span style={{ fontWeight: 700 }}>
+                <input type='checkbox' readOnly /> {item?.title}
+              </span>
+              )
+        }
+        style={{
+          marginBottom: '2px',
+          fontWeight: items.includes(item) ? 700 : 'normal',
+        }}
+      />
+    ),
+    tagRenderer = (item) => item?.title,
+  } = props
+
+  const [query, setQuery] = useState('')
+  const [onlyQueryMemberRepo, setOnlyQueryMemberRepo] = useState(true)
+
+  useEffect(() => {
+    if (query.length <= 2) {
+      // only search when type more than 2 char or empty
+      return
+    }
+    // prevent request too frequently
+    const timer = setTimeout(() => {
+      fetchGitlabProjects(query, onlyQueryMemberRepo)
+    }, 200)
+    return () => clearTimeout(timer)
+  }, [fetchGitlabProjects, query])
+
+  useEffect(() => {
+    if (query.length <= 2) {

Review Comment:
   See Comment on `Ln 71` about migrating this check to the `useGitlab` hook. Additionally, this effect is a bit of a duplicate of the one above it, they should be combined into one effect.



-- 
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 #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/components/blueprints/GitlabProjectsSelector.jsx:
##########
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+import React, { useEffect, useState } from 'react'
+import { Checkbox, Intent, MenuItem, } from '@blueprintjs/core'
+import { MultiSelect } from '@blueprintjs/select'
+
+const GitlabProjectsSelector = (props) => {
+  const {
+    fetchGitlabProjects = () => [],

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] e2corporation commented on a diff in pull request #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/hooks/useDataScopesManager.jsx:
##########
@@ -137,7 +138,8 @@ function useDataScopesManager ({ provider, blueprint, /* connection, */ settings
           newScope = projects[connection.id]?.map((p) => ({
             ...newScope,
             options: {
-              projectId: Number(p),
+              projectId: Number(p.value),

Review Comment:
   Use optional chaining check here (`?`)
   ```suggestion
                 projectId: Number(p?.value),
   ```



-- 
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 #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/hooks/useDataScopesManager.jsx:
##########
@@ -137,7 +138,8 @@ function useDataScopesManager ({ provider, blueprint, /* connection, */ settings
           newScope = projects[connection.id]?.map((p) => ({
             ...newScope,
             options: {
-              projectId: Number(p),
+              projectId: Number(p.value),

Review Comment:
   No error in console after add blueprint and edit blueprint except this. Because of #2994, I cannot go to other page.
   
   ![image](https://user-images.githubusercontent.com/3294100/188793726-d634b4b0-6b75-4a6b-a9b3-e2dbd57f9e86.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] e2corporation commented on a diff in pull request #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/components/blueprints/DataScopesGrid.jsx:
##########
@@ -169,8 +169,8 @@ const DataScopesGrid = (props) => {
                     padding: 0,
                   }}
                 >
-                  {c.boards.map((board, bIdx) => (
-                    <li key={`list-item-key-${bIdx}`}>{board}</li>
+                  {c.boardsList.map((board, bIdx) => (

Review Comment:
   More refinements and property consolidation on the data scope connection model will be done later, especially with regard to duplicated props. Ideally we want to build the same data scope connection for both advanced and normal, due to the differences in how advanced data is referenced currently these "connection" objects constructed in different ways even though they are sharing the same model.
   
   Regardless of this, `boards` has always referenced _selected_ boards and `boardsList` anywhere in the code base has always reflected the _available_ list of boards.



-- 
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] e2corporation commented on a diff in pull request #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/components/blueprints/GitlabProjectsSelector.jsx:
##########
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+import React, { useEffect, useState } from 'react'
+import { Checkbox, Intent, MenuItem, } from '@blueprintjs/core'
+import { MultiSelect } from '@blueprintjs/select'
+
+const GitlabProjectsSelector = (props) => {
+  const {
+    fetchGitlabProjects = () => [],
+    isFetchingGitlab = false,
+    configuredConnection,
+    placeholder = 'Select Projects',
+    items = [],
+    selectedItems = [],
+    activeItem = null,
+    disabled = false,
+    isLoading = false,
+    isSaving = false,
+    onItemSelect = () => {},
+    onRemove = () => {},
+    onClear = () => {},
+    itemRenderer = (item, { handleClick, modifiers }) => (
+      <MenuItem
+        active={modifiers.active}
+        disabled={
+          selectedItems.find(i => i?.id === item?.id)
+        }
+        key={item.value}
+        onClick={handleClick}
+        text={
+          selectedItems.find(i => i?.id === item?.id)
+            ? (
+              <>
+                <input type='checkbox' checked readOnly /> {item?.title}
+              </>
+              )
+            : (
+              <span style={{ fontWeight: 700 }}>
+                <input type='checkbox' readOnly /> {item?.title}
+              </span>
+              )
+        }
+        style={{
+          marginBottom: '2px',
+          fontWeight: items.includes(item) ? 700 : 'normal',
+        }}
+      />
+    ),
+    tagRenderer = (item) => item?.title,
+  } = props
+
+  const [query, setQuery] = useState('')
+  const [onlyQueryMemberRepo, setOnlyQueryMemberRepo] = useState(true)
+
+  useEffect(() => {
+    if (query.length <= 2) {
+      // only search when type more than 2 char or empty
+      return
+    }
+    // prevent request too frequently
+    const timer = setTimeout(() => {
+      fetchGitlabProjects(query, onlyQueryMemberRepo)
+    }, 200)
+    return () => clearTimeout(timer)
+  }, [fetchGitlabProjects, query])
+
+  useEffect(() => {
+    if (query.length <= 2) {
+      // only search when type more than 2 char or empty
+      return
+    }
+    fetchGitlabProjects(query, onlyQueryMemberRepo)
+  }, [fetchGitlabProjects, onlyQueryMemberRepo])
+
+  return (
+    <div
+      className='gitlab-projects-multiselect'
+      style={{ display: 'flex', marginBottom: '10px' }}
+    >
+      <div
+        className='gitlab-projects-multiselect-selector'
+        style={{ minWidth: '200px', width: '100%' }}
+      >
+        <MultiSelect
+          disabled={disabled || isSaving || isLoading}
+          // openOnKeyDown={true}
+          resetOnSelect={true}
+          placeholder={placeholder}
+          popoverProps={{ usePortal: false, minimal: true }}
+          className='multiselector-projects'
+          inline={true}
+          fill={true}
+          items={items}
+          selectedItems={selectedItems}
+          activeItem={activeItem}
+          onQueryChange={query => setQuery(query)}
+          itemRenderer={itemRenderer}
+          tagRenderer={tagRenderer}
+          tagInputProps={{
+            tagProps: {
+              intent: Intent.PRIMARY,
+              minimal: true
+            },
+          }}
+          noResults={
+            (query.length <= 2 && <MenuItem disabled={true} text='Please type more than 2 char to search.' />) ||
+            (isFetchingGitlab && <MenuItem disabled={true} text='Fetching...' />) ||
+            <MenuItem disabled={true} text='No Projects Available.' />
+          }
+          onRemove={(item) => {
+            onRemove((rT) => {
+              return {
+                ...rT,
+                [configuredConnection.id]: rT[configuredConnection.id].filter(
+                  (t) => t?.id !== item.id
+                ),
+              }
+            })
+          }}
+          onItemSelect={(item) => {
+            onItemSelect((rT) => {
+              return !rT[configuredConnection.id].includes(item)
+                ? {
+                    ...rT,
+                    [configuredConnection.id]: [
+                      ...rT[configuredConnection.id],
+                      item,
+                    ],
+                  }
+                : { ...rT }
+            })
+          }}
+          style={{ borderRight: 0 }}
+        />
+
+        <Checkbox
+          label='only search repos joined' checked={onlyQueryMemberRepo}

Review Comment:
   If refactored, this would change to `isPrivate`. Label alternatives might be `Only search my repositories` or `Only private repositories`



-- 
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 #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/components/blueprints/DataScopesGrid.jsx:
##########
@@ -169,8 +169,8 @@ const DataScopesGrid = (props) => {
                     padding: 0,
                   }}
                 >
-                  {c.boards.map((board, bIdx) => (
-                    <li key={`list-item-key-${bIdx}`}>{board}</li>
+                  {c.boardsList.map((board, bIdx) => (

Review Comment:
   > No, for Advanced mode it's just a array of board titles, it gets mapped and converted to Object boards for normal Mode. These props will get revised in another ticket for now, there are different board props for easier use, boardIds it's own prop array etc.
   
   Sometimes boards is string array, sometimes is object array????? No, I don't think it a good practice.



-- 
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] e2corporation commented on a diff in pull request #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/components/blueprints/GitlabProjectsSelector.jsx:
##########
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+import React, { useEffect, useState } from 'react'
+import { Checkbox, Intent, MenuItem, } from '@blueprintjs/core'
+import { MultiSelect } from '@blueprintjs/select'
+
+const GitlabProjectsSelector = (props) => {
+  const {
+    fetchGitlabProjects = () => [],

Review Comment:
   I don't the argument props definitions shouldn't be aliased, 
   
   ```
       fetchGitlabProjects: onFetch = () => [],
        isFetchingGitlab: isFetching = false,
   ```
   
   should just be:
   
   ```
       onFetch: () => [],
       isFetching: isFetching = false,
   ```
   
   
   the alias can be done when GitlabProjectsSelector is implemented (isFetching and fetchGitlabProjects are retrieved from the Gitlab Hook when hook is initialized, and aliased during de-structuring)
   
   ```
   <GitlabProjectsSelector isFetching={isFetchingGitlab) ...
   ```



-- 
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] e2corporation commented on a diff in pull request #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/components/blueprints/DataScopesGrid.jsx:
##########
@@ -169,8 +169,8 @@ const DataScopesGrid = (props) => {
                     padding: 0,
                   }}
                 >
-                  {c.boards.map((board, bIdx) => (
-                    <li key={`list-item-key-${bIdx}`}>{board}</li>
+                  {c.boardsList.map((board, bIdx) => (

Review Comment:
   @likyh I think the ability to display the Named board in Advanced mode is still possible, the JIRA resources would need to be fetched and then boards can be mapped like we do in normal mode. However, after your recent changes Board $title is being stored on the transformation record. So In advanced mode we could just reference the stored Board Title instead of having to fetch.



-- 
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 #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/components/blueprints/GitlabProjectsSelector.jsx:
##########
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+import React, { useEffect, useState } from 'react'
+import { Checkbox, Intent, MenuItem, } from '@blueprintjs/core'
+import { MultiSelect } from '@blueprintjs/select'
+
+const GitlabProjectsSelector = (props) => {
+  const {
+    fetchGitlabProjects = () => [],
+    isFetchingGitlab = false,
+    configuredConnection,
+    placeholder = 'Select Projects',
+    items = [],
+    selectedItems = [],
+    activeItem = null,
+    disabled = false,
+    isLoading = false,
+    isSaving = false,
+    onItemSelect = () => {},
+    onRemove = () => {},
+    onClear = () => {},
+    itemRenderer = (item, { handleClick, modifiers }) => (
+      <MenuItem
+        active={modifiers.active}
+        disabled={
+          selectedItems.find(i => i?.id === item?.id)
+        }
+        key={item.value}
+        onClick={handleClick}
+        text={
+          selectedItems.find(i => i?.id === item?.id)
+            ? (
+              <>
+                <input type='checkbox' checked readOnly /> {item?.title}
+              </>
+              )
+            : (
+              <span style={{ fontWeight: 700 }}>
+                <input type='checkbox' readOnly /> {item?.title}
+              </span>
+              )
+        }
+        style={{
+          marginBottom: '2px',
+          fontWeight: items.includes(item) ? 700 : 'normal',
+        }}
+      />
+    ),
+    tagRenderer = (item) => item?.title,
+  } = props
+
+  const [query, setQuery] = useState('')
+  const [onlyQueryMemberRepo, setOnlyQueryMemberRepo] = useState(true)
+
+  useEffect(() => {
+    if (query.length <= 2) {

Review Comment:
   fixed. Now judge on `useGitlab`. if length<=2, projects will be set to `[]`.



-- 
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 #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/components/blueprints/GitlabProjectsSelector.jsx:
##########
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+import React, { useEffect, useState } from 'react'
+import { Checkbox, Intent, MenuItem, } from '@blueprintjs/core'
+import { MultiSelect } from '@blueprintjs/select'
+
+const GitlabProjectsSelector = (props) => {
+  const {
+    fetchGitlabProjects = () => [],

Review Comment:
   ok



-- 
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] e2corporation commented on a diff in pull request #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/hooks/useDataScopesManager.jsx:
##########
@@ -154,8 +156,8 @@ function useDataScopesManager ({ provider, blueprint, /* connection, */ settings
           newScope = projects[connection.id]?.map((p) => ({
             ...newScope,
             options: {
-              owner: p.split('/')[0],
-              repo: p.split('/')[1],
+              owner: p.value.split('/')[0],

Review Comment:
   Use optional chaining check here for both owner and repo (`?`)
   ```suggestion
                 owner: p.value?.split('/')[0],
   ```



-- 
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] e2corporation commented on a diff in pull request #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/components/blueprints/GitlabProjectsSelector.jsx:
##########
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+import React, { useEffect, useState } from 'react'
+import { Checkbox, Intent, MenuItem, } from '@blueprintjs/core'
+import { MultiSelect } from '@blueprintjs/select'
+
+const GitlabProjectsSelector = (props) => {
+  const {
+    fetchGitlabProjects = () => [],
+    isFetchingGitlab = false,
+    configuredConnection,
+    placeholder = 'Select Projects',
+    items = [],
+    selectedItems = [],
+    activeItem = null,
+    disabled = false,
+    isLoading = false,
+    isSaving = false,
+    onItemSelect = () => {},
+    onRemove = () => {},
+    onClear = () => {},
+    itemRenderer = (item, { handleClick, modifiers }) => (
+      <MenuItem
+        active={modifiers.active}
+        disabled={
+          selectedItems.find(i => i?.id === item?.id)
+        }
+        key={item.value}
+        onClick={handleClick}
+        text={
+          selectedItems.find(i => i?.id === item?.id)
+            ? (
+              <>
+                <input type='checkbox' checked readOnly /> {item?.title}
+              </>
+              )
+            : (
+              <span style={{ fontWeight: 700 }}>
+                <input type='checkbox' readOnly /> {item?.title}
+              </span>
+              )
+        }
+        style={{
+          marginBottom: '2px',
+          fontWeight: items.includes(item) ? 700 : 'normal',
+        }}
+      />
+    ),
+    tagRenderer = (item) => item?.title,
+  } = props
+
+  const [query, setQuery] = useState('')
+  const [onlyQueryMemberRepo, setOnlyQueryMemberRepo] = useState(true)
+
+  useEffect(() => {
+    if (query.length <= 2) {
+      // only search when type more than 2 char or empty
+      return
+    }
+    // prevent request too frequently
+    const timer = setTimeout(() => {
+      fetchGitlabProjects(query, onlyQueryMemberRepo)
+    }, 200)
+    return () => clearTimeout(timer)
+  }, [fetchGitlabProjects, query])
+
+  useEffect(() => {
+    if (query.length <= 2) {
+      // only search when type more than 2 char or empty
+      return
+    }
+    fetchGitlabProjects(query, onlyQueryMemberRepo)
+  }, [fetchGitlabProjects, onlyQueryMemberRepo])
+
+  return (
+    <div
+      className='gitlab-projects-multiselect'
+      style={{ display: 'flex', marginBottom: '10px' }}
+    >
+      <div
+        className='gitlab-projects-multiselect-selector'
+        style={{ minWidth: '200px', width: '100%' }}
+      >
+        <MultiSelect
+          disabled={disabled || isSaving || isLoading}
+          // openOnKeyDown={true}
+          resetOnSelect={true}
+          placeholder={placeholder}
+          popoverProps={{ usePortal: false, minimal: true }}
+          className='multiselector-projects'
+          inline={true}
+          fill={true}
+          items={items}
+          selectedItems={selectedItems}
+          activeItem={activeItem}
+          onQueryChange={query => setQuery(query)}
+          itemRenderer={itemRenderer}
+          tagRenderer={tagRenderer}
+          tagInputProps={{
+            tagProps: {
+              intent: Intent.PRIMARY,
+              minimal: true
+            },
+          }}
+          noResults={
+            (query.length <= 2 && <MenuItem disabled={true} text='Please type more than 2 char to search.' />) ||

Review Comment:
   ```suggestion
               (query.length <= 2 && <MenuItem disabled={true} text='Please type more than 2 characters to search.' />) ||
   ```



-- 
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 #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/hooks/useDataScopesManager.jsx:
##########
@@ -137,7 +138,8 @@ function useDataScopesManager ({ provider, blueprint, /* connection, */ settings
           newScope = projects[connection.id]?.map((p) => ({
             ...newScope,
             options: {
-              projectId: Number(p),
+              projectId: Number(p.value),

Review Comment:
   Here p is from projects. projects maybe is an empty array. But it won't be a null array.
   
   If some else code push string to projects. we will find it.



-- 
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] e2corporation commented on a diff in pull request #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/components/blueprints/GitlabProjectsSelector.jsx:
##########
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+import React, { useEffect, useState } from 'react'
+import { Checkbox, Intent, MenuItem, } from '@blueprintjs/core'
+import { MultiSelect } from '@blueprintjs/select'
+
+const GitlabProjectsSelector = (props) => {
+  const {
+    fetchGitlabProjects = () => [],
+    isFetchingGitlab = false,
+    configuredConnection,
+    placeholder = 'Select Projects',
+    items = [],
+    selectedItems = [],
+    activeItem = null,
+    disabled = false,
+    isLoading = false,
+    isSaving = false,
+    onItemSelect = () => {},
+    onRemove = () => {},
+    onClear = () => {},
+    itemRenderer = (item, { handleClick, modifiers }) => (
+      <MenuItem
+        active={modifiers.active}
+        disabled={
+          selectedItems.find(i => i?.id === item?.id)
+        }
+        key={item.value}
+        onClick={handleClick}
+        text={
+          selectedItems.find(i => i?.id === item?.id)
+            ? (
+              <>
+                <input type='checkbox' checked readOnly /> {item?.title}
+              </>
+              )
+            : (
+              <span style={{ fontWeight: 700 }}>
+                <input type='checkbox' readOnly /> {item?.title}
+              </span>
+              )
+        }
+        style={{
+          marginBottom: '2px',
+          fontWeight: items.includes(item) ? 700 : 'normal',
+        }}
+      />
+    ),
+    tagRenderer = (item) => item?.title,
+  } = props
+
+  const [query, setQuery] = useState('')
+  const [onlyQueryMemberRepo, setOnlyQueryMemberRepo] = useState(true)
+
+  useEffect(() => {
+    if (query.length <= 2) {
+      // only search when type more than 2 char or empty
+      return
+    }
+    // prevent request too frequently
+    const timer = setTimeout(() => {
+      fetchGitlabProjects(query, onlyQueryMemberRepo)
+    }, 200)
+    return () => clearTimeout(timer)
+  }, [fetchGitlabProjects, query])
+
+  useEffect(() => {
+    if (query.length <= 2) {

Review Comment:
   See Comment on `Ln 71` about migrating this check to the `useGitlab` hook.



-- 
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 #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/components/blueprints/GitlabProjectsSelector.jsx:
##########
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+import React, { useEffect, useState } from 'react'
+import { Checkbox, Intent, MenuItem, } from '@blueprintjs/core'
+import { MultiSelect } from '@blueprintjs/select'
+
+const GitlabProjectsSelector = (props) => {

Review Comment:
   We can rename it when github added.



-- 
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 #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/components/blueprints/GitlabProjectsSelector.jsx:
##########
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+import React, { useEffect, useState } from 'react'
+import { Checkbox, Intent, MenuItem, } from '@blueprintjs/core'
+import { MultiSelect } from '@blueprintjs/select'
+
+const GitlabProjectsSelector = (props) => {
+  const {
+    fetchGitlabProjects = () => [],
+    isFetchingGitlab = false,
+    configuredConnection,
+    placeholder = 'Select Projects',
+    items = [],
+    selectedItems = [],
+    activeItem = null,
+    disabled = false,
+    isLoading = false,
+    isSaving = false,
+    onItemSelect = () => {},
+    onRemove = () => {},
+    onClear = () => {},
+    itemRenderer = (item, { handleClick, modifiers }) => (
+      <MenuItem
+        active={modifiers.active}
+        disabled={
+          selectedItems.find(i => i?.id === item?.id)
+        }
+        key={item.value}
+        onClick={handleClick}
+        text={
+          selectedItems.find(i => i?.id === item?.id)
+            ? (
+              <>
+                <input type='checkbox' checked readOnly /> {item?.title}
+              </>
+              )
+            : (
+              <span style={{ fontWeight: 700 }}>
+                <input type='checkbox' readOnly /> {item?.title}
+              </span>
+              )
+        }
+        style={{
+          marginBottom: '2px',
+          fontWeight: items.includes(item) ? 700 : 'normal',
+        }}
+      />
+    ),
+    tagRenderer = (item) => item?.title,
+  } = props
+
+  const [query, setQuery] = useState('')
+  const [onlyQueryMemberRepo, setOnlyQueryMemberRepo] = useState(true)
+
+  useEffect(() => {
+    if (query.length <= 2) {
+      // only search when type more than 2 char or empty
+      return
+    }
+    // prevent request too frequently
+    const timer = setTimeout(() => {
+      fetchGitlabProjects(query, onlyQueryMemberRepo)
+    }, 200)
+    return () => clearTimeout(timer)
+  }, [fetchGitlabProjects, query])
+
+  useEffect(() => {
+    if (query.length <= 2) {
+      // only search when type more than 2 char or empty
+      return
+    }
+    fetchGitlabProjects(query, onlyQueryMemberRepo)
+  }, [fetchGitlabProjects, onlyQueryMemberRepo])
+
+  return (
+    <div
+      className='gitlab-projects-multiselect'
+      style={{ display: 'flex', marginBottom: '10px' }}
+    >
+      <div
+        className='gitlab-projects-multiselect-selector'
+        style={{ minWidth: '200px', width: '100%' }}
+      >
+        <MultiSelect
+          disabled={disabled || isSaving || isLoading}
+          // openOnKeyDown={true}
+          resetOnSelect={true}
+          placeholder={placeholder}
+          popoverProps={{ usePortal: false, minimal: true }}
+          className='multiselector-projects'
+          inline={true}
+          fill={true}
+          items={items}
+          selectedItems={selectedItems}
+          activeItem={activeItem}
+          onQueryChange={query => setQuery(query)}
+          itemRenderer={itemRenderer}
+          tagRenderer={tagRenderer}
+          tagInputProps={{
+            tagProps: {
+              intent: Intent.PRIMARY,
+              minimal: true
+            },
+          }}
+          noResults={
+            (query.length <= 2 && <MenuItem disabled={true} text='Please type more than 2 char to search.' />) ||

Review Comment:
   ok



-- 
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] e2corporation commented on a diff in pull request #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/components/blueprints/GitlabProjectsSelector.jsx:
##########
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+import React, { useEffect, useState } from 'react'
+import { Checkbox, Intent, MenuItem, } from '@blueprintjs/core'
+import { MultiSelect } from '@blueprintjs/select'
+
+const GitlabProjectsSelector = (props) => {
+  const {
+    fetchGitlabProjects = () => [],
+    isFetchingGitlab = false,
+    configuredConnection,
+    placeholder = 'Select Projects',
+    items = [],
+    selectedItems = [],
+    activeItem = null,
+    disabled = false,
+    isLoading = false,
+    isSaving = false,
+    onItemSelect = () => {},
+    onRemove = () => {},
+    onClear = () => {},
+    itemRenderer = (item, { handleClick, modifiers }) => (
+      <MenuItem
+        active={modifiers.active}
+        disabled={
+          selectedItems.find(i => i?.id === item?.id)
+        }
+        key={item.value}
+        onClick={handleClick}
+        text={
+          selectedItems.find(i => i?.id === item?.id)
+            ? (
+              <>
+                <input type='checkbox' checked readOnly /> {item?.title}
+              </>
+              )
+            : (
+              <span style={{ fontWeight: 700 }}>
+                <input type='checkbox' readOnly /> {item?.title}
+              </span>
+              )
+        }
+        style={{
+          marginBottom: '2px',
+          fontWeight: items.includes(item) ? 700 : 'normal',
+        }}
+      />
+    ),
+    tagRenderer = (item) => item?.title,
+  } = props
+
+  const [query, setQuery] = useState('')
+  const [onlyQueryMemberRepo, setOnlyQueryMemberRepo] = useState(true)
+
+  useEffect(() => {
+    if (query.length <= 2) {

Review Comment:
   The min query check should be handled in the `useGitlab` Hook for better control, add it as an `if-else` condition to the existing chain and `Throw` a new error that query length is too short (like we do when connection id is null). Then it can be removed from being duplicated here.



-- 
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] e2corporation commented on a diff in pull request #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/components/blueprints/GitlabProjectsSelector.jsx:
##########
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+import React, { useEffect, useState } from 'react'
+import { Checkbox, Intent, MenuItem, } from '@blueprintjs/core'
+import { MultiSelect } from '@blueprintjs/select'
+
+const GitlabProjectsSelector = (props) => {
+  const {
+    fetchGitlabProjects = () => [],
+    isFetchingGitlab = false,

Review Comment:
   Refactor to `isFetching`, it can be aliased as isFetchingGitlab at a higher level when this component is used.
   
   ```suggestion
       isFetching = false,
   ```



-- 
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 #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/components/blueprints/GitlabProjectsSelector.jsx:
##########
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+import React, { useEffect, useState } from 'react'
+import { Checkbox, Intent, MenuItem, } from '@blueprintjs/core'
+import { MultiSelect } from '@blueprintjs/select'
+
+const GitlabProjectsSelector = (props) => {
+  const {
+    fetchGitlabProjects = () => [],
+    isFetchingGitlab = false,

Review Comment:
   ok



-- 
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] e2corporation commented on a diff in pull request #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/components/blueprints/DataScopesGrid.jsx:
##########
@@ -169,8 +169,8 @@ const DataScopesGrid = (props) => {
                     padding: 0,
                   }}
                 >
-                  {c.boards.map((board, bIdx) => (
-                    <li key={`list-item-key-${bIdx}`}>{board}</li>
+                  {c.boardsList.map((board, bIdx) => (

Review Comment:
   This was correctly set to `c.boards`. `c.boards`, represents the _stored/selected_ boards attached to the blueprint. `c.boardsList` represents all _available_ boards from the JIRA API.



-- 
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 #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/pages/blueprints/blueprint-settings.jsx:
##########
@@ -288,14 +290,27 @@ const BlueprintSettings = (props) => {
     error: jiraProxyError,
   } = useJIRA(
     {
-      apiProxyPath: API_PROXY_ENDPOINT,
+      apiProxyPath: JIRA_API_PROXY_ENDPOINT,
       issuesEndpoint: ISSUE_TYPES_ENDPOINT,
       fieldsEndpoint: ISSUE_FIELDS_ENDPOINT,
       boardsEndpoint: BOARDS_ENDPOINT,
     },
     configuredConnection
   )
 
+  const {
+    fetchProjects: fetchGitlabProjects,
+    projects: gitlabProjects,
+    isFetching: isFetchingGitlab,
+    error: gitlabProxyError,
+  } = useGitlab(
+    {
+      apiProxyPath: JIRA_API_PROXY_ENDPOINT,

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 #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/hooks/useDataScopesManager.jsx:
##########
@@ -137,7 +138,8 @@ function useDataScopesManager ({ provider, blueprint, /* connection, */ settings
           newScope = projects[connection.id]?.map((p) => ({
             ...newScope,
             options: {
-              projectId: Number(p),
+              projectId: Number(p.value),

Review Comment:
   Here p is from projects. projects maybe is an empty array. But it won't be a null array.



-- 
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] e2corporation commented on a diff in pull request #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/components/blueprints/GitlabProjectsSelector.jsx:
##########
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+import React, { useEffect, useState } from 'react'
+import { Checkbox, Intent, MenuItem, } from '@blueprintjs/core'
+import { MultiSelect } from '@blueprintjs/select'
+
+const GitlabProjectsSelector = (props) => {
+  const {
+    fetchGitlabProjects = () => [],

Review Comment:
   I don't the argument props definitions shouldn't be aliased, 
   
   ```
       fetchGitlabProjects: onFetch = () => [],
        isFetchingGitlab: isFetching = false,
   ```
   
   should just be:
   
   ```
       onFetch = () => [],
       isFetching: isFetching = false,
   ```
   
   
   the alias can be done when GitlabProjectsSelector is implemented (isFetching and fetchGitlabProjects are retrieved from the Gitlab Hook when hook is initialized, and aliased during de-structuring)
   
   ```
   <GitlabProjectsSelector isFetching={isFetchingGitlab) ...
   ```



-- 
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 #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/components/blueprints/GitlabProjectsSelector.jsx:
##########
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+import React, { useEffect, useState } from 'react'
+import { Checkbox, Intent, MenuItem, } from '@blueprintjs/core'
+import { MultiSelect } from '@blueprintjs/select'
+
+const GitlabProjectsSelector = (props) => {
+  const {
+    fetchGitlabProjects = () => [],
+    isFetchingGitlab = false,
+    configuredConnection,
+    placeholder = 'Select Projects',
+    items = [],
+    selectedItems = [],
+    activeItem = null,
+    disabled = false,
+    isLoading = false,
+    isSaving = false,
+    onItemSelect = () => {},
+    onRemove = () => {},
+    onClear = () => {},
+    itemRenderer = (item, { handleClick, modifiers }) => (
+      <MenuItem
+        active={modifiers.active}
+        disabled={
+          selectedItems.find(i => i?.id === item?.id)
+        }
+        key={item.value}
+        onClick={handleClick}
+        text={
+          selectedItems.find(i => i?.id === item?.id)
+            ? (
+              <>
+                <input type='checkbox' checked readOnly /> {item?.title}
+              </>
+              )
+            : (
+              <span style={{ fontWeight: 700 }}>
+                <input type='checkbox' readOnly /> {item?.title}
+              </span>
+              )
+        }
+        style={{
+          marginBottom: '2px',
+          fontWeight: items.includes(item) ? 700 : 'normal',
+        }}
+      />
+    ),
+    tagRenderer = (item) => item?.title,
+  } = props
+
+  const [query, setQuery] = useState('')
+  const [onlyQueryMemberRepo, setOnlyQueryMemberRepo] = useState(true)
+
+  useEffect(() => {
+    if (query.length <= 2) {
+      // only search when type more than 2 char or empty
+      return
+    }
+    // prevent request too frequently
+    const timer = setTimeout(() => {
+      fetchGitlabProjects(query, onlyQueryMemberRepo)
+    }, 200)
+    return () => clearTimeout(timer)
+  }, [fetchGitlabProjects, query])
+
+  useEffect(() => {
+    if (query.length <= 2) {

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 #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/hooks/useDataScopesManager.jsx:
##########
@@ -137,7 +138,8 @@ function useDataScopesManager ({ provider, blueprint, /* connection, */ settings
           newScope = projects[connection.id]?.map((p) => ({
             ...newScope,
             options: {
-              projectId: Number(p),
+              projectId: Number(p.value),

Review Comment:
   We shouldn't use `?.` too much if we could know p is not null. Because it will cover up some bugs such as p is not a object.



-- 
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 pull request #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

Posted by GitBox <gi...@apache.org>.
likyh commented on PR #2926:
URL: https://github.com/apache/incubator-devlake/pull/2926#issuecomment-1239482477

   @e2corporation Ok, I prepare to hide left chars in title add add a popover to show full text.


-- 
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] e2corporation commented on a diff in pull request #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/pages/blueprints/create-blueprint.jsx:
##########
@@ -241,14 +243,27 @@ const CreateBlueprint = (props) => {
     error: jiraProxyError,
   } = useJIRA(
     {
-      apiProxyPath: API_PROXY_ENDPOINT,
+      apiProxyPath: JIRA_API_PROXY_ENDPOINT,
       issuesEndpoint: ISSUE_TYPES_ENDPOINT,
       fieldsEndpoint: ISSUE_FIELDS_ENDPOINT,
       boardsEndpoint: BOARDS_ENDPOINT,
     },
     configuredConnection
   )
 
+  const {
+    fetchProjects: fetchGitlabProjects,
+    projects: gitlabProjects,
+    isFetching: isFetchingGitlab,
+    error: gitlabProxyError,
+  } = useGitlab(
+    {
+      apiProxyPath: JIRA_API_PROXY_ENDPOINT,

Review Comment:
   I think you intended to use Gitlab's API Proxy path instead?
   ```suggestion
         apiProxyPath: GITLAB_API_PROXY_ENDPOINT,
   ```



-- 
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] e2corporation commented on a diff in pull request #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/pages/blueprints/blueprint-settings.jsx:
##########
@@ -288,14 +290,27 @@ const BlueprintSettings = (props) => {
     error: jiraProxyError,
   } = useJIRA(
     {
-      apiProxyPath: API_PROXY_ENDPOINT,
+      apiProxyPath: JIRA_API_PROXY_ENDPOINT,
       issuesEndpoint: ISSUE_TYPES_ENDPOINT,
       fieldsEndpoint: ISSUE_FIELDS_ENDPOINT,
       boardsEndpoint: BOARDS_ENDPOINT,
     },
     configuredConnection
   )
 
+  const {
+    fetchProjects: fetchGitlabProjects,
+    projects: gitlabProjects,
+    isFetching: isFetchingGitlab,
+    error: gitlabProxyError,
+  } = useGitlab(
+    {
+      apiProxyPath: JIRA_API_PROXY_ENDPOINT,

Review Comment:
   ```suggestion
         apiProxyPath: GITLAB_API_PROXY_ENDPOINT,
   ```



-- 
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] e2corporation commented on pull request #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

Posted by GitBox <gi...@apache.org>.
e2corporation commented on PR #2926:
URL: https://github.com/apache/incubator-devlake/pull/2926#issuecomment-1238383092

   @likyh Thanks for getting this feature lifted, overall looking good, I may add some additional feedback after some functional/visual tests.


-- 
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] e2corporation commented on a diff in pull request #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/hooks/useDataScopesManager.jsx:
##########
@@ -137,7 +138,8 @@ function useDataScopesManager ({ provider, blueprint, /* connection, */ settings
           newScope = projects[connection.id]?.map((p) => ({
             ...newScope,
             options: {
-              projectId: Number(p),
+              projectId: Number(p.value),

Review Comment:
   It's not about covering up bugs, for vars that are dynamic when components are unmounted/mounted react will throw a warning unnecessarily. Optional chaining will allow code-flow to continue even though we don't expect or prefer p to be null. Any valid bug will present itself in the UI.



-- 
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] e2corporation commented on a diff in pull request #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/components/blueprints/DataScopesGrid.jsx:
##########
@@ -169,8 +169,8 @@ const DataScopesGrid = (props) => {
                     padding: 0,
                   }}
                 >
-                  {c.boards.map((board, bIdx) => (
-                    <li key={`list-item-key-${bIdx}`}>{board}</li>
+                  {c.boardsList.map((board, bIdx) => (

Review Comment:
   No, for Advanced mode it's just a array of board titles, it gets mapped and converted to Object boards for normal Mode. These props will get revised in another ticket for now, there are different board props for easier use, boardIds it's own prop array etc.



-- 
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 #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/components/blueprints/DataScopesGrid.jsx:
##########
@@ -169,8 +169,8 @@ const DataScopesGrid = (props) => {
                     padding: 0,
                   }}
                 >
-                  {c.boards.map((board, bIdx) => (
-                    <li key={`list-item-key-${bIdx}`}>{board}</li>
+                  {c.boardsList.map((board, bIdx) => (

Review Comment:
   Maybe we can delete `c.boards` because it is just a title array. But projects and `boards in create-blueprint are object arrays. Maybe we can rename it to boards and use it as object array.



-- 
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 #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/components/blueprints/DataScopesGrid.jsx:
##########
@@ -169,8 +169,8 @@ const DataScopesGrid = (props) => {
                     padding: 0,
                   }}
                 >
-                  {c.boards.map((board, bIdx) => (
-                    <li key={`list-item-key-${bIdx}`}>{board}</li>
+                  {c.boardsList.map((board, bIdx) => (

Review Comment:
   Now connection.boards haven't been used. So we delete boards here ?



-- 
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] e2corporation commented on pull request #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

Posted by GitBox <gi...@apache.org>.
e2corporation commented on PR #2926:
URL: https://github.com/apache/incubator-devlake/pull/2926#issuecomment-1239521447

   > @e2corporation Ok, I prepare to hide left chars in title add add a popover to show full text.
   
   It might be less work to just use the Project Name alone in the first and not full path as title. Alternaively, on the Transformation settings that we store for the blueprint, we can also consider storing `title` as just the project name and `path` as another key so its separate and contains full path. Or if we keep full path in title, we can explode/split it on forward slash and grab the last item in that resulting array and assume it will be project name alone.


-- 
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 pull request #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

Posted by GitBox <gi...@apache.org>.
likyh commented on PR #2926:
URL: https://github.com/apache/incubator-devlake/pull/2926#issuecomment-1239607306

   ![image](https://user-images.githubusercontent.com/3294100/188928644-07b83bea-4cfa-45cd-b696-a48791d36228.png)
   ![image](https://user-images.githubusercontent.com/3294100/188928669-fa31651e-5af6-487e-8f28-8431c3360487.png)
   ![image](https://user-images.githubusercontent.com/3294100/188928705-31dfc382-4e57-4f3c-90c6-45f6c2e27abd.png)
   ![image](https://user-images.githubusercontent.com/3294100/188928723-865998ce-c4e1-4346-905a-d2b63513f117.png)
   ![image](https://user-images.githubusercontent.com/3294100/188928787-ba0b693e-84e2-4cfd-84cf-73fc2087135f.png)
   ![image](https://user-images.githubusercontent.com/3294100/188928855-c33a6d77-7e59-4960-9989-4b771e7bf34b.png)
   That's fix.


-- 
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 #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/components/blueprints/GitlabProjectsSelector.jsx:
##########
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+import React, { useEffect, useState } from 'react'
+import { Checkbox, Intent, MenuItem, } from '@blueprintjs/core'
+import { MultiSelect } from '@blueprintjs/select'
+
+const GitlabProjectsSelector = (props) => {
+  const {
+    fetchGitlabProjects = () => [],
+    isFetchingGitlab = false,
+    configuredConnection,
+    placeholder = 'Select Projects',
+    items = [],
+    selectedItems = [],
+    activeItem = null,
+    disabled = false,
+    isLoading = false,
+    isSaving = false,
+    onItemSelect = () => {},
+    onRemove = () => {},
+    onClear = () => {},
+    itemRenderer = (item, { handleClick, modifiers }) => (
+      <MenuItem
+        active={modifiers.active}
+        disabled={
+          selectedItems.find(i => i?.id === item?.id)
+        }
+        key={item.value}
+        onClick={handleClick}
+        text={
+          selectedItems.find(i => i?.id === item?.id)
+            ? (
+              <>
+                <input type='checkbox' checked readOnly /> {item?.title}
+              </>
+              )
+            : (
+              <span style={{ fontWeight: 700 }}>
+                <input type='checkbox' readOnly /> {item?.title}
+              </span>
+              )
+        }
+        style={{
+          marginBottom: '2px',
+          fontWeight: items.includes(item) ? 700 : 'normal',
+        }}
+      />
+    ),
+    tagRenderer = (item) => item?.title,
+  } = props
+
+  const [query, setQuery] = useState('')
+  const [onlyQueryMemberRepo, setOnlyQueryMemberRepo] = useState(true)
+
+  useEffect(() => {
+    if (query.length <= 2) {

Review Comment:
   ok



-- 
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] e2corporation commented on a diff in pull request #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/hooks/useDataScopesManager.jsx:
##########
@@ -137,7 +138,8 @@ function useDataScopesManager ({ provider, blueprint, /* connection, */ settings
           newScope = projects[connection.id]?.map((p) => ({
             ...newScope,
             options: {
-              projectId: Number(p),
+              projectId: Number(p.value),

Review Comment:
   Leave chaining off for now and we'll see if React throws an error in dev or built mode.



-- 
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 #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/pages/blueprints/blueprint-settings.jsx:
##########
@@ -579,20 +590,45 @@ const BlueprintSettings = (props) => {
   useEffect(() => {
     console.log('>>> ACTIVE BLUEPRINT ....', activeBlueprint)
     const getGithubProjects = (c) => [Providers.GITHUB].includes(c.plugin)
-      ? c.scope.map((s) => `${s.options.owner}/${s.options?.repo}`)
+      ? c.scope.map((s) => ({
+        id: `${s.options.owner}/${s.options?.repo}`,
+        key: `${s.options.owner}/${s.options?.repo}`,
+        value: `${s.options.owner}/${s.options?.repo}`,
+        title: `${s.options.owner}/${s.options?.repo}`,
+      }))
       : []
     const getGitlabProjects = (c) => [Providers.GITLAB].includes(c.plugin)
-      ? c.scope.map((s) => s.options?.projectId)
+      ? c.scope.map((s) => ({
+        id: s.options?.projectId,
+        key: s.options?.projectId,
+        value: s.options?.projectId,
+        title: s.options?.title || `Project ${s.options?.projectId}`,
+      }))
       : []
     // @todo: handle multi-stage
     const getAdvancedGithubProjects = (t, providerId) => [Providers.GITHUB].includes(providerId)
-      ? [`${t.options?.owner}/${t.options?.repo}`]
+      ? [{
+          id: `${t.options.owner}/${t.options?.repo}`,

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 #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/components/blueprints/DataScopesGrid.jsx:
##########
@@ -169,8 +169,8 @@ const DataScopesGrid = (props) => {
                     padding: 0,
                   }}
                 >
-                  {c.boards.map((board, bIdx) => (
-                    <li key={`list-item-key-${bIdx}`}>{board}</li>
+                  {c.boardsList.map((board, bIdx) => (

Review Comment:
   reverted
   
   ![image](https://user-images.githubusercontent.com/3294100/188893237-e7168e27-aa12-4918-9fa9-6839ac3a499e.png)
   
   ![image](https://user-images.githubusercontent.com/3294100/188893091-15334c36-63ae-47b6-a72f-fce930670dc8.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] e2corporation commented on a diff in pull request #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/components/blueprints/GitlabProjectsSelector.jsx:
##########
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+import React, { useEffect, useState } from 'react'
+import { Checkbox, Intent, MenuItem, } from '@blueprintjs/core'
+import { MultiSelect } from '@blueprintjs/select'
+
+const GitlabProjectsSelector = (props) => {
+  const {
+    fetchGitlabProjects = () => [],
+    isFetchingGitlab = false,
+    configuredConnection,
+    placeholder = 'Select Projects',
+    items = [],
+    selectedItems = [],
+    activeItem = null,
+    disabled = false,
+    isLoading = false,
+    isSaving = false,
+    onItemSelect = () => {},
+    onRemove = () => {},
+    onClear = () => {},
+    itemRenderer = (item, { handleClick, modifiers }) => (
+      <MenuItem
+        active={modifiers.active}
+        disabled={
+          selectedItems.find(i => i?.id === item?.id)
+        }
+        key={item.value}
+        onClick={handleClick}
+        text={
+          selectedItems.find(i => i?.id === item?.id)
+            ? (
+              <>
+                <input type='checkbox' checked readOnly /> {item?.title}
+              </>
+              )
+            : (
+              <span style={{ fontWeight: 700 }}>
+                <input type='checkbox' readOnly /> {item?.title}
+              </span>
+              )
+        }
+        style={{
+          marginBottom: '2px',
+          fontWeight: items.includes(item) ? 700 : 'normal',
+        }}
+      />
+    ),
+    tagRenderer = (item) => item?.title,
+  } = props
+
+  const [query, setQuery] = useState('')
+  const [onlyQueryMemberRepo, setOnlyQueryMemberRepo] = useState(true)

Review Comment:
   This prop being named `isPrivate` would be more fitting.
   
   ```suggestion
     const [isPrivate, setIsPrivate] = useState(true)
   ```



-- 
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] e2corporation commented on a diff in pull request #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/components/blueprints/DataScopesGrid.jsx:
##########
@@ -169,8 +169,8 @@ const DataScopesGrid = (props) => {
                     padding: 0,
                   }}
                 >
-                  {c.boards.map((board, bIdx) => (
-                    <li key={`list-item-key-${bIdx}`}>{board}</li>
+                  {c.boardsList.map((board, bIdx) => (

Review Comment:
   Let's not go down this road where you overreact about mixed Types again, on my Refactor PR these are all wrapped with Data Models (DataScopeConnection). If the backend provided the same data structure and capabilities for normal and advanced blueprints to begin with there wouldn't be a need for this deviance of mixed types. Moreover, the backend wasn't storing any details regarding the JIRA Api.



-- 
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] e2corporation commented on a diff in pull request #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/hooks/useDataScopesManager.jsx:
##########
@@ -137,7 +138,8 @@ function useDataScopesManager ({ provider, blueprint, /* connection, */ settings
           newScope = projects[connection.id]?.map((p) => ({
             ...newScope,
             options: {
-              projectId: Number(p),
+              projectId: Number(p.value),

Review Comment:
   #2994 looks to be a new issue, I still need to local test this PR.



-- 
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] e2corporation commented on a diff in pull request #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/components/blueprints/DataScopesGrid.jsx:
##########
@@ -169,8 +169,8 @@ const DataScopesGrid = (props) => {
                     padding: 0,
                   }}
                 >
-                  {c.boards.map((board, bIdx) => (
-                    <li key={`list-item-key-${bIdx}`}>{board}</li>
+                  {c.boardsList.map((board, bIdx) => (

Review Comment:
   DataScopes grid should not be rendering `boardsList` here, it should be rendering `boards`.



-- 
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 #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/components/blueprints/DataScopesGrid.jsx:
##########
@@ -169,8 +169,8 @@ const DataScopesGrid = (props) => {
                     padding: 0,
                   }}
                 >
-                  {c.boards.map((board, bIdx) => (
-                    <li key={`list-item-key-${bIdx}`}>{board}</li>
+                  {c.boardsList.map((board, bIdx) => (

Review Comment:
   @e2corporation On main branch, it like this too. Jira only fetch when open Data Scope Modal. But advance mode doesn't have it. 



-- 
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 pull request #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

Posted by GitBox <gi...@apache.org>.
likyh commented on PR #2926:
URL: https://github.com/apache/incubator-devlake/pull/2926#issuecomment-1239573511

   ![image](https://user-images.githubusercontent.com/3294100/188920992-ca78689e-d265-41b7-87e3-b75512706a28.png)
   ![image](https://user-images.githubusercontent.com/3294100/188921279-629ad9a4-f7b1-4d17-8fde-825100684c20.png)
   ![image](https://user-images.githubusercontent.com/3294100/188921204-e9402b1d-a0cc-4a60-8161-641b8d32c841.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] e2corporation merged pull request #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


-- 
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] e2corporation commented on a diff in pull request #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/components/blueprints/GitlabProjectsSelector.jsx:
##########
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+import React, { useEffect, useState } from 'react'
+import { Checkbox, Intent, MenuItem, } from '@blueprintjs/core'
+import { MultiSelect } from '@blueprintjs/select'
+
+const GitlabProjectsSelector = (props) => {

Review Comment:
   I think what you've built can be re-used in the future for GitHub API Proxy as well, with the only difference being the API model data driving the "project" entity. I think we should call this `LiveProjectsSelector` or `ApiProjectsSelector` and not make it a Gitlab specific component.



-- 
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 #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/components/blueprints/GitlabProjectsSelector.jsx:
##########
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+import React, { useEffect, useState } from 'react'
+import { Checkbox, Intent, MenuItem, } from '@blueprintjs/core'
+import { MultiSelect } from '@blueprintjs/select'
+
+const GitlabProjectsSelector = (props) => {
+  const {
+    fetchGitlabProjects = () => [],
+    isFetchingGitlab = false,
+    configuredConnection,
+    placeholder = 'Select Projects',
+    items = [],
+    selectedItems = [],
+    activeItem = null,
+    disabled = false,
+    isLoading = false,
+    isSaving = false,
+    onItemSelect = () => {},
+    onRemove = () => {},
+    onClear = () => {},
+    itemRenderer = (item, { handleClick, modifiers }) => (
+      <MenuItem
+        active={modifiers.active}
+        disabled={
+          selectedItems.find(i => i?.id === item?.id)
+        }
+        key={item.value}
+        onClick={handleClick}
+        text={
+          selectedItems.find(i => i?.id === item?.id)
+            ? (
+              <>
+                <input type='checkbox' checked readOnly /> {item?.title}
+              </>
+              )
+            : (
+              <span style={{ fontWeight: 700 }}>
+                <input type='checkbox' readOnly /> {item?.title}
+              </span>
+              )
+        }
+        style={{
+          marginBottom: '2px',
+          fontWeight: items.includes(item) ? 700 : 'normal',
+        }}
+      />
+    ),
+    tagRenderer = (item) => item?.title,
+  } = props
+
+  const [query, setQuery] = useState('')
+  const [onlyQueryMemberRepo, setOnlyQueryMemberRepo] = useState(true)

Review Comment:
   No, if you join in a public repo. it also will be queried.



-- 
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] e2corporation commented on a diff in pull request #2926: feat: add projects selector fetching by api for gitlab when adding blueprint

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


##########
config-ui/src/components/blueprints/GitlabProjectsSelector.jsx:
##########
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+import React, { useEffect, useState } from 'react'
+import { Checkbox, Intent, MenuItem, } from '@blueprintjs/core'
+import { MultiSelect } from '@blueprintjs/select'
+
+const GitlabProjectsSelector = (props) => {
+  const {
+    fetchGitlabProjects = () => [],

Review Comment:
   I don't think the argument props definitions shouldn't be aliased, 
   
   ```
       fetchGitlabProjects: onFetch = () => [],
        isFetchingGitlab: isFetching = false,
   ```
   
   should just be:
   
   ```
       onFetch: () => [],
       isFetching: isFetching = false,
   ```
   
   
   the alias can be done when GitlabProjectsSelector is implemented (isFetching and fetchGitlabProjects are retrieved from the Gitlab Hook when hook is initialized, and aliased during de-structuring)
   
   ```
   <GitlabProjectsSelector isFetching={isFetchingGitlab) ...
   ```



-- 
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