mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-04 00:18:01 +01:00
refactor: remove unused tooltip prop (#769)
* refactor: remove unused tooltip prop * refactor: fix PermissionButton base props * refactor: sync yarn.lock * refactor: fix unused ts-expect-error
This commit is contained in:
parent
3ed8564758
commit
ab4efe0837
@ -112,7 +112,6 @@ export const ConfiguredAddons = ({ getAddonIcon }: IConfigureAddonsProps) => {
|
|||||||
<ListItemSecondaryAction>
|
<ListItemSecondaryAction>
|
||||||
<PermissionIconButton
|
<PermissionIconButton
|
||||||
permission={UPDATE_ADDON}
|
permission={UPDATE_ADDON}
|
||||||
tooltip={addon.enabled ? 'Disable addon' : 'Enable addon'}
|
|
||||||
onClick={() => toggleAddon(addon)}
|
onClick={() => toggleAddon(addon)}
|
||||||
>
|
>
|
||||||
<ConditionallyRender
|
<ConditionallyRender
|
||||||
|
@ -48,7 +48,6 @@ const NoItemsStrategies = ({
|
|||||||
condition={Boolean(onClick)}
|
condition={Boolean(onClick)}
|
||||||
show={
|
show={
|
||||||
<PermissionButton
|
<PermissionButton
|
||||||
// @ts-expect-error
|
|
||||||
variant="contained"
|
variant="contained"
|
||||||
permission={CREATE_FEATURE_STRATEGY}
|
permission={CREATE_FEATURE_STRATEGY}
|
||||||
projectId={projectId}
|
projectId={projectId}
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
import { Button, Tooltip } from '@material-ui/core';
|
import { Button, Tooltip, ButtonProps } from '@material-ui/core';
|
||||||
import { Lock } from '@material-ui/icons';
|
import { Lock } from '@material-ui/icons';
|
||||||
import AccessContext from 'contexts/AccessContext';
|
import AccessContext from 'contexts/AccessContext';
|
||||||
import React, { useContext } from 'react';
|
import React, { useContext } from 'react';
|
||||||
import ConditionallyRender from '../ConditionallyRender';
|
import ConditionallyRender from '../ConditionallyRender';
|
||||||
|
|
||||||
export interface IPermissionButtonProps
|
export interface IPermissionButtonProps extends ButtonProps {
|
||||||
extends React.HTMLProps<HTMLButtonElement> {
|
|
||||||
permission: string | string[];
|
permission: string | string[];
|
||||||
tooltip?: string;
|
|
||||||
onClick?: (e: any) => void;
|
onClick?: (e: any) => void;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
projectId?: string;
|
projectId?: string;
|
||||||
@ -16,7 +14,6 @@ export interface IPermissionButtonProps
|
|||||||
|
|
||||||
const PermissionButton: React.FC<IPermissionButtonProps> = ({
|
const PermissionButton: React.FC<IPermissionButtonProps> = ({
|
||||||
permission,
|
permission,
|
||||||
tooltip,
|
|
||||||
onClick,
|
onClick,
|
||||||
children,
|
children,
|
||||||
disabled,
|
disabled,
|
||||||
@ -65,7 +62,6 @@ const PermissionButton: React.FC<IPermissionButtonProps> = ({
|
|||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
disabled={disabled || !access}
|
disabled={disabled || !access}
|
||||||
variant="contained"
|
variant="contained"
|
||||||
// @ts-expect-error
|
|
||||||
color="primary"
|
color="primary"
|
||||||
{...rest}
|
{...rest}
|
||||||
endIcon={
|
endIcon={
|
||||||
|
@ -1,16 +1,13 @@
|
|||||||
import { IconButton, Tooltip } from '@material-ui/core';
|
import { IconButton, Tooltip, IconButtonProps } from '@material-ui/core';
|
||||||
import React, { useContext } from 'react';
|
import React, { useContext } from 'react';
|
||||||
import AccessContext from '../../../contexts/AccessContext';
|
import AccessContext from '../../../contexts/AccessContext';
|
||||||
|
|
||||||
interface IPermissionIconButtonProps
|
interface IPermissionIconButtonProps extends IconButtonProps {
|
||||||
extends React.HTMLProps<HTMLButtonElement> {
|
|
||||||
permission: string;
|
permission: string;
|
||||||
Icon?: React.ElementType;
|
Icon?: React.ElementType;
|
||||||
tooltip?: string;
|
|
||||||
onClick?: (e: any) => void;
|
onClick?: (e: any) => void;
|
||||||
projectId?: string;
|
projectId?: string;
|
||||||
environmentId?: string;
|
environmentId?: string;
|
||||||
edge?: string;
|
|
||||||
className?: string;
|
className?: string;
|
||||||
title?: string;
|
title?: string;
|
||||||
}
|
}
|
||||||
@ -18,7 +15,6 @@ interface IPermissionIconButtonProps
|
|||||||
const PermissionIconButton: React.FC<IPermissionIconButtonProps> = ({
|
const PermissionIconButton: React.FC<IPermissionIconButtonProps> = ({
|
||||||
permission,
|
permission,
|
||||||
Icon,
|
Icon,
|
||||||
tooltip,
|
|
||||||
onClick,
|
onClick,
|
||||||
projectId,
|
projectId,
|
||||||
children,
|
children,
|
||||||
@ -43,7 +39,6 @@ const PermissionIconButton: React.FC<IPermissionIconButtonProps> = ({
|
|||||||
return (
|
return (
|
||||||
<Tooltip title={tooltipText} arrow>
|
<Tooltip title={tooltipText} arrow>
|
||||||
<span>
|
<span>
|
||||||
{/* @ts-expect-error */}
|
|
||||||
<IconButton onClick={onClick} disabled={!access} {...rest}>
|
<IconButton onClick={onClick} disabled={!access} {...rest}>
|
||||||
{children}
|
{children}
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
@ -7,7 +7,6 @@ import React from 'react';
|
|||||||
interface IResponsiveButtonProps {
|
interface IResponsiveButtonProps {
|
||||||
Icon: React.ElementType;
|
Icon: React.ElementType;
|
||||||
onClick: () => void;
|
onClick: () => void;
|
||||||
tooltip?: string;
|
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
permission: string;
|
permission: string;
|
||||||
projectId?: string;
|
projectId?: string;
|
||||||
@ -20,7 +19,6 @@ const ResponsiveButton: React.FC<IResponsiveButtonProps> = ({
|
|||||||
Icon,
|
Icon,
|
||||||
onClick,
|
onClick,
|
||||||
maxWidth,
|
maxWidth,
|
||||||
tooltip,
|
|
||||||
disabled = false,
|
disabled = false,
|
||||||
children,
|
children,
|
||||||
permission,
|
permission,
|
||||||
@ -40,7 +38,6 @@ const ResponsiveButton: React.FC<IResponsiveButtonProps> = ({
|
|||||||
permission={permission}
|
permission={permission}
|
||||||
projectId={projectId}
|
projectId={projectId}
|
||||||
environmentId={environmentId}
|
environmentId={environmentId}
|
||||||
tooltip={tooltip}
|
|
||||||
data-loading
|
data-loading
|
||||||
{...rest}
|
{...rest}
|
||||||
>
|
>
|
||||||
@ -53,11 +50,9 @@ const ResponsiveButton: React.FC<IResponsiveButtonProps> = ({
|
|||||||
permission={permission}
|
permission={permission}
|
||||||
projectId={projectId}
|
projectId={projectId}
|
||||||
color="primary"
|
color="primary"
|
||||||
// @ts-expect-error
|
|
||||||
variant="contained"
|
variant="contained"
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
environmentId={environmentId}
|
environmentId={environmentId}
|
||||||
tooltip={tooltip}
|
|
||||||
data-loading
|
data-loading
|
||||||
{...rest}
|
{...rest}
|
||||||
>
|
>
|
||||||
|
@ -31,7 +31,6 @@ export const FeatureSettingsInformation = ({
|
|||||||
</Typography>
|
</Typography>
|
||||||
<PermissionIconButton
|
<PermissionIconButton
|
||||||
permission={UPDATE_FEATURE}
|
permission={UPDATE_FEATURE}
|
||||||
tooltip={'Edit feature'}
|
|
||||||
projectId={projectId}
|
projectId={projectId}
|
||||||
data-loading
|
data-loading
|
||||||
onClick={onEdit}
|
onClick={onEdit}
|
||||||
|
@ -84,7 +84,6 @@ const FeatureSettingsMetadata = () => {
|
|||||||
condition={dirty}
|
condition={dirty}
|
||||||
show={
|
show={
|
||||||
<PermissionButton
|
<PermissionButton
|
||||||
tooltip="Save changes"
|
|
||||||
permission={UPDATE_FEATURE}
|
permission={UPDATE_FEATURE}
|
||||||
onClick={handleSubmit}
|
onClick={handleSubmit}
|
||||||
projectId={projectId}
|
projectId={projectId}
|
||||||
|
@ -175,7 +175,6 @@ const FeatureStrategyEditable = ({
|
|||||||
permission={UPDATE_FEATURE_STRATEGY}
|
permission={UPDATE_FEATURE_STRATEGY}
|
||||||
projectId={projectId}
|
projectId={projectId}
|
||||||
environmentId={activeEnvironment?.name}
|
environmentId={activeEnvironment?.name}
|
||||||
// @ts-expect-error
|
|
||||||
variant="contained"
|
variant="contained"
|
||||||
color="primary"
|
color="primary"
|
||||||
className={styles.editButton}
|
className={styles.editButton}
|
||||||
@ -189,8 +188,8 @@ const FeatureStrategyEditable = ({
|
|||||||
onClick={discardChanges}
|
onClick={discardChanges}
|
||||||
className={styles.editButton}
|
className={styles.editButton}
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
color="tertiary"
|
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
|
color="tertiary"
|
||||||
variant="text"
|
variant="text"
|
||||||
permission={UPDATE_FEATURE_STRATEGY}
|
permission={UPDATE_FEATURE_STRATEGY}
|
||||||
projectId={projectId}
|
projectId={projectId}
|
||||||
|
@ -165,8 +165,7 @@ const FeatureStrategyAccordionBody: React.FC<
|
|||||||
<PermissionButton
|
<PermissionButton
|
||||||
className={styles.addConstraintBtn}
|
className={styles.addConstraintBtn}
|
||||||
onClick={toggleConstraints}
|
onClick={toggleConstraints}
|
||||||
// @ts-expect-error
|
variant="text"
|
||||||
variant={'text'}
|
|
||||||
data-test={ADD_CONSTRAINT_ID}
|
data-test={ADD_CONSTRAINT_ID}
|
||||||
permission={[
|
permission={[
|
||||||
UPDATE_FEATURE_STRATEGY,
|
UPDATE_FEATURE_STRATEGY,
|
||||||
|
@ -201,7 +201,6 @@ const FeatureStrategyEditable = ({
|
|||||||
permission={UPDATE_FEATURE_STRATEGY}
|
permission={UPDATE_FEATURE_STRATEGY}
|
||||||
projectId={projectId}
|
projectId={projectId}
|
||||||
environmentId={activeEnvironment?.name}
|
environmentId={activeEnvironment?.name}
|
||||||
// @ts-expect-error
|
|
||||||
variant="contained"
|
variant="contained"
|
||||||
color="primary"
|
color="primary"
|
||||||
className={styles.editButton}
|
className={styles.editButton}
|
||||||
@ -215,8 +214,8 @@ const FeatureStrategyEditable = ({
|
|||||||
onClick={discardChanges}
|
onClick={discardChanges}
|
||||||
className={styles.editButton}
|
className={styles.editButton}
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
color="tertiary"
|
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
|
color="tertiary"
|
||||||
variant="text"
|
variant="text"
|
||||||
permission={UPDATE_FEATURE_STRATEGY}
|
permission={UPDATE_FEATURE_STRATEGY}
|
||||||
projectId={projectId}
|
projectId={projectId}
|
||||||
|
@ -230,7 +230,6 @@ const FeatureStrategyAccordionBody: React.FC<
|
|||||||
<PermissionButton
|
<PermissionButton
|
||||||
className={styles.addConstraintBtn}
|
className={styles.addConstraintBtn}
|
||||||
onClick={addConstraint}
|
onClick={addConstraint}
|
||||||
// @ts-expect-error
|
|
||||||
variant={'text'}
|
variant={'text'}
|
||||||
data-test={ADD_CONSTRAINT_ID}
|
data-test={ADD_CONSTRAINT_ID}
|
||||||
permission={[
|
permission={[
|
||||||
|
@ -166,7 +166,6 @@ export const FeatureView = () => {
|
|||||||
<PermissionIconButton
|
<PermissionIconButton
|
||||||
permission={CREATE_FEATURE}
|
permission={CREATE_FEATURE}
|
||||||
projectId={projectId}
|
projectId={projectId}
|
||||||
tooltip="Copy"
|
|
||||||
data-loading
|
data-loading
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
component={Link}
|
component={Link}
|
||||||
@ -177,7 +176,6 @@ export const FeatureView = () => {
|
|||||||
<PermissionIconButton
|
<PermissionIconButton
|
||||||
permission={DELETE_FEATURE}
|
permission={DELETE_FEATURE}
|
||||||
projectId={projectId}
|
projectId={projectId}
|
||||||
tooltip="Archive feature toggle"
|
|
||||||
data-loading
|
data-loading
|
||||||
onClick={() => setShowDelDialog(true)}
|
onClick={() => setShowDelDialog(true)}
|
||||||
>
|
>
|
||||||
@ -187,7 +185,6 @@ export const FeatureView = () => {
|
|||||||
onClick={() => setOpenStaleDialog(true)}
|
onClick={() => setOpenStaleDialog(true)}
|
||||||
permission={UPDATE_FEATURE}
|
permission={UPDATE_FEATURE}
|
||||||
projectId={projectId}
|
projectId={projectId}
|
||||||
tooltip="Toggle stale status"
|
|
||||||
data-loading
|
data-loading
|
||||||
>
|
>
|
||||||
<WatchLater titleAccess="Toggle stale status" />
|
<WatchLater titleAccess="Toggle stale status" />
|
||||||
@ -196,7 +193,6 @@ export const FeatureView = () => {
|
|||||||
onClick={() => setOpenTagDialog(true)}
|
onClick={() => setOpenTagDialog(true)}
|
||||||
permission={UPDATE_FEATURE}
|
permission={UPDATE_FEATURE}
|
||||||
projectId={projectId}
|
projectId={projectId}
|
||||||
tooltip="Add tag"
|
|
||||||
data-loading
|
data-loading
|
||||||
>
|
>
|
||||||
<Label titleAccess="Add tag" />
|
<Label titleAccess="Add tag" />
|
||||||
|
@ -73,15 +73,8 @@ export const ProjectAccessListItem = ({
|
|||||||
edge="end"
|
edge="end"
|
||||||
aria-label="delete"
|
aria-label="delete"
|
||||||
title="Remove access"
|
title="Remove access"
|
||||||
onClick={() => {
|
onClick={() => handleRemoveAccess(user)}
|
||||||
handleRemoveAccess(user);
|
|
||||||
}}
|
|
||||||
disabled={access.users.length === 1}
|
disabled={access.users.length === 1}
|
||||||
tooltip={
|
|
||||||
access.users.length === 1
|
|
||||||
? 'A project must have at least one owner'
|
|
||||||
: 'Remove access'
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
<Delete />
|
<Delete />
|
||||||
</PermissionIconButton>
|
</PermissionIconButton>
|
||||||
|
@ -154,7 +154,6 @@ export const ProjectListNew = () => {
|
|||||||
onClick={() => history.push('/projects/create')}
|
onClick={() => history.push('/projects/create')}
|
||||||
maxWidth="700px"
|
maxWidth="700px"
|
||||||
permission={CREATE_PROJECT}
|
permission={CREATE_PROJECT}
|
||||||
tooltip={createButtonData.title}
|
|
||||||
disabled={createButtonData.disabled}
|
disabled={createButtonData.disabled}
|
||||||
>
|
>
|
||||||
New project
|
New project
|
||||||
|
@ -189,7 +189,6 @@ export const StrategiesList = () => {
|
|||||||
<PermissionIconButton
|
<PermissionIconButton
|
||||||
onClick={() => onDeprecateStrategy(strategy)}
|
onClick={() => onDeprecateStrategy(strategy)}
|
||||||
permission={UPDATE_STRATEGY}
|
permission={UPDATE_STRATEGY}
|
||||||
tooltip={'Deprecate activation strategy'}
|
|
||||||
>
|
>
|
||||||
<Visibility />
|
<Visibility />
|
||||||
</PermissionIconButton>
|
</PermissionIconButton>
|
||||||
@ -207,7 +206,6 @@ export const StrategiesList = () => {
|
|||||||
history.push(`/strategies/${strategy?.name}/edit`)
|
history.push(`/strategies/${strategy?.name}/edit`)
|
||||||
}
|
}
|
||||||
permission={UPDATE_STRATEGY}
|
permission={UPDATE_STRATEGY}
|
||||||
tooltip={'Edit strategy'}
|
|
||||||
>
|
>
|
||||||
<Edit titleAccess="Edit strategy" />
|
<Edit titleAccess="Edit strategy" />
|
||||||
</PermissionIconButton>
|
</PermissionIconButton>
|
||||||
|
@ -41,7 +41,6 @@ export const StrategyView = () => {
|
|||||||
show={
|
show={
|
||||||
<PermissionIconButton
|
<PermissionIconButton
|
||||||
permission={UPDATE_STRATEGY}
|
permission={UPDATE_STRATEGY}
|
||||||
tooltip={'Edit strategy'}
|
|
||||||
data-loading
|
data-loading
|
||||||
onClick={handleEdit}
|
onClick={handleEdit}
|
||||||
>
|
>
|
||||||
|
@ -5776,7 +5776,7 @@ fsevents@^1.2.7:
|
|||||||
bindings "^1.5.0"
|
bindings "^1.5.0"
|
||||||
nan "^2.12.1"
|
nan "^2.12.1"
|
||||||
|
|
||||||
fsevents@^2.1.2, fsevents@^2.1.3, fsevents@~2.3.1:
|
fsevents@^2.1.2, fsevents@^2.1.3, fsevents@~2.3.1, fsevents@~2.3.2:
|
||||||
version "2.3.2"
|
version "2.3.2"
|
||||||
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a"
|
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a"
|
||||||
integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==
|
integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==
|
||||||
|
Loading…
Reference in New Issue
Block a user