diff --git a/frontend/src/component/archive/__tests__/.eslintrc b/frontend/src/component/archive/__tests__/.eslintrc
deleted file mode 100644
index eba2077219..0000000000
--- a/frontend/src/component/archive/__tests__/.eslintrc
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "env": {
- "jest": true
- }
-}
diff --git a/frontend/src/component/archive/__tests__/__snapshots__/archive-list-component-test.jsx.snap b/frontend/src/component/archive/__tests__/__snapshots__/archive-list-component-test.jsx.snap
deleted file mode 100644
index f9ea853981..0000000000
--- a/frontend/src/component/archive/__tests__/__snapshots__/archive-list-component-test.jsx.snap
+++ /dev/null
@@ -1,100 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`renders correctly with no archived toggles 1`] = `
-
-
-
-
-
-
-
-
-
-
- adin-pay-confirm-disabled
-
- Disables the confirm-functionality from API
-
-
-
-
-
- default
-
-
-
-
-
-
-
-
-
-
-
- adin-pay-platform-sch-payment
-
- Enables use of schibsted payment from order-payment-management
-
-
-
-
-
- default
-
-
-
-
-
-
-`;
diff --git a/frontend/src/component/archive/__tests__/archive-list-component-test.jsx b/frontend/src/component/archive/__tests__/archive-list-component-test.jsx
deleted file mode 100644
index 65723fb83f..0000000000
--- a/frontend/src/component/archive/__tests__/archive-list-component-test.jsx
+++ /dev/null
@@ -1,74 +0,0 @@
-import React from 'react';
-
-import ArchiveList from '../archive-list-component';
-import renderer from 'react-test-renderer';
-
-jest.mock('react-mdl');
-// TODO mock DropdownButton
-// jest.mock('../../common', () => ({ DropdownButton: 'DropdownButton', styles: {} }));
-const archive = [
- {
- name: 'adin-pay-confirm-disabled',
- description: 'Disables the confirm-functionality from API',
- enabled: false,
- strategies: [{ name: 'default', parameters: {} }],
- createdAt: '2016-10-25T15:38:28.573Z',
- reviveName: 'adin-pay-confirm-disabled',
- },
- {
- name: 'adin-pay-platform-sch-payment',
- description: 'Enables use of schibsted payment from order-payment-management',
- enabled: true,
- strategies: [{ name: 'default', parameters: {} }],
- createdAt: '2016-08-03T12:41:35.631Z',
- reviveName: 'adin-pay-platform-sch-payment',
- },
-];
-
-xtest('renders correctly with no archived toggles', () => {
- const featureMetrics = { lastHour: {}, lastMinute: {}, seenApps: {} };
- const settings = {
- feature: {
- filter: '',
- sort: 'name',
- showLastHour: false,
- },
- };
-
- const tree = renderer
- .create(
-
- )
- .toJSON();
- expect(tree).toMatchSnapshot();
-});
-
-xtest('renders correctly with archived toggles', () => {
- const featureMetrics = { lastHour: {}, lastMinute: {}, seenApps: {} };
- const settings = {
- feature: {
- filter: '',
- sort: 'name',
- showLastHour: false,
- },
- };
-
- const tree = renderer
- .create(
-
- )
- .toJSON();
- expect(tree).toMatchSnapshot();
-});
diff --git a/frontend/src/component/archive/archive-list-component.jsx b/frontend/src/component/archive/archive-list-component.jsx
deleted file mode 100644
index a2954c2f81..0000000000
--- a/frontend/src/component/archive/archive-list-component.jsx
+++ /dev/null
@@ -1,142 +0,0 @@
-import React from 'react';
-import PropTypes from 'prop-types';
-import { Link } from 'react-router';
-import Feature from './../feature/feature-list-item-component';
-import { CardActions, Menu, MenuItem, Icon, Card, List, Chip } from 'react-mdl';
-import { MenuItemWithIcon, DropdownButton, styles } from '../common';
-// import styles from './archive.scss';
-
-class ArchiveList extends React.PureComponent {
- static propTypes = {
- name: PropTypes.string,
- archive: PropTypes.array.isRequired,
- fetchArchive: PropTypes.func,
- featureMetrics: PropTypes.object,
- updateSetting: PropTypes.func,
- settings: PropTypes.object,
- revive: PropTypes.func,
- };
-
- componentDidMount() {
- this.props.fetchArchive();
- }
- setSort(v) {
- this.props.updateSetting('sort', typeof v === 'string' ? v.trim() : '');
- }
- toggleMetrics() {
- this.props.updateSetting('showLastHour', !this.props.settings.showLastHour);
- }
- renderStrategyDetail(feature) {
- let strategiesList = (
-
- {feature.strategies.map((s, i) => (
-
- {s.name}
- {Object.keys(s.parameters).map((p, j) => {s.parameters[p]})}
-
- ))}
-
- );
-
- return strategiesList;
- }
- renderStrategiesInList(feature) {
- let display = [];
- if (feature.strategies && feature.strategies.length > 0) {
- const strategiesToShow = Math.min(feature.strategies.length, 3);
- const remainingStrategies = feature.strategies.length - strategiesToShow;
-
- const strategyChips =
- feature.strategies &&
- feature.strategies.slice(0, strategiesToShow).map((s, i) => (
-
- {s.name}
-
- ));
- const remaining = (
-
- +{remainingStrategies}
-
- );
- if (remainingStrategies > 0) {
- display.push(remaining);
- }
- display.push(strategyChips);
- }
- return display;
- }
-
- render() {
- const { archive, featureMetrics, settings, revive } = this.props;
-
- archive.forEach(e => {
- e.reviveName = e.name;
- });
- return (
-
-
-
-
-
-
-
-
- {archive && archive.length > 0 ? (
-
- {archive.map((feature, i) => (
-
- ))}
-
- ) : (
-
-
-
- No archived feature toggles, go see active toggles here
-
- )}
-
- );
- }
-}
-
-export default ArchiveList;
diff --git a/frontend/src/component/archive/archive-list-container.js b/frontend/src/component/archive/archive-list-container.js
index 88e2062fe4..b1c884d258 100644
--- a/frontend/src/component/archive/archive-list-container.js
+++ b/frontend/src/component/archive/archive-list-container.js
@@ -1,5 +1,5 @@
import { connect } from 'react-redux';
-import ArchiveList from './archive-list-component';
+import FeatureListComponent from './../feature/list-component';
import { fetchArchive, revive } from './../../store/archive-actions';
import { updateSettingForGroup } from './../../store/settings/actions';
@@ -63,7 +63,7 @@ const mapStateToProps = state => {
}
return {
- archive: features,
+ features,
featureMetrics,
settings,
};
@@ -75,6 +75,6 @@ const mapDispatchToProps = {
updateSetting: updateSettingForGroup('feature'),
};
-const ArchiveListContainer = connect(mapStateToProps, mapDispatchToProps)(ArchiveList);
+const ArchiveListContainer = connect(mapStateToProps, mapDispatchToProps)(FeatureListComponent);
export default ArchiveListContainer;
diff --git a/frontend/src/component/feature/list-component.jsx b/frontend/src/component/feature/list-component.jsx
index 7b060cc0f7..118260df96 100644
--- a/frontend/src/component/feature/list-component.jsx
+++ b/frontend/src/component/feature/list-component.jsx
@@ -7,11 +7,13 @@ import { Icon, FABButton, Textfield, Menu, MenuItem, Card, CardActions, List } f
import { MenuItemWithIcon, DropdownButton, styles as commonStyles } from '../common';
import styles from './feature.scss';
-export default class FeatureListComponent extends React.PureComponent {
+export default class FeatureListComponent extends React.Component {
static propTypes = {
features: PropTypes.array.isRequired,
featureMetrics: PropTypes.object.isRequired,
- fetchFeatureToggles: PropTypes.func.isRequired,
+ fetchFeatureToggles: PropTypes.func,
+ fetchArchive: PropTypes.func,
+ revive: PropTypes.func,
updateSetting: PropTypes.func.isRequired,
toggleFeature: PropTypes.func,
settings: PropTypes.object,
@@ -22,7 +24,11 @@ export default class FeatureListComponent extends React.PureComponent {
};
componentDidMount() {
- this.props.fetchFeatureToggles();
+ if (this.props.fetchFeatureToggles) {
+ this.props.fetchFeatureToggles();
+ } else {
+ this.props.fetchArchive();
+ }
}
toggleMetrics() {
@@ -38,8 +44,10 @@ export default class FeatureListComponent extends React.PureComponent {
}
render() {
- const { features, toggleFeature, featureMetrics, settings } = this.props;
-
+ const { features, toggleFeature, featureMetrics, settings, revive } = this.props;
+ features.forEach(e => {
+ e.reviveName = e.name;
+ });
return (
@@ -107,7 +115,7 @@ export default class FeatureListComponent extends React.PureComponent {
metricsLastHour={featureMetrics.lastHour[feature.name]}
metricsLastMinute={featureMetrics.lastMinute[feature.name]}
feature={feature}
- toggleFeature={toggleFeature}
+ revive={revive}
/>
))}