mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-09 06:55:47 +01:00
use icons for permission type and for delete function
This commit is contained in:
@@ -22,8 +22,7 @@ class Radio extends React.Component<Props> {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div className="field is-grouped">
|
|
||||||
<div className="control">
|
|
||||||
<label className="radio" disabled={this.props.disabled}>
|
<label className="radio" disabled={this.props.disabled}>
|
||||||
<input
|
<input
|
||||||
type="radio"
|
type="radio"
|
||||||
@@ -36,8 +35,6 @@ class Radio extends React.Component<Props> {
|
|||||||
{this.props.label}
|
{this.props.label}
|
||||||
{this.renderHelp()}
|
{this.renderHelp()}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,7 +93,6 @@
|
|||||||
"error-subtitle": "Unbekannter Fehler bei Berechtigung",
|
"error-subtitle": "Unbekannter Fehler bei Berechtigung",
|
||||||
"name": "Benutzer oder Gruppe",
|
"name": "Benutzer oder Gruppe",
|
||||||
"role": "Rolle",
|
"role": "Rolle",
|
||||||
"type": "Typ",
|
|
||||||
"permissions": "Berechtigung",
|
"permissions": "Berechtigung",
|
||||||
"group-permission": "Gruppenberechtigung",
|
"group-permission": "Gruppenberechtigung",
|
||||||
"user-permission": "Benutzerberechtigung",
|
"user-permission": "Benutzerberechtigung",
|
||||||
|
|||||||
@@ -93,7 +93,6 @@
|
|||||||
"error-subtitle": "Unknown permissions error",
|
"error-subtitle": "Unknown permissions error",
|
||||||
"name": "User or group",
|
"name": "User or group",
|
||||||
"role": "Role",
|
"role": "Role",
|
||||||
"type": "Type",
|
|
||||||
"permissions": "Permissions",
|
"permissions": "Permissions",
|
||||||
"group-permission": "Group Permission",
|
"group-permission": "Group Permission",
|
||||||
"user-permission": "User Permission",
|
"user-permission": "User Permission",
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { translate } from "react-i18next";
|
import { translate } from "react-i18next";
|
||||||
import type { Permission } from "@scm-manager/ui-types";
|
import type { Permission } from "@scm-manager/ui-types";
|
||||||
import { confirmAlert, DeleteButton } from "@scm-manager/ui-components";
|
import { confirmAlert } from "@scm-manager/ui-components";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
permission: Permission,
|
permission: Permission,
|
||||||
@@ -54,18 +54,18 @@ class DeletePermissionButton extends React.Component<Props> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { confirmDialog, loading, t } = this.props;
|
const { confirmDialog } = this.props;
|
||||||
const action = confirmDialog ? this.confirmDelete : this.deletePermission;
|
const action = confirmDialog ? this.confirmDelete : this.deletePermission;
|
||||||
|
|
||||||
if (!this.isDeletable()) {
|
if (!this.isDeletable()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<DeleteButton
|
<a className="level-item" onClick={action}>
|
||||||
label={t("permission.delete-permission-button.label")}
|
<span className="icon is-small">
|
||||||
action={action}
|
<i className="fas fa-trash" />
|
||||||
loading={loading}
|
</span>
|
||||||
/>
|
</a>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ class CreatePermissionForm extends React.Component<Props, State> {
|
|||||||
const { t } = this.props;
|
const { t } = this.props;
|
||||||
if (this.state.groupPermission) {
|
if (this.state.groupPermission) {
|
||||||
return (
|
return (
|
||||||
|
|
||||||
<Autocomplete
|
<Autocomplete
|
||||||
loadSuggestions={this.loadGroupAutocompletion}
|
loadSuggestions={this.loadGroupAutocompletion}
|
||||||
valueSelected={this.groupOrUserSelected}
|
valueSelected={this.groupOrUserSelected}
|
||||||
@@ -159,6 +160,9 @@ class CreatePermissionForm extends React.Component<Props, State> {
|
|||||||
</h2>
|
</h2>
|
||||||
{advancedDialog}
|
{advancedDialog}
|
||||||
<form onSubmit={this.submit}>
|
<form onSubmit={this.submit}>
|
||||||
|
<div className="field is-grouped">
|
||||||
|
|
||||||
|
<div className="control">
|
||||||
<Radio
|
<Radio
|
||||||
name="permission_scope"
|
name="permission_scope"
|
||||||
value="USER_PERMISSION"
|
value="USER_PERMISSION"
|
||||||
@@ -173,7 +177,7 @@ class CreatePermissionForm extends React.Component<Props, State> {
|
|||||||
label={t("permission.group-permission")}
|
label={t("permission.group-permission")}
|
||||||
onChange={this.permissionScopeChanged}
|
onChange={this.permissionScopeChanged}
|
||||||
/>
|
/>
|
||||||
|
</div></div>
|
||||||
<div className="columns">
|
<div className="columns">
|
||||||
<div className="column is-two-thirds">
|
<div className="column is-two-thirds">
|
||||||
{this.renderAutocompletionField()}
|
{this.renderAutocompletionField()}
|
||||||
|
|||||||
@@ -152,12 +152,6 @@ class Permissions extends React.Component<Props> {
|
|||||||
helpText={t("permission.help.nameHelpText")}
|
helpText={t("permission.help.nameHelpText")}
|
||||||
/>
|
/>
|
||||||
</th>
|
</th>
|
||||||
<th className="is-hidden-mobile">
|
|
||||||
<LabelWithHelpIcon
|
|
||||||
label={t("permission.type")}
|
|
||||||
helpText={t("permission.help.groupPermissionHelpText")}
|
|
||||||
/>
|
|
||||||
</th>
|
|
||||||
<th>
|
<th>
|
||||||
<LabelWithHelpIcon
|
<LabelWithHelpIcon
|
||||||
label={t("permission.role")}
|
label={t("permission.role")}
|
||||||
|
|||||||
@@ -14,10 +14,12 @@ import {
|
|||||||
} from "../modules/permissions";
|
} from "../modules/permissions";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import type { History } from "history";
|
import type { History } from "history";
|
||||||
import { Button, Checkbox } from "@scm-manager/ui-components";
|
import { Button } from "@scm-manager/ui-components";
|
||||||
import DeletePermissionButton from "../components/buttons/DeletePermissionButton";
|
import DeletePermissionButton from "../components/buttons/DeletePermissionButton";
|
||||||
import RoleSelector from "../components/RoleSelector";
|
import RoleSelector from "../components/RoleSelector";
|
||||||
import AdvancedPermissionsDialog from "./AdvancedPermissionsDialog";
|
import AdvancedPermissionsDialog from "./AdvancedPermissionsDialog";
|
||||||
|
import classNames from "classnames";
|
||||||
|
import injectSheet from "react-jss";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
availablePermissions: AvailableRepositoryPermissions,
|
availablePermissions: AvailableRepositoryPermissions,
|
||||||
@@ -39,7 +41,8 @@ type Props = {
|
|||||||
namespace: string,
|
namespace: string,
|
||||||
name: string
|
name: string
|
||||||
) => void,
|
) => void,
|
||||||
deleteLoading: boolean
|
deleteLoading: boolean,
|
||||||
|
classes: any
|
||||||
};
|
};
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
@@ -48,6 +51,12 @@ type State = {
|
|||||||
showAdvancedDialog: boolean
|
showAdvancedDialog: boolean
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const styles = {
|
||||||
|
iconColor: {
|
||||||
|
color: "#9a9a9a"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
class SinglePermission extends React.Component<Props, State> {
|
class SinglePermission extends React.Component<Props, State> {
|
||||||
constructor(props: Props) {
|
constructor(props: Props) {
|
||||||
super(props);
|
super(props);
|
||||||
@@ -104,7 +113,8 @@ class SinglePermission extends React.Component<Props, State> {
|
|||||||
availablePermissions,
|
availablePermissions,
|
||||||
loading,
|
loading,
|
||||||
namespace,
|
namespace,
|
||||||
repoName
|
repoName,
|
||||||
|
classes
|
||||||
} = this.props;
|
} = this.props;
|
||||||
const availableRoleNames = availablePermissions.availableRoles.map(
|
const availableRoleNames = availablePermissions.availableRoles.map(
|
||||||
r => r.name
|
r => r.name
|
||||||
@@ -138,10 +148,18 @@ class SinglePermission extends React.Component<Props, State> {
|
|||||||
? t("permission.group")
|
? t("permission.group")
|
||||||
: t("permission.user");
|
: t("permission.user");
|
||||||
|
|
||||||
|
const iconType =
|
||||||
|
permission && permission.groupPermission ? (
|
||||||
|
<i className={classNames("fas fa-user-friends", classes.iconColor)} />
|
||||||
|
) : (
|
||||||
|
<i className={classNames("fas fa-user", classes.iconColor)} />
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<tr>
|
<tr>
|
||||||
<td>{permission.name}</td>
|
<td>
|
||||||
<td>{type}</td>
|
{iconType} {permission.name}
|
||||||
|
</td>
|
||||||
{roleSelector}
|
{roleSelector}
|
||||||
<td>
|
<td>
|
||||||
<Button
|
<Button
|
||||||
@@ -261,4 +279,4 @@ const mapDispatchToProps = dispatch => {
|
|||||||
export default connect(
|
export default connect(
|
||||||
mapStateToProps,
|
mapStateToProps,
|
||||||
mapDispatchToProps
|
mapDispatchToProps
|
||||||
)(translate("repos")(SinglePermission));
|
)(translate("repos")(injectSheet(styles)(SinglePermission)));
|
||||||
|
|||||||
Reference in New Issue
Block a user