Skip to content
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

Merged
merged 81 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
23015c1
[MI-1847] Created new branch for create-issue-modal
raghavaggarwal2308 Jun 16, 2022
10d90d9
[MI-1847] fixed error while running make check-style
raghavaggarwal2308 Jun 16, 2022
f6172d2
[MI-1847]Review fixes
raghavaggarwal2308 Jun 17, 2022
114774c
[MI-1847]Fixed initial srtate of milestone in create_issue.tsx
raghavaggarwal2308 Jun 17, 2022
a054a7d
[MI-1860]Added attach comment to gitlab issue button
raghavaggarwal2308 Jun 9, 2022
cc7f9cc
[MI-1860]Added "Attach to gilab issue" modal
raghavaggarwal2308 Jun 9, 2022
f7e864f
[MI-1860]Attach comment endpoint
raghavaggarwal2308 Jun 10, 2022
7f193d0
[MI-1860]Added post message
raghavaggarwal2308 Jun 11, 2022
af71d4e
[MI-1860]Handled error
raghavaggarwal2308 Jun 12, 2022
e3ca566
Code formatting
raghavaggarwal2308 Jun 12, 2022
bcaea3f
Merge branch 'MI-1847' of github.com:Brightscout/mattermost-plugin-gi…
raghavaggarwal2308 Jun 14, 2022
a753160
[MI-1860]Pull from MI-1847
raghavaggarwal2308 Jun 14, 2022
b5b12b1
removed //eslint-diable...
raghavaggarwal2308 Jun 14, 2022
6fd1907
[MI-1860]Review fixes
raghavaggarwal2308 Jun 15, 2022
a324c0a
Merge branch 'MI-1847' of github.com:Brightscout/mattermost-plugin-gi…
raghavaggarwal2308 Jun 16, 2022
b04d319
[MI-1860]Review Fixes
raghavaggarwal2308 Jun 17, 2022
08318e6
[MI-1860]Fixes
raghavaggarwal2308 Jun 17, 2022
1511295
[MI-1847] Review fixes
raghavaggarwal2308 Jun 20, 2022
395ead8
[MI-1847]Review Fixes
raghavaggarwal2308 Jun 20, 2022
78e2fe4
Merge pull request #9 from Brightscout/new-MI-1847
raghavaggarwal2308 Jun 20, 2022
be79e99
Merge branch 'create_issue_modal' of github.com:Brightscout/mattermos…
raghavaggarwal2308 Jun 21, 2022
f63ed27
Fixed CI error
raghavaggarwal2308 Jun 21, 2022
7280b93
Merge branch 'create_issue_modal' of github.com:Brightscout/mattermos…
raghavaggarwal2308 Jun 21, 2022
f444757
[MI-1847]Fixes
raghavaggarwal2308 Jun 21, 2022
612dae9
[MI-1847]Review FIxes
raghavaggarwal2308 Jun 23, 2022
53c2fc0
Merge branch 'MI-1847-component-fix' of github.com:Brightscout/matter…
raghavaggarwal2308 Jun 23, 2022
505ef61
[MI-1860]Review fixes
raghavaggarwal2308 Jun 24, 2022
e121b66
[MI-1847]Review fixes
raghavaggarwal2308 Jun 29, 2022
b514add
[MI-1847]Converted remaining class components to functional components
raghavaggarwal2308 Jun 29, 2022
71ba323
[MI-1860]Fixed variable names
raghavaggarwal2308 Jun 29, 2022
5891151
[MI-1847]Review fixes
raghavaggarwal2308 Jun 30, 2022
b311a0f
[MI-1847]Review fixes
raghavaggarwal2308 Jun 30, 2022
c441278
[MI-1847]Review fixes
raghavaggarwal2308 Jul 1, 2022
f98f996
Merge pull request #12 from Brightscout/MI-1847-component-fix
raghavaggarwal2308 Jul 1, 2022
b11a35e
Merge branch 'create_issue_modal' of github.com:Brightscout/mattermos…
raghavaggarwal2308 Jul 1, 2022
51ddddd
[MI-1860]Review fixes
raghavaggarwal2308 Jul 1, 2022
286de6f
[MI-1860]Review fixes
raghavaggarwal2308 Jul 5, 2022
d61b49b
[MI-1860]Review Fixes
raghavaggarwal2308 Jul 6, 2022
7e3bb1d
Merge pull request #10 from Brightscout/new-MI-1860
raghavaggarwal2308 Jul 6, 2022
1debe45
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gitl…
raghavaggarwal2308 Jul 13, 2022
77bd128
[MI-2221] Review fixes (#22)
raghavaggarwal2308 Oct 6, 2022
53f914c
[MI-2245] Fix failing "Code scanning / CodeQL" in gitlab create issue…
raghavaggarwal2308 Oct 12, 2022
79e82ae
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gitl…
raghavaggarwal2308 Nov 25, 2022
dd36a6f
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gitl…
raghavaggarwal2308 Dec 15, 2022
f88ea7a
Fix lint errors
raghavaggarwal2308 Dec 15, 2022
d869175
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gitl…
raghavaggarwal2308 Jan 13, 2023
e5b9082
[MI-2701]: Done the review fixes of a PR: Adding create issue modal #…
Nityanand13 Feb 3, 2023
aaf36e3
[MI-2947]: Did the review fixes of a gitlab PR #306 (#31)
Nityanand13 Mar 30, 2023
4da3919
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gitl…
raghavaggarwal2308 Mar 30, 2023
736c0ac
[MI-2967]: Did the review fixes of gitlab PR #306 (#33)
Nityanand13 Apr 4, 2023
bef1f23
[MI-2959] Review fixes on Gitlab PR #306(Add create issue modal)
raghavaggarwal2308 May 1, 2023
4cf4448
Merge pull request #36 from Brightscout/MI-2959
raghavaggarwal2308 May 1, 2023
17a962b
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gitl…
raghavaggarwal2308 May 10, 2023
c43dbe9
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gitl…
raghavaggarwal2308 Nov 28, 2023
cf26366
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gitl…
raghavaggarwal2308 Nov 29, 2023
a926c2c
[MI-3787] Fix reported issue:
raghavaggarwal2308 Nov 29, 2023
a264673
[MM-3] Removed "ussCallback" and "useMemo" hooks
raghavaggarwal2308 Dec 7, 2023
cf43d8e
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gitl…
raghavaggarwal2308 Dec 13, 2023
2666781
[MM-3] Removed useMemo/useCallabck and fixed lint error.
raghavaggarwal2308 Dec 14, 2023
ce8d613
[MM-3] Separated out form components for create issue modal
raghavaggarwal2308 Dec 14, 2023
0e35472
[MM-3] Seperate out form component for attach comment to issue modal
raghavaggarwal2308 Dec 14, 2023
c1bbf7e
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gitl…
raghavaggarwal2308 Dec 20, 2023
d5b52ff
Fix lint errors
raghavaggarwal2308 Dec 20, 2023
33dab04
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gitl…
raghavaggarwal2308 Jan 22, 2024
8e48d31
[MM-158] Review fixes
raghavaggarwal2308 Jan 22, 2024
96c60cd
[MM-158] Review fixes:
raghavaggarwal2308 Jan 22, 2024
2783352
[MM-158] Review fixes:
raghavaggarwal2308 Jan 22, 2024
3fd2c21
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gitl…
raghavaggarwal2308 Jan 31, 2024
1ae302f
[MM-146] Fixed lint errors
raghavaggarwal2308 Jan 31, 2024
ea29b31
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gitl…
raghavaggarwal2308 Feb 2, 2024
082a192
Merge branch 'master' into create_issue_modal
raghavaggarwal2308 Mar 18, 2024
e0e2765
[MM-289] Fix ci error
raghavaggarwal2308 Mar 18, 2024
fe33b33
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gitl…
raghavaggarwal2308 Apr 23, 2024
f01c791
Review fixes: Add new types, error state and some refactoring
ayusht2810 Jun 27, 2024
1f9fbc3
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gitl…
ayusht2810 Jun 27, 2024
c09c256
Fix package-lock.json file
ayusht2810 Jun 27, 2024
7216af6
[MM-527] Review fixes
raghavaggarwal2308 Jun 28, 2024
6758220
Create a new type
ayusht2810 Jul 1, 2024
625e227
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gitl…
raghavaggarwal2308 Jul 9, 2024
dbe16e3
Update package-lock.json file due to ci errors
ayusht2810 Jul 9, 2024
90a50a3
Fix type errors
ayusht2810 Jul 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion server/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ func (p *Plugin) getYourProjects(c *UserContext, w http.ResponseWriter, r *http.
})
if err != nil {
c.Log.WithError(err).Warnf("can't list projects in GitLab")
p.writeAPIError(w, &APIErrorResponse{ID: "", Message: "unable to list projects in GitLab.", StatusCode: http.StatusInternalServerError})
p.writeAPIError(w, &APIErrorResponse{ID: "", Message: "Unable to list projects in GitLab.", StatusCode: http.StatusInternalServerError})
return
}

