Skip to content

Commit f09e50a

Browse files
Add path and commit summary to diff (#919)
Change-Id: diff-path-summary
1 parent c249e59 commit f09e50a

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed

josh-ui/src/DiffViewer.tsx

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export type DiffViewerProps = {
1616
type State = {
1717
content_a?: string
1818
content_b?: string
19+
summary: string
1920
client: GraphQLClient
2021
}
2122

@@ -37,6 +38,7 @@ export class DiffViewer extends React.Component<DiffViewerProps, State> {
3738
state = {
3839
content_a: undefined,
3940
content_b: undefined,
41+
summary: "",
4042
client: new GraphQLClient(`${getServer()}/~/graphql/${this.props.repo}`, {
4143
mode: 'cors',
4244
errorPolicy: 'all'
@@ -64,26 +66,31 @@ export class DiffViewer extends React.Component<DiffViewerProps, State> {
6466

6567
this.setState({
6668
content_a: content_a,
67-
content_b: content_b
69+
content_b: content_b,
70+
summary: data.summary,
6871
})
6972
})
7073
}
7174

7275
render() {
7376
if (this.state.content_a !== undefined
7477
&& this.state.content_b !== undefined) {
75-
return <DiffEditor
76-
modified={this.state.content_b}
77-
original={this.state.content_a}
78-
language={mapLanguage(this.props.path)}
79-
height='80vh'
80-
theme='vs-dark'
81-
options={{
82-
readOnly: true,
83-
domReadOnly: true,
84-
cursorBlinking: 'solid',
85-
}}
86-
/>
78+
return <div>
79+
<div>{this.state.summary}</div>
80+
<div>{this.props.path}</div>
81+
<DiffEditor
82+
modified={this.state.content_b}
83+
original={this.state.content_a}
84+
language={mapLanguage(this.props.path)}
85+
height='80vh'
86+
theme='vs-dark'
87+
options={{
88+
readOnly: true,
89+
domReadOnly: true,
90+
cursorBlinking: 'solid',
91+
}}
92+
/>
93+
</div>
8794
} else
8895
{
8996
return <div>Loading...</div>

josh-ui/src/Navigation.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ query($rev: String!, $filter: String!, $path: String!) {
4444
export const QUERY_FILE_DIFF = gql`
4545
query($rev: String!, $filter: String!, $path: String!) {
4646
rev(at:$rev, filter:$filter) {
47+
summary
4748
history(limit: 2) {
4849
file(path:$path) {
4950
text

0 commit comments

Comments
 (0)