mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
fix: change domain vocabulary (#2503)
* Changes the naming of useOpenRequests to usePendingChangeRequests
This commit is contained in:
parent
bf13009a00
commit
e439e46090
@ -21,7 +21,7 @@ import { useAuthUser } from 'hooks/api/getters/useAuth/useAuthUser';
|
||||
import AccessContext from 'contexts/AccessContext';
|
||||
import { ChangeRequestComment } from './ChangeRequestComments/ChangeRequestComment';
|
||||
import { AddCommentField } from './ChangeRequestComments/AddCommentField';
|
||||
import { useChangeRequestOpen } from 'hooks/api/getters/useChangeRequestOpen/useChangeRequestOpen';
|
||||
import { usePendingChangeRequests } from 'hooks/api/getters/usePendingChangeRequests/usePendingChangeRequests';
|
||||
|
||||
const StyledAsideBox = styled(Box)(({ theme }) => ({
|
||||
width: '30%',
|
||||
@ -60,7 +60,7 @@ export const ChangeRequestOverview: FC = () => {
|
||||
);
|
||||
const { changeState, addComment } = useChangeRequestApi();
|
||||
const { refetch: refetchChangeRequestOpen } =
|
||||
useChangeRequestOpen(projectId);
|
||||
usePendingChangeRequests(projectId);
|
||||
const { setToastData, setToastApiError } = useToast();
|
||||
|
||||
if (!changeRequest) {
|
||||
|
@ -20,7 +20,7 @@ import { APPROVE_CHANGE_REQUEST } from 'component/providers/AccessProvider/permi
|
||||
import PermissionButton from 'component/common/PermissionButton/PermissionButton';
|
||||
import { useAuthUser } from 'hooks/api/getters/useAuth/useAuthUser';
|
||||
import AccessContext from 'contexts/AccessContext';
|
||||
import { useChangeRequestOpen } from 'hooks/api/getters/useChangeRequestOpen/useChangeRequestOpen';
|
||||
import { usePendingChangeRequests } from 'hooks/api/getters/usePendingChangeRequests/usePendingChangeRequests';
|
||||
|
||||
export const ReviewButton = () => {
|
||||
const { isAdmin } = useContext(AccessContext);
|
||||
@ -29,7 +29,7 @@ export const ReviewButton = () => {
|
||||
const { user } = useAuthUser();
|
||||
const { refetchChangeRequest, data } = useChangeRequest(projectId, id);
|
||||
const { refetch: refetchChangeRequestOpen } =
|
||||
useChangeRequestOpen(projectId);
|
||||
usePendingChangeRequests(projectId);
|
||||
const { setToastApiError, setToastData } = useToast();
|
||||
|
||||
const { changeState } = useChangeRequestApi();
|
||||
|
@ -16,7 +16,7 @@ import { PageHeader } from 'component/common/PageHeader/PageHeader';
|
||||
import { CheckCircle, HelpOutline } from '@mui/icons-material';
|
||||
import EnvironmentIcon from 'component/common/EnvironmentIcon/EnvironmentIcon';
|
||||
import { ChangeRequest } from '../ChangeRequest/ChangeRequest';
|
||||
import { useChangeRequestOpen } from 'hooks/api/getters/useChangeRequestOpen/useChangeRequestOpen';
|
||||
import { usePendingChangeRequests } from 'hooks/api/getters/usePendingChangeRequests/usePendingChangeRequests';
|
||||
import { useChangeRequestApi } from 'hooks/api/actions/useChangeRequestApi/useChangeRequestApi';
|
||||
import { ChangeRequestStatusBadge } from '../ChangeRequestStatusBadge/ChangeRequestStatusBadge';
|
||||
import CloseIcon from '@mui/icons-material/Close';
|
||||
@ -124,7 +124,7 @@ export const ChangeRequestSidebar: VFC<IChangeRequestSidebarProps> = ({
|
||||
draft,
|
||||
loading,
|
||||
refetch: refetchChangeRequest,
|
||||
} = useChangeRequestOpen(project);
|
||||
} = usePendingChangeRequests(project);
|
||||
const { changeState, discardDraft } = useChangeRequestApi();
|
||||
const theme = useTheme();
|
||||
const navigate = useNavigate();
|
||||
|
@ -4,7 +4,7 @@ import { useStyles as useAppStyles } from 'component/App.styles';
|
||||
import WarningAmberIcon from '@mui/icons-material/WarningAmber';
|
||||
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
||||
import { ChangeRequestSidebar } from '../ChangeRequestSidebar/ChangeRequestSidebar';
|
||||
import { useChangeRequestOpen } from 'hooks/api/getters/useChangeRequestOpen/useChangeRequestOpen';
|
||||
import { usePendingChangeRequests } from 'hooks/api/getters/usePendingChangeRequests/usePendingChangeRequests';
|
||||
import { IChangeRequest } from '../changeRequest.types';
|
||||
|
||||
interface IDraftBannerProps {
|
||||
@ -76,7 +76,7 @@ const StickyBanner = styled(Box)(({ theme }) => ({
|
||||
|
||||
export const DraftBanner: VFC<IDraftBannerProps> = ({ project }) => {
|
||||
const [isSidebarOpen, setIsSidebarOpen] = useState(false);
|
||||
const { draft, loading } = useChangeRequestOpen(project);
|
||||
const { draft, loading } = usePendingChangeRequests(project);
|
||||
|
||||
if ((!loading && !draft) || draft?.length === 0) {
|
||||
return null;
|
||||
|
@ -29,7 +29,7 @@ import { IFeatureToggle } from 'interfaces/featureToggle';
|
||||
import { comparisonModerator } from '../featureStrategy.utils';
|
||||
import { useChangeRequestApi } from 'hooks/api/actions/useChangeRequestApi/useChangeRequestApi';
|
||||
import { useChangeRequestsEnabled } from 'hooks/useChangeRequestsEnabled';
|
||||
import { useChangeRequestOpen } from 'hooks/api/getters/useChangeRequestOpen/useChangeRequestOpen';
|
||||
import { usePendingChangeRequests } from 'hooks/api/getters/usePendingChangeRequests/usePendingChangeRequests';
|
||||
|
||||
export const FeatureStrategyCreate = () => {
|
||||
const projectId = useRequiredPathParam('projectId');
|
||||
@ -52,7 +52,8 @@ export const FeatureStrategyCreate = () => {
|
||||
const { feature, refetchFeature } = useFeature(projectId, featureId);
|
||||
const ref = useRef<IFeatureToggle>(feature);
|
||||
const { isChangeRequestConfigured } = useChangeRequestsEnabled(projectId);
|
||||
const { refetch: refetchChangeRequests } = useChangeRequestOpen(projectId);
|
||||
const { refetch: refetchChangeRequests } =
|
||||
usePendingChangeRequests(projectId);
|
||||
|
||||
const { data, staleDataNotification, forceRefreshCache } =
|
||||
useCollaborateData<IFeatureToggle>(
|
||||
|
@ -27,7 +27,7 @@ import { IFeatureToggle } from 'interfaces/featureToggle';
|
||||
import { comparisonModerator } from '../featureStrategy.utils';
|
||||
import { useChangeRequestsEnabled } from 'hooks/useChangeRequestsEnabled';
|
||||
import { useChangeRequestApi } from 'hooks/api/actions/useChangeRequestApi/useChangeRequestApi';
|
||||
import { useChangeRequestOpen } from 'hooks/api/getters/useChangeRequestOpen/useChangeRequestOpen';
|
||||
import { usePendingChangeRequests } from 'hooks/api/getters/usePendingChangeRequests/usePendingChangeRequests';
|
||||
|
||||
export const FeatureStrategyEdit = () => {
|
||||
const projectId = useRequiredPathParam('projectId');
|
||||
@ -47,7 +47,8 @@ export const FeatureStrategyEdit = () => {
|
||||
const navigate = useNavigate();
|
||||
const { addChangeRequest } = useChangeRequestApi();
|
||||
const { isChangeRequestConfigured } = useChangeRequestsEnabled(projectId);
|
||||
const { refetch: refetchChangeRequests } = useChangeRequestOpen(projectId);
|
||||
const { refetch: refetchChangeRequests } =
|
||||
usePendingChangeRequests(projectId);
|
||||
|
||||
const { feature, refetchFeature } = useFeature(projectId, featureId);
|
||||
|
||||
|
@ -15,7 +15,7 @@ import PermissionIconButton from 'component/common/PermissionIconButton/Permissi
|
||||
import { Delete } from '@mui/icons-material';
|
||||
import { useChangeRequestApi } from 'hooks/api/actions/useChangeRequestApi/useChangeRequestApi';
|
||||
import { useChangeRequestsEnabled } from 'hooks/useChangeRequestsEnabled';
|
||||
import { useChangeRequestOpen } from 'hooks/api/getters/useChangeRequestOpen/useChangeRequestOpen';
|
||||
import { usePendingChangeRequests } from 'hooks/api/getters/usePendingChangeRequests/usePendingChangeRequests';
|
||||
|
||||
interface IFeatureStrategyRemoveProps {
|
||||
projectId: string;
|
||||
@ -131,7 +131,8 @@ const useOnSuggestRemove = ({
|
||||
strategyId,
|
||||
}: IRemoveProps) => {
|
||||
const { addChangeRequest } = useChangeRequestApi();
|
||||
const { refetch: refetchChangeRequests } = useChangeRequestOpen(projectId);
|
||||
const { refetch: refetchChangeRequests } =
|
||||
usePendingChangeRequests(projectId);
|
||||
const { setToastData, setToastApiError } = useToast();
|
||||
const onSuggestRemove = async (event: React.FormEvent) => {
|
||||
try {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useChangeRequestOpen } from 'hooks/api/getters/useChangeRequestOpen/useChangeRequestOpen';
|
||||
import { usePendingChangeRequests } from 'hooks/api/getters/usePendingChangeRequests/usePendingChangeRequests';
|
||||
|
||||
export const useStrategyChangeFromRequest = (
|
||||
projectId: string,
|
||||
@ -6,7 +6,7 @@ export const useStrategyChangeFromRequest = (
|
||||
environment: string,
|
||||
strategyId: string
|
||||
) => {
|
||||
const { draft } = useChangeRequestOpen(projectId);
|
||||
const { draft } = usePendingChangeRequests(projectId);
|
||||
|
||||
const environmentDraft = draft?.find(
|
||||
draft => draft.environment === environment
|
||||
|
@ -8,7 +8,6 @@ import { StrategyExecution } from './StrategyExecution/StrategyExecution';
|
||||
import { useStyles } from './FeatureStrategyItem.styles';
|
||||
import { StrategyItemContainer } from 'component/common/StrategyItemContainer/StrategyItemContainer';
|
||||
import { objectId } from 'utils/objectId';
|
||||
import { IFeatureStrategy } from 'interfaces/strategy';
|
||||
|
||||
interface IFeatureStrategyItemProps {
|
||||
strategy: PlaygroundStrategySchema;
|
||||
|
@ -10,10 +10,10 @@ const fetcher = (path: string) => {
|
||||
.then(res => res.json());
|
||||
};
|
||||
|
||||
export const useChangeRequestOpen = (project: string) => {
|
||||
export const usePendingChangeRequests = (project: string) => {
|
||||
const { isOss } = useUiConfig();
|
||||
const { data, error, mutate } = useSWR<IChangeRequest[]>(
|
||||
formatApiPath(`api/admin/projects/${project}/change-requests/open`),
|
||||
formatApiPath(`api/admin/projects/${project}/change-requests/pending`),
|
||||
isOss() ? () => Promise.resolve([]) : fetcher
|
||||
);
|
||||
|
@ -3,7 +3,7 @@ import useToast from 'hooks/useToast';
|
||||
import { formatUnknownError } from 'utils/formatUnknownError';
|
||||
import { IFeatureStrategyPayload } from '../interfaces/strategy';
|
||||
import { useChangeRequestApi } from './api/actions/useChangeRequestApi/useChangeRequestApi';
|
||||
import { useChangeRequestOpen } from './api/getters/useChangeRequestOpen/useChangeRequestOpen';
|
||||
import { usePendingChangeRequests } from './api/getters/usePendingChangeRequests/usePendingChangeRequests';
|
||||
|
||||
export type ChangeRequestStrategyAction =
|
||||
| 'addStrategy'
|
||||
@ -17,7 +17,7 @@ export const useChangeRequestAddStrategy = (
|
||||
) => {
|
||||
const { setToastData, setToastApiError } = useToast();
|
||||
const { addChangeRequest } = useChangeRequestApi();
|
||||
const { refetch } = useChangeRequestOpen(project);
|
||||
const { refetch } = usePendingChangeRequests(project);
|
||||
|
||||
const [changeRequestDialogDetails, setChangeRequestDialogDetails] =
|
||||
useState<{
|
||||
|
@ -2,12 +2,13 @@ import { useCallback, useState } from 'react';
|
||||
import useToast from 'hooks/useToast';
|
||||
import { formatUnknownError } from 'utils/formatUnknownError';
|
||||
import { useChangeRequestApi } from './api/actions/useChangeRequestApi/useChangeRequestApi';
|
||||
import { useChangeRequestOpen } from './api/getters/useChangeRequestOpen/useChangeRequestOpen';
|
||||
import { usePendingChangeRequests } from './api/getters/usePendingChangeRequests/usePendingChangeRequests';
|
||||
|
||||
export const useChangeRequestToggle = (project: string) => {
|
||||
const { setToastData, setToastApiError } = useToast();
|
||||
const { addChangeRequest } = useChangeRequestApi();
|
||||
const { refetch: refetchChangeRequests } = useChangeRequestOpen(project);
|
||||
const { refetch: refetchChangeRequests } =
|
||||
usePendingChangeRequests(project);
|
||||
|
||||
const [changeRequestDialogDetails, setChangeRequestDialogDetails] =
|
||||
useState<{
|
||||
|
Loading…
Reference in New Issue
Block a user