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

Support start and due date in epic detail view #82

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
b712729
Refactor user types
maximilianruesch Nov 27, 2023
f9db363
Add create issue for server
maximilianruesch Nov 27, 2023
106a19a
Fix create issue for cloud
maximilianruesch Nov 27, 2023
f940580
Add jira server info to provider class
maximilianruesch Nov 27, 2023
52aebb7
Add implementation for executing api calls in a versioned manner
maximilianruesch Nov 27, 2023
5494f24
Add test implementation for getIssueTypesWithFieldsMap
maximilianruesch Nov 27, 2023
60f7867
Fix issues with changed types
maximilianruesch Nov 27, 2023
db70900
Merge branch 'task/fix-create-issue-for-server' into refactor/impleme…
maximilianruesch Nov 27, 2023
874a2aa
Add error when jira server version is unsupported
maximilianruesch Nov 27, 2023
51dc1b3
Fix server provider for creating epics
maximilianruesch Nov 27, 2023
5e9c1a4
started implementation of Epic View
trueliquid Nov 28, 2023
4669222
implements Button to access Epic List View
trueliquid Nov 28, 2023
ff4f822
Removed Search Bar for now
trueliquid Nov 30, 2023
37ad385
Added Button to open Epic View
trueliquid Nov 30, 2023
39fafcf
Added Epic Card
trueliquid Nov 30, 2023
cd239e3
Added Create Epic Button to Epic View
trueliquid Nov 30, 2023
87d6df4
Add first epic detail view version
maximilianruesch Dec 1, 2023
e13b3e4
Modify type of comment
maximilianruesch Dec 1, 2023
a9c9808
Created first Version of Epic Detail View with a hardcoded Epic
JulianRupprecht Dec 4, 2023
571c669
Epic List View shows epics missing type and status
trueliquid Dec 4, 2023
9f53b21
Removed Issue Type and status label since it is not in the mockup
trueliquid Dec 4, 2023
12c01b8
accidentally removed summary text on epic card
trueliquid Dec 4, 2023
16c8b92
Adapted Progressbar to mockup
JulianRupprecht Dec 5, 2023
6046dd7
Adapted Detail View to mockup
JulianRupprecht Dec 5, 2023
d1f7efc
Merge branch 'task/fix-create-issue-for-server' into refactor/impleme…
maximilianruesch Dec 5, 2023
5c385da
Merge branch 'main' into refactor/implement-different-implementations…
maximilianruesch Dec 5, 2023
56a348f
Merge branch 'refactor/implement-different-implementations-for-server…
maximilianruesch Dec 5, 2023
b22a345
Merge branch 'story/Fast-Epic-List-View' into story/add-epic-detail-view
JulianRupprecht Dec 6, 2023
0a7c358
Fixed EpicDetailView bugs
JulianRupprecht Dec 6, 2023
ff44905
Merge branch 'story/Fast-Epic-List-View' into story/add-epic-detail-view
JulianRupprecht Dec 6, 2023
c6be370
Revert accidental changes
JulianRupprecht Dec 6, 2023
6663b0f
Revert accidental changes
maximilianruesch Dec 6, 2023
76101a2
Formatting and remove redundant code
trueliquid Dec 6, 2023
d41db66
Remove code used for epic search
trueliquid Dec 6, 2023
cb455ce
Merge remote-tracking branch 'origin/story/Fast-Epic-List-View' into …
trueliquid Dec 6, 2023
0f1a562
Merge branch 'refactor/implement-different-implementations-for-server…
maximilianruesch Dec 6, 2023
bb62626
Merge branch 'main' into story/Fast-Epic-List-View
maximilianruesch Dec 6, 2023
bb0296f
Fix linting issues
maximilianruesch Dec 6, 2023
5013be1
Fix linting issues again
maximilianruesch Dec 6, 2023
355548a
Merge branch 'story/Fast-Epic-List-View' into story/add-epic-detail-view
maximilianruesch Dec 6, 2023
3bcf2de
Merge branch 'main' into story/add-epic-detail-view
maximilianruesch Dec 6, 2023
1aed7e5
Fix formatting and linting
maximilianruesch Dec 6, 2023
f5f6c45
Remove unused code
maximilianruesch Dec 6, 2023
ef4db64
Enable editing epic summary
maximilianruesch Dec 6, 2023
de5a049
Remove progress bar
maximilianruesch Dec 6, 2023
029d042
Fix assignee select
maximilianruesch Dec 6, 2023
6f5e301
Fix label select
maximilianruesch Dec 6, 2023
8f52fb4
Fix reporter select
maximilianruesch Dec 6, 2023
d438ee1
Remove comment and attachments
maximilianruesch Dec 6, 2023
86cffcf
Readd date parts
maximilianruesch Dec 6, 2023
3703890
Add first version for date pickers
maximilianruesch Dec 6, 2023
4ace2c5
Merge branch 'main' into story/support-start-and-due-date-in-epic-det…
maximilianruesch Dec 6, 2023
a76a586
Fix dates in cloud and server provider
maximilianruesch Dec 7, 2023
98cd167
Add inline date picker to detail view
maximilianruesch Dec 7, 2023
af95b79
Assert that due date is definitely after start date and vice versa
maximilianruesch Dec 7, 2023
652e225
Hopefully fix type checks
maximilianruesch Dec 7, 2023
4a93c0b
Revert unwanted changes
maximilianruesch Dec 7, 2023
bf55a47
Support clearing start and due date for jira server
maximilianruesch Dec 7, 2023
25c39ae
Merge branch 'main' into story/support-start-and-due-date-in-epic-det…
maximilianruesch Dec 7, 2023
625e800
Remove unused component
maximilianruesch Dec 7, 2023
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
47 changes: 27 additions & 20 deletions electron/providers/jira-cloud-provider/JiraCloudProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -793,10 +793,10 @@ export class JiraCloudProvider implements IProvider {
...(labels && {
labels,
}),
...(offsetStartDate && {
...(offsetStartDate !== undefined && {
[this.customFields.get("Start date")!]: offsetStartDate,
}),
...(offsetDueDate && {
...(offsetDueDate !== undefined && {
[this.customFields.get("Due date")!]: offsetDueDate,
}),
...(sprint && {
Expand Down Expand Up @@ -850,24 +850,31 @@ export class JiraCloudProvider implements IProvider {
.get(`search?jql=issuetype = Epic AND project = ${projectIdOrKey}`)
.then(async (response) => {
const epics: Promise<Issue[]> = Promise.all(
response.data.issues.map(async (element: JiraIssue) => ({
issueKey: element.key,
summary: element.fields.summary,
labels: element.fields.labels,
assignee: {
displayName: element.fields.assignee?.displayName,
avatarUrls: element.fields.assignee?.avatarUrls,
},
subtasks: element.fields.subtasks,
created: element.fields.created,
updated: element.fields.updated,
comment: element.fields.comment ?? {
comments: [],
},
projectId: element.fields.project.id,
sprint: element.fields.sprint,
attachments: element.fields.attachment,
}))
response.data.issues.map(async (element: JiraIssue) => {
const startDate = element.fields[this.customFields.get("Start date")!] as string;
const dueDate = element.fields[this.customFields.get("Due date")!] as string;

return {
issueKey: element.key,
summary: element.fields.summary,
labels: element.fields.labels,
assignee: {
displayName: element.fields.assignee?.displayName,
avatarUrls: element.fields.assignee?.avatarUrls,
},
subtasks: element.fields.subtasks,
created: element.fields.created,
updated: element.fields.updated,
comment: element.fields.comment ?? {
comments: [],
},
projectId: element.fields.project.id,
sprint: element.fields.sprint,
attachments: element.fields.attachment,
startDate: startDate ? new Date(startDate) : undefined,
dueDate: dueDate ? new Date(dueDate) : undefined,
}
})
)
resolve(epics)
})
Expand Down
38 changes: 27 additions & 11 deletions electron/providers/jira-server-provider/JiraServerProvider.ts
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The date picker is there for the server, but it doesn't let me save the start or end date if I make a change.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed this, but there remains an open question since Jira Server does not seem to fully support setting start dates (due dates however should work)

Original file line number Diff line number Diff line change
Expand Up @@ -579,15 +579,31 @@ export class JiraServerProvider implements IProvider {
.get(`search?jql=issuetype = Epic AND project = ${projectIdOrKey}`)
.then(async (response) => {
const epics: Promise<Issue[]> = Promise.all(
response.data.issues.map(async (element: JiraIssue) => ({
issueKey: element.key,
summary: element.fields.summary,
labels: element.fields.labels,
assignee: {
displayName: element.fields.assignee?.displayName,
avatarUrls: element.fields.assignee?.avatarUrls,
},
}))
response.data.issues.map(async (element: JiraIssue) => {
const startDate = element.fields[this.customFields.get("Start date")!] as string;
const dueDate = element.fields[this.customFields.get("Due date")!] as string;

return {
issueKey: element.key,
summary: element.fields.summary,
labels: element.fields.labels,
assignee: {
displayName: element.fields.assignee?.displayName,
avatarUrls: element.fields.assignee?.avatarUrls,
},
subtasks: element.fields.subtasks,
created: element.fields.created,
updated: element.fields.updated,
comment: element.fields.comment ?? {
comments: [],
},
projectId: element.fields.project.id,
sprint: element.fields.sprint,
attachments: element.fields.attachment,
startDate: startDate ? new Date(startDate) : undefined,
dueDate: dueDate ? new Date(dueDate) : undefined,
}
})
)
resolve(epics)
})
Expand Down Expand Up @@ -878,10 +894,10 @@ export class JiraServerProvider implements IProvider {
...(labels && {
labels,
}),
...(offsetStartDate && {
...(offsetStartDate !== undefined && {
[this.customFields.get("Start date")!]: offsetStartDate,
}),
...(offsetDueDate && {
...(offsetDueDate !== undefined && {
[this.customFields.get("Due date")!]: offsetDueDate,
}),
...(sprint && {
Expand Down
19 changes: 19 additions & 0 deletions src/components/EpicDetailView/Components/InlineDatePicker.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { UseMutationResult } from "@tanstack/react-query"
import { DatePicker } from "@mantine/dates";
import { DatePickerProps } from "@mantine/dates/lib/components/DatePicker/DatePicker";

export function InlineDatePicker(props: DatePickerProps & {
date: Date | undefined
mutation: UseMutationResult<unknown, unknown, Date | null>
}) {
return (
<DatePicker
value={props.date}
withinPortal
clearable
variant="filled"
onChange={props.mutation.mutate}
{...props}
/>
)
}
106 changes: 0 additions & 106 deletions src/components/EpicDetailView/Components/IssueSprint.tsx

This file was deleted.

48 changes: 47 additions & 1 deletion src/components/EpicDetailView/EpicDetailView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,18 @@ import {
Title,
} from "@mantine/core"
import { Issue, User } from "types"
import { useQueryClient } from "@tanstack/react-query";
import { useMutation, useQueryClient } from "@tanstack/react-query";
import { showNotification } from "@mantine/notifications";
import { AssigneeMenu } from "../DetailView/Components/AssigneeMenu"
import { Description } from "../DetailView/Components/Description"
import { InlineDatePicker } from "./Components/InlineDatePicker"
import { IssueSummary } from "./Components/IssueSummary"
import { Labels } from "../DetailView/Components/Labels"
import { ReporterMenu } from "../DetailView/Components/ReporterMenu"
import { DeleteIssue } from "../DetailView/Components/DeleteIssue"
import { ColorSchemeToggle } from "../common/ColorSchemeToggle"
import { IssueIcon } from "../BacklogView/Issue/IssueIcon"
import { editIssue } from "./helpers/queryFunctions";

export function EpicDetailView({
issueKey,
Expand All @@ -29,6 +32,8 @@ export function EpicDetailView({
created,
updated,
closeModal,
startDate,
dueDate,
}: {
issueKey: string
summary: string
Expand All @@ -38,10 +43,29 @@ export function EpicDetailView({
created: string
updated: string
closeModal: () => void
startDate: Date
dueDate: Date
}) {
const queryClient = useQueryClient()
const reloadEpics = () => queryClient.invalidateQueries({ queryKey: ["epics"] });

const useDateMutation = (property: string) => useMutation({
aymka marked this conversation as resolved.
Show resolved Hide resolved
mutationFn: async (currentDate: Date | null) =>
editIssue({ [property]: currentDate } as unknown as Issue, issueKey).then(reloadEpics),
onError: () => {
showNotification({
message: `An error occurred while modifing the date 😢`,
color: "red",
})
},
onSuccess: () => {
showNotification({
message: `The date for epic ${issueKey} has been modified!`,
color: "green",
})
},
})

const dateFormat = new Intl.DateTimeFormat("en-GB", {
dateStyle: "full",
timeStyle: "short",
Expand Down Expand Up @@ -109,6 +133,28 @@ export function EpicDetailView({
</Text>
<Labels labels={labels} issueKey={issueKey} onMutate={reloadEpics} />
</Group>
<Group grow>
<Text fz="sm" color="dimmed">
Start date
</Text>
<InlineDatePicker
date={startDate}
mutation={useDateMutation('startDate')}
placeholder="Pick start date"
{...(dueDate && { maxDate: dueDate })}
/>
</Group>
<Group grow>
<Text fz="sm" color="dimmed">
Due date
</Text>
<InlineDatePicker
date={dueDate}
mutation={useDateMutation('dueDate')}
placeholder="Pick due date"
{...(startDate && { minDate: startDate })}
/>
</Group>
<ReporterMenu issueKey={issueKey} />
</Stack>
</Accordion.Panel>
Expand Down