Skip to content
Open
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
17 changes: 17 additions & 0 deletions browser/src/components/LogView/LogEntry/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,23 @@ class LogEntryView extends React.Component<ResultListProps, {}> {
</div>
<div className="buttons" onClick={() => this.props.onViewCommit(this.props.logEntry)}>
<div>
<span
role="button"
className="btnx hint--top-left hint--rounded hint--bounce"
aria-label="Quick Compare file with previous commit"
>
<a
role="button"
onClick={() => {
//Put the following function on the macro queue. after onViewCommit execute "getCommit" that micro queue,get the latest committedFiles field
setTimeout(() => {
this.props.onAction(this.props.logEntry, 'quick_compare_previous');
}, 0);
}}
>
quick look diff
</a>
</span>
<span
onClick={e => copyText(e, this.props.logEntry.hash.full)}
className="btnx hash clipboard hint--top-left hint--rounded hint--bounce"
Expand Down
15 changes: 14 additions & 1 deletion browser/src/components/LogView/LogView/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { connect } from 'react-redux';
import { ResultActions } from '../../../actions/results';
import { LogEntry, Ref } from '../../../definitions';
import { CommittedFile, LogEntry, Ref } from '../../../definitions';
import { LogEntriesState, RootState } from '../../../reducers';
import BranchGraph from '../BranchGraph';
import LogEntryList from '../LogEntryList';
Expand All @@ -17,6 +17,7 @@ type LogViewProps = {
actionRef: typeof ResultActions.actionRef;
getPreviousCommits: typeof ResultActions.getPreviousCommits;
getNextCommits: typeof ResultActions.getNextCommits;
actionFile: typeof ResultActions.actionFile;
};

interface LogViewState {}
Expand Down Expand Up @@ -149,6 +150,15 @@ class LogView extends React.Component<LogViewProps, LogViewState> {
{ entry, name },
);
break;
case 'quick_compare_previous':
this.props.actionFile(
this.props.logEntries.selected,
this.props.logEntries.selected.committedFiles.find(
(el) => el.uri.fsPath === this.props.logEntries.file.fsPath,
),
'compare_previous',
);
break;
default:
this.props.actionCommit(entry, name);
break;
Expand Down Expand Up @@ -191,6 +201,9 @@ function mapDispatchToProps(dispatch) {
dispatch(ResultActions.actionRef(logEntry, ref, name)),
getNextCommits: () => dispatch(ResultActions.getNextCommits()),
getPreviousCommits: () => dispatch(ResultActions.getPreviousCommits()),
actionFile: (logEntry: LogEntry, committedFile: CommittedFile, name) => {
dispatch(ResultActions.actionFile(logEntry, committedFile, name));
},
};
}

Expand Down