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:
parent
77c3f9131b
commit
d9cc7eda51
62 changed files with 57 additions and 62 deletions
|
@ -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>
|
||||
);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue