diff --git a/webapp/src/components/data_selectors/jira_user_selector/jira_user_selector.tsx b/webapp/src/components/data_selectors/jira_user_selector/jira_user_selector.tsx index db0dbd357..78cff4dd6 100644 --- a/webapp/src/components/data_selectors/jira_user_selector/jira_user_selector.tsx +++ b/webapp/src/components/data_selectors/jira_user_selector/jira_user_selector.tsx @@ -9,7 +9,7 @@ import BackendSelector, {Props as BackendSelectorProps} from '../backend_selecto type Props = BackendSelectorProps & { projectKey: string; - searchUsers: (params: {project: string; q: string}) => Promise<{data: JiraUser[]; error?: Error}>; + searchUsers: (params: {project: string; q: string}) => Promise<{data: {label: string; value: JiraUser[]}; error?: Error}>; }; export default class JiraUserSelector extends React.PureComponent { diff --git a/webapp/src/components/modals/create_issue/create_issue_form.tsx b/webapp/src/components/modals/create_issue/create_issue_form.tsx index f855b4877..ac097b86d 100644 --- a/webapp/src/components/modals/create_issue/create_issue_form.tsx +++ b/webapp/src/components/modals/create_issue/create_issue_form.tsx @@ -127,16 +127,14 @@ export default class CreateIssueForm extends React.PureComponent { if (error) { state.error = error.message; - } else { - const fields = this.filterInvalidFields(this.state.projectKey, this.state.issueType, this.state.fields); - state.fields = fields; } this.setState(state); }); - let fields = { - ...this.state.fields, + const fields = { + summary: this.state.fields.summary, + description: this.state.fields.description, project: {key: projectKey}, } as CreateIssueFields; @@ -146,7 +144,6 @@ export default class CreateIssueForm extends React.PureComponent { id: issueType, }; - fields = this.filterInvalidFields(projectKey, issueType, fields); this.setState({ projectKey, issueType, @@ -159,12 +156,13 @@ export default class CreateIssueForm extends React.PureComponent { } handleIssueTypeChange = (_: string, issueType: string) => { - let fields = { - ...this.state.fields, + const fields = { + summary: this.state.fields.summary, + description: this.state.fields.description, + project: {key: this.state.projectKey}, issuetype: {id: issueType}, } as CreateIssueFields; - fields = this.filterInvalidFields(this.state.projectKey, issueType, fields); this.setState({ issueType, fields, @@ -210,27 +208,6 @@ export default class CreateIssueForm extends React.PureComponent { return fieldsNotCovered; } - filterInvalidFields = (projectKey: string | null, issueType: string | null, fields: CreateIssueFields) => { - if (!projectKey || !issueType || !this.state.jiraIssueMetadata) { - return fields; - } - - const available = getFields(this.state.jiraIssueMetadata, projectKey, issueType); - - if (Object.keys(available).length === 0) { - return fields; - } - - const result = {} as CreateIssueFields; - for (const key of Object.keys(fields)) { - if (available[key] || key === 'project' || key === 'issuetype') { - result[key] = fields[key]; - } - } - - return result; - } - handleSubmit = (e?: React.FormEvent) => { if (e && e.preventDefault) { e.preventDefault(); diff --git a/webapp/src/types/model.ts b/webapp/src/types/model.ts index fca984f1a..9f8b4bb8d 100644 --- a/webapp/src/types/model.ts +++ b/webapp/src/types/model.ts @@ -212,6 +212,7 @@ export type AllProjectMetadata = { export type CreateIssueFields = { description: string; + summary?: string; project: {key: string}; issuetype: {id: string}; } & {[key: string]: JiraField};