Expand Down
6 changes: 3 additions & 3 deletions server/gitlab/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"strings"
"sync"

"github.com/mattermost/mattermost/server/public/model"
"github.com/mattermost/mattermost/server/public/pluginapi/experimental/bot/logger"

"github.com/pkg/errors"
Expand Down Expand Up @@ -660,13 +661,12 @@ func (g *gitlab) GetYourProjects(ctx context.Context, user *UserInfo, token *oau
if err != nil {
return nil, err
}
owned := true

var projects []*internGitlab.Project
if g.gitlabGroup == "" {
result, resp, err := client.Projects.ListProjects(
&internGitlab.ListProjectsOptions{
Owned: &owned,
Owned: model.NewBool(true),
},
internGitlab.WithContext(ctx),
)
Expand All @@ -682,7 +682,7 @@ func (g *gitlab) GetYourProjects(ctx context.Context, user *UserInfo, token *oau
result, resp, err := client.Groups.ListGroupProjects(
g.gitlabGroup,
&internGitlab.ListGroupProjectsOptions{
Owned: &owned,
Owned: model.NewBool(true),
},
internGitlab.WithContext(ctx),
)
Expand Down
54,042 changes: 31,840 additions & 22,202 deletions webapp/package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions webapp/src/components/form_button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@

import React from 'react';

type PropTypes = {
type Prop = {
raghavaggarwal2308 marked this conversation as resolved.
Show resolved Hide resolved
disabled?: boolean;
defaultMessage?: string,
defaultMessage?: string;
btnClass?: string;
saving?: boolean;
savingMessage?: string;
onClick?: () => void;
};

const FormButton = ({saving, disabled, savingMessage, defaultMessage, btnClass, onClick}: PropTypes) => {
const FormButton = ({saving, disabled, savingMessage, defaultMessage, btnClass, onClick}: Prop) => {
const contents = saving ? (
<span>
<span
Expand Down
4 changes: 2 additions & 2 deletions webapp/src/components/gitlab_assignee_selector/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ type PropTypes = {
};

const GitlabAssigneeSelector = ({projectID, projectName, theme, selectedAssignees, onChange}: PropTypes) => {
const returnType = ['id', 'username'];
const returnType: [string, string] = ['id', 'username'];
const errorMessage = 'failed to load assignees';

const loadAssignees = useOptions(projectName, getAssigneeOptions as FetchIssueAttributeOptionsForProject, returnType, errorMessage, projectID);
const loadAssignees = useOptions({projectName, getOptions: getAssigneeOptions as FetchIssueAttributeOptionsForProject<Assignee>, returnType, errorMessage, projectID});

return (
<div className='form-group margin-bottom x3'>
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/components/gitlab_issue_selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const GitlabIssueSelector = ({name, required, theme, onChange, error, value, add
return debouncedSearchIssues(inputValue);
};

const searchIssues = async (text: string) => {
const searchIssues = async (text: string): Promise<ReactSelectOption[]> => {
const textEncoded = encodeURIComponent(text.trim().replace(/\\/g, '\\\\').replace(/"/g, '\\"'));
try {
const issues = await Client.searchIssues(textEncoded);
Expand Down
4 changes: 2 additions & 2 deletions webapp/src/components/gitlab_label_selector/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ type PropTypes = {
};

const GitlabLabelSelector = ({projectID, projectName, theme, selectedLabels, onChange}: PropTypes) => {
const returnType = ['name', 'name'];
const returnType: [string, string] = ['name', 'name'];
const errorMessage = 'failed to load labels';

const loadLabels = useOptions(projectName, getLabelOptions as FetchIssueAttributeOptionsForProject, returnType, errorMessage, projectID);
const loadLabels = useOptions({projectName, getOptions: getLabelOptions as FetchIssueAttributeOptionsForProject<Label>, returnType, errorMessage, projectID});

return (
<div className='form-group margin-bottom x3'>
Expand Down
4 changes: 2 additions & 2 deletions webapp/src/components/gitlab_milestone_selector/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ type PropTypes = {
};

const GitlabMilestoneSelector = ({projectID, projectName, theme, selectedMilestone, onChange}: PropTypes) => {
const returnType = ['id', 'title'];
const returnType: [string, string] = ['id', 'title'];
const errorMessage = 'failed to load milestones';

const loadMilestones = useOptions(projectName, getMilestoneOptions as FetchIssueAttributeOptionsForProject, returnType, errorMessage, projectID);
const loadMilestones = useOptions({projectName, getOptions: getMilestoneOptions as FetchIssueAttributeOptionsForProject<Milestone>, returnType, errorMessage, projectID});

return (
<div className='form-group margin-bottom x3'>
Expand Down
37 changes: 29 additions & 8 deletions webapp/src/components/gitlab_project_selector/index.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.

import React, {useEffect, useState} from 'react';
import React, {useEffect, useMemo, useState} from 'react';
import {useDispatch, useSelector} from 'react-redux';
import {Theme} from 'mattermost-redux/types/preferences';

import {getProjects} from 'src/actions';
import manifest from 'src/manifest';
import ReactSelectSetting from 'src/components/react_select_setting';
import {GlobalState} from 'src/types/global_state';
import {getPluginState} from 'src/selectors';
import {getErrorMessage} from 'src/utils/user_utils';

type PropTypes = {
theme: Theme;
Expand All @@ -21,10 +22,9 @@ type PropTypes = {

const GitlabProjectSelector = ({theme, required, onChange, value, addValidate, removeValidate}: PropTypes) => {
const [isLoading, setIsLoading] = useState(false);
const [error, setError] = useState<string>('');

const {yourProjects} = useSelector((state: GlobalState) => ({
yourProjects: state[`plugins-${manifest.id}` as pluginReduxStoreKey].yourProjects,
}));
const myProjects = useSelector((state: GlobalState) => getPluginState(state).yourProjects);

const dispatch = useDispatch();

Expand All @@ -34,16 +34,25 @@ const GitlabProjectSelector = ({theme, required, onChange, value, addValidate, r

const loadProjects = async () => {
setIsLoading(true);
await dispatch(getProjects());
const res: any = await dispatch(getProjects());
raghavaggarwal2308 marked this conversation as resolved.
Show resolved Hide resolved
if (res.error) {
const errMessage = getErrorMessage((res as { error: ErrorType }).error.message);
setError(errMessage);
} else {
setError('');
}

setIsLoading(false);
};

const handleOnChange = (_: string, name: string) => {
const project = yourProjects.find((p: Project) => p.path_with_namespace === name);
const project = myProjects.find((p: Project) => p.path_with_namespace === name);
onChange(project ? {name, project_id: project?.id} : null);
};

const projectOptions = yourProjects.map((item: Project) => ({value: item.path_with_namespace, label: item.path_with_namespace}));
const projectOptions = useMemo(() => {
return myProjects.map((item: Project) => ({value: item.path_with_namespace, label: item.path_with_namespace}));
}, [myProjects]);

return (
<div className={'form-group margin-bottom x3'}>
Expand All @@ -64,6 +73,18 @@ const GitlabProjectSelector = ({theme, required, onChange, value, addValidate, r
<div className={'help-text'}>
{'Returns GitLab projects connected to the user account'}
</div>
{error && (
<p
className='alert alert-danger'
style={{marginTop: '10px'}}
>
<i
className='fa fa-warning'
title='Warning Icon'
/>
<span> {error}</span>
</p>
)}
</div>
);
};
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/components/issue_attribute_selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const IssueAttributeSelector = ({isMulti, projectName, theme, label, onChange, l
if (projectName) {
loadSelectOptions();
}
}, []);
}, [projectName]);

const prevProjectName = usePrevious(projectName);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import manifest from 'src/manifest';
import GitLabIcon from 'src/images/icons/gitlab';
import {openAttachCommentToIssueModal} from 'src/actions';
import {GlobalState} from 'src/types/global_state';
import {isUserConnectedToGitlab} from 'src/selectors';

interface PropTypes {
postId: string;
Expand All @@ -19,10 +20,10 @@ interface PropTypes {
const AttachCommentToIssuePostMenuAction = ({postId}: PropTypes) => {
const {show} = useSelector((state: GlobalState) => {
const post = getPost(state, postId);
const systemMessage = Boolean(!post || isSystemMessage(post));
const isPostSystemMessage = Boolean(!post || isSystemMessage(post));

return {
show: state[`plugins-${manifest.id}` as pluginReduxStoreKey].connected && !systemMessage,
show: isUserConnectedToGitlab(state) && !isPostSystemMessage,
};
});

Expand Down
5 changes: 3 additions & 2 deletions webapp/src/components/post_options/create_issue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import GitLabIcon from 'src/images/icons/gitlab';
import manifest from 'src/manifest';
import {openCreateIssueModal} from 'src/actions';
import {GlobalState} from 'src/types/global_state';
import {isUserConnectedToGitlab} from 'src/selectors';

type PropTypes = {
postId: string;
Expand All @@ -18,10 +19,10 @@ type PropTypes = {
const CreateIssuePostMenuAction = ({postId}: PropTypes) => {
const {show} = useSelector((state: GlobalState) => {
const post = getPost(state, postId);
const systemMessage = Boolean(!post || isSystemMessage(post));
const isPostSystemMessage = Boolean(!post || isSystemMessage(post));

return {
show: state[`plugins-${manifest.id}` as pluginReduxStoreKey].connected && !systemMessage,
show: isUserConnectedToGitlab(state) && !isPostSystemMessage,
};
});

Expand Down
9 changes: 5 additions & 4 deletions webapp/src/components/sidebar_buttons/sidebar_buttons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {RHSStates, connectUsingBrowserMessage} from '../../constants';
import {isDesktopApp} from '../../utils/user_agent';

import {GitLabIssuesIcon, GitLabMergeRequestIcon, GitLabReviewsIcon, GitLabTodosIcon} from '../../utils/icons';
import {Item} from 'src/types/gitlab_items';

interface SidebarButtonsProps {
theme: Theme;
Expand All @@ -19,10 +20,10 @@ interface SidebarButtonsProps {
org: string;
clientId: string;
gitlabURL: string;
reviews?: unknown[];
todos?: unknown[];
yourAssignedPrs?: unknown[];
yourAssignedIssues?: unknown[];
reviews?: Item[];
todos?: Item[];
yourAssignedPrs?: Item[];
yourAssignedIssues?: Item[];
isTeamSidebar: boolean;
pluginServerRoute: string;
showRHSPlugin: () => void;
Expand Down
15 changes: 11 additions & 4 deletions webapp/src/hooks/use_options.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import {useCallback} from 'react';
import {useDispatch} from 'react-redux';

export const useOptions = (projectName: string, getOptions: FetchIssueAttributeOptionsForProject, returnFields: string[], errorMessage: string, projectID?: number) => {
type useOptionsProps = {
projectName: string;
getOptions: FetchIssueAttributeOptionsForProject<AttributeType>;
returnType: [string, string];
errorMessage: string;
projectID?: number;
}

export const useOptions = ({projectName, getOptions, returnType, errorMessage, projectID}: useOptionsProps) => {
const dispatch = useDispatch();

const loadOptions = async () => {
Expand All @@ -19,8 +26,8 @@ export const useOptions = (projectName: string, getOptions: FetchIssueAttributeO
}

return options.data.map((option: any) => ({
value: option[returnFields[0]],
label: option[returnFields[1]],
value: option[returnType[0]],
label: option[returnType[1]],
}));
};
return loadOptions;
Expand Down
5 changes: 2 additions & 3 deletions webapp/src/hooks/use_previous.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import {useEffect, useRef} from 'react';
import {Post} from 'mattermost-redux/types/posts';

// Extension of https://stackoverflow.com/a/53446665
export const usePrevious = (value: string | Post | null | undefined) => {
const ref: React.MutableRefObject<string | Post | null | undefined> = useRef();

// Store current value in ref
useEffect(() => {
ref.current = value;
}, [value]); // Only re-run if value changes
// Return previous value (happens before update in useEffect above)
}, [value]);
return ref.current;
};
2 changes: 2 additions & 0 deletions webapp/src/selectors/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ function mapPrsToDetails(prs, details) {

export const getPluginState = (state) => state[`plugins-${manifest.id}`];

export const isUserConnectedToGitlab = (state) => state[`plugins-${manifest.id}`].connected;

export const getSidebarData = createSelector(
getPluginState,
(pluginState) => {
Expand Down
13 changes: 10 additions & 3 deletions webapp/src/types/common.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
type OnChangeType = SelectionType | SelectionType[] | null;

type SelectionType = {
value: number | string;
value: number | string | Issue;
label: string;
}

Expand All @@ -11,7 +11,14 @@ type ErrorType = {

type pluginReduxStoreKey = 'plugins-com.github.manland.mattermost-plugin-gitlab'

type FetchIssueAttributeOptionsForProject = (projectID?: number) => (dispatch: Dispatch<GenericAction>) => Promise<{
type AttributeType = Assignee | Milestone | Label;

type FetchIssueAttributeOptionsForProject<T> = (projectID?: number) => (dispatch: Dispatch<GenericAction>) => Promise<{
error?: ErrorType;
data?: Assignee[] | Milestone[] | Label[];
data?: T[];
}>

type ReactSelectOption = {
value: Issue;
label: string;
}
6 changes: 3 additions & 3 deletions webapp/src/types/gitlab_types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ interface IssueBody {
title: string;
description: string;
project_id?: number;
labels?: (string | number)[];
assignees?: (string | number)[];
milestone?: (string | number);
labels?: (string | number | Issue)[];
assignees?: (string | number | Issue)[];
milestone?: (string | number | Issue);
raghavaggarwal2308 marked this conversation as resolved.
Show resolved Hide resolved
post_id: string;
channel_id: string;
}
Expand Down
2 changes: 2 additions & 0 deletions webapp/src/types/mattermost-webapp/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ export interface PluginRegistry {
registerPopoverUserAttributesComponent(component: React.ReactNode)
registerLinkTooltipComponent(component: React.ReactNode)
registerReconnectHandler(handler: any)
registerPostDropdownMenuComponent(component: React.ReactNode)
registerRootComponent(component: ReactDOM)
raghavaggarwal2308 marked this conversation as resolved.
Show resolved Hide resolved

// Add more if needed from https://developers.mattermost.com/extend/plugins/webapp/reference
}
Loading