From 8deb2753e0998d33293c49f8a015c7527f008073 Mon Sep 17 00:00:00 2001 From: olav Date: Wed, 9 Feb 2022 13:18:15 +0100 Subject: [PATCH] refactor: remove unused feature types state (#688) --- frontend/src/store/feature-type/actions.js | 18 ------------------ frontend/src/store/feature-type/api.js | 14 -------------- frontend/src/store/feature-type/index.js | 21 --------------------- frontend/src/store/index.js | 2 -- frontend/src/store/ui-bootstrap/actions.js | 2 -- 5 files changed, 57 deletions(-) delete mode 100644 frontend/src/store/feature-type/actions.js delete mode 100644 frontend/src/store/feature-type/api.js delete mode 100644 frontend/src/store/feature-type/index.js diff --git a/frontend/src/store/feature-type/actions.js b/frontend/src/store/feature-type/actions.js deleted file mode 100644 index 7eed119f9f..0000000000 --- a/frontend/src/store/feature-type/actions.js +++ /dev/null @@ -1,18 +0,0 @@ -import api from './api'; -import { dispatchError } from '../util'; - -export const RECEIVE_FEATURE_TYPES = 'RECEIVE_FEATURE_TYPES'; -export const ERROR_RECEIVE_FEATURE_TYPES = 'ERROR_RECEIVE_FEATURE_TYPES'; - -export const receiveFeatureTypes = value => ({ - type: RECEIVE_FEATURE_TYPES, - value, -}); - -export function fetchFeatureTypes() { - return dispatch => - api - .fetchAll() - .then(json => dispatch(receiveFeatureTypes(json.types))) - .catch(dispatchError(dispatch, ERROR_RECEIVE_FEATURE_TYPES)); -} diff --git a/frontend/src/store/feature-type/api.js b/frontend/src/store/feature-type/api.js deleted file mode 100644 index 37074bfc1d..0000000000 --- a/frontend/src/store/feature-type/api.js +++ /dev/null @@ -1,14 +0,0 @@ -import { formatApiPath } from '../../utils/format-path'; -import { throwIfNotSuccess } from '../api-helper'; - -const URI = formatApiPath('api/admin/feature-types'); - -function fetchAll() { - return fetch(URI, { credentials: 'include' }) - .then(throwIfNotSuccess) - .then(response => response.json()); -} - -export default { - fetchAll, -}; diff --git a/frontend/src/store/feature-type/index.js b/frontend/src/store/feature-type/index.js deleted file mode 100644 index f31efacd7a..0000000000 --- a/frontend/src/store/feature-type/index.js +++ /dev/null @@ -1,21 +0,0 @@ -import { List } from 'immutable'; -import { RECEIVE_FEATURE_TYPES } from './actions'; - -const DEFAULT_FEATURE_TYPES = [ - { id: 'release', name: 'Release', initial: true }, -]; - -function getInitState() { - return new List(DEFAULT_FEATURE_TYPES); -} - -const strategies = (state = getInitState(), action) => { - switch (action.type) { - case RECEIVE_FEATURE_TYPES: - return new List(action.value); - default: - return state; - } -}; - -export default strategies; diff --git a/frontend/src/store/index.js b/frontend/src/store/index.js index e0ae18ee6e..68ae07a75d 100644 --- a/frontend/src/store/index.js +++ b/frontend/src/store/index.js @@ -1,6 +1,5 @@ import { combineReducers } from 'redux'; import features from './feature-toggle'; -import featureTypes from './feature-type'; import featureMetrics from './feature-metrics'; import featureTags from './feature-tags'; import tagTypes from './tag-type'; @@ -17,7 +16,6 @@ import feedback from './feedback'; const unleashStore = combineReducers({ features, - featureTypes, featureMetrics, strategies, tagTypes, diff --git a/frontend/src/store/ui-bootstrap/actions.js b/frontend/src/store/ui-bootstrap/actions.js index 6fac14fc4b..564fac6240 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 { receiveConfig } from '../ui-config/actions'; -import { receiveFeatureTypes } from '../feature-type/actions'; import { receiveProjects } from '../project/actions'; import { receiveTagTypes } from '../tag-type/actions'; import { receiveStrategies } from '../strategy/actions'; @@ -17,7 +16,6 @@ export function fetchUiBootstrap() { dispatch(receiveProjects(json.projects)); dispatch(receiveConfig(json.uiConfig)); dispatch(receiveTagTypes(json)); - dispatch(receiveFeatureTypes(json.featureTypes)); dispatch(receiveStrategies(json.strategies)); }) .catch(dispatchError(dispatch, ERROR_RECEIVE_BOOTSTRAP));