From d42d412bc81c5cd6fba9d25ab3b2ec400f879f98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivar=20Conradi=20=C3=98sthus?= Date: Fri, 15 Oct 2021 11:20:14 +0200 Subject: [PATCH] fix: make toggle list sortable inside a project (#436) * fix: make toggle list sortable inside a project * fix: minor cleanup --- .../common/PaginateUI/PaginateUI.tsx | 8 ++ .../FeatureToggleListActions.jsx | 9 +- .../FeatureToggleListItem.jsx | 22 ++-- .../FeatureToggleListItem/styles.js | 4 +- .../feature-list-item-component-test.jsx.snap | 82 +++++++++---- .../list-component-test.jsx.snap | 111 ------------------ .../FeatureToggleListNew.styles.ts | 8 ++ .../FeatureToggleListNew.tsx | 106 +++++++++++++++-- .../FeatureToggleListNewItem/CreatedAt.tsx | 25 ++++ .../FeatureToggleListNewItem.tsx | 7 ++ .../FeatureStatus/FeatureStatus.tsx | 4 +- .../ProjectFeatureToggles.styles.ts | 2 +- frontend/src/interfaces/featureToggle.ts | 4 +- 13 files changed, 233 insertions(+), 159 deletions(-) create mode 100644 frontend/src/component/feature/FeatureToggleListNew/FeatureToggleListNewItem/CreatedAt.tsx diff --git a/frontend/src/component/common/PaginateUI/PaginateUI.tsx b/frontend/src/component/common/PaginateUI/PaginateUI.tsx index 6d4ea54126..fabe28f703 100644 --- a/frontend/src/component/common/PaginateUI/PaginateUI.tsx +++ b/frontend/src/component/common/PaginateUI/PaginateUI.tsx @@ -37,6 +37,14 @@ const PaginateUI = ({ } }, [matches]); + + useEffect(() => { + if(pageIndex === 0 && start !== 0) { + setStart(0); + setLimit(STARTLIMIT); + } + }, [pageIndex, start]) + return ( 1} diff --git a/frontend/src/component/feature/FeatureToggleList/FeatureToggleListActions/FeatureToggleListActions.jsx b/frontend/src/component/feature/FeatureToggleList/FeatureToggleListActions/FeatureToggleListActions.jsx index 0bf508d053..d242ebdd2f 100644 --- a/frontend/src/component/feature/FeatureToggleList/FeatureToggleListActions/FeatureToggleListActions.jsx +++ b/frontend/src/component/feature/FeatureToggleList/FeatureToggleListActions/FeatureToggleListActions.jsx @@ -2,9 +2,8 @@ import React from 'react'; import PropTypes from 'prop-types'; import { MenuItem, Typography } from '@material-ui/core'; -import { HourglassEmpty, HourglassFull } from '@material-ui/icons'; - -import { MenuItemWithIcon } from '../../../common'; +// import { HourglassEmpty, HourglassFull } from '@material-ui/icons'; +// import { MenuItemWithIcon } from '../../../common'; import DropdownMenu from '../../../common/DropdownMenu/DropdownMenu'; import ProjectSelect from '../../../common/ProjectSelect'; import { useStyles } from './styles'; @@ -53,6 +52,7 @@ const FeatureToggleListActions = ({ )); + /* const renderMetricsOptions = () => [ , ]; + */ return (
Sorted by: + {/* } + {*/} - - {name}  - + + + {name}  + + @@ -74,9 +76,11 @@ const FeatureToggleListItem = ({ } elseShow={ <> - - {name}  - + + + {name}  +z + @@ -100,7 +104,9 @@ const FeatureToggleListItem = ({ )} > - + + + ({ listItemType: { width: '40px', textAlign: 'center', + marginRight: '0', + flexShrink: '0', }, listItemSvg: { fill: theme.palette.icons.lightGrey, }, listItemLink: { - marginLeft: '10px', + marginLeft: '0.25rem', minWidth: '0', }, listItemStrategies: { 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 bbf66a980d..c04dcb5bec 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 @@ -23,7 +23,7 @@ exports[`renders correctly with one feature 1`] = ` "fontSize": "0.8rem", } } - title="No usage reported" + title="No usage reported from connected applications" > Another   @@ -96,23 +104,33 @@ exports[`renders correctly with one feature 1`] = ` -
- - default - -
+ + default + +
+ `; @@ -140,7 +158,7 @@ exports[`renders correctly with one feature without permission 1`] = ` "fontSize": "0.8rem", } } - title="No usage reported" + title="No usage reported from connected applications" > Another   @@ -213,21 +239,31 @@ 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 16521d96be..0a8318a4f3 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 @@ -85,60 +85,6 @@ exports[`renders correctly with one feature 1`] = ` > Sorted by:

-