mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-16 10:16:16 +01:00
fix url and add the postcss-easy-import dependency
This commit is contained in:
@@ -104,16 +104,6 @@ class RepositoryRoot extends React.Component<Props> {
|
||||
path={`${url}/edit`}
|
||||
component={() => <Edit repository={repository} />}
|
||||
/>
|
||||
<Route
|
||||
path={`${url}/diff`}
|
||||
component={() => (
|
||||
<ScmDiff
|
||||
namespace={"scmadmin"}
|
||||
name={"foo"}
|
||||
revision={"4c18735d4c3bd89242284ed3eac52592637024b6"}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
<Route
|
||||
path={`${url}/permissions`}
|
||||
render={props => (
|
||||
@@ -123,6 +113,16 @@ class RepositoryRoot extends React.Component<Props> {
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
<Route
|
||||
path={`${url}/diff`}
|
||||
component={() => (
|
||||
<ScmDiff
|
||||
namespace={repository.namespace}
|
||||
name={repository.name}
|
||||
revision={"db64ca5992ad8e327c7687d49f5297bef7b29893"}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className="column">
|
||||
<Navigation>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// @flow
|
||||
|
||||
import React from "react";
|
||||
import { Diff, Hunk, parseDiff } from "react-diff-view";
|
||||
import { apiClient } from "@scm-manager/ui-components";
|
||||
import {Diff, Hunk, parseDiff} from "react-diff-view";
|
||||
import {apiClient} from "@scm-manager/ui-components";
|
||||
|
||||
type Props = {
|
||||
namespace: string,
|
||||
@@ -17,13 +17,13 @@ class ScmDiff extends React.Component<Props> {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const { namespace, name, revision } = this.props;
|
||||
const url = `http://localhost:8081/scm/api/rest/v2/repositories/${namespace}/${name}/diff/${revision}`;
|
||||
const {namespace, name, revision} = this.props;
|
||||
const url = `/repositories/${namespace}/${name}/diff/${revision}`;
|
||||
apiClient
|
||||
.get(url)
|
||||
.then(response => response.text())
|
||||
.then(text => this.setState({ diff: text }))
|
||||
.catch(error => this.setState({ error }));
|
||||
.then(text => this.setState({diff: text}))
|
||||
.catch(error => this.setState({error}));
|
||||
}
|
||||
|
||||
render() {
|
||||
@@ -31,11 +31,18 @@ class ScmDiff extends React.Component<Props> {
|
||||
return null;
|
||||
}
|
||||
const files = parseDiff(this.state.diff);
|
||||
|
||||
const renderFile = ({newPath, oldRevision, newRevision, type, hunks}) => (
|
||||
<div>
|
||||
<div> File: {newPath} </div>
|
||||
<Diff key={oldRevision + '-' + newRevision} diffType={type} hunks={hunks} viewType="split">
|
||||
</Diff>
|
||||
</div>
|
||||
);
|
||||
|
||||
return (
|
||||
<div>
|
||||
{files.map(({ hunks }, i) => (
|
||||
<Diff key={i} hunks={hunks} viewType="unified" />
|
||||
))}
|
||||
{files.map(renderFile)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user