mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-11 07:55:47 +01:00
Implemented editing of repos (in UI)
This commit is contained in:
22
scm-ui/src/repos/components/EditNavLink.js
Normal file
22
scm-ui/src/repos/components/EditNavLink.js
Normal file
@@ -0,0 +1,22 @@
|
||||
//@flow
|
||||
import React from "react";
|
||||
import { NavLink } from "../../components/navigation";
|
||||
import { translate } from "react-i18next";
|
||||
import type { Repository } from "../types/Repositories";
|
||||
|
||||
type Props = { editUrl: string, t: string => string, repository: Repository };
|
||||
|
||||
class EditNavLink extends React.Component<Props> {
|
||||
isEditable = () => {
|
||||
return this.props.repository._links.update;
|
||||
};
|
||||
render() {
|
||||
if (!this.isEditable()) {
|
||||
return null;
|
||||
}
|
||||
const { editUrl, t } = this.props;
|
||||
return <NavLink to={editUrl} label={t("edit-nav-link.label")} />;
|
||||
}
|
||||
}
|
||||
|
||||
export default translate("repos")(EditNavLink);
|
||||
Reference in New Issue
Block a user