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