mirror of
https://github.com/Unleash/unleash.git
synced 2025-10-27 11:02:16 +01:00
https://linear.app/unleash/issue/2-3367/remove-get-apiadminarchivefeaturesprojectid-deprecated-in-4110 Removes GET `/api/admin/archive/features/{projectId}` which was deprecated in v4.11. Also cleans up related code. I leveraged our search features endpoint where needed, since that's what we're using now in our UI (to see archived features you filter by archived=true). Builds on top of https://github.com/Unleash/unleash/pull/9924 — Since they're both related.
52 lines
1.6 KiB
TypeScript
52 lines
1.6 KiB
TypeScript
import { Link } from 'react-router-dom';
|
|
import { getCreateTogglePath } from 'utils/routePathHelpers';
|
|
import { useRequiredPathParam } from 'hooks/useRequiredPathParam';
|
|
import { styled } from '@mui/material';
|
|
import { useFeatureSearch } from 'hooks/api/getters/useFeatureSearch/useFeatureSearch';
|
|
|
|
const StyledFeatureId = styled('strong')({
|
|
wordBreak: 'break-all',
|
|
});
|
|
|
|
export const FeatureNotFound = () => {
|
|
const projectId = useRequiredPathParam('projectId');
|
|
const featureId = useRequiredPathParam('featureId');
|
|
const { features: archivedFeatures } = useFeatureSearch({
|
|
project: `IS:${projectId}`,
|
|
archived: 'IS:true',
|
|
});
|
|
|
|
const createFeatureTogglePath = getCreateTogglePath(projectId, {
|
|
name: featureId,
|
|
});
|
|
|
|
if (!archivedFeatures) {
|
|
return null;
|
|
}
|
|
|
|
const isArchived = archivedFeatures.some((archivedFeature) => {
|
|
return archivedFeature.name === featureId;
|
|
});
|
|
|
|
if (isArchived) {
|
|
return (
|
|
<p>
|
|
The feature <StyledFeatureId>{featureId}</StyledFeatureId> has
|
|
been archived. You can find it on the{' '}
|
|
<Link to={`/projects/${projectId}?archived=IS%3Atrue`}>
|
|
project overview with archived flags filter
|
|
</Link>
|
|
.
|
|
</p>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<p>
|
|
The feature <StyledFeatureId>{featureId}</StyledFeatureId> does not
|
|
exist. Would you like to{' '}
|
|
<Link to={createFeatureTogglePath}>create it</Link>?
|
|
</p>
|
|
);
|
|
};
|