1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-04 21:35:23 +02:00

refactor(app): move access-control components [EE-3441] (#7559)

This commit is contained in:
Chaim Lev-Ari 2022-09-07 07:25:00 +03:00 committed by GitHub
parent 77c3f9131b
commit d9cc7eda51
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
62 changed files with 57 additions and 62 deletions

View file

@ -0,0 +1,43 @@
import { User } from '@/portainer/users/types';
import { UsersSelector } from '@@/UsersSelector';
import { FormControl } from '@@/form-components/FormControl';
import { Link } from '@@/Link';
interface Props {
name: string;
users: User[];
value: number[];
onChange(value: number[]): void;
errors?: string | string[];
}
export function UsersField({ name, users, value, onChange, errors }: Props) {
return (
<FormControl
label="Authorized users"
tooltip={
users.length > 0
? 'You can select which user(s) will be able to manage this resource.'
: undefined
}
inputId="users-selector"
errors={errors}
>
{users.length > 0 ? (
<UsersSelector
name={name}
users={users}
onChange={onChange}
value={value}
inputId="users-selector"
/>
) : (
<span className="small text-muted">
You have not yet created any users. Head over to the
<Link to="portainer.users">Users view</Link> to manage users.
</span>
)}
</FormControl>
);
}