mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-25 00:07:47 +01:00
Merge branch 'main' into fix/context-form-validation
This commit is contained in:
commit
19abd37b60
@ -1,7 +1,7 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { useState, useEffect } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { TextField, FormControlLabel, Switch } from '@material-ui/core';
|
||||
import { FormButtons, styles as commonStyles } from '../../common';
|
||||
import { TextField, FormControlLabel, Switch, Button } from '@material-ui/core';
|
||||
import { styles as commonStyles } from '../../common';
|
||||
import { trim } from '../../common/util';
|
||||
import { AddonParameters } from './AddonParameters/AddonParameters';
|
||||
import { AddonEvents } from './AddonEvents/AddonEvents';
|
||||
@ -79,7 +79,7 @@ export const AddonForm = ({ editMode, provider, addon, fetch }) => {
|
||||
setErrors({ ...errors, events: undefined });
|
||||
};
|
||||
|
||||
const handleCancel = () => {
|
||||
const onCancel = () => {
|
||||
history.goBack();
|
||||
};
|
||||
|
||||
@ -203,10 +203,12 @@ export const AddonForm = ({ editMode, provider, addon, fetch }) => {
|
||||
/>
|
||||
</section>
|
||||
<section className={styles.formSection}>
|
||||
<FormButtons
|
||||
submitText={submitText}
|
||||
onCancel={handleCancel}
|
||||
/>
|
||||
<Button type="submit" color="primary" variant="contained">
|
||||
{submitText}
|
||||
</Button>
|
||||
<Button type="button" onClick={onCancel}>
|
||||
Cancel
|
||||
</Button>
|
||||
</section>
|
||||
</form>
|
||||
</PageContent>
|
||||
|
@ -44,7 +44,6 @@ export const AvailableAddons = ({
|
||||
onClick={() =>
|
||||
history.push(`/addons/create/${provider.name}`)
|
||||
}
|
||||
tooltip={`Configure ${provider.name} Addon`}
|
||||
>
|
||||
Configure
|
||||
</PermissionButton>
|
||||
|
@ -123,7 +123,6 @@ export const ConfiguredAddons = ({ getAddonIcon }: IConfigureAddonsProps) => {
|
||||
</PermissionIconButton>
|
||||
<PermissionIconButton
|
||||
permission={UPDATE_ADDON}
|
||||
tooltip={'Edit Addon'}
|
||||
onClick={() => {
|
||||
history.push(`/addons/edit/${addon.id}`);
|
||||
}}
|
||||
@ -132,7 +131,6 @@ export const ConfiguredAddons = ({ getAddonIcon }: IConfigureAddonsProps) => {
|
||||
</PermissionIconButton>
|
||||
<PermissionIconButton
|
||||
permission={DELETE_ADDON}
|
||||
tooltip={'Remove Addon'}
|
||||
onClick={() => {
|
||||
setDeletedAddon(addon);
|
||||
setShowDelete(true);
|
||||
|
@ -249,7 +249,7 @@ export const ApiTokenList = () => {
|
||||
}
|
||||
data-test={CREATE_API_TOKEN_BUTTON}
|
||||
>
|
||||
Create API token
|
||||
New API token
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
|
@ -126,7 +126,7 @@ to resources within a project"
|
||||
getRoleKey={getRoleKey}
|
||||
>
|
||||
<PermissionButton permission={ADMIN} type="submit">
|
||||
Edit role
|
||||
Save
|
||||
</PermissionButton>
|
||||
</ProjectRoleForm>
|
||||
</FormTemplate>
|
||||
|
@ -51,7 +51,6 @@ const RoleListItem = ({
|
||||
<PermissionIconButton
|
||||
data-loading
|
||||
aria-label="Edit"
|
||||
tooltip="Edit"
|
||||
disabled={type === BUILTIN_ROLE_TYPE}
|
||||
onClick={() => {
|
||||
history.push(`/admin/roles/${id}/edit`);
|
||||
@ -63,7 +62,6 @@ const RoleListItem = ({
|
||||
<PermissionIconButton
|
||||
data-loading
|
||||
aria-label="Remove role"
|
||||
tooltip="Remove role"
|
||||
disabled={type === BUILTIN_ROLE_TYPE}
|
||||
onClick={() => {
|
||||
setCurrentRole({ id, name, description });
|
||||
|
@ -96,7 +96,7 @@ const EditUser = () => {
|
||||
mode={EDIT}
|
||||
>
|
||||
<PermissionButton permission={ADMIN} type="submit">
|
||||
Edit user
|
||||
Save
|
||||
</PermissionButton>
|
||||
</UserForm>
|
||||
</FormTemplate>
|
||||
|
@ -35,7 +35,7 @@ const UsersAdmin = () => {
|
||||
history.push('/admin/create-user')
|
||||
}
|
||||
>
|
||||
Add new user
|
||||
New user
|
||||
</Button>
|
||||
}
|
||||
elseShow={
|
||||
|
@ -52,7 +52,6 @@ const Constraint = ({
|
||||
<div className={styles.btnContainer}>
|
||||
<PermissionIconButton
|
||||
onClick={editCallback}
|
||||
tooltip="Edit strategy"
|
||||
permission={UPDATE_FEATURE}
|
||||
projectId={projectId}
|
||||
>
|
||||
@ -61,7 +60,6 @@ const Constraint = ({
|
||||
|
||||
<PermissionIconButton
|
||||
onClick={deleteCallback}
|
||||
tooltip="Delete strategy"
|
||||
permission={UPDATE_FEATURE}
|
||||
projectId={projectId}
|
||||
>
|
||||
|
@ -16,7 +16,7 @@ export interface IPermissionIconButtonProps
|
||||
|
||||
const PermissionButton: React.FC<IPermissionIconButtonProps> = ({
|
||||
permission,
|
||||
tooltip = 'Click to perform action',
|
||||
tooltip,
|
||||
onClick,
|
||||
children,
|
||||
disabled,
|
||||
@ -54,9 +54,9 @@ const PermissionButton: React.FC<IPermissionIconButtonProps> = ({
|
||||
|
||||
access = handleAccess();
|
||||
|
||||
const tooltipText = access
|
||||
? tooltip
|
||||
: "You don't have access to perform this operation";
|
||||
const tooltipText = !access
|
||||
? "You don't have access to perform this operation"
|
||||
: '';
|
||||
|
||||
return (
|
||||
<Tooltip title={tooltipText} arrow>
|
||||
|
@ -39,9 +39,9 @@ const PermissionIconButton: React.FC<IPermissionIconButtonProps> = ({
|
||||
access = hasAccess(permission);
|
||||
}
|
||||
|
||||
const tooltipText = access
|
||||
? tooltip || ''
|
||||
: "You don't have access to perform this operation";
|
||||
const tooltipText = !access
|
||||
? "You don't have access to perform this operation"
|
||||
: '';
|
||||
|
||||
return (
|
||||
<Tooltip title={tooltipText} arrow>
|
||||
|
@ -19,7 +19,7 @@ const PermissionSwitch = React.forwardRef<
|
||||
>((props, ref) => {
|
||||
const {
|
||||
permission,
|
||||
tooltip = '',
|
||||
tooltip,
|
||||
disabled,
|
||||
projectId,
|
||||
environmentId,
|
||||
@ -39,9 +39,9 @@ const PermissionSwitch = React.forwardRef<
|
||||
access = hasAccess(permission);
|
||||
}
|
||||
|
||||
const tooltipText = access
|
||||
? tooltip
|
||||
: "You don't have access to perform this operation";
|
||||
const tooltipText = !access
|
||||
? "You don't have access to perform this operation"
|
||||
: '';
|
||||
|
||||
return (
|
||||
<Tooltip title={tooltipText} arrow>
|
||||
|
@ -128,7 +128,7 @@ const ContextList = () => {
|
||||
color="primary"
|
||||
variant="contained"
|
||||
>
|
||||
Add new context field
|
||||
New context field
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
|
@ -102,7 +102,7 @@ export const EditContext = () => {
|
||||
permission={UPDATE_CONTEXT_FIELD}
|
||||
type="submit"
|
||||
>
|
||||
Edit context
|
||||
Save
|
||||
</PermissionButton>
|
||||
</ContextForm>
|
||||
</FormTemplate>
|
||||
|
@ -87,7 +87,7 @@ const EditEnvironment = () => {
|
||||
clearErrors={clearErrors}
|
||||
>
|
||||
<PermissionButton permission={ADMIN} type="submit">
|
||||
Edit environment
|
||||
Save
|
||||
</PermissionButton>
|
||||
</EnvironmentForm>
|
||||
</FormTemplate>
|
||||
|
@ -175,12 +175,11 @@ const EnvironmentList = () => {
|
||||
<ResponsiveButton
|
||||
onClick={navigateToCreateEnvironment}
|
||||
maxWidth="700px"
|
||||
tooltip="Add environment"
|
||||
Icon={Add}
|
||||
permission={ADMIN}
|
||||
disabled={!Boolean(uiConfig.flags.EEA)}
|
||||
>
|
||||
Add Environment
|
||||
New Environment
|
||||
</ResponsiveButton>
|
||||
</>
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ const EditFeature = () => {
|
||||
projectId={project}
|
||||
type="submit"
|
||||
>
|
||||
Edit toggle
|
||||
Save
|
||||
</PermissionButton>
|
||||
</FeatureForm>
|
||||
</FormTemplate>
|
||||
|
@ -183,7 +183,7 @@ const FeatureToggleList = ({
|
||||
skeleton: loading,
|
||||
})}
|
||||
>
|
||||
Create feature toggle
|
||||
New feature toggle
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
|
@ -165,7 +165,7 @@ exports[`renders correctly with one feature 1`] = `
|
||||
<span
|
||||
className="MuiButton-label"
|
||||
>
|
||||
Create feature toggle
|
||||
New feature toggle
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
@ -362,7 +362,7 @@ exports[`renders correctly with one feature without permissions 1`] = `
|
||||
<span
|
||||
className="MuiButton-label"
|
||||
>
|
||||
Create feature toggle
|
||||
New feature toggle
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
|
@ -95,7 +95,6 @@ const FeatureOverviewEnvSwitch = ({
|
||||
checked={env.enabled}
|
||||
onChange={toggleEnvironment}
|
||||
environmentId={env.name}
|
||||
tooltip={''}
|
||||
/>
|
||||
{content}
|
||||
</div>
|
||||
|
@ -102,7 +102,6 @@ const FeatureSettingsProject = () => {
|
||||
show={
|
||||
<PermissionButton
|
||||
permission={MOVE_FEATURE_TOGGLE}
|
||||
tooltip="Update feature"
|
||||
onClick={() => setShowConfirmDialog(true)}
|
||||
projectId={projectId}
|
||||
>
|
||||
|
@ -282,7 +282,7 @@ const FeatureStrategiesEnvironments = () => {
|
||||
environmentId={activeEnvironment.name}
|
||||
permission={CREATE_FEATURE_STRATEGY}
|
||||
>
|
||||
Add new strategy
|
||||
New strategy
|
||||
</ResponsiveButton>
|
||||
}
|
||||
/>
|
||||
|
@ -294,7 +294,7 @@ const FeatureOverviewVariants = () => {
|
||||
permission={UPDATE_FEATURE_VARIANTS}
|
||||
projectId={projectId}
|
||||
>
|
||||
Add variant
|
||||
New variant
|
||||
</PermissionButton>
|
||||
<ConditionallyRender
|
||||
condition={editable}
|
||||
|
@ -92,7 +92,7 @@ const EditProject = () => {
|
||||
validateIdUniqueness={validateIdUniqueness}
|
||||
>
|
||||
<PermissionButton permission={UPDATE_PROJECT} type="submit">
|
||||
Edit project
|
||||
Save
|
||||
</PermissionButton>
|
||||
</ProjectForm>
|
||||
</FormTemplate>
|
||||
|
@ -125,7 +125,6 @@ const Project = () => {
|
||||
<div className={styles.titleText}>{project?.name}</div>
|
||||
<PermissionIconButton
|
||||
permission={UPDATE_PROJECT}
|
||||
tooltip="Edit"
|
||||
projectId={project?.id}
|
||||
onClick={() => history.push(`/projects/${id}/edit`)}
|
||||
data-loading
|
||||
|
@ -66,7 +66,6 @@ const ProjectFeatureToggles = ({
|
||||
)
|
||||
}
|
||||
maxWidth="700px"
|
||||
tooltip="New feature toggle"
|
||||
Icon={Add}
|
||||
projectId={id}
|
||||
permission={CREATE_FEATURE}
|
||||
|
@ -50,7 +50,6 @@ const ProjectInfo = ({
|
||||
const permissionButton = (
|
||||
<PermissionIconButton
|
||||
permission={UPDATE_PROJECT}
|
||||
tooltip={'Edit description'}
|
||||
projectId={id}
|
||||
component={Link}
|
||||
className={permissionButtonClass}
|
||||
|
@ -139,7 +139,7 @@ const ProjectListNew = () => {
|
||||
tooltip={createButtonData.title}
|
||||
disabled={createButtonData.disabled}
|
||||
>
|
||||
Add new project
|
||||
New project
|
||||
</ResponsiveButton>
|
||||
}
|
||||
/>
|
||||
|
@ -72,7 +72,6 @@ export const StrategiesList = () => {
|
||||
data-test={ADD_NEW_STRATEGY_ID}
|
||||
onClick={() => history.push('/strategies/create')}
|
||||
permission={CREATE_STRATEGY}
|
||||
tooltip={'Add new strategy'}
|
||||
>
|
||||
<Add />
|
||||
</PermissionIconButton>
|
||||
@ -83,9 +82,8 @@ export const StrategiesList = () => {
|
||||
color="primary"
|
||||
permission={CREATE_STRATEGY}
|
||||
data-test={ADD_NEW_STRATEGY_ID}
|
||||
tooltip={'Add new strategy'}
|
||||
>
|
||||
Add new strategy
|
||||
New strategy
|
||||
</PermissionButton>
|
||||
}
|
||||
/>
|
||||
@ -168,7 +166,6 @@ export const StrategiesList = () => {
|
||||
<PermissionIconButton
|
||||
onClick={() => onReactivateStrategy(strategy)}
|
||||
permission={UPDATE_STRATEGY}
|
||||
tooltip={'Reactivate activation strategy'}
|
||||
>
|
||||
<VisibilityOff />
|
||||
</PermissionIconButton>
|
||||
@ -208,7 +205,6 @@ export const StrategiesList = () => {
|
||||
<PermissionIconButton
|
||||
onClick={() => onDeleteStrategy(strategy)}
|
||||
permission={DELETE_STRATEGY}
|
||||
tooltip={'Delete strategy'}
|
||||
>
|
||||
<Delete />
|
||||
</PermissionIconButton>
|
||||
|
@ -178,7 +178,7 @@ export const StrategyForm = ({ editMode, strategy }: IStrategyFormProps) => {
|
||||
color="primary"
|
||||
style={{ display: 'block' }}
|
||||
>
|
||||
Update
|
||||
Save
|
||||
</Button>
|
||||
}
|
||||
elseShow={
|
||||
|
@ -38,7 +38,7 @@ exports[`renders correctly with one strategy 1`] = `
|
||||
onMouseOver={[Function]}
|
||||
onTouchEnd={[Function]}
|
||||
onTouchStart={[Function]}
|
||||
title="Add new strategy"
|
||||
title=""
|
||||
>
|
||||
<button
|
||||
className="MuiButtonBase-root MuiButton-root MuiButton-contained MuiButton-containedPrimary"
|
||||
@ -62,7 +62,7 @@ exports[`renders correctly with one strategy 1`] = `
|
||||
<span
|
||||
className="MuiButton-label"
|
||||
>
|
||||
Add new strategy
|
||||
New strategy
|
||||
<span
|
||||
className="MuiButton-endIcon MuiButton-iconSizeMedium"
|
||||
/>
|
||||
@ -135,7 +135,7 @@ exports[`renders correctly with one strategy 1`] = `
|
||||
onMouseOver={[Function]}
|
||||
onTouchEnd={[Function]}
|
||||
onTouchStart={[Function]}
|
||||
title="Deprecate activation strategy"
|
||||
title=""
|
||||
>
|
||||
<button
|
||||
className="MuiButtonBase-root MuiIconButton-root"
|
||||
@ -263,7 +263,7 @@ exports[`renders correctly with one strategy without permissions 1`] = `
|
||||
onMouseOver={[Function]}
|
||||
onTouchEnd={[Function]}
|
||||
onTouchStart={[Function]}
|
||||
title="Add new strategy"
|
||||
title=""
|
||||
>
|
||||
<button
|
||||
className="MuiButtonBase-root MuiButton-root MuiButton-contained MuiButton-containedPrimary"
|
||||
@ -287,7 +287,7 @@ exports[`renders correctly with one strategy without permissions 1`] = `
|
||||
<span
|
||||
className="MuiButton-label"
|
||||
>
|
||||
Add new strategy
|
||||
New strategy
|
||||
<span
|
||||
className="MuiButton-endIcon MuiButton-iconSizeMedium"
|
||||
/>
|
||||
@ -360,7 +360,7 @@ exports[`renders correctly with one strategy without permissions 1`] = `
|
||||
onMouseOver={[Function]}
|
||||
onTouchEnd={[Function]}
|
||||
onTouchStart={[Function]}
|
||||
title="Deprecate activation strategy"
|
||||
title=""
|
||||
>
|
||||
<button
|
||||
className="MuiButtonBase-root MuiIconButton-root"
|
||||
|
@ -76,7 +76,7 @@ const EditTagType = () => {
|
||||
clearErrors={clearErrors}
|
||||
>
|
||||
<PermissionButton permission={UPDATE_TAG_TYPE} type="submit">
|
||||
Edit type
|
||||
Save
|
||||
</PermissionButton>
|
||||
</TagForm>
|
||||
</FormTemplate>
|
||||
|
@ -81,7 +81,7 @@ export const TagTypeList = () => {
|
||||
history.push('/tag-types/create')
|
||||
}
|
||||
>
|
||||
Add new tag type
|
||||
New tag type
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
|
@ -50,7 +50,7 @@ exports[`renders a list with elements correctly 1`] = `
|
||||
<span
|
||||
className="MuiButton-label"
|
||||
>
|
||||
Add new tag type
|
||||
New tag type
|
||||
</span>
|
||||
<span
|
||||
className="MuiTouchRipple-root"
|
||||
@ -126,7 +126,7 @@ exports[`renders an empty list correctly 1`] = `
|
||||
<span
|
||||
className="MuiButton-label"
|
||||
>
|
||||
Add new tag type
|
||||
New tag type
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user