-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GH-61]: Adding "Create Issue" and "Attach Comment to Issue" modals #306
[GH-61]: Adding "Create Issue" and "Attach Comment to Issue" modals #306
Conversation
1. Converted files to .tsx 2. Defined proper types
1. Button in context menu to open "Attach to gitlab issue" modal. 2. Created modal to attach comment to issue.
1. Created api endpoint to attach comment to an issue.
1. Added message when comment is created.
1. Handled error while making call for searching issues.
1. Converted file to .tsx. 2. Removed redundant code.
…tlab into MI-1860
1. Fixed error messages.
1. Made first letter of error lowercase 2. Used shorthand 3. fixed lint errors
…tlab into MI-1860 Review fixes: 1. Defined types and converted files to .tsx
1. Defined proper types 2. Changed file extension of types file to .d.ts
1. Corrected error messages in api.go. 2. Added EOF.
1. Moved type "Actions" from index.ts to main file. 2. Converted form_button to fuctional component. 3. Converted gitlab.jsx to .tsx.
1. Converted gitlab.tsx to funtional component. 2. Optional chaining while checking for error in loadoptions function.
Review Fixes and created new branch.
Hello @raghavaggarwal2308, Thanks for your pull request! A Core Committer will review your pull request soon. For code contributions, you can learn more about the review process here. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #306 +/- ##
==========================================
- Coverage 34.02% 32.02% -2.00%
==========================================
Files 22 22
Lines 4021 4293 +272
==========================================
+ Hits 1368 1375 +7
- Misses 2515 2780 +265
Partials 138 138 ☔ View full report in Codecov by Sentry. |
…t-plugin-gitlab into create_issue_modal
1. Added "react-dom" dependency in package.json
…t-plugin-gitlab into new-MI-1860
1. Converted class components to functional components. 2. Used absolute paths.
1. Removed mapStateToProps/mapDispatchToProps from functional components and used useSelector/useDispatch.
…most-plugin-gitlab into new-MI-1860
…ab into create_issue_modal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work @raghavaggarwal2308 👍 This feature has a high impact for the plugin
I gave the PR another review and left some comments. Generally approving but want to give you a chance to discuss before approving. Let me know what you think
Also, can you please create some gifs of this feature working so it's easy for UX designers to see it in action?
For the project selector in the attach comment modal #306 (comment)
Just a suggestion for point 4, we can also use the config setting "Gitlab Group". When the setting is empty we can show all issues and when it is specified we can display the issues related to that group only.
Are we able to filter on projects where the user is a member or collaborator, if the gitlab group is not set?
type PropTypes = { | ||
disabled?: boolean; | ||
defaultMessage?: string, | ||
btnClass?: string; | ||
saving?: boolean; | ||
savingMessage?: string; | ||
onClick?: () => void; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should some of these be set to required? I know this is likely copied from another project
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is used at multiple places, and each uses different props. So none of them are required.
if (!projectName) { | ||
return []; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So if a project has not been selected yet, we unconditionally return an empty array (of assignees for instance). Should we disable the select component in this case if it's always going to be empty?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The assignees and other options are hidden for a user until the user selects the project. Same can be seen in the video. #306 (comment)
}; | ||
|
||
const IssueAttributeSelector = ({isMulti, projectName, theme, label, onChange, loadOptions, selection}: PropTypes) => { | ||
const [options, setOptions] = useState<SelectionType[]>([]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't tell what SelectionType
is or where it's defined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is defined in the types folder under common types https://github.com/Brightscout/mattermost-plugin-gitlab/blob/1f9fbc3912fb9b8f5f7f679dff259cb44a63efa1/webapp/src/types/common.d.ts#L3
useEffect(() => { | ||
if (projectName && prevProjectName !== projectName) { | ||
loadSelectOptions(); | ||
} | ||
}, [projectName]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add prevProjectName
to the array?
useEffect(() => { | |
if (projectName && prevProjectName !== projectName) { | |
loadSelectOptions(); | |
} | |
}, [projectName]); | |
useEffect(() => { | |
if (projectName && prevProjectName !== projectName) { | |
loadSelectOptions(); | |
} | |
}, [projectName, prevProjectName]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should really be using the react hooks eslint rule to find these sorts of cases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need prevProjectName
in the array, as its value will change when we update the projectName
@raghavaggarwal2308 Are you or another developer planning on continuing work on this? |
@mickmister Yeah, we will work on this ASAP. Apologies for the delay. |
Video for the feature: |
@mickmister Fixed the review fixes. Please re-review.
Also can you provide more details on this comment? |
@ayusht2810 If the gitlab group is not set in the system console: Can we make it so the user only sees projects where the user a member or collaborator? Meaning, the user shouldn't see projects that they have no association with in the project selectors |
@mickmister Fixed the review comments added by you |
webapp/src/components/modals/create_issue/create_issue_form.tsx
Outdated
Show resolved
Hide resolved
@mickmister Fixed the review fixes. Please re-review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@raghavaggarwal2308 Found a issue while testing this PR.
Issue: Private projects are accessible without any granted permissions (Access to the private repository is kept off from sysytem console).
Steps to reproduce:
- Enter a message in channel
- Go to the message action
- Select the option 'Create GitLab Issue'
- Check the project suggestions in the Project dropdown
Expected: Private projects should not be accessibile without the permission
Actual: Private projects are accessibile without the granted permission
@AayushChaudhary0001 Regarding the expected behavior, the system console settings for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving this PR, as everything is working fine for this, will create a separate issue regarding the flow above.
Summary
Added a modal to create a GitLab issue on an existing project of the user.
Screenshots
Click "Create Gitlab Issue" or "Attach to Gitlab issue" in the context menu (shown when a user connects their GitLab account with the plugin installed) on non-system messages
Create Gilab issue modal will open
Search and select a Project and title of the issue
Select labels, assignees, milestone, and description if any, and click submit to create an issue
Attach comment to issue modal
Ticket
Fixes #61 (Adding create issue modal and Attach comment to issue modal)
Fixes #402