mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-25 00:07:47 +01:00
chore: useProject cleanup (#6700)
This commit is contained in:
parent
4271c6ff74
commit
f89c2aa829
@ -9,7 +9,7 @@ import { InactiveUsersList } from './InactiveUsersList/InactiveUsersList';
|
||||
import { AccessMatrix } from './AccessMatrix/AccessMatrix';
|
||||
import { PremiumFeature } from '../../common/PremiumFeature/PremiumFeature';
|
||||
import { ConditionallyRender } from '../../common/ConditionallyRender/ConditionallyRender';
|
||||
import useUiConfig from '../../../hooks/api/getters/useUiConfig/useUiConfig';
|
||||
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
|
||||
|
||||
export const UsersAdmin = () => {
|
||||
const { isEnterprise } = useUiConfig();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useUiFlag } from '../../../hooks/useUiFlag';
|
||||
import { useUiFlag } from 'hooks/useUiFlag';
|
||||
import { ConditionallyRender } from '../../common/ConditionallyRender/ConditionallyRender';
|
||||
import { Banner } from '../Banner/Banner';
|
||||
import type { IBanner } from '../../../interfaces/banner';
|
||||
|
@ -15,7 +15,7 @@ import { StickyProvider } from 'component/common/Sticky/StickyProvider';
|
||||
const server = testServerSetup();
|
||||
|
||||
const projectWithCollaborationMode = (mode: ProjectMode) =>
|
||||
testServerRoute(server, '/api/admin/projects/default', { mode });
|
||||
testServerRoute(server, '/api/admin/projects/default/overview', { mode });
|
||||
|
||||
const changeRequestsEnabledIn = (
|
||||
env: 'development' | 'production' | 'custom',
|
||||
|
@ -22,8 +22,8 @@ import useFeatureApi from 'hooks/api/actions/useFeatureApi/useFeatureApi';
|
||||
import { useFeature } from 'hooks/api/getters/useFeature/useFeature';
|
||||
import { useRequiredPathParam } from 'hooks/useRequiredPathParam';
|
||||
import { useChangeRequestsEnabled } from 'hooks/useChangeRequestsEnabled';
|
||||
import useProject from 'hooks/api/getters/useProject/useProject';
|
||||
import { FeatureNamingPatternInfo } from '../FeatureNamingPatternInfo/FeatureNamingPatternInfo';
|
||||
import useProjectOverview from 'hooks/api/getters/useProjectOverview/useProjectOverview';
|
||||
|
||||
const StyledPage = styled(Paper)(({ theme }) => ({
|
||||
overflow: 'visible',
|
||||
@ -81,7 +81,7 @@ export const CopyFeatureToggle = () => {
|
||||
|
||||
const {
|
||||
project: { featureNaming },
|
||||
} = useProject(projectId);
|
||||
} = useProjectOverview(projectId);
|
||||
|
||||
const setValue: ChangeEventHandler<HTMLInputElement> = (event) => {
|
||||
const value = trim(event.target.value);
|
||||
|
@ -7,7 +7,6 @@ import type { FeatureSchema } from 'openapi';
|
||||
|
||||
import { formatUnknownError } from 'utils/formatUnknownError';
|
||||
import useFeatureApi from 'hooks/api/actions/useFeatureApi/useFeatureApi';
|
||||
import useProject from 'hooks/api/getters/useProject/useProject';
|
||||
import { useChangeRequestsEnabled } from 'hooks/useChangeRequestsEnabled';
|
||||
import { useChangeRequestApi } from 'hooks/api/actions/useChangeRequestApi/useChangeRequestApi';
|
||||
import { usePendingChangeRequests } from 'hooks/api/getters/usePendingChangeRequests/usePendingChangeRequests';
|
||||
@ -43,7 +42,6 @@ export const BulkDisableDialog = ({
|
||||
const [selected, setSelected] = useState(environments[0]);
|
||||
const { bulkToggleFeaturesEnvironmentOff } = useFeatureApi();
|
||||
const { addChange } = useChangeRequestApi();
|
||||
const { refetch: refetchProject } = useProject(projectId);
|
||||
const { setToastApiError, setToastData } = useToast();
|
||||
const { isChangeRequestConfigured } = useChangeRequestsEnabled(projectId);
|
||||
const { refetch: refetchChangeRequests } =
|
||||
@ -85,7 +83,6 @@ export const BulkDisableDialog = ({
|
||||
data.map((feature) => feature.name),
|
||||
selected,
|
||||
);
|
||||
refetchProject();
|
||||
setToastData({
|
||||
text: 'Your feature toggles have been disabled',
|
||||
type: 'success',
|
||||
|
@ -21,7 +21,6 @@ import {
|
||||
useNavigate,
|
||||
} from 'react-router-dom';
|
||||
import { useFeature } from 'hooks/api/getters/useFeature/useFeature';
|
||||
import useProject from 'hooks/api/getters/useProject/useProject';
|
||||
import {
|
||||
CREATE_FEATURE,
|
||||
DELETE_FEATURE,
|
||||
@ -137,7 +136,6 @@ export const StyledLink = styled(Link)(({ theme }) => ({
|
||||
export const FeatureView = () => {
|
||||
const projectId = useRequiredPathParam('projectId');
|
||||
const featureId = useRequiredPathParam('featureId');
|
||||
const { refetch: projectRefetch } = useProject(projectId);
|
||||
const { favorite, unfavorite } = useFavoriteFeaturesApi();
|
||||
const { refetchFeature } = useFeature(projectId, featureId);
|
||||
const { setToastData, setToastApiError } = useToast();
|
||||
@ -379,7 +377,6 @@ export const FeatureView = () => {
|
||||
<FeatureArchiveDialog
|
||||
isOpen={showDelDialog}
|
||||
onConfirm={() => {
|
||||
projectRefetch();
|
||||
navigate(`/projects/${projectId}`);
|
||||
}}
|
||||
onClose={() => setShowDelDialog(false)}
|
||||
|
@ -4,7 +4,7 @@ import { Box, Button } from '@mui/material';
|
||||
import { Dialogue } from 'component/common/Dialogue/Dialogue';
|
||||
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
||||
import { usePlausibleTracker } from 'hooks/usePlausibleTracker';
|
||||
import useUiConfig from '../../../hooks/api/getters/useUiConfig/useUiConfig';
|
||||
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
|
||||
|
||||
interface IErrorProps {
|
||||
error: Error;
|
||||
|
@ -9,7 +9,7 @@ import {
|
||||
UPDATE_FEATURE_STRATEGY,
|
||||
} from '../component/providers/AccessProvider/permissions';
|
||||
import { useAuthPermissions } from './api/getters/useAuth/useAuthPermissions';
|
||||
import useProject from './api/getters/useProject/useProject';
|
||||
import useProjectOverview from './api/getters/useProjectOverview/useProjectOverview';
|
||||
|
||||
/**
|
||||
* This is for features not integrated with change request.
|
||||
@ -90,7 +90,7 @@ const useIsProjectMember = (projectId: string) => {
|
||||
|
||||
const useIsAllowedUser = (projectId: string) => {
|
||||
const isProjectMember = useIsProjectMember(projectId);
|
||||
const { project } = useProject(projectId);
|
||||
const { project } = useProjectOverview(projectId);
|
||||
const isProtectedProject = project.mode === 'protected';
|
||||
return isProtectedProject ? isProjectMember : true;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user