@patternfly/react-core#ActionGroup JavaScript Examples
The following examples show how to use
@patternfly/react-core#ActionGroup.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FormButtons.js From user-preferences-frontend with Apache License 2.0 | 6 votes |
FormButtons = ({
dirtyFieldsSinceLastSubmit,
submitSucceeded,
pristine,
}) => {
const { reset } = useFormApi();
const noChanges =
isEmpty(dirtyFieldsSinceLastSubmit) || (!submitSucceeded && pristine);
return (
<ActionGroup>
<Button
className="pref-email__form-button"
type="submit"
ouiaId="user-pref-primary-button"
isDisabled={noChanges}
variant="primary"
>
Save
</Button>
<Button
variant="link"
ouiaId="user-pref-reset-button"
isDisabled={noChanges}
onClick={() => reset()}
>
Cancel
</Button>
</ActionGroup>
);
}
Example #2
Source File: forgot-password.js From ibutsu-server with MIT License | 5 votes |
render() {
const signUpForAccountMessage = (
<LoginMainFooterBandItem>
Need an account? <NavLink to="/sign-up">Sign up.</NavLink>
</LoginMainFooterBandItem>
);
const forgotCredentials = (
<LoginMainFooterBandItem>
Already registered? <NavLink to="/login">Log in.</NavLink>
</LoginMainFooterBandItem>
);
const backgroundImages = {
lg: '/images/pfbg_1200.jpg',
sm: '/images/pfbg_768.jpg',
sm2x: '/images/[email protected]',
xs: '/images/pfbg_576.jpg',
xs2x: '/images/[email protected]'
};
return (
<LoginPage
footerListVariants="inline"
brandImgSrc="/images/ibutsu-wordart-164.png"
brandImgAlt="Ibutsu"
backgroundImgSrc={backgroundImages}
backgroundImgAlt="Background image"
textContent="Ibutsu is an open source test result aggregation. Collect and display your test results, view artifacts, and monitor tests."
loginTitle="Recover your account"
loginSubtitle="Please type in your e-mail address and a reset link will be sent to it."
signUpForAccountMessage={signUpForAccountMessage}
forgotCredentials={forgotCredentials}
>
<Form>
{this.state.showAlert &&
<FormAlert>
<Alert variant={this.state.alertType} title={this.state.alertText} aria-live="polite" isInline/>
</FormAlert>
}
<FormGroup
label="Email address"
isRequired
fieldId="email"
validated={this.state.isValidEmail ? 'default' : 'error'}
helperText="The e-mail address you signed up with"
>
<TextInput
isRequired
type="email"
id="email"
name="email"
validated={this.state.isValidEmail ? 'default' : 'error'}
aria-describedby="email-helper"
value={this.state.emailValue}
onChange={this.onEmailChange}
/>
</FormGroup>
<ActionGroup>
<Button variant="primary" isBlock onClick={this.onRecoverAccountClick}>Recover account</Button>
</ActionGroup>
</Form>
</LoginPage>
);
}
Example #3
Source File: project-edit.js From ibutsu-server with MIT License | 5 votes |
render() {
const { project, users, owner } = this.state;
return (
<React.Fragment>
<PageSection variant={PageSectionVariants.light}>
<Title headingLevel="h1" size='2xl' className="pf-c-title">
Projects / {project && project.title}
</Title>
</PageSection>
<PageSection>
{!project && <Alert variant="info" title="Loading..." />}
{project &&
<Card>
<CardBody>
<Form>
<FormGroup label="Title" isRequired fieldId="projectTitle" helperText="The project's friendly name">
<TextInput
isRequired
type="text"
id="projectTitle"
name="projectTitle"
aria-describedby="The project's friendly name"
value={project.title}
onChange={this.onProjectTitleChanged}
/>
</FormGroup>
<FormGroup label="Name" isRequired fieldId="projectName" helperText="The project's machine name">
<TextInput
isRequired
type="text"
id="projectName"
name="projectName"
aria-describedby="The project's machine name"
value={project.name}
onChange={this.onProjectNameChanged}
/>
</FormGroup>
<FormGroup fieldId="owner" label="Owner" helperText="The user who owns the project">
<Select
variant={SelectVariant.typeahead}
typeAheadAriaLabel="Select user"
onToggle={this.onOwnerToggle}
onSelect={this.onOwnerSelect}
onClear={this.onOwnerClear}
onTypeaheadInputChanged={this.onOwnerChanged}
selections={owner}
isOpen={this.state.isOwnerOpen}
aria-labelledby="owner"
placeholderText="Select user"
>
{users.map(user => (
<SelectOption key={user.id} value={userToOption(user)} description={user.email} />
))}
</Select>
</FormGroup>
<ActionGroup>
<Button
variant="primary"
ouiaId="admin-project-edit-save"
onClick={this.onSubmitClick}
>
Submit
</Button>
<Button
variant="secondary"
ouiaId="admin-project-edit-cancel"
component={(props: any) => <Link {...props} to="/admin/projects" />}
>
Cancel
</Button>
</ActionGroup>
</Form>
</CardBody>
</Card>
}
</PageSection>
</React.Fragment>
);
}
Example #4
Source File: report-builder.js From ibutsu-server with MIT License | 5 votes |
render() {
document.title = 'Report Builder | Ibutsu';
const { columns, rows, actions } = this.state;
const reportTypes = this.state.reportTypes.map((reportType) => <FormSelectOption key={reportType.type} value={reportType.type} label={reportType.name} />);
const pagination = {
page: this.state.page,
pageSize: this.state.pageSize,
totalItems: this.state.totalItems
};
return (
<React.Fragment>
<PageSection variant={PageSectionVariants.light}>
<TextContent>
<Text component="h1">Report Builder</Text>
</TextContent>
</PageSection>
<PageSection>
<Card>
<CardBody>
<Form isHorizontal>
<FormGroup isRequired label="Report Type" helperText="The type of report" fieldId="report-type">
<FormSelect id="report-type" value={this.state.reportType} onChange={this.onReportTypeChange}>
{reportTypes}
</FormSelect>
</FormGroup>
<FormGroup label="Filter" fieldId="report-filter">
<TextInput type="text" id="report-filter" value={this.state.reportFilter} onChange={this.onReportFilterChange} />
<ExpandableSection toggleText="Filter Help" onToggle={this.onHelpToggle} isExpanded={this.state.isHelpExpanded}>
<TextContent>
<p>The filter parameter takes a comma-separated list of filters to apply. <Linkify componentDecorator={linkifyDecorator}>https://docs.ibutsu-project.org/en/latest/user-guide/filter-help.html</Linkify></p>
</TextContent>
</ExpandableSection>
</FormGroup>
<FormGroup label="Source" helperText="The source of report" fieldId="report-source">
<TextInput type="text" id="report-source" value={this.state.reportSource} onChange={this.onReportSourceChange} />
</FormGroup>
<ActionGroup>
<Button variant="primary" onClick={this.onRunReportClick}>Run Report</Button>
</ActionGroup>
</Form>
</CardBody>
<CardFooter>
<Text className="disclaimer" component="h4">
* Note: reports can only show a maximum of 100,000 results.
</Text>
</CardFooter>
</Card>
</PageSection>
<PageSection>
<Card>
<CardBody>
<FilterTable
columns={columns}
rows={rows}
actions={actions}
pagination={pagination}
isEmpty={this.state.isEmpty}
isError={this.state.isError}
onSetPage={this.setPage}
onSetPageSize={this.setPageSize}
/>
</CardBody>
</Card>
</PageSection>
</React.Fragment>
);
}
Example #5
Source File: ModalConfirm.js From cockpit-wicked with GNU General Public License v2.0 | 5 votes |
ModalConfirm = ({
caption,
title,
isOpen = false,
onConfirm,
onConfirmDisable = false,
onConfirmLabel = _("Confirm"),
onCancel,
onCancelLabel = _("Cancel"),
variant = ModalVariant.small,
children
}) => {
if (!isOpen) return;
return (
<Modal
aria-label={title}
variant={variant}
isOpen={isOpen}
showClose={false}
header={
<>
<Text component={TextVariants.small} className='modal-form-caption'>
{caption}
</Text>
<Title headingLevel="h1">
{title}
</Title>
</>
}
footer={
<ActionGroup>
<Button key="confirm" variant="danger" onClick={onConfirm}>
{onConfirmLabel}
</Button>
<Button key="cancel" variant="link" onClick={onCancel}>
{onCancelLabel}
</Button>
</ActionGroup>
}
>
{children}
</Modal>
);
}
Example #6
Source File: ModalForm.js From cockpit-wicked with GNU General Public License v2.0 | 5 votes |
ModalForm = ({
caption,
title,
isOpen = false,
onSubmit,
onSubmitDisable = false,
onSubmitLabel = _("Apply"),
onCancel,
onCancelLabel = _("Cancel"),
variant = ModalVariant.small,
children
}) => {
if (!isOpen) return;
return (
<Modal
aria-label={title}
variant={variant}
isOpen={isOpen}
showClose={false}
header={
<>
<Text component={TextVariants.small} className='modal-form-caption'>
{caption}
</Text>
<Title headingLevel="h1">
{title}
</Title>
</>
}
footer={
<ActionGroup>
<Button key="submit" onClick={onSubmit} isDisabled={onSubmitDisable}>
{onSubmitLabel}
</Button>
<Button key="cancel" variant="link" onClick={onCancel}>
{onCancelLabel}
</Button>
</ActionGroup>
}
>
<Form>
{children}
</Form>
</Modal>
);
}
Example #7
Source File: ActivationKeys.js From sed-frontend with Apache License 2.0 | 4 votes |
ActivationKeys = () => {
const queryClient = useQueryClient();
const user = queryClient.getQueryData('user');
const { isLoading, error, data } = useActivationKeys();
const [isOpen, setisOpen] = useState(false);
const [currentKeyName, setCurrentKeyName] = useState('');
const [isDeleteActivationKeyModalOpen, setIsDeleteActivationKeyModalOpen] =
useState(false);
const [isEditActivationKeyModalOpen, setIsEditActivationKeyModalOpen] =
useState(false);
const handleModalToggle = () => {
setisOpen(!isOpen);
};
const actions = (activationKeyName) => {
return [
{
title: 'Edit',
onClick: () => handleEditActivationKeyModalToggle(activationKeyName),
},
{
title: 'Delete',
onClick: () => handleDeleteActivationKeyModalToggle(activationKeyName),
},
];
};
let pageContent;
if (isLoading) {
pageContent = <Loading />;
} else if (!isLoading && !error && !data.length) {
pageContent = (
<NoActivationKeysFound handleModalToggle={handleModalToggle} />
);
} else if (!isLoading && !error && data.length) {
pageContent = (
<>
<ActionGroup>
<CreateActivationKeyButton onClick={handleModalToggle} />
</ActionGroup>
<ActivationKeysTable actions={actions} />
</>
);
}
const setKeyName = (modalOpen, name) => {
let currentName = modalOpen ? '' : name;
setCurrentKeyName(currentName);
};
const handleDeleteActivationKeyModalToggle = (name) => {
setKeyName(isDeleteActivationKeyModalOpen, name);
setIsDeleteActivationKeyModalOpen(!isDeleteActivationKeyModalOpen);
};
const handleEditActivationKeyModalToggle = (name) => {
setKeyName(isEditActivationKeyModalOpen, name);
setIsEditActivationKeyModalOpen(!isEditActivationKeyModalOpen);
};
const Page = () => {
return (
<React.Fragment>
<PageHeader>
<Split hasGutter className="page-title">
<SplitItem isFilled>
<Flex>
<FlexItem spacer={{ default: 'spacerSm' }}>
<PageHeaderTitle title="Activation Keys" />
</FlexItem>
<FlexItem>
<ActivationKeysDocsPopover orgId={user.orgId} />
</FlexItem>
</Flex>
</SplitItem>
</Split>
<TextContent>
<Text component={TextVariants.p}>
Organization ID: {user.orgId}
</Text>
</TextContent>
</PageHeader>
<Main>
<PageSection variant={PageSectionVariants.light}>
{pageContent}
</PageSection>
</Main>
<CreateActivationKeyModal
isOpen={isOpen}
handleModalToggle={handleModalToggle}
/>
<EditActivationKeyModal
isOpen={isEditActivationKeyModalOpen}
handleModalToggle={handleEditActivationKeyModalToggle}
activationKeyName={currentKeyName}
/>
<DeleteActivationKeyConfirmationModal
handleModalToggle={handleDeleteActivationKeyModalToggle}
isOpen={isDeleteActivationKeyModalOpen}
name={currentKeyName}
/>
</React.Fragment>
);
};
if (user.rbacPermissions.canReadActivationKeys) {
return <Page />;
} else {
return <NoAccessView />;
}
}
Example #8
Source File: ActivationKeyForm.js From sed-frontend with Apache License 2.0 | 4 votes |
ActivationKeyForm = (props) => {
const { handleModalToggle, submitForm, isSuccess, isError, activationKey } =
props;
const { addSuccessNotification, addErrorNotification } = useNotifications();
const { isLoading, error, data } = useSystemPurposeAttributes();
const [name, setName] = useState('');
const [role, setRole] = useState('');
const [serviceLevel, setServiceLevel] = useState('');
const [usage, setUsage] = useState('');
const [validated, setValidated] = useState('default');
const nameRegex = '^[a-zA-Z0-9-_]*$';
const validationText =
'Provide a name to be used when registering the activation key. Your activation key name must be unique, may contain only numbers, letters, underscores, and hyphens, and less than 256 characters.';
const handleSubmit = (event) => {
event.preventDefault();
if (validated === 'success' || activationKey) {
submitForm(name, role, serviceLevel, usage);
} else {
setValidated('error');
}
};
const validateName = (value) => {
if (value.length === 0 || value.length > 255) {
setValidated('error');
} else if (!value.match(nameRegex)) {
setValidated('error');
} else {
setValidated('success');
setName(value);
}
};
useEffect(() => {
if (activationKey) {
setRole(activationKey.role);
setUsage(activationKey.usage);
setServiceLevel(activationKey.serviceLevel);
}
}, [activationKey]);
const createButtonDisabled = () => {
if (activationKey) {
return (
activationKey.role === role &&
activationKey.serviceLevel === serviceLevel &&
activationKey.usage === usage
);
} else {
return (
validated === 'error' || name.length === 0 || !name.match(nameRegex)
);
}
};
if (isSuccess) {
const successMessage = activationKey
? `Activation key ${activationKey.name} updated successfully.`
: 'Activation key created successfully.';
addSuccessNotification(successMessage, {
timeout: false,
});
handleModalToggle();
} else if (isError) {
const errorMessage = activationKey
? `Error updating activation key ${activationKey.name}.`
: 'Activation Key was not created, please try again.';
addErrorNotification(errorMessage, {
timeout: 8000,
});
handleModalToggle();
}
return (
<Form id="activation-key-form" onSubmit={handleSubmit}>
{!activationKey && (
<FormGroup label="Name" isRequired helperText={validationText}>
<TextInput
id="activation-key-name"
label="Name"
isRequired
type="text"
validated={validated}
onChange={validateName}
name="name"
/>
</FormGroup>
)}
{activationKey && (
<FormGroup label="Name">
{' '}
<TextContent>{activationKey.name}</TextContent>
</FormGroup>
)}
{!isLoading && !error && (
<ActivationKeysFormSelect
data={data.roles}
value={role}
onSelect={setRole}
label="Role"
name="role"
placeholderValue="Select role"
disableDefaultValues={activationKey ? true : false}
popover={
<Popover
bodyContent={
<TextContent>
<Text component={TextVariants.p}>
Role is used to categorize systems by the workload on the
system
</Text>
<Text component={TextVariants.p}>
Subscription Watch can help you filter and report by these
items.
</Text>
<Text component={TextVariants.p}>
Only roles available to your account are shown.
</Text>
</TextContent>
}
>
<HelpIcon />
</Popover>
}
helperText="Select the required role from the list. The list only contains roles available to the activation key."
/>
)}
{!isLoading && !error && (
<ActivationKeysFormSelect
data={data.serviceLevel}
value={serviceLevel}
onSelect={setServiceLevel}
label="Service Level Agreement (SLA)"
name="serviceLevel"
placeholderValue="Select a service level agreement"
disableDefaultValues={activationKey ? true : false}
popover={
<Popover
bodyContent={
<TextContent>
<Text component={TextVariants.p}>
Service Level Agreement (SLA) determines the level of
support for systems registered with this activation key.
</Text>
</TextContent>
}
>
<HelpIcon />
</Popover>
}
helperText="Select the required service level from the list. The list only contains service levels available to the activation key."
/>
)}
{!isLoading && !error && (
<ActivationKeysFormSelect
data={data.usage}
value={usage}
onSelect={setUsage}
label="Usage"
name="usage"
placeholderValue="Select usage"
disableDefaultValues={activationKey ? true : false}
popover={
<Popover
bodyContent={
<TextContent>
<Text component={TextVariants.p}>
Usage is used to categorize systems by how they are meant to
be used, and therefore supported.
</Text>
<Text component={TextVariants.p}>
Subscription Watch can help you filter and report by these
items.
</Text>
</TextContent>
}
>
<HelpIcon />
</Popover>
}
helperText="Select the required usage from the list. The list only contains usages available to the activation key."
/>
)}
<ActionGroup>
<Button
key="create"
id="submit-activation-key-button"
variant="primary"
type="submit"
isDisabled={createButtonDisabled()}
data-testid="activation-key-submit-button"
>
{activationKey ? 'Save changes' : 'Create'}
</Button>
<Button
key="cancel"
id="cancel-activation-key-button"
variant="link"
onClick={handleModalToggle}
>
Cancel
</Button>
</ActionGroup>
</Form>
);
}
Example #9
Source File: login.js From ibutsu-server with MIT License | 4 votes |
render() {
const socialMediaLoginContent = (
<React.Fragment>
{this.state.externalLogins.keycloak &&
<LoginMainFooterLinksItem onClick={this.onKeycloakLogin} href="#" linkComponentProps={{ 'aria-label': `Login with ${this.getKeycloakName()}`, 'title': `Login with ${this.getKeycloakName()}` }}>
{this.getKeycloakIcon()}
</LoginMainFooterLinksItem>
}
{this.state.externalLogins.google &&
<GoogleLogin
clientId={this.state.externalLogins.google.client_id}
scope={this.state.externalLogins.google.scope}
redirectUri={this.state.externalLogins.google.redirect_uri}
onSuccess={this.onGoogleLogin}
onFailure={(response) => console.error(response)}
render={renderProps => (
<LoginMainFooterLinksItem onClick={renderProps.onClick} href="#" linkComponentProps={{ 'aria-label': 'Login with Google', 'title': 'Login with Google' }}>
<GoogleIcon size="lg" />
</LoginMainFooterLinksItem>
)}
/>
}
{this.state.externalLogins.github &&
<OAuth2Login
isCrossOrigin={true}
authorizationUrl={this.state.externalLogins.github.authorization_url}
responseType="code"
clientId={this.state.externalLogins.github.client_id}
redirectUri={this.state.externalLogins.github.redirect_uri}
scope={this.state.externalLogins.github.scope}
onSuccess={this.onOAuth2Success}
onFailure={(response) => console.error(response)}
render={renderProps => (
<LoginMainFooterLinksItem onClick={renderProps.onClick} href="#" linkComponentProps={{ 'aria-label': 'Login with GitHub', 'title': 'Login with GitHub' }}>
<GithubIcon size="lg" />
</LoginMainFooterLinksItem>
)}
/>
}
{this.state.externalLogins.facebook &&
<FacebookLogin
appId={this.state.externalLogins.facebook.app_id}
onSuccess={this.onFacebookLogin}
onFail={(response) => console.error(response)}
// useRedirect={true}
dialogParams={{redirect_uri: this.state.externalLogins.facebook.redirect_uri, response_type: 'code'}}
render={(renderProps) => (
<LoginMainFooterLinksItem onClick={renderProps.onClick} href="#" linkComponentProps={{ 'aria-label': 'Login with Facebook' }}>
<FacebookIcon size="lg" />
</LoginMainFooterLinksItem>
)}
/>
}
{this.state.externalLogins.gitlab &&
<OAuth2Login
isCrossOrigin={true}
authorizationUrl={this.state.externalLogins.gitlab.authorization_url}
responseType="code"
clientId={this.state.externalLogins.gitlab.client_id}
redirectUri={this.state.externalLogins.gitlab.redirect_uri}
scope={this.state.externalLogins.gitlab.scope}
onSuccess={this.onOAuth2Success}
onFailure={(response) => console.error(response)}
render={renderProps => (
<LoginMainFooterLinksItem onClick={renderProps.onClick} href="#" linkComponentProps={{ 'aria-label': 'Login with GitLab', 'title': 'Login with GitLab' }}>
<GitlabIcon size="lg" />
</LoginMainFooterLinksItem>
)}
/>
}
</React.Fragment>
);
const signUpForAccountMessage = (
<LoginMainFooterBandItem>
Need an account? <NavLink to="/sign-up">Sign up.</NavLink>
</LoginMainFooterBandItem>
);
const forgotCredentials = (
<LoginMainFooterBandItem>
<NavLink to="/forgot-password">Forgot username or password?</NavLink>
</LoginMainFooterBandItem>
);
const loginWithUserDescription = 'Please use your e-mail address and password, or login via one of the icons below the Log In button.';
const loginWithoutUserDescription = 'Log in via one of the icons below.';
const backgroundImages = {
lg: '/images/pfbg_1200.jpg',
sm: '/images/pfbg_768.jpg',
sm2x: '/images/[email protected]',
xs: '/images/pfbg_576.jpg',
xs2x: '/images/[email protected]'
};
return (
<LoginPage
footerListVariants="inline"
brandImgSrc="/images/ibutsu-wordart-164.png"
brandImgAlt="Ibutsu"
backgroundImgSrc={backgroundImages}
backgroundImgAlt="Background image"
textContent="Ibutsu is an open source test result aggregation tool. Collect and display your test results, view artifacts, and monitor tests."
loginTitle="Log in to your account"
loginSubtitle={this.state.loginSupport.user ? loginWithUserDescription : loginWithoutUserDescription}
socialMediaLoginContent={socialMediaLoginContent}
signUpForAccountMessage={this.state.loginSupport.user ? signUpForAccountMessage : ''}
forgotCredentials={this.state.loginSupport.user ? forgotCredentials : ''}
>
{this.state.loginSupport.user &&
<Form>
<FormAlert>
{this.state.alert && this.state.alert.message &&
<Alert
variant={this.state.alert.status || 'info'}
title={this.state.alert.message}
aria-live="polite"
isInline
/>
}
</FormAlert>
<FormGroup
label="Email address"
isRequired
fieldId="email"
validated={this.state.isValidEmail ? 'default' : 'error'}
>
<TextInput
isRequired
type="email"
id="email"
name="email"
validated={this.state.isValidEmail ? 'default' : 'error'}
aria-describedby="email-helper"
value={this.state.emailValue}
onChange={this.onEmailChange}
onKeyPress={this.onEnterKeyPress}
/>
</FormGroup>
<FormGroup
label="Password"
isRequired
fieldId="password"
validated={this.state.isValidPassword ? 'default' : 'error'}
>
<InputGroup>
{!this.state.isPasswordVisible &&
<TextInput
isRequired
type="password"
id="password"
name="password"
validated={this.state.isValidPassword ? 'default' : 'error'}
aria-describedby="password-helper"
value={this.state.passwordValue}
onChange={this.onPasswordChange}
onKeyPress={this.onEnterKeyPress} />
}
{this.state.isPasswordVisible &&
<TextInput
isRequired
type="text"
id="password"
name="password"
validated={this.state.isValidPassword ? 'default' : 'error'}
aria-describedby="password-helper"
value={this.state.passwordValue}
onChange={this.onPasswordChange}
onKeyPress={this.onEnterKeyPress} />
}
<Button variant="control" aria-label="Show password" onClick={this.onPasswordVisibleClick}>
{!this.state.isPasswordVisible && <EyeIcon/>}
{this.state.isPasswordVisible && <EyeSlashIcon/>}
</Button>
</InputGroup>
</FormGroup>
<ActionGroup>
<Button
variant="primary"
isBlock
isLoading={this.state.isLoggingIn}
isDisabled={this.state.isLoggingIn}
onClick={this.onLoginButtonClick}
>
{this.state.isLoggingIn ? 'Logging in...' : 'Log In'}
</Button>
</ActionGroup>
</Form>
}
</LoginPage>
);
}
Example #10
Source File: user-edit.js From ibutsu-server with MIT License | 4 votes |
render() {
const { user, projects, userProjects } = this.state;
return (
<React.Fragment>
<PageSection variant={PageSectionVariants.light}>
<Title headingLevel="h1" size='2xl' className="pf-c-title">
Users / {user && user.name} {' '}
{user && user.is_superadmin &&
<Label className="super-admin-label" variant="outline" color="blue">Administrator</Label>
}
</Title>
</PageSection>
<PageSection>
{!user && <Alert variant="info" title="Loading..." />}
{user &&
<Card>
<CardBody>
<Form>
<FormGroup label="Name" isRequired fieldId="userName" helperText="The user's name">
<TextInput
isRequired
type="text"
id="userName"
name="userName"
aria-describedby="The user's name"
value={user.name}
onChange={this.onUserNameChanged}
/>
</FormGroup>
<FormGroup label="E-mail" isRequired fieldId="userEmail" helperText="The user's e-mail address">
<TextInput
isRequired
type="email"
id="userEmail"
name="userEmail"
aria-describedby="The user's e-mail address"
value={user.email}
onChange={this.onUserEmailChanged}
/>
</FormGroup>
<FormGroup fieldId="userStatus" label="User status">
<Checkbox
label="Is active"
id="userIsActive"
name="userIsActive"
aria-label="User is active"
isChecked={user.is_active}
onChange={this.onIsActiveToggle}
/>
<Checkbox
label="Is administrator"
id="userIsAdmin"
name="userIsAdmin"
aria-label="User is administrator"
isChecked={user.is_superadmin}
onChange={this.onIsAdminToggle}
/>
</FormGroup>
<FormGroup fieldId="userProjects" label="Projects" helperText="The projects to which a user has access">
<Select
variant={SelectVariant.typeaheadMulti}
typeAheadAriaLabel="Select one or more projects"
onToggle={this.onProjectsToggle}
onSelect={this.onProjectsSelect}
onClear={this.onProjectsClear}
selections={userProjects}
isOpen={this.state.isProjectsOpen}
aria-labelledby="userProjects"
placeholderText="Select one or more projects"
>
{projects.map(project => (
<SelectOption key={project.id} value={projectToOption(project)} description={project.name} />
))}
</Select>
</FormGroup>
<ActionGroup>
<Button variant="primary" onClick={this.onSubmitClick}>Submit</Button>
<Button variant="secondary" onClick={this.props.history.goBack}>Cancel</Button>
</ActionGroup>
</Form>
</CardBody>
</Card>
}
</PageSection>
</React.Fragment>
);
}
Example #11
Source File: reset-password.js From ibutsu-server with MIT License | 4 votes |
render() {
const loginMessage = (
<LoginMainFooterBandItem>
Already registered? <NavLink to="/login">Log in.</NavLink>
</LoginMainFooterBandItem>
);
const forgotCredentials = (
<LoginMainFooterBandItem>
<NavLink to="/forgot-password">Forgot username or password?</NavLink>
</LoginMainFooterBandItem>
);
const backgroundImages = {
lg: '/images/pfbg_1200.jpg',
sm: '/images/pfbg_768.jpg',
sm2x: '/images/[email protected]',
xs: '/images/pfbg_576.jpg',
xs2x: '/images/[email protected]'
};
return (
<LoginPage
footerListVariants="inline"
brandImgSrc="/images/ibutsu-wordart-164.png"
brandImgAlt="Ibutsu"
backgroundImgSrc={backgroundImages}
backgroundImgAlt="Background image"
textContent="Ibutsu is an open source test result aggregation. Collect and display your test results, view artifacts, and monitor tests."
loginTitle="Reset your password"
loginSubtitle="Please type in a secure password"
signUpForAccountMessage={loginMessage}
forgotCredentials={forgotCredentials}
>
<Form>
{this.state.showAlert &&
<FormAlert>
<Alert variant={this.state.alertType} title={this.state.alertText} aria-live="polite" isInline/>
</FormAlert>
}
<FormGroup
label="Password"
isRequired
fieldId="password"
validated={this.state.isValidPassword ? 'default' : 'error'}
>
<InputGroup>
{!this.state.isPasswordVisible &&
<TextInput
isRequired
type="password"
id="password"
name="password"
validated={this.state.isValidPassword ? 'default' : 'error'}
aria-describedby="password-helper"
value={this.state.passwordValue}
onChange={this.onPasswordChange} />
}
{this.state.isPasswordVisible &&
<TextInput
isRequired
type="text"
id="password"
name="password"
validated={this.state.isValidPassword ? 'default' : 'error'}
aria-describedby="password-helper"
value={this.state.passwordValue}
onChange={this.onPasswordChange} />}
<Button variant="control" aria-label="Show password" onClick={this.onPasswordVisibleClick}>
{!this.state.isPasswordVisible && <EyeIcon/>}
{this.state.isPasswordVisible && <EyeSlashIcon/>}
</Button>
</InputGroup>
<PasswordErrorBoundary>
<Suspense fallback={""}>
<PasswordStrengthBar password={this.state.passwordValue}/>
</Suspense>
</PasswordErrorBoundary>
</FormGroup>
<FormGroup
label="Confirm password"
isRequired
fieldId="confirm-password"
helperText={this.state.confirmPasswordHelpText}
helperTextInvalid="Passwords do not match"
validated={this.state.confirmPasswordValidation}
>
<InputGroup>
{!this.state.isConfirmPasswordVisible && <TextInput isRequired type="password" id="confirm-password" name="confirm-password" aria-describedby="confirm-password-helper" value={this.state.confirmPasswordValue} onChange={this.onConfirmPasswordChange} validated={this.state.confirmPasswordValidation} />}
{this.state.isConfirmPasswordVisible && <TextInput isRequired type="text" id="confirm-password" name="confirm-password" aria-describedby="confirm-password-helper" value={this.state.confirmPasswordValue} onChange={this.onConfirmPasswordChange} validated={this.state.confirmPasswordValidation} />}
<Button variant="control" aria-label="Show password" onClick={this.onConfirmPasswordVisibleClick}>
{!this.state.isConfirmPasswordVisible && <EyeIcon/>}
{this.state.isConfirmPasswordVisible && <EyeSlashIcon/>}
</Button>
</InputGroup>
</FormGroup>
<ActionGroup>
<Button variant="primary" isBlock onClick={this.onResetButtonClick}>Reset Password</Button>
</ActionGroup>
</Form>
</LoginPage>
);
}
Example #12
Source File: sign-up.js From ibutsu-server with MIT License | 4 votes |
render() {
const loginMessage = (
<LoginMainFooterBandItem>
Already registered? <NavLink to="/login">Log in.</NavLink>
</LoginMainFooterBandItem>
);
const forgotCredentials = (
<LoginMainFooterBandItem>
<NavLink to="/forgot-password">Forgot username or password?</NavLink>
</LoginMainFooterBandItem>
);
const backgroundImages = {
lg: '/images/pfbg_1200.jpg',
sm: '/images/pfbg_768.jpg',
sm2x: '/images/[email protected]',
xs: '/images/pfbg_576.jpg',
xs2x: '/images/[email protected]'
};
return (
<LoginPage
footerListVariants="inline"
brandImgSrc="/images/ibutsu-wordart-164.png"
brandImgAlt="Ibutsu"
backgroundImgSrc={backgroundImages}
backgroundImgAlt="Background image"
textContent="Ibutsu is an open source test result aggregation. Collect and display your test results, view artifacts, and monitor tests."
loginTitle="Register a new account"
loginSubtitle="Please type in your e-mail address and a secure password"
signUpForAccountMessage={loginMessage}
forgotCredentials={forgotCredentials}
>
<Form>
{this.state.showAlert &&
<FormAlert>
<Alert variant={this.state.alertType} title={this.state.alertText} aria-live="polite" isInline/>
</FormAlert>
}
<FormGroup
label="Email address"
isRequired
fieldId="email"
validated={this.state.isValidEmail ? 'default' : 'error'}
helperText="The e-mail address you want to use to log in"
>
<TextInput
isRequired
type="email"
id="email"
name="email"
validated={this.state.isValidEmail ? 'default' : 'error'}
aria-describedby="email-helper"
value={this.state.emailValue}
onChange={this.onEmailChange}
/>
</FormGroup>
<FormGroup
label="Password"
isRequired
fieldId="password"
validated={this.state.isValidPassword ? 'default' : 'error'}
>
<InputGroup>
{!this.state.isPasswordVisible &&
<TextInput
isRequired
type="password"
id="password"
name="password"
validated={this.state.isValidPassword ? 'default' : 'error'}
aria-describedby="password-helper"
value={this.state.passwordValue}
onChange={this.onPasswordChange} />
}
{this.state.isPasswordVisible &&
<TextInput
isRequired
type="text"
id="password"
name="password"
validated={this.state.isValidPassword ? 'default' : 'error'}
aria-describedby="password-helper"
value={this.state.passwordValue}
onChange={this.onPasswordChange} />}
<Button variant="control" aria-label="Show password" onClick={this.onPasswordVisibleClick}>
{!this.state.isPasswordVisible && <EyeIcon/>}
{this.state.isPasswordVisible && <EyeSlashIcon/>}
</Button>
</InputGroup>
<PasswordErrorBoundary>
<Suspense fallback={""}>
<PasswordStrengthBar password={this.state.passwordValue}/>
</Suspense>
</PasswordErrorBoundary>
</FormGroup>
<FormGroup
label="Confirm password"
isRequired
fieldId="confirm-password"
helperText={this.state.confirmPasswordHelpText}
helperTextInvalid="Passwords do not match"
validated={this.state.confirmPasswordValidation}
>
<InputGroup>
{!this.state.isConfirmPasswordVisible && <TextInput isRequired type="password" id="confirm-password" name="confirm-password" aria-describedby="confirm-password-helper" value={this.state.confirmPasswordValue} onChange={this.onConfirmPasswordChange} validated={this.state.confirmPasswordValidation} />}
{this.state.isConfirmPasswordVisible && <TextInput isRequired type="text" id="confirm-password" name="confirm-password" aria-describedby="confirm-password-helper" value={this.state.confirmPasswordValue} onChange={this.onConfirmPasswordChange} validated={this.state.confirmPasswordValidation} />}
<Button variant="control" aria-label="Show password" onClick={this.onConfirmPasswordVisibleClick}>
{!this.state.isConfirmPasswordVisible && <EyeIcon/>}
{this.state.isConfirmPasswordVisible && <EyeSlashIcon/>}
</Button>
</InputGroup>
</FormGroup>
<ActionGroup>
<Button variant="primary" isBlock onClick={this.onRegisterButtonClick}>Register</Button>
</ActionGroup>
</Form>
</LoginPage>
);
}