diff --git a/frontend/src/component/common/Dialogue/Dialogue.jsx b/frontend/src/component/common/Dialogue/Dialogue.jsx
index d18bcedd2d..f386faf778 100644
--- a/frontend/src/component/common/Dialogue/Dialogue.jsx
+++ b/frontend/src/component/common/Dialogue/Dialogue.jsx
@@ -10,7 +10,7 @@ import PropTypes from 'prop-types';
import ConditionallyRender from '../ConditionallyRender/ConditionallyRender';
import { useStyles } from './Dialogue.styles';
-const ConfirmDialogue = ({
+const Dialogue = ({
children,
open,
onClick,
@@ -67,10 +67,9 @@ const ConfirmDialogue = ({
);
};
-ConfirmDialogue.propTypes = {
+Dialogue.propTypes = {
primaryButtonText: PropTypes.string,
secondaryButtonText: PropTypes.string,
- children: PropTypes.object,
open: PropTypes.bool,
onClick: PropTypes.func,
onClose: PropTypes.func,
@@ -80,4 +79,4 @@ ConfirmDialogue.propTypes = {
fullWidth: PropTypes.bool,
};
-export default ConfirmDialogue;
+export default Dialogue;
diff --git a/frontend/src/component/context/ContextList/ContextList.jsx b/frontend/src/component/context/ContextList/ContextList.jsx
index 0ba5874cd8..6042c1a07a 100644
--- a/frontend/src/component/context/ContextList/ContextList.jsx
+++ b/frontend/src/component/context/ContextList/ContextList.jsx
@@ -26,6 +26,8 @@ const ContextList = ({ removeContextField, history, contextFields }) => {
const [showDelDialogue, setShowDelDialogue] = useState(false);
const [name, setName] = useState();
+ console.log(contextFields);
+
const styles = useStyles();
const contextList = () =>
contextFields.map(field => (
diff --git a/frontend/src/component/feature/strategy/StrategyCard/StrategyCardContent/common/StrategyCardConstraints/StrategyCardConstraints.jsx b/frontend/src/component/feature/strategy/StrategyCard/StrategyCardContent/common/StrategyCardConstraints/StrategyCardConstraints.jsx
index 133e72cb56..5eb6f29659 100644
--- a/frontend/src/component/feature/strategy/StrategyCard/StrategyCardContent/common/StrategyCardConstraints/StrategyCardConstraints.jsx
+++ b/frontend/src/component/feature/strategy/StrategyCard/StrategyCardContent/common/StrategyCardConstraints/StrategyCardConstraints.jsx
@@ -6,7 +6,7 @@ import { useStyles } from './StrategyCardConstraints.styles.js';
import ConditionallyRender from '../../../../../../common/ConditionallyRender/ConditionallyRender';
import { C } from '../../../../../../common/flags.js';
-const StrategyCardConstraints = ({ constraints= [], flags }) => {
+const StrategyCardConstraints = ({ constraints = [], flags }) => {
const styles = useStyles();
const isEnterprise = () => {
@@ -33,8 +33,9 @@ const StrategyCardConstraints = ({ constraints= [], flags }) => {
};
const renderConstraints = () => {
+ /* TODO: We need something unique here or we might have weird rendering issues. */
return constraints.map((constraint, i) => (
-
+
0}
show={and}
diff --git a/frontend/src/component/feature/strategy/StrategyConstraint/StrategyConstraintInputField/StrategyConstraintInputField.jsx b/frontend/src/component/feature/strategy/StrategyConstraint/StrategyConstraintInputField/StrategyConstraintInputField.jsx
index faa3868bd8..9a67115bbb 100644
--- a/frontend/src/component/feature/strategy/StrategyConstraint/StrategyConstraintInputField/StrategyConstraintInputField.jsx
+++ b/frontend/src/component/feature/strategy/StrategyConstraint/StrategyConstraintInputField/StrategyConstraintInputField.jsx
@@ -13,7 +13,12 @@ const constraintOperators = [
{ key: 'NOT_IN', label: 'NOT_IN' },
];
-const StrategyConstraintInputField = ({ constraint, updateConstraint, removeConstraint, contextFields }) => {
+const StrategyConstraintInputField = ({
+ constraint,
+ updateConstraint,
+ removeConstraint,
+ contextFields,
+}) => {
const [error, setError] = useState();
const commonStyles = useCommonStyles();
const styles = useStyles();
@@ -40,10 +45,14 @@ const StrategyConstraintInputField = ({ constraint, updateConstraint, removeCons
key: f.name,
label: f.name,
}));
- const constraintDef = contextFields.find(c => c.name === constraint.contextName);
+ const constraintDef = contextFields.find(
+ c => c.name === constraint.contextName
+ );
const options =
- constraintDef && constraintDef.legalValues && constraintDef.legalValues.length > 0
+ constraintDef &&
+ constraintDef.legalValues &&
+ constraintDef.legalValues.length > 0
? constraintDef.legalValues.map(l => ({ value: l, label: l }))
: undefined;
const values = constraint.values.map(v => ({ value: v, label: v }));
@@ -55,8 +64,10 @@ const StrategyConstraintInputField = ({ constraint, updateConstraint, removeCons
name="contextName"
label="Context Field"
options={constraintContextNames}
- value={constraint.contextName}
- onChange={evt => updateConstraint(evt.target.value, 'contextName')}
+ value={constraint.contextName || ''}
+ onChange={evt =>
+ updateConstraint(evt.target.value, 'contextName')
+ }
className={styles.contextField}
/>
@@ -66,7 +77,9 @@ const StrategyConstraintInputField = ({ constraint, updateConstraint, removeCons
label="Operator"
options={constraintOperators}
value={constraint.operator}
- onChange={evt => updateConstraint(evt.target.value, 'operator')}
+ onChange={evt =>
+ updateConstraint(evt.target.value, 'operator')
+ }
className={styles.operator}
/>
@@ -78,13 +91,27 @@ const StrategyConstraintInputField = ({ constraint, updateConstraint, removeCons
multiple
size="small"
options={options}
+ value={values || []}
getOptionLabel={option => option.label}
- getOptionSelected={(option, value) => option.value === value.value}
- defaultValue={values}
+ getOptionSelected={(option, value) =>
+ option.value === value.value
+ }
filterSelectedOptions
- filterOptions={options => options.filter(o => !values.some(v => v.value === o.value))}
- onChange={(evt, values) => handleChangeValue(values)}
- renderInput={params => }
+ filterOptions={options =>
+ options.filter(
+ o => !values.some(v => v.value === o.value)
+ )
+ }
+ onChange={(evt, values) =>
+ handleChangeValue(values)
+ }
+ renderInput={params => (
+
+ )}
/>
}
elseShow={
@@ -94,7 +121,9 @@ const StrategyConstraintInputField = ({ constraint, updateConstraint, removeCons
onBlur={onBlur}
values={constraint.values}
label="Values (v1, v2, v3)"
- updateValues={values => updateConstraint(values, 'values')}
+ updateValues={values =>
+ updateConstraint(values, 'values')
+ }
/>
}
/>
diff --git a/frontend/src/component/feature/view/update-description-component.jsx b/frontend/src/component/feature/view/update-description-component.jsx
index ecf51a0cea..907c8c6b8c 100644
--- a/frontend/src/component/feature/view/update-description-component.jsx
+++ b/frontend/src/component/feature/view/update-description-component.jsx
@@ -1,7 +1,13 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';
-import { Typography, IconButton, FormControl, TextField, Button } from '@material-ui/core';
+import {
+ Typography,
+ IconButton,
+ FormControl,
+ TextField,
+ Button,
+} from '@material-ui/core';
import CreateIcon from '@material-ui/icons/Create';
import ConditionallyRender from '../../common/ConditionallyRender/ConditionallyRender';
@@ -53,7 +59,10 @@ export default class UpdateDescriptionComponent extends React.Component {
aria-label="toggle description edit"
to="#edit"
component={Link}
- onClick={this.onEditMode.bind(this, description)}
+ onClick={this.onEditMode.bind(
+ this,
+ description
+ )}
>
@@ -79,11 +88,16 @@ export default class UpdateDescriptionComponent extends React.Component {
onChange={this.updateValue}
/>
-
@@ -93,6 +107,8 @@ export default class UpdateDescriptionComponent extends React.Component {
render() {
const { editMode } = this.state;
- return editMode ? this.renderEdit(this.props) : this.renderRead(this.props);
+ return editMode
+ ? this.renderEdit(this.props)
+ : this.renderRead(this.props);
}
}
diff --git a/frontend/src/component/strategies/CreateStrategy/CreateStrategy.jsx b/frontend/src/component/strategies/CreateStrategy/CreateStrategy.jsx
index dafc0c9eca..3fc1e4fd2b 100644
--- a/frontend/src/component/strategies/CreateStrategy/CreateStrategy.jsx
+++ b/frontend/src/component/strategies/CreateStrategy/CreateStrategy.jsx
@@ -30,7 +30,7 @@ const CreateStrategy = ({
+
Be careful! Changing a strategy definition might also
require changes to the implementation in the clients.
diff --git a/frontend/src/component/strategies/strategy-details-component.jsx b/frontend/src/component/strategies/strategy-details-component.jsx
index 3ad1e5cfcd..58b55ef6eb 100644
--- a/frontend/src/component/strategies/strategy-details-component.jsx
+++ b/frontend/src/component/strategies/strategy-details-component.jsx
@@ -17,7 +17,7 @@ export default class StrategyDetails extends Component {
toggles: PropTypes.array,
applications: PropTypes.array,
activeTab: PropTypes.string.isRequired,
- strategy: PropTypes.object.isRequired,
+ strategy: PropTypes.object,
fetchStrategies: PropTypes.func.isRequired,
fetchApplications: PropTypes.func.isRequired,
fetchFeatureToggles: PropTypes.func.isRequired,
@@ -38,6 +38,8 @@ export default class StrategyDetails extends Component {
render() {
const strategy = this.props.strategy;
+ if (!strategy) return null;
+
const tabData = [
{
label: 'Details',
diff --git a/frontend/src/component/tag-types/TagTypeList/TagTypeList.jsx b/frontend/src/component/tag-types/TagTypeList/TagTypeList.jsx
index aacb9af926..c4ba69aea5 100644
--- a/frontend/src/component/tag-types/TagTypeList/TagTypeList.jsx
+++ b/frontend/src/component/tag-types/TagTypeList/TagTypeList.jsx
@@ -1,4 +1,4 @@
-import React, { useContext, useEffect, useState } from 'react';
+import { useContext, useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import { Link, useHistory } from 'react-router-dom';
@@ -11,7 +11,6 @@ import {
IconButton,
Button,
Tooltip,
- Typography,
} from '@material-ui/core';
import HeaderTitle from '../../common/HeaderTitle';
import PageContent from '../../common/PageContent/PageContent';
@@ -131,9 +130,7 @@ const TagTypeList = ({ tagTypes, fetchTagTypes, removeTagType }) => {
onClose={() => {
setDeletion({ open: false });
}}
- >
- Are you sure?
-
+ />
);
};
diff --git a/frontend/src/page/admin/api/api-key-create.jsx b/frontend/src/page/admin/api/api-key-create.jsx
index 3bd51a103f..1e66f83fce 100644
--- a/frontend/src/page/admin/api/api-key-create.jsx
+++ b/frontend/src/page/admin/api/api-key-create.jsx
@@ -1,6 +1,13 @@
import React, { useState } from 'react';
import PropTypes from 'prop-types';
-import { Select, TextField, Button, MenuItem, FormControl, InputLabel } from '@material-ui/core';
+import {
+ Select,
+ TextField,
+ Button,
+ MenuItem,
+ FormControl,
+ InputLabel,
+} from '@material-ui/core';
import Dialogue from '../../../component/common/Dialogue/Dialogue';
import classnames from 'classnames';
import { styles as commonStyles } from '../../../component/common';
@@ -43,9 +50,15 @@ function CreateApiKey({ addKey }) {
secondaryButtonText="Cancel"
title="Add new API key"
>
-