mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-18 03:01:05 +01:00
fix Diff ui types
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
//@flow
|
//@flow
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import DiffFile from "./DiffFile";
|
import DiffFile from "./DiffFile";
|
||||||
import type { DiffObjectProps } from "./DiffTypes";
|
import type { DiffObjectProps, File } from "./DiffTypes";
|
||||||
|
|
||||||
type Props = DiffObjectProps & {
|
type Props = DiffObjectProps & {
|
||||||
diff: any
|
diff: File[]
|
||||||
};
|
};
|
||||||
|
|
||||||
class Diff extends React.Component<Props> {
|
class Diff extends React.Component<Props> {
|
||||||
|
|||||||
@@ -27,12 +27,17 @@ export type Hunk = {
|
|||||||
content: string
|
content: string
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type ChangeType = "insert" | "delete" | "normal";
|
||||||
|
|
||||||
export type Change = {
|
export type Change = {
|
||||||
content: string,
|
content: string,
|
||||||
isNormal: boolean,
|
isNormal?: boolean,
|
||||||
newLineNumber: number,
|
isInsert?: boolean,
|
||||||
oldLineNumber: number,
|
isDelete?: boolean,
|
||||||
type: string
|
lineNumber?: number,
|
||||||
|
newLineNumber?: number,
|
||||||
|
oldLineNumber?: number,
|
||||||
|
type: ChangeType
|
||||||
};
|
};
|
||||||
|
|
||||||
export type BaseContext = {
|
export type BaseContext = {
|
||||||
|
|||||||
@@ -6,14 +6,14 @@ import parser from "gitdiff-parser";
|
|||||||
|
|
||||||
import Loading from "../Loading";
|
import Loading from "../Loading";
|
||||||
import Diff from "./Diff";
|
import Diff from "./Diff";
|
||||||
import type {DiffObjectProps} from "./DiffTypes";
|
import type {DiffObjectProps, File} from "./DiffTypes";
|
||||||
|
|
||||||
type Props = DiffObjectProps & {
|
type Props = DiffObjectProps & {
|
||||||
url: string
|
url: string
|
||||||
};
|
};
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
diff?: any,
|
diff?: File[],
|
||||||
loading: boolean,
|
loading: boolean,
|
||||||
error?: Error
|
error?: Error
|
||||||
};
|
};
|
||||||
@@ -47,7 +47,8 @@ class LoadingDiff extends React.Component<Props, State> {
|
|||||||
.get(url)
|
.get(url)
|
||||||
.then(response => response.text())
|
.then(response => response.text())
|
||||||
.then(parser.parse)
|
.then(parser.parse)
|
||||||
.then(diff => {
|
// $FlowFixMe
|
||||||
|
.then((diff: File[]) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
loading: false,
|
||||||
diff: diff
|
diff: diff
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ export type {
|
|||||||
FileChangeType,
|
FileChangeType,
|
||||||
Hunk,
|
Hunk,
|
||||||
Change,
|
Change,
|
||||||
|
ChangeType,
|
||||||
BaseContext,
|
BaseContext,
|
||||||
AnnotationFactory,
|
AnnotationFactory,
|
||||||
AnnotationFactoryContext,
|
AnnotationFactoryContext,
|
||||||
|
|||||||
Reference in New Issue
Block a user