diff --git a/frontend/src/component/menu/routes.js b/frontend/src/component/menu/routes.js
index a61593860f..b473a9ad37 100644
--- a/frontend/src/component/menu/routes.js
+++ b/frontend/src/component/menu/routes.js
@@ -8,7 +8,7 @@ import HistoryTogglePage from '../../page/history/toggle';
import { ArchiveListContainer } from '../archive/ArchiveListContainer';
import Applications from '../../page/applications';
import ApplicationView from '../../page/applications/view';
-import ListTagTypes from '../../page/tag-types';
+import { TagTypeList } from '../tags/TagTypeList/TagTypeList';
import Addons from '../../page/addons';
import AddonsCreate from '../../page/addons/create';
import AddonsEdit from '../../page/addons/edit';
@@ -37,8 +37,8 @@ import CreateEnvironment from '../environments/CreateEnvironment/CreateEnvironme
import EditEnvironment from '../environments/EditEnvironment/EditEnvironment';
import CreateContext from '../context/CreateContext/CreateContext';
import EditContext from '../context/EditContext/EditContext';
-import EditTagType from '../tagTypes/EditTagType/EditTagType';
-import CreateTagType from '../tagTypes/CreateTagType/CreateTagType';
+import EditTagType from '../tags/EditTagType/EditTagType';
+import CreateTagType from '../tags/CreateTagType/CreateTagType';
import EditProject from '../project/Project/EditProject/EditProject';
import CreateProject from '../project/Project/CreateProject/CreateProject';
import CreateFeature from '../feature/CreateFeature/CreateFeature';
@@ -314,7 +314,7 @@ export const routes = [
{
path: '/tag-types',
title: 'Tag types',
- component: ListTagTypes,
+ component: TagTypeList,
type: 'protected',
layout: 'main',
menu: { mobile: true, advanced: true },
diff --git a/frontend/src/component/tag-types/TagTypeList/index.jsx b/frontend/src/component/tag-types/TagTypeList/index.jsx
deleted file mode 100644
index 20507a5dfc..0000000000
--- a/frontend/src/component/tag-types/TagTypeList/index.jsx
+++ /dev/null
@@ -1,3 +0,0 @@
-import TagTypeList from './TagTypeList';
-
-export default TagTypeList;
diff --git a/frontend/src/component/tag-types/__tests__/__snapshots__/tag-type-create-component-test.js.snap b/frontend/src/component/tag-types/__tests__/__snapshots__/tag-type-create-component-test.js.snap
deleted file mode 100644
index 29b3b14a98..0000000000
--- a/frontend/src/component/tag-types/__tests__/__snapshots__/tag-type-create-component-test.js.snap
+++ /dev/null
@@ -1,157 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`it supports editMode 1`] = `
-
-
-
-
-
- Update Tag type
-
-
-
-
-
-
-
- Tag types allow you to group tags together in the management UI
-
-
-
-
-
-`;
-
-exports[`renders correctly for creating 1`] = `
-
-
-
-
-
- Create Tag type
-
-
-
-
-
-
-
- Tag types allow you to group tags together in the management UI
-
-
-
-
-
-`;
-
-exports[`renders correctly for creating without permissions 1`] = `
-
-
-
-
-
- Create Tag type
-
-
-
-
-
-
-
- Tag types allow you to group tags together in the management UI
-
-
-
-
-
-`;
diff --git a/frontend/src/component/tag-types/__tests__/tag-type-create-component-test.js b/frontend/src/component/tag-types/__tests__/tag-type-create-component-test.js
deleted file mode 100644
index f43bb99bde..0000000000
--- a/frontend/src/component/tag-types/__tests__/tag-type-create-component-test.js
+++ /dev/null
@@ -1,80 +0,0 @@
-import React from 'react';
-import { ThemeProvider } from '@material-ui/core';
-import TagTypes from '../form-tag-type-component';
-import renderer from 'react-test-renderer';
-import theme from '../../../themes/main-theme';
-import AccessProvider from '../../providers/AccessProvider/AccessProvider';
-import { createFakeStore } from '../../../accessStoreFake';
-import {
- CREATE_TAG_TYPE,
- UPDATE_TAG_TYPE,
-} from '../../providers/AccessProvider/permissions';
-
-jest.mock('@material-ui/core/TextField');
-
-test('renders correctly for creating', () => {
- const tree = renderer
- .create(
-
-
- Promise.resolve(true)}
- tagType={{ name: '', description: '', icon: '' }}
- editMode={false}
- submit={jest.fn()}
- />
-
-
- )
- .toJSON();
- expect(tree).toMatchSnapshot();
-});
-
-test('renders correctly for creating without permissions', () => {
- const tree = renderer
- .create(
-
-
- Promise.resolve(true)}
- tagType={{ name: '', description: '', icon: '' }}
- editMode={false}
- submit={jest.fn()}
- />
-
-
- )
- .toJSON();
- expect(tree).toMatchSnapshot();
-});
-
-test('it supports editMode', () => {
- const tree = renderer
- .create(
-
-
- Promise.resolve(true)}
- tagType={{ name: '', description: '', icon: '' }}
- editMode
- submit={jest.fn()}
- />
-
-
- )
- .toJSON();
- expect(tree).toMatchSnapshot();
-});
diff --git a/frontend/src/component/tag-types/create-tag-type-container.js b/frontend/src/component/tag-types/create-tag-type-container.js
deleted file mode 100644
index a8cd3c253e..0000000000
--- a/frontend/src/component/tag-types/create-tag-type-container.js
+++ /dev/null
@@ -1,17 +0,0 @@
-import { connect } from 'react-redux';
-import TagTypeComponent from './form-tag-type-component';
-import { createTagType, validateName } from '../../store/tag-type/actions';
-
-const mapStateToProps = () => ({
- tagType: { name: '', description: '', icon: '' },
- editMode: false,
-});
-
-const mapDispatchToProps = dispatch => ({
- validateName: name => validateName(name),
- submit: tagType => createTagType(tagType)(dispatch),
-});
-
-const FormAddContainer = connect(mapStateToProps, mapDispatchToProps)(TagTypeComponent);
-
-export default FormAddContainer;
diff --git a/frontend/src/component/tag-types/edit-tag-type-container.js b/frontend/src/component/tag-types/edit-tag-type-container.js
deleted file mode 100644
index 4372dc799b..0000000000
--- a/frontend/src/component/tag-types/edit-tag-type-container.js
+++ /dev/null
@@ -1,25 +0,0 @@
-import { connect } from 'react-redux';
-import Component from './form-tag-type-component';
-import { updateTagType } from '../../store/tag-type/actions';
-
-const mapStateToProps = (state, props) => {
- const tagTypeBase = { name: '', description: '', icon: '' };
- const realTagType = state.tagTypes.toJS().find(n => n.name === props.tagTypeName);
- const tagType = Object.assign(tagTypeBase, realTagType);
-
- return {
- tagType,
- editMode: true,
- };
-};
-
-const mapDispatchToProps = dispatch => ({
- validateName: () => {},
- submit: tagType => {
- updateTagType(tagType)(dispatch);
- },
-});
-
-const FormAddContainer = connect(mapStateToProps, mapDispatchToProps)(Component);
-
-export default FormAddContainer;
diff --git a/frontend/src/component/tag-types/form-tag-type-component.js b/frontend/src/component/tag-types/form-tag-type-component.js
deleted file mode 100644
index 0f07f700d7..0000000000
--- a/frontend/src/component/tag-types/form-tag-type-component.js
+++ /dev/null
@@ -1,140 +0,0 @@
-import React, { useContext, useState } from 'react';
-import PropTypes from 'prop-types';
-import classnames from 'classnames';
-
-import { FormButtons } from '../common';
-import PageContent from '../common/PageContent/PageContent';
-import { Typography, TextField } from '@material-ui/core';
-
-import styles from './TagType.module.scss';
-import commonStyles from '../common/common.module.scss';
-import AccessContext from '../../contexts/AccessContext';
-import {
- CREATE_TAG_TYPE,
- UPDATE_TAG_TYPE,
-} from '../providers/AccessProvider/permissions';
-import ConditionallyRender from '../common/ConditionallyRender';
-
-const AddTagTypeComponent = ({
- tagType,
- validateName,
- submit,
- history,
- editMode,
-}) => {
- const [tagTypeName, setTagTypeName] = useState(tagType.name || '');
- const [tagTypeDescription, setTagTypeDescription] = useState(
- tagType.description || ''
- );
- const [errors, setErrors] = useState({
- general: undefined,
- name: undefined,
- description: undefined,
- });
- const { hasAccess } = useContext(AccessContext);
-
- const onValidateName = async evt => {
- evt.preventDefault();
- const name = evt.target.value;
- try {
- await validateName(name);
- setErrors({ name: undefined });
- } catch (err) {
- setErrors({ name: err.message });
- }
- };
-
- const onCancel = evt => {
- evt.preventDefault();
- history.push('/tag-types');
- };
-
- const onSubmit = async evt => {
- evt.preventDefault();
- try {
- await submit({
- name: tagTypeName,
- description: tagTypeDescription,
- });
- history.push('/tag-types');
- } catch (e) {
- setErrors({ general: e.message });
- }
- };
- const submitText = editMode ? 'Update' : 'Create';
- return (
-
-
-
- Tag types allow you to group tags together in the
- management UI
-
-
-
-
- );
-};
-
-AddTagTypeComponent.propTypes = {
- tagType: PropTypes.object.isRequired,
- validateName: PropTypes.func.isRequired,
- submit: PropTypes.func.isRequired,
- history: PropTypes.object.isRequired,
- editMode: PropTypes.bool.isRequired,
-};
-
-export default AddTagTypeComponent;
diff --git a/frontend/src/component/tag-types/index.jsx b/frontend/src/component/tag-types/index.jsx
deleted file mode 100644
index 5cd1cf92d5..0000000000
--- a/frontend/src/component/tag-types/index.jsx
+++ /dev/null
@@ -1,21 +0,0 @@
-import { connect } from 'react-redux';
-import TagTypesListComponent from './TagTypeList';
-import { fetchTagTypes, removeTagType } from '../../store/tag-type/actions';
-
-const mapStateToProps = state => {
- const list = state.tagTypes.toJS();
- return {
- tagTypes: list,
- };
-};
-
-const mapDispatchToProps = dispatch => ({
- removeTagType: tagtype => {
- removeTagType(tagtype)(dispatch);
- },
- fetchTagTypes: () => fetchTagTypes()(dispatch),
-});
-
-const TagTypesListContainer = connect(mapStateToProps, mapDispatchToProps)(TagTypesListComponent);
-
-export default TagTypesListContainer;
diff --git a/frontend/src/component/tagTypes/CreateTagType/CreateTagType.tsx b/frontend/src/component/tags/CreateTagType/CreateTagType.tsx
similarity index 97%
rename from frontend/src/component/tagTypes/CreateTagType/CreateTagType.tsx
rename to frontend/src/component/tags/CreateTagType/CreateTagType.tsx
index 75f589eaab..147129e1b9 100644
--- a/frontend/src/component/tagTypes/CreateTagType/CreateTagType.tsx
+++ b/frontend/src/component/tags/CreateTagType/CreateTagType.tsx
@@ -5,7 +5,7 @@ import useToast from '../../../hooks/useToast';
import FormTemplate from '../../common/FormTemplate/FormTemplate';
import PermissionButton from '../../common/PermissionButton/PermissionButton';
import { UPDATE_TAG_TYPE } from '../../providers/AccessProvider/permissions';
-import useTagForm from '../hooks/useTagForm';
+import useTagTypeForm from '../TagTypeForm/useTagTypeForm';
import TagTypeForm from '../TagTypeForm/TagTypeForm';
const CreateTagType = () => {
@@ -21,7 +21,7 @@ const CreateTagType = () => {
validateNameUniqueness,
errors,
clearErrors,
- } = useTagForm();
+ } = useTagTypeForm();
const { createTag, loading } = useTagTypesApi();
const handleSubmit = async (e: Event) => {
diff --git a/frontend/src/component/tagTypes/EditTagType/EditTagType.tsx b/frontend/src/component/tags/EditTagType/EditTagType.tsx
similarity index 95%
rename from frontend/src/component/tagTypes/EditTagType/EditTagType.tsx
rename to frontend/src/component/tags/EditTagType/EditTagType.tsx
index e1bba0ff8d..b8d825f00d 100644
--- a/frontend/src/component/tagTypes/EditTagType/EditTagType.tsx
+++ b/frontend/src/component/tags/EditTagType/EditTagType.tsx
@@ -6,7 +6,7 @@ import useToast from '../../../hooks/useToast';
import FormTemplate from '../../common/FormTemplate/FormTemplate';
import PermissionButton from '../../common/PermissionButton/PermissionButton';
import { UPDATE_TAG_TYPE } from '../../providers/AccessProvider/permissions';
-import useTagForm from '../hooks/useTagForm';
+import useTagTypeForm from '../TagTypeForm/useTagTypeForm';
import TagForm from '../TagTypeForm/TagTypeForm';
const EditTagType = () => {
@@ -23,7 +23,7 @@ const EditTagType = () => {
getTagPayload,
errors,
clearErrors,
- } = useTagForm(tagType?.name, tagType?.description);
+ } = useTagTypeForm(tagType?.name, tagType?.description);
const { updateTagType, loading } = useTagTypesApi();
const handleSubmit = async (e: Event) => {
diff --git a/frontend/src/component/tags/Tag.module.scss b/frontend/src/component/tags/Tag.module.scss
deleted file mode 100644
index b2a967e5a3..0000000000
--- a/frontend/src/component/tags/Tag.module.scss
+++ /dev/null
@@ -1,32 +0,0 @@
-.select {
- min-width: 100px;
-}
-
-.textfield {
- margin-left: 15px;
-}
-
-.header {
- padding: var(--card-header-padding);
- word-break: break-all;
- border-bottom: var(--default-border);
- display: flex;
- align-items: center;
- justify-content: space-between;
-}
-
-.header h1 {
- font-size: var(--h1-size);
-}
-
-.container {
- padding: var(--card-padding);
-}
-
-.formbuttons {
- padding-top: 1rem;
-}
-
-.tagListItem {
- padding: 0;
-}
diff --git a/frontend/src/component/tags/TagList/TagList.jsx b/frontend/src/component/tags/TagList/TagList.jsx
deleted file mode 100644
index bc26b0dbf6..0000000000
--- a/frontend/src/component/tags/TagList/TagList.jsx
+++ /dev/null
@@ -1,138 +0,0 @@
-import React, { useContext, useEffect } from 'react';
-import PropTypes from 'prop-types';
-import useMediaQuery from '@material-ui/core/useMediaQuery';
-import { useHistory } from 'react-router-dom';
-
-import {
- Button,
- IconButton,
- List,
- ListItem,
- ListItemIcon,
- ListItemText,
- Tooltip,
-} from '@material-ui/core';
-import { Add, Label, Delete } from '@material-ui/icons';
-
-import {
- CREATE_TAG,
- DELETE_TAG,
-} from '../../providers/AccessProvider/permissions';
-import ConditionallyRender from '../../common/ConditionallyRender/ConditionallyRender';
-import HeaderTitle from '../../common/HeaderTitle';
-import PageContent from '../../common/PageContent/PageContent';
-
-import { useStyles } from './TagList.styles';
-import AccessContext from '../../../contexts/AccessContext';
-
-const TagList = ({ tags, fetchTags, removeTag }) => {
- const history = useHistory();
- const smallScreen = useMediaQuery('(max-width:700px)');
- const styles = useStyles();
- const { hasAccess } = useContext(AccessContext);
-
- useEffect(() => {
- fetchTags();
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, []);
-
- const remove = (tag, evt) => {
- evt.preventDefault();
- removeTag(tag);
- };
-
- const listItem = tag => (
-
-
-
-
-
-
- }
- />
-
- );
-
- const DeleteButton = ({ tagType, tagValue }) => (
-
- remove({ type: tagType, value: tagValue }, e)}
- >
-
-
-
- );
-
- DeleteButton.propTypes = {
- tagType: PropTypes.string,
- tagValue: PropTypes.string,
- };
-
- const AddButton = ({ hasAccess }) => (
- history.push('/tag-types/create')}
- >
-
-
- }
- elseShow={
-
- }
- onClick={() =>
- history.push('/tag-types/create')
- }
- variant="contained"
- >
- Add new tag
-
-
- }
- />
- }
- />
- );
- return (
- }
- />
- }
- >
-
- 0}
- show={tags.map(tag => listItem(tag))}
- elseShow={
-
-
-
- }
- />
-
-
- );
-};
-
-TagList.propTypes = {
- tags: PropTypes.array.isRequired,
- fetchTags: PropTypes.func.isRequired,
- removeTag: PropTypes.func.isRequired,
-};
-
-export default TagList;
diff --git a/frontend/src/component/tags/TagList/TagList.styles.js b/frontend/src/component/tags/TagList/TagList.styles.js
deleted file mode 100644
index 05e9821937..0000000000
--- a/frontend/src/component/tags/TagList/TagList.styles.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import { makeStyles } from '@material-ui/styles';
-
-export const useStyles = makeStyles({
- tagListItem: {
- padding: 0,
- },
-});
diff --git a/frontend/src/component/tags/TagList/index.jsx b/frontend/src/component/tags/TagList/index.jsx
deleted file mode 100644
index bcd0059830..0000000000
--- a/frontend/src/component/tags/TagList/index.jsx
+++ /dev/null
@@ -1,3 +0,0 @@
-import TagsListComponent from './TagList';
-
-export default TagsListComponent;
diff --git a/frontend/src/component/tagTypes/TagTypeForm/TagTypeForm.styles.ts b/frontend/src/component/tags/TagTypeForm/TagTypeForm.styles.ts
similarity index 100%
rename from frontend/src/component/tagTypes/TagTypeForm/TagTypeForm.styles.ts
rename to frontend/src/component/tags/TagTypeForm/TagTypeForm.styles.ts
diff --git a/frontend/src/component/tagTypes/TagTypeForm/TagTypeForm.tsx b/frontend/src/component/tags/TagTypeForm/TagTypeForm.tsx
similarity index 100%
rename from frontend/src/component/tagTypes/TagTypeForm/TagTypeForm.tsx
rename to frontend/src/component/tags/TagTypeForm/TagTypeForm.tsx
diff --git a/frontend/src/component/tagTypes/hooks/useTagForm.ts b/frontend/src/component/tags/TagTypeForm/useTagTypeForm.ts
similarity index 94%
rename from frontend/src/component/tagTypes/hooks/useTagForm.ts
rename to frontend/src/component/tags/TagTypeForm/useTagTypeForm.ts
index feb1df7982..fe7452914e 100644
--- a/frontend/src/component/tagTypes/hooks/useTagForm.ts
+++ b/frontend/src/component/tags/TagTypeForm/useTagTypeForm.ts
@@ -1,7 +1,7 @@
import { useEffect, useState } from 'react';
import useTagTypesApi from '../../../hooks/api/actions/useTagTypesApi/useTagTypesApi';
-const useTagForm = (initialTagName = '', initialTagDesc = '') => {
+const useTagTypeForm = (initialTagName = '', initialTagDesc = '') => {
const [tagName, setTagName] = useState(initialTagName);
const [tagDesc, setTagDesc] = useState(initialTagDesc);
const [errors, setErrors] = useState({});
@@ -66,4 +66,4 @@ const useTagForm = (initialTagName = '', initialTagDesc = '') => {
};
};
-export default useTagForm;
+export default useTagTypeForm;
diff --git a/frontend/src/component/tag-types/TagTypeList/TagTypeList.jsx b/frontend/src/component/tags/TagTypeList/TagTypeList.jsx
similarity index 98%
rename from frontend/src/component/tag-types/TagTypeList/TagTypeList.jsx
rename to frontend/src/component/tags/TagTypeList/TagTypeList.jsx
index e8e3cdce38..72bb7d8b12 100644
--- a/frontend/src/component/tag-types/TagTypeList/TagTypeList.jsx
+++ b/frontend/src/component/tags/TagTypeList/TagTypeList.jsx
@@ -2,12 +2,12 @@ import { useContext, useState } from 'react';
import PropTypes from 'prop-types';
import { Link, useHistory } from 'react-router-dom';
import {
+ Button,
+ IconButton,
List,
ListItem,
ListItemIcon,
ListItemText,
- IconButton,
- Button,
Tooltip,
} from '@material-ui/core';
import { Add, Delete, Edit, Label } from '@material-ui/icons';
@@ -20,14 +20,14 @@ import {
} from '../../providers/AccessProvider/permissions';
import Dialogue from '../../common/Dialogue/Dialogue';
import useMediaQuery from '@material-ui/core/useMediaQuery';
-import styles from '../TagType.module.scss';
+import styles from './TagTypeList.module.scss';
import AccessContext from '../../../contexts/AccessContext';
import useTagTypesApi from '../../../hooks/api/actions/useTagTypesApi/useTagTypesApi';
import useTagTypes from '../../../hooks/api/getters/useTagTypes/useTagTypes';
import useToast from '../../../hooks/useToast';
import PermissionIconButton from '../../common/PermissionIconButton/PermissionIconButton';
-const TagTypeList = () => {
+export const TagTypeList = () => {
const { hasAccess } = useContext(AccessContext);
const [deletion, setDeletion] = useState({ open: false });
const history = useHistory();
@@ -160,5 +160,3 @@ TagTypeList.propTypes = {
fetchTagTypes: PropTypes.func.isRequired,
removeTagType: PropTypes.func.isRequired,
};
-
-export default TagTypeList;
diff --git a/frontend/src/component/tag-types/TagType.module.scss b/frontend/src/component/tags/TagTypeList/TagTypeList.module.scss
similarity index 100%
rename from frontend/src/component/tag-types/TagType.module.scss
rename to frontend/src/component/tags/TagTypeList/TagTypeList.module.scss
diff --git a/frontend/src/component/tag-types/__tests__/tag-type-list-component-test.js b/frontend/src/component/tags/TagTypeList/__tests__/TagTypeList.test.js
similarity index 82%
rename from frontend/src/component/tag-types/__tests__/tag-type-list-component-test.js
rename to frontend/src/component/tags/TagTypeList/__tests__/TagTypeList.test.js
index 31d648fee7..b91aed95e7 100644
--- a/frontend/src/component/tag-types/__tests__/tag-type-list-component-test.js
+++ b/frontend/src/component/tags/TagTypeList/__tests__/TagTypeList.test.js
@@ -1,20 +1,18 @@
import React from 'react';
-
-import TagTypesList from '../TagTypeList';
+import { TagTypeList } from '../TagTypeList';
import renderer from 'react-test-renderer';
import { MemoryRouter } from 'react-router-dom';
import { ThemeProvider } from '@material-ui/styles';
-import theme from '../../../themes/main-theme';
-import { createFakeStore } from '../../../accessStoreFake';
-import AccessProvider from '../../providers/AccessProvider/AccessProvider';
-
+import theme from '../../../../themes/main-theme';
+import { createFakeStore } from '../../../../accessStoreFake';
+import AccessProvider from '../../../providers/AccessProvider/AccessProvider';
import {
ADMIN,
CREATE_TAG_TYPE,
UPDATE_TAG_TYPE,
DELETE_TAG_TYPE,
-} from '../../providers/AccessProvider/permissions';
-import UIProvider from '../../providers/UIProvider/UIProvider';
+} from '../../../providers/AccessProvider/permissions';
+import UIProvider from '../../../providers/UIProvider/UIProvider';
test('renders an empty list correctly', () => {
const tree = renderer.create(
@@ -24,7 +22,7 @@ test('renders an empty list correctly', () => {
- {
{ permission: DELETE_TAG_TYPE },
])}
>
- ({
- tag: { type: '', value: '' },
-});
-
-const mapDispatchToProps = dispatch => ({
- submit: tag => create(tag)(dispatch),
-});
-
-const FormAddContainer = connect(mapStateToProps, mapDispatchToProps)(TagComponent);
-
-export default FormAddContainer;
diff --git a/frontend/src/component/tags/form-tag-component.js b/frontend/src/component/tags/form-tag-component.js
deleted file mode 100644
index a564920bae..0000000000
--- a/frontend/src/component/tags/form-tag-component.js
+++ /dev/null
@@ -1,107 +0,0 @@
-import React, { Component } from 'react';
-import PropTypes from 'prop-types';
-import { TextField } from '@material-ui/core';
-import styles from './Tag.module.scss';
-import { FormButtons } from '../common';
-import PageContent from '../common/PageContent/PageContent';
-import TagSelect from '../common/TagSelect/TagSelect';
-
-class AddTagComponent extends Component {
- constructor(props) {
- super(props);
- this.state = {
- tag: props.tag,
- errors: {},
- dirty: false,
- currentLegalValue: '',
- };
- }
-
- static getDerivedStateFromProps(props, state) {
- if (!state.tag.id && props.tag.id) {
- return { tag: props.tag };
- } else {
- return null;
- }
- }
-
- setValue = (field, value) => {
- const { tag } = this.state;
- tag[field] = value;
- this.setState({ tag, dirty: true });
- };
-
- onCancel = evt => {
- evt.preventDefault();
- this.props.history.push('/tags');
- };
-
- onSubmit = async evt => {
- evt.preventDefault();
- const { tag } = this.state;
- if (!tag.type || tag.type === '') {
- tag.type = 'simple';
- }
- try {
- await this.props.submit(tag);
- this.props.history.push('/tags');
- } catch (e) {
- this.setState({
- errors: {
- general: e.message,
- },
- });
- }
- };
-
- render() {
- const { tag, errors } = this.state;
- const submitText = 'Create';
- return (
-
-
-
- );
- }
-}
-
-AddTagComponent.propTypes = {
- tag: PropTypes.object.isRequired,
- submit: PropTypes.func.isRequired,
- history: PropTypes.object.isRequired,
-};
-
-export default AddTagComponent;
diff --git a/frontend/src/component/tags/index.jsx b/frontend/src/component/tags/index.jsx
deleted file mode 100644
index 35483b01fa..0000000000
--- a/frontend/src/component/tags/index.jsx
+++ /dev/null
@@ -1,24 +0,0 @@
-import { connect } from 'react-redux';
-import TagsListComponent from './TagList';
-import { fetchTags, removeTag } from '../../store/tag/actions';
-
-const mapStateToProps = state => {
- const list = state.tags.toJS();
- return {
- tags: list,
- };
-};
-
-const mapDispatchToProps = dispatch => ({
- removeTag: tag => {
- // eslint-disable-next-line no-alert
- if (window.confirm('Are you sure you want to remove this tag?')) {
- removeTag(tag)(dispatch);
- }
- },
- fetchTags: () => fetchTags()(dispatch),
-});
-
-const TagsListContainer = connect(mapStateToProps, mapDispatchToProps)(TagsListComponent);
-
-export default TagsListContainer;
diff --git a/frontend/src/page/tag-types/create.js b/frontend/src/page/tag-types/create.js
deleted file mode 100644
index c3cf82f127..0000000000
--- a/frontend/src/page/tag-types/create.js
+++ /dev/null
@@ -1,11 +0,0 @@
-import React from 'react';
-import AddTagType from '../../component/tag-types/create-tag-type-container';
-import PropTypes from 'prop-types';
-
-const render = ({ history }) => ;
-
-render.propTypes = {
- history: PropTypes.object.isRequired,
-};
-
-export default render;
diff --git a/frontend/src/page/tag-types/edit.js b/frontend/src/page/tag-types/edit.js
deleted file mode 100644
index 6c07fb920d..0000000000
--- a/frontend/src/page/tag-types/edit.js
+++ /dev/null
@@ -1,13 +0,0 @@
-import React from 'react';
-import EditTagType from './../../component/tag-types/edit-tag-type-container';
-import PropTypes from 'prop-types';
-
-const render = ({ match: { params }, history }) => (
-
-);
-render.propTypes = {
- match: PropTypes.object.isRequired,
- history: PropTypes.object.isRequired,
-};
-
-export default render;
diff --git a/frontend/src/page/tag-types/index.js b/frontend/src/page/tag-types/index.js
deleted file mode 100644
index 364d30e57e..0000000000
--- a/frontend/src/page/tag-types/index.js
+++ /dev/null
@@ -1,11 +0,0 @@
-import React from 'react';
-import TagTypes from '../../component/tag-types';
-import PropTypes from 'prop-types';
-
-const render = ({ history }) => ;
-
-render.propTypes = {
- history: PropTypes.object.isRequired,
-};
-
-export default render;
diff --git a/frontend/src/page/tags/create.js b/frontend/src/page/tags/create.js
deleted file mode 100644
index bb45eef335..0000000000
--- a/frontend/src/page/tags/create.js
+++ /dev/null
@@ -1,11 +0,0 @@
-import React from 'react';
-import AddTag from '../../component/tags/create-tag-container';
-import PropTypes from 'prop-types';
-
-const render = ({ history }) => ;
-
-render.propTypes = {
- history: PropTypes.object.isRequired,
-};
-
-export default render;
diff --git a/frontend/src/page/tags/index.js b/frontend/src/page/tags/index.js
deleted file mode 100644
index 26cc882ae9..0000000000
--- a/frontend/src/page/tags/index.js
+++ /dev/null
@@ -1,11 +0,0 @@
-import React from 'react';
-import Tags from '../../component/tags';
-import PropTypes from 'prop-types';
-
-const render = ({ history }) => ;
-
-render.propTypes = {
- history: PropTypes.object.isRequired,
-};
-
-export default render;
diff --git a/frontend/src/store/index.js b/frontend/src/store/index.js
index 326d8cef67..5ad7970ca3 100644
--- a/frontend/src/store/index.js
+++ b/frontend/src/store/index.js
@@ -1,7 +1,5 @@
import { combineReducers } from 'redux';
import features from './feature-toggle';
-import tagTypes from './tag-type';
-import tags from './tag';
import strategies from './strategy';
import error from './error';
import user from './user';
@@ -13,8 +11,6 @@ import apiCalls from './api-calls';
const unleashStore = combineReducers({
features,
strategies,
- tagTypes,
- tags,
error,
user,
applications,
diff --git a/frontend/src/store/tag-type/actions.js b/frontend/src/store/tag-type/actions.js
deleted file mode 100644
index cde0ef325e..0000000000
--- a/frontend/src/store/tag-type/actions.js
+++ /dev/null
@@ -1,77 +0,0 @@
-import api from './api';
-import { dispatchError } from '../util';
-
-export const START_FETCH_TAG_TYPES = 'START_FETCH_TAG_TYPES';
-export const RECEIVE_TAG_TYPES = 'RECEIVE_TAG_TYPES';
-export const ERROR_FETCH_TAG_TYPES = 'ERROR_FETCH_TAG_TYPES';
-export const START_CREATE_TAG_TYPE = 'START_CREATE_TAG_TYPE';
-export const ADD_TAG_TYPE = 'ADD_TAG_TYPE';
-export const ERROR_CREATE_TAG_TYPE = 'ERROR_CREATE_TAG_TYPE';
-export const START_DELETE_TAG_TYPE = 'START_DELETE_TAG_TYPE';
-export const DELETE_TAG_TYPE = 'DELETE_TAG_TYPE';
-export const ERROR_DELETE_TAG_TYPE = 'ERROR_DELETE_TAG_TYPE';
-export const START_UPDATE_TAG_TYPE = 'START_UPDATE_TAG_TYPE';
-export const UPDATE_TAG_TYPE = 'UPDATE_TAG_TYPE';
-export const ERROR_UPDATE_TAG_TYPE = 'ERROR_UPDATE_TAG_TYPE';
-
-export function receiveTagTypes(json) {
- return {
- type: RECEIVE_TAG_TYPES,
- value: json,
- receivedAt: Date.now(),
- };
-}
-
-export function fetchTagTypes() {
- return dispatch => {
- dispatch({ type: START_FETCH_TAG_TYPES });
- return api
- .fetchTagTypes()
- .then(json => dispatch(receiveTagTypes(json)))
- .catch(dispatchError(dispatch, ERROR_FETCH_TAG_TYPES));
- };
-}
-
-export function createTagType({ name, description, icon }) {
- return dispatch => {
- dispatch({ type: START_CREATE_TAG_TYPE });
- return api
- .create({ name, description, icon })
- .then(() =>
- dispatch({
- type: ADD_TAG_TYPE,
- tagType: { name, description, icon },
- })
- )
- .catch(dispatchError(dispatch, ERROR_CREATE_TAG_TYPE));
- };
-}
-
-export function updateTagType({ name, description, icon }) {
- return dispatch => {
- dispatch({ type: START_UPDATE_TAG_TYPE });
- return api
- .update({ name, description, icon })
- .then(() =>
- dispatch({
- type: UPDATE_TAG_TYPE,
- tagType: { name, description, icon },
- })
- )
- .catch(dispatchError(dispatch, ERROR_UPDATE_TAG_TYPE));
- };
-}
-
-export function removeTagType(name) {
- return dispatch => {
- dispatch({ type: START_DELETE_TAG_TYPE });
- return api
- .deleteTagType(name)
- .then(() => dispatch({ type: DELETE_TAG_TYPE, tagType: { name } }))
- .catch(dispatchError(dispatch, ERROR_DELETE_TAG_TYPE));
- };
-}
-
-export function validateName(name) {
- return api.validateTagType({ name });
-}
diff --git a/frontend/src/store/tag-type/api.js b/frontend/src/store/tag-type/api.js
deleted file mode 100644
index 53f180ac9d..0000000000
--- a/frontend/src/store/tag-type/api.js
+++ /dev/null
@@ -1,58 +0,0 @@
-import { formatApiPath } from '../../utils/format-path';
-import { throwIfNotSuccess, headers } from '../api-helper';
-
-const URI = formatApiPath('api/admin/tag-types');
-
-function fetchTagTypes() {
- return fetch(URI, { credentials: 'include' })
- .then(throwIfNotSuccess)
- .then(response => response.json());
-}
-
-function validateTagType(tagType) {
- return fetch(`${URI}/validate`, {
- method: 'POST',
- headers,
- credentials: 'include',
- body: JSON.stringify(tagType),
- }).then(throwIfNotSuccess);
-}
-
-function create(tagType) {
- return validateTagType(tagType)
- .then(() =>
- fetch(URI, {
- method: 'POST',
- headers,
- credentials: 'include',
- body: JSON.stringify(tagType),
- })
- )
- .then(throwIfNotSuccess);
-}
-
-function update(tagType) {
- return fetch(`${URI}/${tagType.name}`, {
- method: 'PUT',
- headers,
- credentials: 'include',
- body: JSON.stringify(tagType),
- }).then(throwIfNotSuccess);
-}
-
-function deleteTagType(tagTypeName) {
- return fetch(`${URI}/${tagTypeName}`, {
- method: 'DELETE',
- headers,
- credentials: 'include',
- }).then(throwIfNotSuccess);
-}
-
-const api = {
- fetchTagTypes,
- create,
- update,
- deleteTagType,
- validateTagType,
-};
-export default api;
diff --git a/frontend/src/store/tag-type/index.js b/frontend/src/store/tag-type/index.js
deleted file mode 100644
index 4417af4fe9..0000000000
--- a/frontend/src/store/tag-type/index.js
+++ /dev/null
@@ -1,33 +0,0 @@
-import { List, Map as $Map } from 'immutable';
-import { RECEIVE_TAG_TYPES, ADD_TAG_TYPE, DELETE_TAG_TYPE, UPDATE_TAG_TYPE, ERROR_FETCH_TAG_TYPES } from './actions';
-
-const debug = require('debug')('unleash:tag-type-store');
-
-const tagTypes = (state = new List([]), action) => {
- switch (action.type) {
- case ADD_TAG_TYPE:
- debug('Add tagtype');
- return state.push(new $Map(action.tagType));
- case DELETE_TAG_TYPE:
- debug('Delete tagtype');
- return state.filter(tagtype => tagtype.get('name') !== action.tagType.name);
- case RECEIVE_TAG_TYPES:
- debug('Receive tag types', action);
- return new List(action.value.tagTypes.map($Map));
- case ERROR_FETCH_TAG_TYPES:
- debug('Error receiving tag types', action);
- return state;
- case UPDATE_TAG_TYPE:
- return state.map(tagtype => {
- if (tagtype.get('name') === action.tagType.name) {
- return new $Map(action.tagType);
- } else {
- return tagtype;
- }
- });
- default:
- return state;
- }
-};
-
-export default tagTypes;
diff --git a/frontend/src/store/tag/actions.js b/frontend/src/store/tag/actions.js
deleted file mode 100644
index 491b9773ff..0000000000
--- a/frontend/src/store/tag/actions.js
+++ /dev/null
@@ -1,50 +0,0 @@
-import api from './api';
-import { dispatchError } from '../util';
-
-export const START_FETCH_TAGS = 'START_FETCH_TAGS';
-export const RECEIVE_TAGS = 'RECEIVE_TAGS';
-export const ERROR_FETCH_TAGS = 'ERROR_FETCH_TAGS';
-export const START_CREATE_TAG = 'START_CREATE_TAG';
-export const ADD_TAG = 'ADD_TAG';
-export const ERROR_CREATE_TAG = 'ERROR_CREATE_TAG';
-export const START_DELETE_TAG = 'START_DELETE_TAG';
-export const DELETE_TAG = 'DELETE_TAG';
-export const ERROR_DELETE_TAG = 'ERROR_DELETE_TAG';
-
-function receiveTags(json) {
- return {
- type: RECEIVE_TAGS,
- value: json,
- receivedAt: Date.now(),
- };
-}
-
-export function fetchTags() {
- return dispatch => {
- dispatch({ type: START_FETCH_TAGS });
- return api
- .fetchTags()
- .then(json => dispatch(receiveTags(json)))
- .catch(dispatchError(dispatch, ERROR_FETCH_TAGS));
- };
-}
-
-export function create({ type, value }) {
- return dispatch => {
- dispatch({ type: START_CREATE_TAG });
- return api
- .create({ type, value })
- .then(() => dispatch({ type: ADD_TAG, tag: { type, value } }))
- .catch(dispatchError(dispatch, ERROR_CREATE_TAG));
- };
-}
-
-export function removeTag(tag) {
- return dispatch => {
- dispatch({ type: START_DELETE_TAG });
- return api
- .deleteTag(tag)
- .then(() => dispatch({ type: DELETE_TAG, tag }))
- .catch(dispatchError(dispatch, ERROR_DELETE_TAG));
- };
-}
diff --git a/frontend/src/store/tag/api.js b/frontend/src/store/tag/api.js
deleted file mode 100644
index 17461526be..0000000000
--- a/frontend/src/store/tag/api.js
+++ /dev/null
@@ -1,33 +0,0 @@
-import { formatApiPath } from '../../utils/format-path';
-import { throwIfNotSuccess, headers } from '../api-helper';
-
-const URI = formatApiPath('api/admin/tags');
-
-function fetchTags() {
- return fetch(URI, { credentials: 'include' })
- .then(throwIfNotSuccess)
- .then(response => response.json());
-}
-
-function create(tag) {
- return fetch(URI, {
- method: 'POST',
- headers,
- credentials: 'include',
- body: JSON.stringify(tag),
- }).then(throwIfNotSuccess);
-}
-
-function deleteTag(tag) {
- return fetch(`${URI}/${tag.type}/${encodeURIComponent(tag.value)}`, {
- method: 'DELETE',
- headers,
- credentials: 'include',
- }).then(throwIfNotSuccess);
-}
-
-export default {
- fetchTags,
- deleteTag,
- create,
-};
diff --git a/frontend/src/store/tag/index.js b/frontend/src/store/tag/index.js
deleted file mode 100644
index 827c5c8156..0000000000
--- a/frontend/src/store/tag/index.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import { List, Map as $Map } from 'immutable';
-import { ADD_TAG, DELETE_TAG, ERROR_FETCH_TAGS, RECEIVE_TAGS } from './actions';
-const debug = require('debug')('unleash:tag-store');
-
-const tags = (state = new List([]), action) => {
- switch (action.type) {
- case ADD_TAG:
- debug('Add tag');
- return state.push(new $Map(action.tag));
- case DELETE_TAG:
- debug('Delete tag');
- return state.filter(tag => tag.get('type') !== action.tag.type && tag.get('value') !== action.tag.value);
- case RECEIVE_TAGS:
- debug('Receive tags', action);
- return new List(action.value.tags.map($Map));
- case ERROR_FETCH_TAGS:
- debug('Error receiving tag types', action);
- return state;
- default:
- return state;
- }
-};
-
-export default tags;
diff --git a/frontend/src/store/ui-bootstrap/actions.js b/frontend/src/store/ui-bootstrap/actions.js
index 0336f930f7..4f116983b7 100644
--- a/frontend/src/store/ui-bootstrap/actions.js
+++ b/frontend/src/store/ui-bootstrap/actions.js
@@ -1,7 +1,6 @@
import api from './api';
import { dispatchError } from '../util';
import { receiveProjects } from '../project/actions';
-import { receiveTagTypes } from '../tag-type/actions';
import { receiveStrategies } from '../strategy/actions';
export const RECEIVE_BOOTSTRAP = 'RECEIVE_CONFIG';
@@ -13,7 +12,6 @@ export function fetchUiBootstrap() {
.fetchUIBootstrap()
.then(json => {
dispatch(receiveProjects(json.projects));
- dispatch(receiveTagTypes(json));
dispatch(receiveStrategies(json.strategies));
})
.catch(dispatchError(dispatch, ERROR_RECEIVE_BOOTSTRAP));