2019-11-25 23:38:06 +08:00
|
|
|
import React, { useState } from 'react';
|
2019-10-22 23:36:07 +08:00
|
|
|
import { Legend } from './Legend';
|
|
|
|
|
|
2019-11-25 23:38:06 +08:00
|
|
|
import { withCenteredStory } from '../../utils/storybook/withCenteredStory';
|
|
|
|
|
import { withStoryContainer } from '../../utils/storybook/withStoryContainer';
|
|
|
|
|
import { Field } from './Field';
|
|
|
|
|
import { Input } from './Input/Input';
|
|
|
|
|
import { Button } from './Button';
|
|
|
|
|
import { Form } from './Form';
|
|
|
|
|
import { Switch } from './Switch';
|
|
|
|
|
import { Icon } from '../Icon/Icon';
|
2019-11-27 15:30:23 +08:00
|
|
|
import { TextArea } from './TextArea/TextArea';
|
2019-11-25 23:38:06 +08:00
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
title: 'UI/Forms/Test forms/Server admin',
|
|
|
|
|
decorators: [withStoryContainer, withCenteredStory],
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const users = () => {
|
|
|
|
|
const [name, setName] = useState();
|
|
|
|
|
const [email, setEmail] = useState();
|
|
|
|
|
const [username, setUsername] = useState();
|
|
|
|
|
const [password, setPassword] = useState();
|
|
|
|
|
const [disabledUser, setDisabledUser] = useState(false);
|
2019-10-22 23:36:07 +08:00
|
|
|
|
|
|
|
|
return (
|
2019-11-25 23:38:06 +08:00
|
|
|
<>
|
|
|
|
|
<Form>
|
|
|
|
|
<Legend>Edit user</Legend>
|
|
|
|
|
<Field label="Name">
|
|
|
|
|
<Input
|
|
|
|
|
id="name"
|
|
|
|
|
placeholder="Roger Waters"
|
|
|
|
|
value={name}
|
|
|
|
|
onChange={e => setName(e.currentTarget.value)}
|
|
|
|
|
size="md"
|
|
|
|
|
/>
|
|
|
|
|
</Field>
|
|
|
|
|
<Field label="Email">
|
|
|
|
|
<Input
|
|
|
|
|
id="email"
|
|
|
|
|
type="email"
|
|
|
|
|
placeholder="roger.waters@grafana.com"
|
|
|
|
|
value={email}
|
|
|
|
|
onChange={e => setEmail(e.currentTarget.value)}
|
|
|
|
|
size="md"
|
|
|
|
|
/>
|
|
|
|
|
</Field>
|
|
|
|
|
<Field label="Username">
|
|
|
|
|
<Input
|
|
|
|
|
id="username"
|
|
|
|
|
placeholder="mr.waters"
|
|
|
|
|
value={username}
|
|
|
|
|
onChange={e => setUsername(e.currentTarget.value)}
|
|
|
|
|
size="md"
|
|
|
|
|
/>
|
|
|
|
|
</Field>
|
|
|
|
|
<Field label="Disable" description="Added for testing purposes">
|
|
|
|
|
<Switch checked={disabledUser} onChange={(_e, checked) => setDisabledUser(checked)} />
|
|
|
|
|
</Field>
|
|
|
|
|
<Button>Update</Button>
|
|
|
|
|
</Form>
|
|
|
|
|
<Form>
|
|
|
|
|
<Legend>Change password</Legend>
|
|
|
|
|
<Field label="Password">
|
|
|
|
|
<Input
|
|
|
|
|
id="password>"
|
|
|
|
|
type="password"
|
|
|
|
|
placeholder="Be safe..."
|
|
|
|
|
value={password}
|
|
|
|
|
onChange={e => setPassword(e.currentTarget.value)}
|
|
|
|
|
size="md"
|
|
|
|
|
prefix={<Icon name="lock" />}
|
|
|
|
|
/>
|
|
|
|
|
</Field>
|
|
|
|
|
<Button>Update</Button>
|
|
|
|
|
</Form>
|
|
|
|
|
|
|
|
|
|
<Form>
|
|
|
|
|
<fieldset>
|
|
|
|
|
<Legend>CERT validation</Legend>
|
|
|
|
|
<Field
|
|
|
|
|
label="Path to client cert"
|
|
|
|
|
description="Authentication against LDAP servers requiring client certificates if not required leave empty "
|
|
|
|
|
>
|
2019-11-27 15:30:23 +08:00
|
|
|
<TextArea id="clientCert" value={''} size="lg" />
|
2019-11-25 23:38:06 +08:00
|
|
|
</Field>
|
|
|
|
|
</fieldset>
|
|
|
|
|
<Button>Update</Button>
|
|
|
|
|
</Form>
|
|
|
|
|
</>
|
2019-10-22 23:36:07 +08:00
|
|
|
);
|
2019-11-25 23:38:06 +08:00
|
|
|
};
|