1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-07-26 13:48:33 +02:00

Fix/create feature (#332)

* fix: ensure constraints exists before running check

* fix: project select

* fix: add zIndex to toast starting position

* fix: lint

* fix: hide project select in oss
This commit is contained in:
Fredrik Strand Oseberg 2021-08-30 14:26:53 +02:00 committed by GitHub
parent ae4d8f6b05
commit f04ed138ed
4 changed files with 40 additions and 15 deletions

View File

@ -77,6 +77,8 @@ export const useCommonStyles = makeStyles(theme => ({
right: '40px',
bottom: '40px',
transform: 'translateY(400px)',
zIndex: 300,
position: 'relative',
},
fadeInBottomEnter: {
transform: 'translateY(0)',

View File

@ -1,16 +1,26 @@
import React from 'react';
import React, { useEffect } from 'react';
import { MenuItem } from '@material-ui/core';
import PropTypes from 'prop-types';
import DropdownMenu from '../DropdownMenu/DropdownMenu';
import useProjects from '../../../hooks/api/getters/useProjects/useProjects';
const ALL_PROJECTS = { id: '*', name: '> All projects' };
const ProjectSelect = ({
projects,
currentProjectId,
updateCurrentProject,
...rest
}) => {
const ProjectSelect = ({ currentProjectId, updateCurrentProject, ...rest }) => {
const { projects } = useProjects();
useEffect(() => {
let currentProject = projects.find(i => i.id === currentProjectId);
if (currentProject) {
setProject(currentProject.id);
return;
}
setProject('*');
/* eslint-disable-next-line */
}, []);
const setProject = v => {
const id = typeof v === 'string' ? v.trim() : '';
updateCurrentProject(id);

View File

@ -9,6 +9,8 @@ import DropdownMenu from '../../../common/DropdownMenu/DropdownMenu';
import ProjectSelect from '../../../common/ProjectSelect';
import { useStyles } from './styles';
import useLoading from '../../../../hooks/useLoading';
import useUiConfig from '../../../../hooks/api/getters/useUiConfig/useUiConfig';
import ConditionallyRender from '../../../common/ConditionallyRender';
const sortingOptions = [
{ type: 'name', displayName: 'Name' },
@ -29,6 +31,7 @@ const FeatureToggleListActions = ({
loading,
}) => {
const styles = useStyles();
const { uiConfig } = useUiConfig();
const ref = useLoading(loading);
const handleSort = e => {
@ -94,14 +97,19 @@ const FeatureToggleListActions = ({
style={{ textTransform: 'lowercase', fontWeight: 'normal' }}
data-loading
/>
<ProjectSelect
settings={settings}
updateSetting={updateSetting}
style={{
textTransform: 'lowercase',
fontWeight: 'normal',
}}
data-loading
<ConditionallyRender
condition={uiConfig.flags.P}
show={
<ProjectSelect
settings={settings}
updateSetting={updateSetting}
style={{
textTransform: 'lowercase',
fontWeight: 'normal',
}}
data-loading
/>
}
/>
</div>
);

View File

@ -61,6 +61,11 @@ const EditStrategyModal = ({
const { constraints } = strategy;
let valid = true;
if (!constraints) {
saveStrategy();
return;
}
constraints.forEach((constraint, index) => {
const { values } = constraint;