mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-02 19:45:51 +01:00
improve user and repository detail pages
This commit is contained in:
@@ -3,7 +3,9 @@
|
|||||||
"name": "Name",
|
"name": "Name",
|
||||||
"type": "Type",
|
"type": "Type",
|
||||||
"contact": "Contact",
|
"contact": "Contact",
|
||||||
"description": "Description"
|
"description": "Description",
|
||||||
|
"creationDate": "Creation Date",
|
||||||
|
"lastModified": "Last Modified"
|
||||||
},
|
},
|
||||||
"validation": {
|
"validation": {
|
||||||
"name-invalid": "The repository name is invalid",
|
"name-invalid": "The repository name is invalid",
|
||||||
@@ -16,7 +18,9 @@
|
|||||||
},
|
},
|
||||||
"repository-root": {
|
"repository-root": {
|
||||||
"error-title": "Error",
|
"error-title": "Error",
|
||||||
"error-subtitle": "Unknown repository error"
|
"error-subtitle": "Unknown repository error",
|
||||||
|
"actions-label": "Actions",
|
||||||
|
"back-label": "Back"
|
||||||
},
|
},
|
||||||
"create": {
|
"create": {
|
||||||
"title": "Create Repository",
|
"title": "Create Repository",
|
||||||
|
|||||||
@@ -5,7 +5,10 @@
|
|||||||
"mail": "E-Mail",
|
"mail": "E-Mail",
|
||||||
"password": "Password",
|
"password": "Password",
|
||||||
"admin": "Admin",
|
"admin": "Admin",
|
||||||
"active": "Active"
|
"active": "Active",
|
||||||
|
"type": "Type",
|
||||||
|
"creationDate": "Creation Date",
|
||||||
|
"lastModified": "Last Modified"
|
||||||
},
|
},
|
||||||
"users": {
|
"users": {
|
||||||
"title": "Users",
|
"title": "Users",
|
||||||
|
|||||||
18
scm-ui/src/components/MailLink.js
Normal file
18
scm-ui/src/components/MailLink.js
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
// @flow
|
||||||
|
import React from "react";
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
address?: string
|
||||||
|
};
|
||||||
|
|
||||||
|
class MailLink extends React.Component<Props> {
|
||||||
|
render() {
|
||||||
|
const { address } = this.props;
|
||||||
|
if (!address) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return <a href={"mailto: " + address}>{address}</a>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default MailLink;
|
||||||
@@ -1,16 +1,56 @@
|
|||||||
//@flow
|
//@flow
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import type {Repository} from '../types/Repositories';
|
import { translate } from "react-i18next";
|
||||||
|
import type { Repository } from "../types/Repositories";
|
||||||
|
import MailLink from "../../components/MailLink";
|
||||||
|
import DateFromNow from "../../components/DateFromNow";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
repository: Repository
|
repository: Repository,
|
||||||
|
// context props
|
||||||
|
t: string => string
|
||||||
};
|
};
|
||||||
|
|
||||||
class RepositoryDetails extends React.Component<Props> {
|
class RepositoryDetails extends React.Component<Props> {
|
||||||
render() {
|
render() {
|
||||||
const { repository } = this.props;
|
const { repository, t } = this.props;
|
||||||
return <div>{repository.description}</div>;
|
return (
|
||||||
|
<table className="table">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>{t("repository.name")}</td>
|
||||||
|
<td>{repository.name}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{t("repository.type")}</td>
|
||||||
|
<td>{repository.type}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{t("repository.contact")}</td>
|
||||||
|
<td>
|
||||||
|
<MailLink address={repository.contact} />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{t("repository.description")}</td>
|
||||||
|
<td>{repository.description}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{t("repository.creationDate")}</td>
|
||||||
|
<td>
|
||||||
|
<DateFromNow date={repository.creationDate} />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{t("repository.lastModified")}</td>
|
||||||
|
<td>
|
||||||
|
<DateFromNow date={repository.lastModified} />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default RepositoryDetails;
|
export default translate("repos")(RepositoryDetails);
|
||||||
|
|||||||
@@ -1,15 +1,20 @@
|
|||||||
//@flow
|
//@flow
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import {fetchRepo, getFetchRepoFailure, getRepository, isFetchRepoPending} from '../modules/repos';
|
import {
|
||||||
|
fetchRepo,
|
||||||
|
getFetchRepoFailure,
|
||||||
|
getRepository,
|
||||||
|
isFetchRepoPending
|
||||||
|
} from "../modules/repos";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import {Route} from "react-router-dom"
|
import { Route } from "react-router-dom";
|
||||||
import type {Repository} from '../types/Repositories';
|
import type { Repository } from "../types/Repositories";
|
||||||
import {Page} from '../../components/layout';
|
import { Page } from "../../components/layout";
|
||||||
import Loading from '../../components/Loading';
|
import Loading from "../../components/Loading";
|
||||||
import ErrorPage from '../../components/ErrorPage';
|
import ErrorPage from "../../components/ErrorPage";
|
||||||
import { translate } from "react-i18next";
|
import { translate } from "react-i18next";
|
||||||
import {Navigation} from '../../components/navigation';
|
import { Navigation, NavLink, Section } from "../../components/navigation";
|
||||||
import RepositoryDetails from '../components/RepositoryDetails';
|
import RepositoryDetails from "../components/RepositoryDetails";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
namespace: string,
|
namespace: string,
|
||||||
@@ -44,7 +49,6 @@ class RepositoryRoot extends React.Component<Props> {
|
|||||||
return this.stripEndingSlash(this.props.match.url);
|
return this.stripEndingSlash(this.props.match.url);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { loading, error, repository, t } = this.props;
|
const { loading, error, repository, t } = this.props;
|
||||||
|
|
||||||
@@ -59,27 +63,34 @@ class RepositoryRoot extends React.Component<Props> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!repository || loading) {
|
if (!repository || loading) {
|
||||||
return <Loading />
|
return <Loading />;
|
||||||
}
|
}
|
||||||
|
|
||||||
const url = this.matchedUrl();
|
const url = this.matchedUrl();
|
||||||
|
|
||||||
return <Page title={repository.namespace + "/" + repository.name}>
|
return (
|
||||||
|
<Page title={repository.namespace + "/" + repository.name}>
|
||||||
<div className="columns">
|
<div className="columns">
|
||||||
<div className="column is-three-quarters">
|
<div className="column is-three-quarters">
|
||||||
<Route path={url} exact component={() => <RepositoryDetails repository={repository} />} />
|
<Route
|
||||||
|
path={url}
|
||||||
|
exact
|
||||||
|
component={() => <RepositoryDetails repository={repository} />}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="column">
|
<div className="column">
|
||||||
<Navigation>
|
<Navigation>
|
||||||
|
<Section label={t("repository-root.actions-label")}>
|
||||||
|
<NavLink to="/repos" label={t("repository-root.back-label")} />
|
||||||
|
</Section>
|
||||||
</Navigation>
|
</Navigation>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Page>
|
</Page>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const mapStateToProps = (state, ownProps) => {
|
const mapStateToProps = (state, ownProps) => {
|
||||||
const { namespace, name } = ownProps.match.params;
|
const { namespace, name } = ownProps.match.params;
|
||||||
const repository = getRepository(state, namespace, name);
|
const repository = getRepository(state, namespace, name);
|
||||||
@@ -96,8 +107,8 @@ const mapStateToProps = (state, ownProps) => {
|
|||||||
|
|
||||||
const mapDispatchToProps = dispatch => {
|
const mapDispatchToProps = dispatch => {
|
||||||
return {
|
return {
|
||||||
fetchRepo : (namespace: string, name: string) => {
|
fetchRepo: (namespace: string, name: string) => {
|
||||||
dispatch(fetchRepo(namespace, name))
|
dispatch(fetchRepo(namespace, name));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ import React from "react";
|
|||||||
import type { User } from "../../types/User";
|
import type { User } from "../../types/User";
|
||||||
import { translate } from "react-i18next";
|
import { translate } from "react-i18next";
|
||||||
import { Checkbox } from "../../../components/forms";
|
import { Checkbox } from "../../../components/forms";
|
||||||
|
import MailLink from "../../../components/MailLink";
|
||||||
|
import DateFromNow from "../../../components/DateFromNow";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
user: User,
|
user: User,
|
||||||
@@ -25,7 +27,9 @@ class Details extends React.Component<Props> {
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>{t("user.mail")}</td>
|
<td>{t("user.mail")}</td>
|
||||||
<td>{user.mail}</td>
|
<td>
|
||||||
|
<MailLink address={user.mail} />
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>{t("user.admin")}</td>
|
<td>{t("user.admin")}</td>
|
||||||
@@ -39,6 +43,22 @@ class Details extends React.Component<Props> {
|
|||||||
<Checkbox checked={user.active} />
|
<Checkbox checked={user.active} />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{t("user.type")}</td>
|
||||||
|
<td>{user.type}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{t("user.creationDate")}</td>
|
||||||
|
<td>
|
||||||
|
<DateFromNow date={user.creationDate} />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{t("user.lastModified")}</td>
|
||||||
|
<td>
|
||||||
|
<DateFromNow date={user.lastModified} />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -8,5 +8,8 @@ export type User = {
|
|||||||
password: string,
|
password: string,
|
||||||
admin: boolean,
|
admin: boolean,
|
||||||
active: boolean,
|
active: boolean,
|
||||||
|
type?: string,
|
||||||
|
creationDate?: string,
|
||||||
|
lastModified?: string,
|
||||||
_links: Links
|
_links: Links
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user