diff --git a/frontend/src/component/Reporting/ReportToggleList/ReportToggleList.jsx b/frontend/src/component/Reporting/ReportToggleList/ReportToggleList.jsx
index 8a51cccb94..8ba05c14ee 100644
--- a/frontend/src/component/Reporting/ReportToggleList/ReportToggleList.jsx
+++ b/frontend/src/component/Reporting/ReportToggleList/ReportToggleList.jsx
@@ -56,6 +56,7 @@ const ReportToggleList = ({ features, selectedProject }) => {
));
diff --git a/frontend/src/component/Reporting/ReportToggleList/ReportToggleListContainer.jsx b/frontend/src/component/Reporting/ReportToggleList/ReportToggleListContainer.jsx
deleted file mode 100644
index cbf146aa9f..0000000000
--- a/frontend/src/component/Reporting/ReportToggleList/ReportToggleListContainer.jsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import { connect } from 'react-redux';
-
-import ReportToggleList from './ReportToggleList';
-
-const mapStateToProps = (state, ownProps) => {};
-
-const ReportToggleListContainer = connect(
- mapStateToProps,
- null
-)(ReportToggleList);
-
-export default ReportToggleListContainer;
diff --git a/frontend/src/component/Reporting/ReportToggleList/ReportToggleListItem/ReportToggleListItem.jsx b/frontend/src/component/Reporting/ReportToggleList/ReportToggleListItem/ReportToggleListItem.jsx
index 83047f72f9..d6948e63c0 100644
--- a/frontend/src/component/Reporting/ReportToggleList/ReportToggleListItem/ReportToggleListItem.jsx
+++ b/frontend/src/component/Reporting/ReportToggleList/ReportToggleListItem/ReportToggleListItem.jsx
@@ -21,12 +21,14 @@ import {
} from '../../../../constants/featureToggleTypes';
import styles from '../ReportToggleList.module.scss';
+import { getTogglePath } from '../../../../utils/route-path-helpers';
const ReportToggleListItem = ({
name,
stale,
lastSeenAt,
createdAt,
+ project,
type,
checked,
bulkActionsOn,
@@ -121,7 +123,7 @@ const ReportToggleListItem = ({
};
const navigateToFeature = () => {
- history.push(`/features/strategies/${name}`);
+ history.push(getTogglePath(project, name));
};
const statusClasses = classnames(styles.active, {
diff --git a/frontend/src/component/Reporting/Reporting.jsx b/frontend/src/component/Reporting/Reporting.jsx
index dda39df3f3..d7465092db 100644
--- a/frontend/src/component/Reporting/Reporting.jsx
+++ b/frontend/src/component/Reporting/Reporting.jsx
@@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
import Select from '../common/select';
import ReportCardContainer from './ReportCard/ReportCardContainer';
-import ReportToggleListContainer from './ReportToggleList/ReportToggleListContainer';
+import ReportToggleList from './ReportToggleList/ReportToggleList';
import ConditionallyRender from '../common/ConditionallyRender/ConditionallyRender';
@@ -14,6 +14,7 @@ import { REPORTING_SELECT_ID } from '../../testIds';
import styles from './Reporting.module.scss';
import useHealthReport from '../../hooks/api/getters/useHealthReport/useHealthReport';
import ApiError from '../common/ApiError/ApiError';
+import useQueryParams from '../../hooks/useQueryParams';
const Reporting = ({ projects }) => {
const [projectOptions, setProjectOptions] = useState([
@@ -22,8 +23,15 @@ const Reporting = ({ projects }) => {
const [selectedProject, setSelectedProject] = useState('default');
const { project, error, refetch } = useHealthReport(selectedProject);
+ const params = useQueryParams();
+ const projectId = params.get('project');
+
useEffect(() => {
+ if (projectId) {
+ return setSelectedProject(projectId);
+ }
setSelectedProject(projects[0].id);
+
/* eslint-disable-next-line */
}, []);
@@ -82,7 +90,7 @@ const Reporting = ({ projects }) => {
potentiallyStaleCount={project?.potentiallyStaleCount}
selectedProject={selectedProject}
/>
-
diff --git a/frontend/src/component/application/__tests__/__snapshots__/application-edit-component-test.js.snap b/frontend/src/component/application/__tests__/__snapshots__/application-edit-component-test.js.snap
index bebdb4496c..a3024b8d79 100644
--- a/frontend/src/component/application/__tests__/__snapshots__/application-edit-component-test.js.snap
+++ b/frontend/src/component/application/__tests__/__snapshots__/application-edit-component-test.js.snap
@@ -324,7 +324,7 @@ exports[`renders correctly with permissions 1`] = `
className="MuiTypography-root MuiListItemText-primary MuiTypography-body1 MuiTypography-displayBlock"
>
ToggleA
@@ -362,7 +362,7 @@ exports[`renders correctly with permissions 1`] = `
className="MuiTypography-root MuiListItemText-primary MuiTypography-body1 MuiTypography-displayBlock"
>
ToggleB
diff --git a/frontend/src/component/application/__tests__/application-edit-component-test.js b/frontend/src/component/application/__tests__/application-edit-component-test.js
index 9c58edbd57..7c184d3f7a 100644
--- a/frontend/src/component/application/__tests__/application-edit-component-test.js
+++ b/frontend/src/component/application/__tests__/application-edit-component-test.js
@@ -64,12 +64,14 @@ test('renders correctly without permission', () => {
name: 'ToggleA',
description: 'this is A toggle',
enabled: true,
+ project: 'default',
},
{
name: 'ToggleB',
description: 'this is B toggle',
enabled: false,
notFound: true,
+ project: 'default',
},
],
url: 'http://example.org',
@@ -125,12 +127,14 @@ test('renders correctly with permissions', () => {
name: 'ToggleA',
description: 'this is A toggle',
enabled: true,
+ project: 'default',
},
{
name: 'ToggleB',
description: 'this is B toggle',
enabled: false,
notFound: true,
+ project: 'default',
},
],
url: 'http://example.org',
diff --git a/frontend/src/component/application/application-view.jsx b/frontend/src/component/application/application-view.jsx
index 99bbd12528..e068b0e278 100644
--- a/frontend/src/component/application/application-view.jsx
+++ b/frontend/src/component/application/application-view.jsx
@@ -15,7 +15,7 @@ import { Report, Extension, Timeline } from '@material-ui/icons';
import { shorten } from '../common';
import { CREATE_FEATURE, CREATE_STRATEGY } from '../AccessProvider/permissions';
import ConditionallyRender from '../common/ConditionallyRender/ConditionallyRender';
-
+import { getTogglePath } from '../../utils/route-path-helpers';
function ApplicationView({
seenToggles,
hasAccess,
@@ -89,18 +89,21 @@ function ApplicationView({
{seenToggles.map(
- ({ name, description, enabled, notFound }, i) => (
+ (
+ { name, description, enabled, notFound, project },
+ i
+ ) => (
{
item !== 'variants' &&
item !== 'logs' &&
item !== 'metrics' &&
- item !== 'copy'
+ item !== 'copy' &&
+ item !== 'strategies' &&
+ item !== 'features'
);
return (
@@ -49,11 +51,22 @@ const BreadcrumbNav = () => {
);
}
+
+ let link = '/';
+
+ paths.forEach((path, i) => {
+ if (i !== index && i < index) {
+ link += path + '/';
+ } else if (i === index) {
+ link += path;
+ }
+ });
+
return (
{path}
diff --git a/frontend/src/component/common/DropdownMenu/DropdownMenu.jsx b/frontend/src/component/common/DropdownMenu/DropdownMenu.jsx
index 41d6fc322a..9e51e217c4 100644
--- a/frontend/src/component/common/DropdownMenu/DropdownMenu.jsx
+++ b/frontend/src/component/common/DropdownMenu/DropdownMenu.jsx
@@ -14,6 +14,7 @@ const DropdownMenu = ({
callback,
icon = ,
label,
+ style,
startIcon,
...rest
}) => {
@@ -37,6 +38,7 @@ const DropdownMenu = ({
title={title}
startIcon={startIcon}
onClick={handleOpen}
+ style={style}
aria-controls={id}
aria-haspopup="true"
icon={icon}
diff --git a/frontend/src/component/common/PageContent/PageContent.jsx b/frontend/src/component/common/PageContent/PageContent.jsx
index 026c0aa648..f04454a1ae 100644
--- a/frontend/src/component/common/PageContent/PageContent.jsx
+++ b/frontend/src/component/common/PageContent/PageContent.jsx
@@ -11,6 +11,7 @@ const PageContent = ({
headerContent,
disablePadding,
disableBorder,
+ bodyClass,
...rest
}) => {
const styles = useStyles();
@@ -23,6 +24,7 @@ const PageContent = ({
const bodyClasses = classnames(styles.bodyContainer, {
[styles.paddingDisabled]: disablePadding,
[styles.borderDisabled]: disableBorder,
+ [bodyClass]: bodyClass,
});
let header = null;
diff --git a/frontend/src/component/common/ProjectSelect/ProjectSelect.jsx b/frontend/src/component/common/ProjectSelect/ProjectSelect.jsx
index c034d2e5e8..f1866aeffa 100644
--- a/frontend/src/component/common/ProjectSelect/ProjectSelect.jsx
+++ b/frontend/src/component/common/ProjectSelect/ProjectSelect.jsx
@@ -32,6 +32,7 @@ const ProjectSelect = ({
disabled={selectedId === item.id}
data-target={item.id}
key={item.id}
+ style={{ fontSize: '14px' }}
>
{item.name}
@@ -43,6 +44,7 @@ const ProjectSelect = ({
disabled={curentProject === ALL_PROJECTS}
data-target={ALL_PROJECTS.id}
key={ALL_PROJECTS.id}
+ style={{ fontSize: '14px' }}
>
{ALL_PROJECTS.name}
,
diff --git a/frontend/src/component/feature/FeatureToggleList/FeatureToggleList.jsx b/frontend/src/component/feature/FeatureToggleList/FeatureToggleList.jsx
index 72a815b546..f4be94aeca 100644
--- a/frontend/src/component/feature/FeatureToggleList/FeatureToggleList.jsx
+++ b/frontend/src/component/feature/FeatureToggleList/FeatureToggleList.jsx
@@ -21,6 +21,7 @@ import AccessContext from '../../../contexts/AccessContext';
import { useStyles } from './styles';
import ListPlaceholder from '../../common/ListPlaceholder/ListPlaceholder';
+import { getCreateTogglePath } from '../../../utils/route-path-helpers';
const FeatureToggleList = ({
fetcher,
@@ -51,6 +52,8 @@ const FeatureToggleList = ({
updateSetting('sort', typeof v === 'string' ? v.trim() : '');
};
+ const createURL = getCreateTogglePath(currentProjectId);
+
const renderFeatures = () => {
features.forEach(e => {
e.reviveName = e.name;
@@ -101,7 +104,7 @@ const FeatureToggleList = ({
}
@@ -155,7 +158,7 @@ const FeatureToggleList = ({
sortingOptions.map(option => (
+ revive(feature.name)}>
+
+
+ }
+ elseShow={}
+ />
}
- elseShow={}
/>
);
diff --git a/frontend/src/component/feature/FeatureToggleList/__tests__/__snapshots__/feature-list-item-component-test.jsx.snap b/frontend/src/component/feature/FeatureToggleList/__tests__/__snapshots__/feature-list-item-component-test.jsx.snap
index 51202aee47..fe706a6270 100644
--- a/frontend/src/component/feature/FeatureToggleList/__tests__/__snapshots__/feature-list-item-component-test.jsx.snap
+++ b/frontend/src/component/feature/FeatureToggleList/__tests__/__snapshots__/feature-list-item-component-test.jsx.snap
@@ -63,7 +63,7 @@ exports[`renders correctly with one feature 1`] = `
>
-
`;
@@ -164,7 +163,7 @@ exports[`renders correctly with one feature without permission 1`] = `
>
-
`;
diff --git a/frontend/src/component/feature/FeatureToggleList/__tests__/__snapshots__/list-component-test.jsx.snap b/frontend/src/component/feature/FeatureToggleList/__tests__/__snapshots__/list-component-test.jsx.snap
index 44152a9777..96cc31e468 100644
--- a/frontend/src/component/feature/FeatureToggleList/__tests__/__snapshots__/list-component-test.jsx.snap
+++ b/frontend/src/component/feature/FeatureToggleList/__tests__/__snapshots__/list-component-test.jsx.snap
@@ -106,6 +106,7 @@ exports[`renders correctly with one feature 1`] = `
onTouchStart={[Function]}
style={
Object {
+ "fontWeight": "normal",
"textTransform": "lowercase",
}
}
@@ -159,6 +160,7 @@ exports[`renders correctly with one feature 1`] = `
onTouchStart={[Function]}
style={
Object {
+ "fontWeight": "normal",
"textTransform": "lowercase",
}
}
@@ -196,7 +198,7 @@ exports[`renders correctly with one feature 1`] = `
aria-disabled={true}
className="MuiButtonBase-root MuiButton-root MuiButton-contained MuiButton-containedPrimary Mui-disabled Mui-disabled"
data-test="add-feature-btn"
- href="/features/create"
+ href="/projects/default/create-toggle?project=default"
onBlur={[Function]}
onClick={[Function]}
onDragLeave={[Function]}
@@ -355,6 +357,7 @@ exports[`renders correctly with one feature without permissions 1`] = `
onTouchStart={[Function]}
style={
Object {
+ "fontWeight": "normal",
"textTransform": "lowercase",
}
}
@@ -411,6 +414,7 @@ exports[`renders correctly with one feature without permissions 1`] = `
onTouchStart={[Function]}
style={
Object {
+ "fontWeight": "normal",
"textTransform": "lowercase",
}
}
@@ -451,7 +455,7 @@ exports[`renders correctly with one feature without permissions 1`] = `
aria-disabled={true}
className="MuiButtonBase-root MuiButton-root MuiButton-contained MuiButton-containedPrimary Mui-disabled Mui-disabled"
data-test="add-feature-btn"
- href="/features/create"
+ href="/projects/default/create-toggle?project=default"
onBlur={[Function]}
onClick={[Function]}
onDragLeave={[Function]}
diff --git a/frontend/src/component/feature/FeatureToggleList/__tests__/feature-list-item-component-test.jsx b/frontend/src/component/feature/FeatureToggleList/__tests__/feature-list-item-component-test.jsx
index 4a0e2345ef..a9325a9d36 100644
--- a/frontend/src/component/feature/FeatureToggleList/__tests__/feature-list-item-component-test.jsx
+++ b/frontend/src/component/feature/FeatureToggleList/__tests__/feature-list-item-component-test.jsx
@@ -15,6 +15,7 @@ test('renders correctly with one feature', () => {
description: "another's description",
enabled: false,
stale: false,
+ project: 'default',
strategies: [
{
name: 'gradualRolloutRandom',
diff --git a/frontend/src/component/feature/FeatureToggleListNew/FeatureToggleListNew.styles.ts b/frontend/src/component/feature/FeatureToggleListNew/FeatureToggleListNew.styles.ts
index 4784b6e01d..37c8b7d55a 100644
--- a/frontend/src/component/feature/FeatureToggleListNew/FeatureToggleListNew.styles.ts
+++ b/frontend/src/component/feature/FeatureToggleListNew/FeatureToggleListNew.styles.ts
@@ -10,6 +10,9 @@ export const useStyles = makeStyles(theme => ({
},
tableCellHeader: {
paddingBottom: '0.5rem',
+ fontWeight: 'normal',
+ color: theme.palette.grey[600],
+ borderBottom: '1px solid ' + theme.palette.grey[200],
},
typeHeader: {
[theme.breakpoints.down('sm')]: {
diff --git a/frontend/src/component/feature/FeatureToggleListNew/FeatureToggleListNew.tsx b/frontend/src/component/feature/FeatureToggleListNew/FeatureToggleListNew.tsx
index 02f539b3ac..786de58387 100644
--- a/frontend/src/component/feature/FeatureToggleListNew/FeatureToggleListNew.tsx
+++ b/frontend/src/component/feature/FeatureToggleListNew/FeatureToggleListNew.tsx
@@ -109,7 +109,7 @@ const FeatureToggleListNew = ({
>
{env.name === ':global:'
- ? 'global'
+ ? 'status'
: env.name}
diff --git a/frontend/src/component/feature/FeatureToggleListNew/FeatureToggleListNewItem/FeatureToggleListNewItem.tsx b/frontend/src/component/feature/FeatureToggleListNew/FeatureToggleListNewItem/FeatureToggleListNewItem.tsx
index 0fb5ba54dd..ec534b4ab7 100644
--- a/frontend/src/component/feature/FeatureToggleListNew/FeatureToggleListNewItem/FeatureToggleListNewItem.tsx
+++ b/frontend/src/component/feature/FeatureToggleListNew/FeatureToggleListNewItem/FeatureToggleListNewItem.tsx
@@ -13,6 +13,7 @@ import useToggleFeatureByEnv from '../../../../hooks/api/actions/useToggleFeatur
import { IEnvironments } from '../../../../interfaces/featureToggle';
import ConditionallyRender from '../../../common/ConditionallyRender';
import useToast from '../../../../hooks/useToast';
+import { getTogglePath } from '../../../../utils/route-path-helpers';
interface IFeatureToggleListNewItemProps {
name: string;
@@ -41,7 +42,7 @@ const FeatureToggleListNewItem = ({
const onClick = (e: Event) => {
if (!ref.current?.contains(e.target)) {
- history.push(`/features/strategies/${name}`);
+ history.push(getTogglePath(projectId, name));
}
};
diff --git a/frontend/src/component/feature/FeatureView/FeatureView.jsx b/frontend/src/component/feature/FeatureView/FeatureView.jsx
index 4d60c4e12e..288fabf202 100644
--- a/frontend/src/component/feature/FeatureView/FeatureView.jsx
+++ b/frontend/src/component/feature/FeatureView/FeatureView.jsx
@@ -1,4 +1,4 @@
-import React, { useContext, useEffect, useLayoutEffect, useState } from 'react';
+import { useContext, useEffect, useLayoutEffect, useState } from 'react';
import classnames from 'classnames';
import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';
@@ -37,6 +37,9 @@ import ConfirmDialogue from '../../common/Dialogue';
import { useCommonStyles } from '../../../common.styles';
import AccessContext from '../../../contexts/AccessContext';
import { projectFilterGenerator } from '../../../utils/project-filter-generator';
+import { getToggleCopyPath } from '../../../utils/route-path-helpers';
+import useFeatureApi from '../../../hooks/api/actions/useFeatureApi/useFeatureApi';
+import useToast from '../../../hooks/useToast';
const FeatureView = ({
activeTab,
@@ -62,6 +65,9 @@ const FeatureView = ({
const commonStyles = useCommonStyles();
const { hasAccess } = useContext(AccessContext);
const { project } = featureToggle || {};
+ const { changeFeatureProject } = useFeatureApi();
+ const { toast, setToastData } = useToast();
+ const archive = !Boolean(isFeatureView);
useEffect(() => {
scrollToTop();
@@ -112,31 +118,56 @@ const FeatureView = ({
};
const getTabData = () => {
- const path = !!isFeatureView ? 'features' : 'archive';
+ const path = !!isFeatureView
+ ? `projects/${project}/features`
+ : `projects/${project}/archived`;
+
+ if (archive) {
+ return [
+ {
+ label: 'Metrics',
+ component: getTabComponent('metrics'),
+ name: 'metrics',
+ path: `/${path}/${featureToggleName}/metrics`,
+ },
+ {
+ label: 'Variants',
+ component: getTabComponent('variants'),
+ name: 'variants',
+ path: `/${path}/${featureToggleName}/variants`,
+ },
+ {
+ label: 'Log',
+ component: getTabComponent('log'),
+ name: 'logs',
+ path: `/${path}/${featureToggleName}/logs`,
+ },
+ ];
+ }
return [
{
label: 'Activation',
component: getTabComponent('activation'),
name: 'strategies',
- path: `/${path}/strategies/${featureToggleName}`,
+ path: `/${path}/${featureToggleName}/strategies`,
},
{
label: 'Metrics',
component: getTabComponent('metrics'),
name: 'metrics',
- path: `/${path}/metrics/${featureToggleName}`,
+ path: `/${path}/${featureToggleName}/metrics`,
},
{
label: 'Variants',
component: getTabComponent('variants'),
name: 'variants',
- path: `/${path}/variants/${featureToggleName}`,
+ path: `/${path}/${featureToggleName}/variants`,
},
{
label: 'Log',
component: getTabComponent('log'),
name: 'logs',
- path: `/${path}/logs/${featureToggleName}`,
+ path: `/${path}/${featureToggleName}/logs`,
},
];
};
@@ -153,7 +184,7 @@ const FeatureView = ({
show={
@@ -168,11 +199,11 @@ const FeatureView = ({
const removeToggle = () => {
removeFeatureToggle(featureToggle.name);
- history.push('/features');
+ history.push(`/projects/${featureToggle.project}`);
};
const reviveToggle = () => {
revive(featureToggle.name);
- history.push('/features');
+ history.push(`/projects/${featureToggle.project}`);
};
const updateDescription = description => {
let feature = { ...featureToggle, description };
@@ -198,16 +229,25 @@ const FeatureView = ({
};
const updateProject = evt => {
- evt.preventDefault();
- const project = evt.target.value;
- let feature = { ...featureToggle, project };
- if (Array.isArray(feature.strategies)) {
- feature.strategies.forEach(s => {
- delete s.id;
- });
- }
+ const { project, name } = featureToggle;
+ const newProjectId = evt.target.value;
- editFeatureToggle(feature);
+ changeFeatureProject(project, name, newProjectId)
+ .then(() => {
+ fetchFeatureToggles();
+ setToastData({
+ show: true,
+ type: 'success',
+ text: 'Successfully updated toggle project.',
+ });
+ })
+ .catch(e => {
+ setToastData({
+ show: true,
+ type: 'error',
+ text: e.toString(),
+ });
+ });
};
const updateStale = stale => {
@@ -233,7 +273,13 @@ const FeatureView = ({
{featureToggle.name}
-
+ Archived}
+ elseShow={
+
+ }
+ />
Clone
@@ -348,7 +397,7 @@ const FeatureView = ({
}
elseShow={
@@ -94,8 +97,8 @@ exports[`renders correctly with one feature 1`] = `
className="MuiFormControl-root"
>
@@ -114,13 +117,7 @@ exports[`renders correctly with one feature 1`] = `
role="button"
tabIndex={0}
>
-
+ default
@@ -377,8 +387,7 @@ exports[`renders correctly with one feature 1`] = `
Activation
+
@@ -486,6 +513,7 @@ exports[`renders correctly with one feature 1`] = `
"description": "another's description",
"enabled": false,
"name": "Another",
+ "project": "default",
"stale": false,
"strategies": Array [
Object {
@@ -505,6 +533,7 @@ exports[`renders correctly with one feature 1`] = `
"description": "another's description",
"enabled": false,
"name": "Another",
+ "project": "default",
"stale": false,
"strategies": Array [
Object {
diff --git a/frontend/src/component/feature/view/__tests__/view-component-test.jsx b/frontend/src/component/feature/view/__tests__/view-component-test.jsx
index 611c8a01d2..e84581b05d 100644
--- a/frontend/src/component/feature/view/__tests__/view-component-test.jsx
+++ b/frontend/src/component/feature/view/__tests__/view-component-test.jsx
@@ -34,6 +34,7 @@ test('renders correctly with one feature', () => {
enabled: false,
stale: false,
type: 'release',
+ project: 'default',
strategies: [
{
name: 'gradualRolloutRandom',
diff --git a/frontend/src/component/menu/routes.js b/frontend/src/component/menu/routes.js
index f642d116b2..1de66179d3 100644
--- a/frontend/src/component/menu/routes.js
+++ b/frontend/src/component/menu/routes.js
@@ -16,7 +16,6 @@ import CreateContextField from '../../page/context/create';
import EditContextField from '../../page/context/edit';
import CreateProject from '../../page/project/create';
import EditProject from '../../page/project/edit';
-import ViewProject from '../../page/project/view';
import EditProjectAccess from '../../page/project/access';
import ListTagTypes from '../../page/tag-types';
import CreateTagType from '../../page/tag-types/create';
@@ -39,32 +38,16 @@ import ResetPassword from '../user/ResetPassword/ResetPassword';
import ForgottenPassword from '../user/ForgottenPassword/ForgottenPassword';
import ProjectListNew from '../project/ProjectList/ProjectList';
import Project from '../project/Project/Project';
+import RedirectFeatureViewPage from '../../page/features/redirect';
+import RedirectArchive from '../feature/RedirectArchive/RedirectArchive';
export const routes = [
// Features
- {
- path: '/features/create',
- parent: '/features',
- title: 'Create',
- component: CreateFeatureToggle,
- type: 'protected',
- layout: 'main',
- menu: {},
- },
- {
- path: '/features/copy/:copyToggle',
- parent: '/features',
- title: 'Copy',
- component: CopyFeatureToggle,
- type: 'protected',
- layout: 'main',
- menu: {},
- },
{
path: '/features/:activeTab/:name',
parent: '/features',
title: ':name',
- component: ViewFeatureToggle,
+ component: RedirectFeatureViewPage,
type: 'protected',
layout: 'main',
menu: {},
@@ -127,7 +110,7 @@ export const routes = [
// Archive
{
- path: '/archive/:activeTab/:name',
+ path: '/projects/:id/archived/:name/:activeTab',
title: ':name',
parent: '/archive',
component: ShowArchive,
@@ -203,7 +186,7 @@ export const routes = [
menu: {},
},
{
- path: '/projects/edit/:id',
+ path: '/projects/:id/edit',
parent: '/projects',
title: ':id',
component: EditProject,
@@ -211,15 +194,6 @@ export const routes = [
layout: 'main',
menu: {},
},
- {
- path: '/projects/view/:id',
- parent: '/projects',
- title: ':id',
- component: ViewProject,
- type: 'protected',
- layout: 'main',
- menu: {},
- },
{
path: '/projects/:id/access',
parent: '/projects',
@@ -229,6 +203,42 @@ export const routes = [
layout: 'main',
menu: {},
},
+ {
+ path: '/projects/:id/archived',
+ title: ':name',
+ parent: '/archive',
+ component: RedirectArchive,
+ type: 'protected',
+ layout: 'main',
+ menu: {},
+ },
+ {
+ path: '/projects/:id/features/:name/:activeTab/copy',
+ parent: '/projects/:id/features/:name/:activeTab',
+ title: 'Copy',
+ component: CopyFeatureToggle,
+ type: 'protected',
+ layout: 'main',
+ menu: {},
+ },
+ {
+ path: '/projects/:id/features/:name/:activeTab',
+ parent: '/projects',
+ title: ':name',
+ component: ViewFeatureToggle,
+ type: 'protected',
+ layout: 'main',
+ menu: {},
+ },
+ {
+ path: '/projects/:id/create-toggle',
+ parent: '/projects',
+ title: 'Create',
+ component: CreateFeatureToggle,
+ type: 'protected',
+ layout: 'main',
+ menu: {},
+ },
{
path: '/projects/:id',
parent: '/projects',
diff --git a/frontend/src/component/project/Project/Project.tsx b/frontend/src/component/project/Project/Project.tsx
index 23f196d5c2..6480c8adca 100644
--- a/frontend/src/component/project/Project/Project.tsx
+++ b/frontend/src/component/project/Project/Project.tsx
@@ -13,6 +13,7 @@ import { Link } from 'react-router-dom';
import useToast from '../../../hooks/useToast';
import useQueryParams from '../../../hooks/useQueryParams';
import { useEffect } from 'react';
+import { getProjectEditPath } from '../../../utils/route-path-helpers';
const Project = () => {
const { id } = useParams<{ id: string }>();
@@ -43,7 +44,7 @@ const Project = () => {
{project?.name}{' '}
-
+
diff --git a/frontend/src/component/project/Project/ProjectFeatureToggles/ProjectFeatureToggles.styles.ts b/frontend/src/component/project/Project/ProjectFeatureToggles/ProjectFeatureToggles.styles.ts
index 4a7839d6bd..69f48f7efe 100644
--- a/frontend/src/component/project/Project/ProjectFeatureToggles/ProjectFeatureToggles.styles.ts
+++ b/frontend/src/component/project/Project/ProjectFeatureToggles/ProjectFeatureToggles.styles.ts
@@ -11,6 +11,7 @@ export const useStyles = makeStyles(theme => ({
paddingBottom: '4rem',
},
},
+ bodyClass: { padding: '0.5rem 2rem' },
header: {
padding: '1rem',
},
diff --git a/frontend/src/component/project/Project/ProjectFeatureToggles/ProjectFeatureToggles.tsx b/frontend/src/component/project/Project/ProjectFeatureToggles/ProjectFeatureToggles.tsx
index d479d8542e..3864493944 100644
--- a/frontend/src/component/project/Project/ProjectFeatureToggles/ProjectFeatureToggles.tsx
+++ b/frontend/src/component/project/Project/ProjectFeatureToggles/ProjectFeatureToggles.tsx
@@ -1,9 +1,12 @@
+import { useContext } from 'react';
import { IconButton } from '@material-ui/core';
import { Add } from '@material-ui/icons';
import FilterListIcon from '@material-ui/icons/FilterList';
import { useParams } from 'react-router';
import { Link, useHistory } from 'react-router-dom';
+import AccessContext from '../../../../contexts/AccessContext';
import { IFeatureToggleListItem } from '../../../../interfaces/featureToggle';
+import { getCreateTogglePath } from '../../../../utils/route-path-helpers';
import ConditionallyRender from '../../../common/ConditionallyRender';
import { PROJECTFILTERING } from '../../../common/flags';
import HeaderTitle from '../../../common/HeaderTitle';
@@ -11,6 +14,7 @@ import PageContent from '../../../common/PageContent';
import ResponsiveButton from '../../../common/ResponsiveButton/ResponsiveButton';
import FeatureToggleListNew from '../../../feature/FeatureToggleListNew/FeatureToggleListNew';
import { useStyles } from './ProjectFeatureToggles.styles';
+import { CREATE_FEATURE } from '../../../AccessProvider/permissions';
interface IProjectFeatureToggles {
features: IFeatureToggleListItem[];
@@ -24,10 +28,12 @@ const ProjectFeatureToggles = ({
const styles = useStyles();
const { id } = useParams();
const history = useHistory();
+ const { hasAccess } = useContext(AccessContext);
return (
}
/>
-
- history.push(
- `/features/create?project=${id}`
- )
+
+ history.push(
+ getCreateTogglePath(id)
+ )
+ }
+ maxWidth="700px"
+ tooltip="New feature toggle"
+ Icon={Add}
+ >
+ New feature toggle
+
}
- maxWidth="700px"
- tooltip="New feature toggle"
- Icon={Add}
- >
- New feature toggle
-
+ />
>
}
/>
@@ -78,13 +89,18 @@ const ProjectFeatureToggles = ({
No feature toggles added yet.
-
- Add your first toggle
-
+
+ Add your first toggle
+
+ }
+ />
>
}
/>
diff --git a/frontend/src/component/project/Project/ProjectInfo/ProjectInfo.tsx b/frontend/src/component/project/Project/ProjectInfo/ProjectInfo.tsx
index dc0fa4e04e..aa72a7e8c5 100644
--- a/frontend/src/component/project/Project/ProjectInfo/ProjectInfo.tsx
+++ b/frontend/src/component/project/Project/ProjectInfo/ProjectInfo.tsx
@@ -50,7 +50,7 @@ const ProjectInfo = ({
commonStyles.justifyCenter,
styles.infoLink
)}
- to="/reporting"
+ to={`/reporting?project=${id}`}
>
view more{' '}
diff --git a/frontend/src/component/project/ProjectCard/ProjectCard.tsx b/frontend/src/component/project/ProjectCard/ProjectCard.tsx
index 114abb9ee0..23b64a7de9 100644
--- a/frontend/src/component/project/ProjectCard/ProjectCard.tsx
+++ b/frontend/src/component/project/ProjectCard/ProjectCard.tsx
@@ -11,6 +11,7 @@ import Dialogue from '../../common/Dialogue';
import useProjectApi from '../../../hooks/api/actions/useProjectApi/useProjectApi';
import useProjects from '../../../hooks/api/getters/useProjects/useProjects';
import { Delete, Edit } from '@material-ui/icons';
+import { getProjectEditPath } from '../../../utils/route-path-helpers';
interface IProjectCardProps {
name: string;
featureCount: number;
@@ -77,7 +78,8 @@ const ProjectCard = ({