mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-11 07:55:47 +01:00
fix redirect url / use hal links in legacy plugin
This commit is contained in:
@@ -10,9 +10,11 @@ import {
|
|||||||
ErrorBoundary
|
ErrorBoundary
|
||||||
} from "@scm-manager/ui-components";
|
} from "@scm-manager/ui-components";
|
||||||
import DummyComponent from "./DummyComponent";
|
import DummyComponent from "./DummyComponent";
|
||||||
|
import type {Links} from "@scm-manager/ui-types";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
authenticated?: boolean,
|
authenticated?: boolean,
|
||||||
|
links: Links,
|
||||||
|
|
||||||
//context objects
|
//context objects
|
||||||
history: History
|
history: History
|
||||||
@@ -35,14 +37,14 @@ class LegacyRepositoryRedirect extends React.Component<Props, State> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
redirectLegacyRepository() {
|
redirectLegacyRepository() {
|
||||||
const { history } = this.props;
|
const { history, links } = this.props;
|
||||||
if (location.href && location.href.includes("#diffPanel;")) {
|
if (location.href && location.href.includes("#diffPanel;")) {
|
||||||
let splittedUrl = location.href.split(";");
|
let splittedUrl = location.href.split(";");
|
||||||
let repoId = splittedUrl[1];
|
let repoId = splittedUrl[1];
|
||||||
let changeSetId = splittedUrl[2];
|
let changeSetId = splittedUrl[2];
|
||||||
|
|
||||||
apiClient
|
apiClient
|
||||||
.get("/legacy/repository/" + repoId)
|
.get(links.nameAndNamespace.href.replace("{id}", repoId))
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(payload =>
|
.then(payload =>
|
||||||
history.push(
|
history.push(
|
||||||
@@ -50,7 +52,7 @@ class LegacyRepositoryRedirect extends React.Component<Props, State> {
|
|||||||
payload.namespace +
|
payload.namespace +
|
||||||
"/" +
|
"/" +
|
||||||
payload.name +
|
payload.name +
|
||||||
"/changesets/" +
|
"/changeset/" +
|
||||||
changeSetId
|
changeSetId
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -90,4 +92,4 @@ class LegacyRepositoryRedirect extends React.Component<Props, State> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
binder.bind("legacy.redirectRepository", withRouter(LegacyRepositoryRedirect));
|
binder.bind("main.route", withRouter(LegacyRepositoryRedirect));
|
||||||
|
|||||||
@@ -122,11 +122,6 @@ class Main extends React.Component<Props> {
|
|||||||
component={Profile}
|
component={Profile}
|
||||||
authenticated={authenticated}
|
authenticated={authenticated}
|
||||||
/>
|
/>
|
||||||
<ExtensionPoint
|
|
||||||
name="legacy.redirectRepository"
|
|
||||||
renderAll={true}
|
|
||||||
props={{ authenticated }}
|
|
||||||
/>
|
|
||||||
<ExtensionPoint
|
<ExtensionPoint
|
||||||
name="main.route"
|
name="main.route"
|
||||||
renderAll={true}
|
renderAll={true}
|
||||||
|
|||||||
Reference in New Issue
Block a user