mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-04 00:18:01 +01:00
feat: switch to hook without features list (#7085)
This commit is contained in:
parent
3768331e9a
commit
0537d3d5f6
@ -13,7 +13,7 @@ const setupApi = () => {
|
|||||||
current: { enterprise: 'present' },
|
current: { enterprise: 'present' },
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
testServerRoute(server, '/api/admin/projects/default', {
|
testServerRoute(server, '/api/admin/projects/default/overview', {
|
||||||
environments: [
|
environments: [
|
||||||
{ environment: 'development' },
|
{ environment: 'development' },
|
||||||
{ environment: 'production' },
|
{ environment: 'production' },
|
||||||
|
@ -3,7 +3,7 @@ import KeyboardArrowDownOutlined from '@mui/icons-material/KeyboardArrowDownOutl
|
|||||||
import { type FC, useEffect } from 'react';
|
import { type FC, useEffect } from 'react';
|
||||||
import { Box, styled, Typography } from '@mui/material';
|
import { Box, styled, Typography } from '@mui/material';
|
||||||
import { IMPORT_ENVIRONMENT } from 'utils/testIds';
|
import { IMPORT_ENVIRONMENT } from 'utils/testIds';
|
||||||
import useProject from 'hooks/api/getters/useProject/useProject';
|
import useProjectOverview from 'hooks/api/getters/useProjectOverview/useProjectOverview';
|
||||||
|
|
||||||
const ImportOptionsContainer = styled(Box)(({ theme }) => ({
|
const ImportOptionsContainer = styled(Box)(({ theme }) => ({
|
||||||
backgroundColor: theme.palette.background.elevation2,
|
backgroundColor: theme.palette.background.elevation2,
|
||||||
@ -31,7 +31,7 @@ export const ImportOptions: FC<IImportOptionsProps> = ({
|
|||||||
environment,
|
environment,
|
||||||
onChange,
|
onChange,
|
||||||
}) => {
|
}) => {
|
||||||
const { project: projectInfo } = useProject(project);
|
const { project: projectInfo } = useProjectOverview(project);
|
||||||
const environmentOptions = projectInfo.environments.map(
|
const environmentOptions = projectInfo.environments.map(
|
||||||
({ environment }) => ({
|
({ environment }) => ({
|
||||||
key: environment,
|
key: environment,
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { useNavigate } from 'react-router';
|
import { useNavigate } from 'react-router';
|
||||||
import useProject from 'hooks/api/getters/useProject/useProject';
|
|
||||||
import useLoading from 'hooks/useLoading';
|
import useLoading from 'hooks/useLoading';
|
||||||
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
||||||
import {
|
import {
|
||||||
@ -43,6 +42,7 @@ import { HiddenProjectIconWithTooltip } from './HiddenProjectIconWithTooltip/Hid
|
|||||||
import { ChangeRequestPlausibleProvider } from 'component/changeRequest/ChangeRequestContext';
|
import { ChangeRequestPlausibleProvider } from 'component/changeRequest/ChangeRequestContext';
|
||||||
import { ProjectApplications } from '../ProjectApplications/ProjectApplications';
|
import { ProjectApplications } from '../ProjectApplications/ProjectApplications';
|
||||||
import { ProjectInsights } from './ProjectInsights/ProjectInsights';
|
import { ProjectInsights } from './ProjectInsights/ProjectInsights';
|
||||||
|
import useProjectOverview from 'hooks/api/getters/useProjectOverview/useProjectOverview';
|
||||||
|
|
||||||
const StyledBadge = styled(Badge)(({ theme }) => ({
|
const StyledBadge = styled(Badge)(({ theme }) => ({
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
@ -65,7 +65,7 @@ interface ITab {
|
|||||||
export const Project = () => {
|
export const Project = () => {
|
||||||
const projectId = useRequiredPathParam('projectId');
|
const projectId = useRequiredPathParam('projectId');
|
||||||
const params = useQueryParams();
|
const params = useQueryParams();
|
||||||
const { project, loading, error, refetch } = useProject(projectId);
|
const { project, loading, error, refetch } = useProjectOverview(projectId);
|
||||||
const ref = useLoading(loading, '[data-loading-project=true]');
|
const ref = useLoading(loading, '[data-loading-project=true]');
|
||||||
const { setToastData, setToastApiError } = useToast();
|
const { setToastData, setToastApiError } = useToast();
|
||||||
const [modalOpen, setModalOpen] = useState(false);
|
const [modalOpen, setModalOpen] = useState(false);
|
||||||
|
@ -2,7 +2,6 @@ import { useMemo, useState, type VFC } from 'react';
|
|||||||
import { Button } from '@mui/material';
|
import { Button } from '@mui/material';
|
||||||
import { PermissionHOC } from 'component/common/PermissionHOC/PermissionHOC';
|
import { PermissionHOC } from 'component/common/PermissionHOC/PermissionHOC';
|
||||||
import { DELETE_FEATURE } from 'component/providers/AccessProvider/permissions';
|
import { DELETE_FEATURE } from 'component/providers/AccessProvider/permissions';
|
||||||
import useProject from 'hooks/api/getters/useProject/useProject';
|
|
||||||
import { FeatureArchiveDialog } from 'component/common/FeatureArchiveDialog/FeatureArchiveDialog';
|
import { FeatureArchiveDialog } from 'component/common/FeatureArchiveDialog/FeatureArchiveDialog';
|
||||||
import { usePlausibleTracker } from 'hooks/usePlausibleTracker';
|
import { usePlausibleTracker } from 'hooks/usePlausibleTracker';
|
||||||
import type { FeatureSchema } from 'openapi';
|
import type { FeatureSchema } from 'openapi';
|
||||||
@ -30,7 +29,6 @@ export const ArchiveButton: VFC<IArchiveButtonProps> = ({
|
|||||||
features,
|
features,
|
||||||
onConfirm,
|
onConfirm,
|
||||||
}) => {
|
}) => {
|
||||||
const { refetch } = useProject(projectId);
|
|
||||||
const [isDialogOpen, setIsDialogOpen] = useState(false);
|
const [isDialogOpen, setIsDialogOpen] = useState(false);
|
||||||
const { trackEvent } = usePlausibleTracker();
|
const { trackEvent } = usePlausibleTracker();
|
||||||
|
|
||||||
@ -44,7 +42,6 @@ export const ArchiveButton: VFC<IArchiveButtonProps> = ({
|
|||||||
const onArchive = async () => {
|
const onArchive = async () => {
|
||||||
setIsDialogOpen(false);
|
setIsDialogOpen(false);
|
||||||
onConfirm?.();
|
onConfirm?.();
|
||||||
await refetch();
|
|
||||||
trackEvent('batch_operations', {
|
trackEvent('batch_operations', {
|
||||||
props: {
|
props: {
|
||||||
eventType: 'features archived',
|
eventType: 'features archived',
|
||||||
|
Loading…
Reference in New Issue
Block a user