mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-07 14:05:44 +01:00
fix links and routes
This commit is contained in:
@@ -5,7 +5,7 @@ import { Link } from "react-router-dom";
|
|||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
title: string;
|
title: string;
|
||||||
description: string;
|
description?: string;
|
||||||
avatar: ReactNode;
|
avatar: ReactNode;
|
||||||
contentRight?: ReactNode;
|
contentRight?: ReactNode;
|
||||||
footerLeft: ReactNode;
|
footerLeft: ReactNode;
|
||||||
|
|||||||
@@ -13,10 +13,15 @@ type Props = {
|
|||||||
class DropDown extends React.Component<Props> {
|
class DropDown extends React.Component<Props> {
|
||||||
render() {
|
render() {
|
||||||
const { options, optionValues, preselectedOption, className, disabled } = this.props;
|
const { options, optionValues, preselectedOption, className, disabled } = this.props;
|
||||||
|
|
||||||
|
if (preselectedOption && !options.includes(preselectedOption)) {
|
||||||
|
options.unshift(preselectedOption)
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classNames(className, "select", disabled ? "disabled" : "")}>
|
<div className={classNames(className, "select", disabled ? "disabled" : "")}>
|
||||||
<select value={preselectedOption ? preselectedOption : ""} onChange={this.change} disabled={disabled}>
|
<select value={preselectedOption ? preselectedOption : ""} onChange={this.change} disabled={disabled}>
|
||||||
<option key="" />
|
<option key={preselectedOption} />
|
||||||
{options.map((option, index) => {
|
{options.map((option, index) => {
|
||||||
return (
|
return (
|
||||||
<option key={option} value={optionValues && optionValues[index] ? optionValues[index] : option}>
|
<option key={option} value={optionValues && optionValues[index] ? optionValues[index] : option}>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export function createChangesetLink(repository: Repository, changeset: Changeset
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function createSourcesLink(repository: Repository, changeset: Changeset) {
|
export function createSourcesLink(repository: Repository, changeset: Changeset) {
|
||||||
return `/repo/${repository.namespace}/${repository.name}/sources/${changeset.id}`;
|
return `/repo/${repository.namespace}/${repository.name}/code/sources/${changeset.id}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function parseDescription(description?: string): Description {
|
export function parseDescription(description?: string): Description {
|
||||||
|
|||||||
@@ -28,13 +28,13 @@ const CodeViewSwitcher: FC<Props> = ({ url }) => {
|
|||||||
<SmallButton
|
<SmallButton
|
||||||
label={t("code.commits")}
|
label={t("code.commits")}
|
||||||
icon="fa fa-exchange-alt"
|
icon="fa fa-exchange-alt"
|
||||||
color={url.includes("/code/changesets/") ? "link is-selected" : undefined}
|
color={url.includes("/code/changesets") ? "link is-selected" : undefined}
|
||||||
link={createDestinationUrl("changesets")}
|
link={createDestinationUrl("changesets")}
|
||||||
/>
|
/>
|
||||||
<SmallButton
|
<SmallButton
|
||||||
label={t("code.sources")}
|
label={t("code.sources")}
|
||||||
icon="fa fa-code"
|
icon="fa fa-code"
|
||||||
color={url.includes("/code/sources/") ? "link is-selected" : undefined}
|
color={url.includes("/code/sources") ? "link is-selected" : undefined}
|
||||||
link={createDestinationUrl("sources")}
|
link={createDestinationUrl("sources")}
|
||||||
/>
|
/>
|
||||||
</ButtonAddons>
|
</ButtonAddons>
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ class CodeOverview extends React.Component<Props> {
|
|||||||
const { repository, baseUrl, branches, error, loading, t } = this.props;
|
const { repository, baseUrl, branches, error, loading, t } = this.props;
|
||||||
const url = baseUrl;
|
const url = baseUrl;
|
||||||
|
|
||||||
if (!branches || loading) {
|
if (loading) {
|
||||||
return <Loading />;
|
return <Loading />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,14 +22,14 @@ class RepositoryEntry extends React.Component<Props> {
|
|||||||
|
|
||||||
renderChangesetsLink = (repository: Repository, repositoryLink: string) => {
|
renderChangesetsLink = (repository: Repository, repositoryLink: string) => {
|
||||||
if (repository._links["changesets"]) {
|
if (repository._links["changesets"]) {
|
||||||
return <RepositoryEntryLink icon="exchange-alt" to={repositoryLink + "/changesets"} />;
|
return <RepositoryEntryLink icon="exchange-alt" to={repositoryLink + "/code/changesets"} />;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
renderSourcesLink = (repository: Repository, repositoryLink: string) => {
|
renderSourcesLink = (repository: Repository, repositoryLink: string) => {
|
||||||
if (repository._links["sources"]) {
|
if (repository._links["sources"]) {
|
||||||
return <RepositoryEntryLink icon="code" to={repositoryLink + "/sources"} />;
|
return <RepositoryEntryLink icon="code" to={repositoryLink + "/code/sources"} />;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user