remove if else to show permission add option also in repos without any permissions

This commit is contained in:
Maren Süwer
2018-09-03 14:19:44 +02:00
parent 0acaca78b0
commit 1e68060a98

View File

@@ -15,7 +15,6 @@ import {
import Loading from "../../components/Loading"; import Loading from "../../components/Loading";
import ErrorPage from "../../components/ErrorPage"; import ErrorPage from "../../components/ErrorPage";
import type { import type {
Permission,
PermissionCollection, PermissionCollection,
PermissionEntry PermissionEntry
} from "../types/Permissions"; } from "../types/Permissions";
@@ -70,6 +69,7 @@ class Permissions extends React.Component<Props> {
loadingCreatePermission, loadingCreatePermission,
hasPermissionToCreate hasPermissionToCreate
} = this.props; } = this.props;
console.log(permissions);
if (error) { if (error) {
return ( return (
@@ -98,8 +98,6 @@ class Permissions extends React.Component<Props> {
loading={loadingCreatePermission} loading={loadingCreatePermission}
/> />
) : null; ) : null;
if (permissions.length > 0)
return ( return (
<div> <div>
<table className="table is-hoverable is-fullwidth"> <table className="table is-hoverable is-fullwidth">
@@ -111,10 +109,10 @@ class Permissions extends React.Component<Props> {
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{permissions.map((permission, index) => { {permissions.map(permission => {
return ( return (
<SinglePermission <SinglePermission
key={index} key={permission.name}
namespace={namespace} namespace={namespace}
repoName={repoName} repoName={repoName}
permission={permission} permission={permission}
@@ -126,8 +124,6 @@ class Permissions extends React.Component<Props> {
{createPermissionForm} {createPermissionForm}
</div> </div>
); );
return <div />;
} }
} }
@@ -142,7 +138,6 @@ const mapStateToProps = (state, ownProps) => {
namespace, namespace,
repoName repoName
); );
console.log(permissions);
const hasPermissionToCreate = hasCreatePermission(state, namespace, repoName); const hasPermissionToCreate = hasCreatePermission(state, namespace, repoName);
return { return {
namespace, namespace,