Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions src/common/timelineEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export interface CommitEvent {
message: string;
bodyHTML?: string;
committedDate: Date;
status?: 'EXPECTED' | 'ERROR' | 'FAILURE' | 'PENDING' | 'SUCCESS';
}

export interface NewCommitsSinceReviewEvent {
Expand Down
3 changes: 3 additions & 0 deletions src/github/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@ export interface Commit {
oid: string;
message: string;
committedDate: Date;
statusCheckRollup?: {
state: 'EXPECTED' | 'ERROR' | 'FAILURE' | 'PENDING' | 'SUCCESS';
};
};

url: string;
Expand Down
3 changes: 3 additions & 0 deletions src/github/queriesShared.gql
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ fragment Commit on PullRequestCommit {
oid
message
committedDate
statusCheckRollup {
state
}
}
url
}
Expand Down
1 change: 1 addition & 0 deletions src/github/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1200,6 +1200,7 @@ export async function parseCombinedTimelineEvents(
htmlUrl: commitEv.url,
message: commitEv.commit.message,
committedDate: new Date(commitEv.commit.committedDate),
status: commitEv.commit.statusCheckRollup?.state
} as Common.CommitEvent); // TODO remove cast
break;
case Common.EventType.Merged:
Expand Down
19 changes: 18 additions & 1 deletion webviews/components/timeline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import React, { useContext, useRef, useState } from 'react';
import { CommentView } from './comment';
import Diff from './diff';
import { addIcon, errorIcon, gitCommitIcon, gitMergeIcon, loadingIcon, tasklistIcon, threeBars } from './icon';
import { addIcon, checkIcon, circleFilledIcon, closeIcon, errorIcon, gitCommitIcon, gitMergeIcon, loadingIcon, tasklistIcon, threeBars } from './icon';
import { nbsp } from './space';
import { Timestamp } from './timestamp';
import { AuthorLink, Avatar } from './user';
Expand Down Expand Up @@ -105,6 +105,20 @@ export const Timeline = ({ events, isIssue }: { events: TimelineEvent[], isIssue

export default Timeline;


function CommitStateIcon({ status }: { status: 'EXPECTED' | 'ERROR' | 'FAILURE' | 'PENDING' | 'SUCCESS' | undefined; }) {
switch (status) {
case 'PENDING':
return circleFilledIcon;
case 'SUCCESS':
return checkIcon;
case 'FAILURE':
case 'ERROR':
return closeIcon;
}
return null;
}

const CommitEventView = (event: CommitEvent) => {
const context = useContext(PullRequestContext);
const [clickedElement, setClickedElement] = useState<'title' | 'sha' | undefined>(undefined);
Expand Down Expand Up @@ -139,6 +153,9 @@ const CommitEventView = (event: CommitEvent) => {
</div>
</div>
<div className="timeline-detail">
<div className='status-section'>
<CommitStateIcon status={event.status} />
</div>
<a
className="sha"
onClick={(e) => handleCommitClick(e, 'sha')}
Expand Down