From 46c28091202dc4f9899c0fdc160432bbe91aa9e5 Mon Sep 17 00:00:00 2001 From: ivaosthu Date: Thu, 10 Nov 2016 15:11:43 +0100 Subject: [PATCH] Moved unleash-frontend-next to separate repo https://github.com/Unleash/unleash-frontend --- packages/unleash-frontend-next/.babelrc | 8 -- packages/unleash-frontend-next/.eslintignore | 2 - packages/unleash-frontend-next/.eslintrc | 9 -- packages/unleash-frontend-next/.gitignore | 1 - packages/unleash-frontend-next/README.md | 14 --- packages/unleash-frontend-next/index.html | 13 --- packages/unleash-frontend-next/index.js | 7 -- .../jest-preprocessor.js | 9 -- packages/unleash-frontend-next/mock-api.json | 74 --------------- packages/unleash-frontend-next/package.json | 89 ----------------- packages/unleash-frontend-next/src/.eslintrc | 25 ----- .../src/component/app.jsx | 40 -------- .../component/archive/archive-container.js | 15 --- .../archive/archive-list-component.jsx | 48 ---------- .../client-instance-component.js | 38 -------- .../client-instance-container.js | 9 -- .../client-strategy/strategy-component.js | 34 ------- .../client-strategy/strategy-container.js | 9 -- .../src/component/error/error-component.jsx | 28 ------ .../src/component/error/error-container.jsx | 14 --- .../component/feature/feature-component.jsx | 53 ----------- .../src/component/feature/feature.scss | 16 ---- .../component/feature/form-add-container.jsx | 47 --------- .../component/feature/form-edit-container.jsx | 70 -------------- .../src/component/feature/form/index.jsx | 95 ------------------- .../component/feature/form/strategies-add.jsx | 72 -------------- .../feature/form/strategies-list.jsx | 43 --------- .../form/strategies-section-container.jsx | 8 -- .../feature/form/strategies-section.jsx | 44 --------- .../feature/form/strategy-configure.jsx | 80 ---------------- .../src/component/feature/list-component.jsx | 55 ----------- .../src/component/feature/list-container.jsx | 24 ----- .../component/history/history-container.js | 15 --- .../history/history-list-component.jsx | 58 ----------- .../src/component/input-helpers.js | 68 ------------- .../component/metrics/metrics-component.js | 31 ------ .../component/metrics/metrics-container.js | 39 -------- .../src/component/nav.jsx | 45 --------- .../src/component/strategies/add-container.js | 45 --------- .../src/component/strategies/add-strategy.jsx | 74 --------------- .../component/strategies/list-component.jsx | 54 ----------- .../component/strategies/list-container.jsx | 24 ----- .../src/component/strategies/strategies.scss | 8 -- .../src/component/styles.scss | 17 ---- .../src/data/archive-api.js | 24 ----- .../src/data/client-instance-api.js | 13 --- .../src/data/client-strategy-api.js | 13 --- .../src/data/feature-api.js | 48 ---------- .../unleash-frontend-next/src/data/helper.js | 25 ----- .../src/data/history-api.js | 13 --- .../src/data/metrics-api.js | 13 --- .../src/data/strategy-api.js | 30 ------ packages/unleash-frontend-next/src/index.jsx | 46 --------- .../src/page/archive/index.js | 6 -- .../src/page/client-instances/index.js | 6 -- .../src/page/client-strategies/index.js | 11 --- .../src/page/features/create.js | 11 --- .../src/page/features/edit.js | 19 ---- .../src/page/features/index.js | 8 -- .../src/page/history/index.js | 6 -- .../src/page/metrics/index.js | 6 -- .../src/page/strategies/create.js | 4 - .../src/page/strategies/index.js | 4 - .../src/store/archive-actions.js | 33 ------- .../src/store/archive-store.js | 19 ---- .../src/store/client-instance-actions.js | 20 ---- .../src/store/client-instance-store.js | 17 ---- .../src/store/client-strategy-actions.js | 20 ---- .../src/store/client-strategy-store.js | 17 ---- .../src/store/error-actions.js | 8 -- .../src/store/error-store.js | 40 -------- .../src/store/feature-actions.js | 93 ------------------ .../src/store/feature-metrics-actions.js | 30 ------ .../src/store/feature-metrics-api.js | 29 ------ .../src/store/feature-metrics-store.js | 21 ---- .../src/store/feature-store.js | 38 -------- .../src/store/history-actions.js | 20 ---- .../src/store/history-store.js | 17 ---- .../unleash-frontend-next/src/store/index.js | 26 ----- .../src/store/input-actions.js | 19 ---- .../src/store/input-store.js | 94 ------------------ .../src/store/metrics-actions.js | 20 ---- .../src/store/metrics-store.js | 21 ---- .../src/store/strategy-actions.js | 61 ------------ .../src/store/strategy-store.js | 29 ------ .../src/theme/_config.scss | 31 ------ .../unleash-frontend-next/webpack.config.js | 86 ----------------- 87 files changed, 2686 deletions(-) delete mode 100644 packages/unleash-frontend-next/.babelrc delete mode 100644 packages/unleash-frontend-next/.eslintignore delete mode 100644 packages/unleash-frontend-next/.eslintrc delete mode 100644 packages/unleash-frontend-next/.gitignore delete mode 100644 packages/unleash-frontend-next/README.md delete mode 100644 packages/unleash-frontend-next/index.html delete mode 100644 packages/unleash-frontend-next/index.js delete mode 100644 packages/unleash-frontend-next/jest-preprocessor.js delete mode 100644 packages/unleash-frontend-next/mock-api.json delete mode 100644 packages/unleash-frontend-next/package.json delete mode 100644 packages/unleash-frontend-next/src/.eslintrc delete mode 100644 packages/unleash-frontend-next/src/component/app.jsx delete mode 100644 packages/unleash-frontend-next/src/component/archive/archive-container.js delete mode 100644 packages/unleash-frontend-next/src/component/archive/archive-list-component.jsx delete mode 100644 packages/unleash-frontend-next/src/component/client-instance/client-instance-component.js delete mode 100644 packages/unleash-frontend-next/src/component/client-instance/client-instance-container.js delete mode 100644 packages/unleash-frontend-next/src/component/client-strategy/strategy-component.js delete mode 100644 packages/unleash-frontend-next/src/component/client-strategy/strategy-container.js delete mode 100644 packages/unleash-frontend-next/src/component/error/error-component.jsx delete mode 100644 packages/unleash-frontend-next/src/component/error/error-container.jsx delete mode 100644 packages/unleash-frontend-next/src/component/feature/feature-component.jsx delete mode 100644 packages/unleash-frontend-next/src/component/feature/feature.scss delete mode 100644 packages/unleash-frontend-next/src/component/feature/form-add-container.jsx delete mode 100644 packages/unleash-frontend-next/src/component/feature/form-edit-container.jsx delete mode 100644 packages/unleash-frontend-next/src/component/feature/form/index.jsx delete mode 100644 packages/unleash-frontend-next/src/component/feature/form/strategies-add.jsx delete mode 100644 packages/unleash-frontend-next/src/component/feature/form/strategies-list.jsx delete mode 100644 packages/unleash-frontend-next/src/component/feature/form/strategies-section-container.jsx delete mode 100644 packages/unleash-frontend-next/src/component/feature/form/strategies-section.jsx delete mode 100644 packages/unleash-frontend-next/src/component/feature/form/strategy-configure.jsx delete mode 100644 packages/unleash-frontend-next/src/component/feature/list-component.jsx delete mode 100644 packages/unleash-frontend-next/src/component/feature/list-container.jsx delete mode 100644 packages/unleash-frontend-next/src/component/history/history-container.js delete mode 100644 packages/unleash-frontend-next/src/component/history/history-list-component.jsx delete mode 100644 packages/unleash-frontend-next/src/component/input-helpers.js delete mode 100644 packages/unleash-frontend-next/src/component/metrics/metrics-component.js delete mode 100644 packages/unleash-frontend-next/src/component/metrics/metrics-container.js delete mode 100644 packages/unleash-frontend-next/src/component/nav.jsx delete mode 100644 packages/unleash-frontend-next/src/component/strategies/add-container.js delete mode 100644 packages/unleash-frontend-next/src/component/strategies/add-strategy.jsx delete mode 100644 packages/unleash-frontend-next/src/component/strategies/list-component.jsx delete mode 100644 packages/unleash-frontend-next/src/component/strategies/list-container.jsx delete mode 100644 packages/unleash-frontend-next/src/component/strategies/strategies.scss delete mode 100644 packages/unleash-frontend-next/src/component/styles.scss delete mode 100644 packages/unleash-frontend-next/src/data/archive-api.js delete mode 100644 packages/unleash-frontend-next/src/data/client-instance-api.js delete mode 100644 packages/unleash-frontend-next/src/data/client-strategy-api.js delete mode 100644 packages/unleash-frontend-next/src/data/feature-api.js delete mode 100644 packages/unleash-frontend-next/src/data/helper.js delete mode 100644 packages/unleash-frontend-next/src/data/history-api.js delete mode 100644 packages/unleash-frontend-next/src/data/metrics-api.js delete mode 100644 packages/unleash-frontend-next/src/data/strategy-api.js delete mode 100644 packages/unleash-frontend-next/src/index.jsx delete mode 100644 packages/unleash-frontend-next/src/page/archive/index.js delete mode 100644 packages/unleash-frontend-next/src/page/client-instances/index.js delete mode 100644 packages/unleash-frontend-next/src/page/client-strategies/index.js delete mode 100644 packages/unleash-frontend-next/src/page/features/create.js delete mode 100644 packages/unleash-frontend-next/src/page/features/edit.js delete mode 100644 packages/unleash-frontend-next/src/page/features/index.js delete mode 100644 packages/unleash-frontend-next/src/page/history/index.js delete mode 100644 packages/unleash-frontend-next/src/page/metrics/index.js delete mode 100644 packages/unleash-frontend-next/src/page/strategies/create.js delete mode 100644 packages/unleash-frontend-next/src/page/strategies/index.js delete mode 100644 packages/unleash-frontend-next/src/store/archive-actions.js delete mode 100644 packages/unleash-frontend-next/src/store/archive-store.js delete mode 100644 packages/unleash-frontend-next/src/store/client-instance-actions.js delete mode 100644 packages/unleash-frontend-next/src/store/client-instance-store.js delete mode 100644 packages/unleash-frontend-next/src/store/client-strategy-actions.js delete mode 100644 packages/unleash-frontend-next/src/store/client-strategy-store.js delete mode 100644 packages/unleash-frontend-next/src/store/error-actions.js delete mode 100644 packages/unleash-frontend-next/src/store/error-store.js delete mode 100644 packages/unleash-frontend-next/src/store/feature-actions.js delete mode 100644 packages/unleash-frontend-next/src/store/feature-metrics-actions.js delete mode 100644 packages/unleash-frontend-next/src/store/feature-metrics-api.js delete mode 100644 packages/unleash-frontend-next/src/store/feature-metrics-store.js delete mode 100644 packages/unleash-frontend-next/src/store/feature-store.js delete mode 100644 packages/unleash-frontend-next/src/store/history-actions.js delete mode 100644 packages/unleash-frontend-next/src/store/history-store.js delete mode 100644 packages/unleash-frontend-next/src/store/index.js delete mode 100644 packages/unleash-frontend-next/src/store/input-actions.js delete mode 100644 packages/unleash-frontend-next/src/store/input-store.js delete mode 100644 packages/unleash-frontend-next/src/store/metrics-actions.js delete mode 100644 packages/unleash-frontend-next/src/store/metrics-store.js delete mode 100644 packages/unleash-frontend-next/src/store/strategy-actions.js delete mode 100644 packages/unleash-frontend-next/src/store/strategy-store.js delete mode 100644 packages/unleash-frontend-next/src/theme/_config.scss delete mode 100644 packages/unleash-frontend-next/webpack.config.js diff --git a/packages/unleash-frontend-next/.babelrc b/packages/unleash-frontend-next/.babelrc deleted file mode 100644 index 4d3b7d3676..0000000000 --- a/packages/unleash-frontend-next/.babelrc +++ /dev/null @@ -1,8 +0,0 @@ -{ - "presets": ["react", "es2015", "stage-2"], - "env": { - "development": { - "presets": ["react-hmre"] - } - } -} diff --git a/packages/unleash-frontend-next/.eslintignore b/packages/unleash-frontend-next/.eslintignore deleted file mode 100644 index d1c1dbe227..0000000000 --- a/packages/unleash-frontend-next/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules -bundle.js diff --git a/packages/unleash-frontend-next/.eslintrc b/packages/unleash-frontend-next/.eslintrc deleted file mode 100644 index ee0b68514f..0000000000 --- a/packages/unleash-frontend-next/.eslintrc +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": [ - "finn", - "finn/node" - ], - "rules": { - "no-shadow": 0 - } -} diff --git a/packages/unleash-frontend-next/.gitignore b/packages/unleash-frontend-next/.gitignore deleted file mode 100644 index 1521c8b765..0000000000 --- a/packages/unleash-frontend-next/.gitignore +++ /dev/null @@ -1 +0,0 @@ -dist diff --git a/packages/unleash-frontend-next/README.md b/packages/unleash-frontend-next/README.md deleted file mode 100644 index 9e0a26fa5b..0000000000 --- a/packages/unleash-frontend-next/README.md +++ /dev/null @@ -1,14 +0,0 @@ -## Start developing: - -1. start mock-api: - -```bash -npm run start:api -``` - -2. start webpack-dev-server with hot-reload: -```bash -npm run start -``` - -Happy coding! diff --git a/packages/unleash-frontend-next/index.html b/packages/unleash-frontend-next/index.html deleted file mode 100644 index 7c0bb5e22d..0000000000 --- a/packages/unleash-frontend-next/index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - Unleash Admin - - - - - -
- - - diff --git a/packages/unleash-frontend-next/index.js b/packages/unleash-frontend-next/index.js deleted file mode 100644 index 621880f22a..0000000000 --- a/packages/unleash-frontend-next/index.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; - -const path = require('path'); - -module.exports = { - publicFolder: path.join(__dirname, 'dist'), -}; diff --git a/packages/unleash-frontend-next/jest-preprocessor.js b/packages/unleash-frontend-next/jest-preprocessor.js deleted file mode 100644 index 66c8d10d00..0000000000 --- a/packages/unleash-frontend-next/jest-preprocessor.js +++ /dev/null @@ -1,9 +0,0 @@ -// preprocessor.js -'use strict'; - -const ReactTools = require('react-tools'); -module.exports = { - process (src) { - return ReactTools.transform(src); - }, -}; diff --git a/packages/unleash-frontend-next/mock-api.json b/packages/unleash-frontend-next/mock-api.json deleted file mode 100644 index 0bc4ee1726..0000000000 --- a/packages/unleash-frontend-next/mock-api.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "features": { - "version": 1, - "features": [ - { - "name": "Feature.A", - "description": "lorem ipsum", - "enabled": false, - "strategies": [ - { - "name": "default", - "parameters": {} - } - ] - }, - { - "name": "Feature.B", - "description": "lorem ipsum", - "enabled": true, - "strategies": [ - { - "name": "ActiveForUserWithId", - "parameters": { - "userIdList": "123,221,998" - } - }, - { - "name": "GradualRolloutRandom", - "parameters": { - "percentage": "10" - } - } - ] - }, - { - "name": "Feature.C", - "description": "lorem ipsum", - "enabled": false, - "strategies": [ - { - "name": "default", - "parameters": {} - } - ] - }, - { - "name": "Feature.D", - "description": "lorem ipsum", - "enabled": true, - "strategies": [ - { - "name": "default", - "parameters": {} - } - ] - }, - { - "name": "Feature.E", - "description": "lorem ipsum", - "enabled": true, - "strategies": [ - { - "name": "default", - "parameters": {} - }, - { - "name": "FancyStrat", - "parameters": {} - } - ] - } - ] - } -} diff --git a/packages/unleash-frontend-next/package.json b/packages/unleash-frontend-next/package.json deleted file mode 100644 index eb6e15f538..0000000000 --- a/packages/unleash-frontend-next/package.json +++ /dev/null @@ -1,89 +0,0 @@ -{ - "name": "unleash-frontend-next", - "description": "unleash your features", - "version": "1.0.0", - "keywords": [ - "unleash", - "feature toggle", - "feature", - "toggle" - ], - "files": [ - "public" - ], - "repository": { - "type": "git", - "url": "ssh://git@github.com:finn-no/unleash.git" - }, - "bugs": { - "url": "https://github.com/finn-no/unleash/issues" - }, - "engines": { - "node": "6" - }, - "scripts": { - "build": "webpack -p", - "start": "webpack-dev-server --config webpack.config.js --hot --progress --colors --port 3000", - "start:api": "json-server --watch mock-api.json -p 3001", - "lint": "eslint . --ext=js,jsx", - "test": "echo 'no test'", - "test:ci": "npm run test", - "prepublish": "npm run build" - }, - "main": "./index.js", - "dependencies": { - "debug": "^2.2.0", - "immutability-helper": "^2.0.0", - "immutable": "^3.8.1", - "normalize.css": "^4.2.0", - "react": "^15.3.1", - "react-addons-css-transition-group": "^15.3.1", - "react-dom": "^15.3.1", - "react-redux": "^4.4.5", - "react-router": "^2.8.0", - "react-toolbox": "^1.2.1", - "redux": "^3.6.0", - "redux-thunk": "^2.1.0" - }, - "devDependencies": { - "babel-core": "^6.14.0", - "babel-loader": "^6.2.5", - "babel-preset-es2015": "^6.14.0", - "babel-preset-react": "^6.11.1", - "babel-preset-react-hmre": "^1.1.1", - "babel-preset-stage-0": "^6.5.0", - "babel-preset-stage-2": "^6.13.0", - "css-loader": "^0.25.0", - "eslint": "^3.4.0", - "eslint-config-finn": "1.0.0-alpha.11", - "eslint-config-finn-react": "^1.0.0-alpha.2", - "eslint-plugin-react": "^6.2.0", - "extract-text-webpack-plugin": "^1.0.1", - "json-server": "^0.8.21", - "node-sass": "~3.7.0", - "postcss-loader": "^0.13.0", - "redux-devtools": "^3.3.1", - "sass-loader": "^4.0.2", - "style-loader": "^0.13.1", - "toolbox-loader": "0.0.3", - "webpack": "^1.13.2", - "webpack-dev-server": "^1.15.1" - }, - "jest": { - "scriptPreprocessor": "/jest-preprocessor.js", - "modulePathIgnorePatterns": [ - "/node_modules/npm" - ], - "unmockedModulePathPatterns": [ - "/node_modules/react", - "/node_modules/reflux" - ], - "moduleFileExtensions": [ - "jsx", - "js" - ] - }, - "pre-commit": [ - "lint" - ] -} diff --git a/packages/unleash-frontend-next/src/.eslintrc b/packages/unleash-frontend-next/src/.eslintrc deleted file mode 100644 index 67c2bde374..0000000000 --- a/packages/unleash-frontend-next/src/.eslintrc +++ /dev/null @@ -1,25 +0,0 @@ -{ - "parser": "babel-eslint", - "extends": [ - "finn", - "finn-react", - "finn/es-modules" - ], - "env": { - "browser": true, - "commonjs": true, - "es6": true - }, - "parserOptions": { - "ecmaVersion": 7, - "ecmaFeatures": { - "experimentalObjectRestSpread": true, - "classes":true, - "spread":true, - "restParams": true - } - }, - "rules": { - "no-shadow": 0 - } -} diff --git a/packages/unleash-frontend-next/src/component/app.jsx b/packages/unleash-frontend-next/src/component/app.jsx deleted file mode 100644 index 34f65038f4..0000000000 --- a/packages/unleash-frontend-next/src/component/app.jsx +++ /dev/null @@ -1,40 +0,0 @@ -import React, { Component } from 'react'; -import { Layout, Panel, NavDrawer, AppBar } from 'react-toolbox'; -import style from './styles.scss'; -import ErrorContainer from './error/error-container'; - -import Navigation from './nav'; - -export default class App extends Component { - constructor (props) { - super(props); - this.state = { drawerActive: false }; - - this.toggleDrawerActive = () => { - this.setState({ drawerActive: !this.state.drawerActive }); - }; - } - - onOverlayClick = () => this.setState({ drawerActive: false }); - - render () { - return ( -
- -
- - - - - -
- {this.props.children} -
-
- -
-
-
- ); - } -}; diff --git a/packages/unleash-frontend-next/src/component/archive/archive-container.js b/packages/unleash-frontend-next/src/component/archive/archive-container.js deleted file mode 100644 index a7b589e5d7..0000000000 --- a/packages/unleash-frontend-next/src/component/archive/archive-container.js +++ /dev/null @@ -1,15 +0,0 @@ -import { connect } from 'react-redux'; -import ListComponent from './archive-list-component'; -import { fetchArchive, revive } from '../../store/archive-actions'; - -const mapStateToProps = (state) => { - const archive = state.archive.get('list').toArray(); - - return { - archive, - }; -}; - -const ArchiveListContainer = connect(mapStateToProps, { fetchArchive, revive })(ListComponent); - -export default ArchiveListContainer; diff --git a/packages/unleash-frontend-next/src/component/archive/archive-list-component.jsx b/packages/unleash-frontend-next/src/component/archive/archive-list-component.jsx deleted file mode 100644 index 5dcd783ba5..0000000000 --- a/packages/unleash-frontend-next/src/component/archive/archive-list-component.jsx +++ /dev/null @@ -1,48 +0,0 @@ -import React, { Component } from 'react'; -import { List, ListItem, ListSubHeader } from 'react-toolbox/lib/list'; -import FontIcon from 'react-toolbox/lib/font_icon'; -import Chip from 'react-toolbox/lib/chip'; -import Switch from 'react-toolbox/lib/switch'; - -const ArchivedFeature = ({ feature, revive }) => { - const { name, description, enabled, strategies } = feature; - const actions = [ -
{strategies && strategies.map(s => {s.name})}
, - revive(feature)} />, - ]; - - const leftActions = [ - , - ]; - - return ( - - ); -}; - -class ArchiveList extends Component { - componentDidMount () { - this.props.fetchArchive(); - } - - render () { - const { archive, revive } = this.props; - return ( - - - {archive.length > 0 ? - archive.map((feature, i) => ) : - } - - ); - } -} - - -export default ArchiveList; diff --git a/packages/unleash-frontend-next/src/component/client-instance/client-instance-component.js b/packages/unleash-frontend-next/src/component/client-instance/client-instance-component.js deleted file mode 100644 index 6d22b39433..0000000000 --- a/packages/unleash-frontend-next/src/component/client-instance/client-instance-component.js +++ /dev/null @@ -1,38 +0,0 @@ -import React, { Component, PropTypes } from 'react'; -import Table from 'react-toolbox/lib/table'; - -const Model = { - appName: { type: String, title: 'Application Name' }, - instanceId: { type: String }, - clientIp: { type: String }, - createdAt: { type: String }, - lastSeen: { type: String }, -}; - -class ClientStrategies extends Component { - static propTypes () { - return { - fetchClientInstances: PropTypes.func.isRequired, - clientInstances: PropTypes.array.isRequired, - }; - } - - componentDidMount () { - this.props.fetchClientInstances(); - } - - render () { - const source = this.props.clientInstances; - - return ( - - ); - } -} - - -export default ClientStrategies; diff --git a/packages/unleash-frontend-next/src/component/client-instance/client-instance-container.js b/packages/unleash-frontend-next/src/component/client-instance/client-instance-container.js deleted file mode 100644 index 4c13df8eab..0000000000 --- a/packages/unleash-frontend-next/src/component/client-instance/client-instance-container.js +++ /dev/null @@ -1,9 +0,0 @@ -import { connect } from 'react-redux'; -import ClientInstances from './client-instance-component'; -import { fetchClientInstances } from '../../store/client-instance-actions'; - -const mapStateToProps = (state) => ({ clientInstances: state.clientInstances.toJS() }); - -const StrategiesContainer = connect(mapStateToProps, { fetchClientInstances })(ClientInstances); - -export default StrategiesContainer; diff --git a/packages/unleash-frontend-next/src/component/client-strategy/strategy-component.js b/packages/unleash-frontend-next/src/component/client-strategy/strategy-component.js deleted file mode 100644 index 3814f84dcb..0000000000 --- a/packages/unleash-frontend-next/src/component/client-strategy/strategy-component.js +++ /dev/null @@ -1,34 +0,0 @@ -import React, { Component } from 'react'; -import Table from 'react-toolbox/lib/table'; - -const Model = { - appName: { type: String, title: 'Application Name' }, - strategies: { type: String }, -}; - -class ClientStrategies extends Component { - - componentDidMount () { - this.props.fetchClientStrategies(); - } - - render () { - const source = this.props.clientStrategies.map(item => ( - { - appName: item.appName, - strategies: item.strategies.join(', '), - }) - ); - - return ( -
- ); - } -} - - -export default ClientStrategies; diff --git a/packages/unleash-frontend-next/src/component/client-strategy/strategy-container.js b/packages/unleash-frontend-next/src/component/client-strategy/strategy-container.js deleted file mode 100644 index e227c65a8a..0000000000 --- a/packages/unleash-frontend-next/src/component/client-strategy/strategy-container.js +++ /dev/null @@ -1,9 +0,0 @@ -import { connect } from 'react-redux'; -import ClientStrategies from './strategy-component'; -import { fetchClientStrategies } from '../../store/client-strategy-actions'; - -const mapStateToProps = (state) => ({ clientStrategies: state.clientStrategies.toJS() }); - -const StrategiesContainer = connect(mapStateToProps, { fetchClientStrategies })(ClientStrategies); - -export default StrategiesContainer; diff --git a/packages/unleash-frontend-next/src/component/error/error-component.jsx b/packages/unleash-frontend-next/src/component/error/error-component.jsx deleted file mode 100644 index 22e3d6faf2..0000000000 --- a/packages/unleash-frontend-next/src/component/error/error-component.jsx +++ /dev/null @@ -1,28 +0,0 @@ -import Snackbar from 'react-toolbox/lib/snackbar'; -import React, { PropTypes } from 'react'; - -class ErrorComponent extends React.Component { - static propTypes () { - return { - errors: PropTypes.array.isRequired, - muteError: PropTypes.func.isRequired, - }; - } - - render () { - const showError = this.props.errors.length > 0; - const error = showError ? this.props.errors[0] : undefined; - return ( - this.props.muteError(error)} - type="warning" - /> - ); - } -} - -export default ErrorComponent; diff --git a/packages/unleash-frontend-next/src/component/error/error-container.jsx b/packages/unleash-frontend-next/src/component/error/error-container.jsx deleted file mode 100644 index 04dd974fd0..0000000000 --- a/packages/unleash-frontend-next/src/component/error/error-container.jsx +++ /dev/null @@ -1,14 +0,0 @@ -import { connect } from 'react-redux'; -import ErrorComponent from './error-component'; -import { muteError } from '../../store/error-actions'; - - -const mapDispatchToProps = { - muteError, -}; - -const mapStateToProps = (state) => ({ - errors: state.error.get('list').toArray(), -}); - -export default connect(mapStateToProps, mapDispatchToProps)(ErrorComponent); diff --git a/packages/unleash-frontend-next/src/component/feature/feature-component.jsx b/packages/unleash-frontend-next/src/component/feature/feature-component.jsx deleted file mode 100644 index 84920fcad5..0000000000 --- a/packages/unleash-frontend-next/src/component/feature/feature-component.jsx +++ /dev/null @@ -1,53 +0,0 @@ -import React, { PropTypes } from 'react'; - -import { Link } from 'react-router'; -import FontIcon from 'react-toolbox/lib/font_icon'; -import Switch from 'react-toolbox/lib/switch'; -import { ListItem } from 'react-toolbox/lib/list'; -import Chip from 'react-toolbox/lib/chip'; - -import style from './feature.scss'; - -const Feature = ({ - feature, - onFeatureClick, - onFeatureRemove, - metricsLastHour = { yes: 0, no: 0, hasData: false }, - metricsLastMinute = { yes: 0, no: 0, hasData: false }, -}) => { - const { name, description, enabled, strategies, createdAt } = feature; - const created = new Date(createdAt); - - const actions = [ -
{strategies && strategies.map((s, i) => {s.name})}
, -
({created.toLocaleDateString('nb-NO')})
, - - - , - onFeatureRemove(name)} />, - ]; - - const leftActions = [ - {metricsLastHour.yes} / {metricsLastHour.no}, - {metricsLastMinute.yes} / {metricsLastMinute.no}, - onFeatureClick(feature)} checked={enabled} />, - ]; - - return ( - - ); -}; - -Feature.propTypes = { - feature: PropTypes.object, - onFeatureClick: PropTypes.func, - onFeatureRemove: PropTypes.func, -}; - -export default Feature; diff --git a/packages/unleash-frontend-next/src/component/feature/feature.scss b/packages/unleash-frontend-next/src/component/feature/feature.scss deleted file mode 100644 index 636272d55f..0000000000 --- a/packages/unleash-frontend-next/src/component/feature/feature.scss +++ /dev/null @@ -1,16 +0,0 @@ -.link { - color: #212121; -} - -.action { - color: #aaa !important; - cursor: pointer; -} - -.yes { - color: green; -} - -.no { - color: red; -} diff --git a/packages/unleash-frontend-next/src/component/feature/form-add-container.jsx b/packages/unleash-frontend-next/src/component/feature/form-add-container.jsx deleted file mode 100644 index 8a2ab56105..0000000000 --- a/packages/unleash-frontend-next/src/component/feature/form-add-container.jsx +++ /dev/null @@ -1,47 +0,0 @@ -import { connect } from 'react-redux'; -import { hashHistory } from 'react-router'; -import { createFeatureToggles, validateName } from '../../store/feature-actions'; -import { createMapper, createActions } from '../input-helpers'; -import FormComponent from './form'; - -const ID = 'add-feature-toggle'; -const mapStateToProps = createMapper({ id: ID }); -const prepare = (methods, dispatch) => { - methods.onSubmit = (input) => ( - (e) => { - e.preventDefault(); - createFeatureToggles(input)(dispatch) - .then(() => methods.clear()) - .then(() => hashHistory.push('/features')); - } - ); - - methods.onCancel = (evt) => { - evt.preventDefault(); - hashHistory.push('/features'); - }; - - methods.addStrategy = (v) => { - methods.pushToList('strategies', v); - }; - - methods.updateStrategy = (v, n) => { - methods.updateInList('strategies', v, n); - }; - - methods.removeStrategy = (v) => { - methods.removeFromList('strategies', v); - }; - - methods.validateName = (v) => { - const featureToggleName = v.target.value; - validateName(featureToggleName) - .then(() => methods.setValue('nameError', undefined)) - .catch((err) => methods.setValue('nameError', err.message)); - }; - - return methods; -}; -const actions = createActions({ id: ID, prepare }); - -export default connect(mapStateToProps, actions)(FormComponent); diff --git a/packages/unleash-frontend-next/src/component/feature/form-edit-container.jsx b/packages/unleash-frontend-next/src/component/feature/form-edit-container.jsx deleted file mode 100644 index b9264f7b82..0000000000 --- a/packages/unleash-frontend-next/src/component/feature/form-edit-container.jsx +++ /dev/null @@ -1,70 +0,0 @@ -import { connect } from 'react-redux'; -import { hashHistory } from 'react-router'; - -import { requestUpdateFeatureToggle } from '../../store/feature-actions'; -import { createMapper, createActions } from '../input-helpers'; -import FormComponent from './form'; - -const ID = 'edit-feature-toggle'; -function getId (props) { - return [ID, props.featureToggleName]; -} -// TODO: need to scope to the active featureToggle -// best is to emulate the "input-storage"? -const mapStateToProps = createMapper({ - id: getId, - getDefault: (state, ownProps) => { - if (ownProps.featureToggleName) { - const match = state.features.findEntry((entry) => entry.get('name') === ownProps.featureToggleName); - - if (match && match[1]) { - return match[1].toJS(); - } - } - return {}; - }, - prepare: (props) => { - props.editmode = true; - return props; - }, -}); - -const prepare = (methods, dispatch) => { - methods.onSubmit = (input) => ( - (e) => { - e.preventDefault(); - // TODO: should add error handling - requestUpdateFeatureToggle(input)(dispatch) - .then(() => methods.clear()) - .then(() => window.history.back()); - } - ); - - methods.onCancel = (evt) => { - evt.preventDefault(); - hashHistory.push('/features'); - }; - - methods.addStrategy = (v) => { - methods.pushToList('strategies', v); - }; - - methods.removeStrategy = (v) => { - methods.removeFromList('strategies', v); - }; - - methods.updateStrategy = (v, n) => { - methods.updateInList('strategies', v, n); - }; - - methods.validateName = () => {}; - - return methods; -}; - -const actions = createActions({ - id: getId, - prepare, -}); - -export default connect(mapStateToProps, actions)(FormComponent); diff --git a/packages/unleash-frontend-next/src/component/feature/form/index.jsx b/packages/unleash-frontend-next/src/component/feature/form/index.jsx deleted file mode 100644 index f292085a01..0000000000 --- a/packages/unleash-frontend-next/src/component/feature/form/index.jsx +++ /dev/null @@ -1,95 +0,0 @@ -import React, { Component, PropTypes } from 'react'; -import Input from 'react-toolbox/lib/input'; -import Button from 'react-toolbox/lib/button'; -import Switch from 'react-toolbox/lib/switch'; -import StrategiesSection from './strategies-section-container'; - -class AddFeatureToggleComponent extends Component { - - componentWillMount () { - // TODO unwind this stuff - if (this.props.initCallRequired === true) { - this.props.init(this.props.input); - } - } - - render () { - const { - input, - setValue, - validateName, - addStrategy, - removeStrategy, - updateStrategy, - onSubmit, - onCancel, - editmode = false, - } = this.props; - - const { - name, // eslint-disable-line - nameError, - description, - enabled, - } = input; - const configuredStrategies = input.strategies || []; - - return ( -
-
- validateName(v)} - onChange={(v) => setValue('name', v)} /> - setValue('description', v)} /> - -
- - setValue('enabled', v)} /> -
-
- - - -
- - , - ]); - - - return ( - - ); - }) : } - - this.context.router.push('/strategies/create')} - caption="Add" legend="new strategy" leftIcon="add" /> - - ); - } -} - - -export default StrategiesListComponent; diff --git a/packages/unleash-frontend-next/src/component/strategies/list-container.jsx b/packages/unleash-frontend-next/src/component/strategies/list-container.jsx deleted file mode 100644 index 1b1d1eb87e..0000000000 --- a/packages/unleash-frontend-next/src/component/strategies/list-container.jsx +++ /dev/null @@ -1,24 +0,0 @@ -import { connect } from 'react-redux'; -import StrategiesListComponent from './list-component.jsx'; -import { fetchStrategies, removeStrategy } from '../../store/strategy-actions'; - -const mapStateToProps = (state) => { - const list = state.strategies.get('list').toArray(); - - return { - strategies: list, - }; -}; - -const mapDispatchToProps = (dispatch) => ({ - removeStrategy: (strategy) => { - if (window.confirm('Are you sure you want to remove this strategy?')) { // eslint-disable-line no-alert - removeStrategy(strategy)(dispatch); - } - }, - fetchStrategies: () => fetchStrategies()(dispatch), -}); - -const StrategiesListContainer = connect(mapStateToProps, mapDispatchToProps)(StrategiesListComponent); - -export default StrategiesListContainer; diff --git a/packages/unleash-frontend-next/src/component/strategies/strategies.scss b/packages/unleash-frontend-next/src/component/strategies/strategies.scss deleted file mode 100644 index 544d25fa08..0000000000 --- a/packages/unleash-frontend-next/src/component/strategies/strategies.scss +++ /dev/null @@ -1,8 +0,0 @@ -.non-style-button { - cursor: pointer; - color: #757575; - background: none; - border: 0; - padding: 0; - margin: 0; -} diff --git a/packages/unleash-frontend-next/src/component/styles.scss b/packages/unleash-frontend-next/src/component/styles.scss deleted file mode 100644 index 2bb912f3e9..0000000000 --- a/packages/unleash-frontend-next/src/component/styles.scss +++ /dev/null @@ -1,17 +0,0 @@ -.container { - position: absolute; - top: 0; - bottom: 0; - left: 0; - right: 0; - width: 100%; - height: auto; - overflow-y: auto; -} - -.navigation { - .active { - background-color: #EEE; - } -} - diff --git a/packages/unleash-frontend-next/src/data/archive-api.js b/packages/unleash-frontend-next/src/data/archive-api.js deleted file mode 100644 index 29f6ae3743..0000000000 --- a/packages/unleash-frontend-next/src/data/archive-api.js +++ /dev/null @@ -1,24 +0,0 @@ -import { throwIfNotSuccess, headers } from './helper'; - -const URI = '/archive'; - -function fetchAll () { - return fetch(`${URI}/features`) - .then(throwIfNotSuccess) - .then(response => response.json()); -} - -function revive (feature) { - return fetch(`${URI}/revive`, { - method: 'POST', - headers, - body: JSON.stringify(feature), - }).then(throwIfNotSuccess); -} - - -module.exports = { - fetchAll, - revive, -}; - diff --git a/packages/unleash-frontend-next/src/data/client-instance-api.js b/packages/unleash-frontend-next/src/data/client-instance-api.js deleted file mode 100644 index bb56fd43a2..0000000000 --- a/packages/unleash-frontend-next/src/data/client-instance-api.js +++ /dev/null @@ -1,13 +0,0 @@ -import { throwIfNotSuccess, headers } from './helper'; - -const URI = '/client/instances'; - -function fetchAll () { - return fetch(URI, { headers }) - .then(throwIfNotSuccess) - .then(response => response.json()); -} - -module.exports = { - fetchAll, -}; diff --git a/packages/unleash-frontend-next/src/data/client-strategy-api.js b/packages/unleash-frontend-next/src/data/client-strategy-api.js deleted file mode 100644 index d97642f233..0000000000 --- a/packages/unleash-frontend-next/src/data/client-strategy-api.js +++ /dev/null @@ -1,13 +0,0 @@ -import { throwIfNotSuccess, headers } from './helper'; - -const URI = '/client/strategies'; - -function fetchAll () { - return fetch(URI, { headers }) - .then(throwIfNotSuccess) - .then(response => response.json()); -} - -module.exports = { - fetchAll, -}; diff --git a/packages/unleash-frontend-next/src/data/feature-api.js b/packages/unleash-frontend-next/src/data/feature-api.js deleted file mode 100644 index 5cf22290f8..0000000000 --- a/packages/unleash-frontend-next/src/data/feature-api.js +++ /dev/null @@ -1,48 +0,0 @@ -import { throwIfNotSuccess, headers } from './helper'; - -const URI = '/features'; -const URI_VALIDATE = '/features-validate'; - -function fetchAll () { - return fetch(URI) - .then(throwIfNotSuccess) - .then(response => response.json()); -} - -function create (featureToggle) { - return fetch(URI, { - method: 'POST', - headers, - body: JSON.stringify(featureToggle), - }).then(throwIfNotSuccess); -} - -function validate (featureToggle) { - return fetch(URI_VALIDATE, { - method: 'POST', - headers, - body: JSON.stringify(featureToggle), - }).then(throwIfNotSuccess); -} - -function update (featureToggle) { - return fetch(`${URI}/${featureToggle.name}`, { - method: 'PUT', - headers, - body: JSON.stringify(featureToggle), - }).then(throwIfNotSuccess); -} - -function remove (featureToggleName) { - return fetch(`${URI}/${featureToggleName}`, { - method: 'DELETE', - }).then(throwIfNotSuccess); -} - -module.exports = { - fetchAll, - create, - validate, - update, - remove, -}; diff --git a/packages/unleash-frontend-next/src/data/helper.js b/packages/unleash-frontend-next/src/data/helper.js deleted file mode 100644 index 4d396f379d..0000000000 --- a/packages/unleash-frontend-next/src/data/helper.js +++ /dev/null @@ -1,25 +0,0 @@ -const defaultErrorMessage = 'Unexptected exception when talking to unleash-api'; - -export function throwIfNotSuccess (response) { - if (!response.ok) { - if (response.status > 399 && response.status < 404) { - return new Promise((resolve, reject) => { - response.json().then(body => { - const errorMsg = body && body.length > 0 ? body[0].msg : defaultErrorMessage; - let error = new Error(errorMsg); - error.statusCode = response.status; - reject(error); - }); - }); - } else { - return Promise.reject(new Error(defaultErrorMessage)); - } - } - return Promise.resolve(response); -}; - - -export const headers = { - 'Accept': 'application/json', - 'Content-Type': 'application/json', -}; diff --git a/packages/unleash-frontend-next/src/data/history-api.js b/packages/unleash-frontend-next/src/data/history-api.js deleted file mode 100644 index 48037fa52a..0000000000 --- a/packages/unleash-frontend-next/src/data/history-api.js +++ /dev/null @@ -1,13 +0,0 @@ -import { throwIfNotSuccess } from './helper'; - -const URI = '/events'; - -function fetchAll () { - return fetch(URI) - .then(throwIfNotSuccess) - .then(response => response.json()); -} - -module.exports = { - fetchAll, -}; diff --git a/packages/unleash-frontend-next/src/data/metrics-api.js b/packages/unleash-frontend-next/src/data/metrics-api.js deleted file mode 100644 index dbbdf19b76..0000000000 --- a/packages/unleash-frontend-next/src/data/metrics-api.js +++ /dev/null @@ -1,13 +0,0 @@ -import { throwIfNotSuccess } from './helper'; - -const URI = '/metrics'; - -function fetchAll () { - return fetch(URI) - .then(throwIfNotSuccess) - .then(response => response.json()); -} - -module.exports = { - fetchAll, -}; diff --git a/packages/unleash-frontend-next/src/data/strategy-api.js b/packages/unleash-frontend-next/src/data/strategy-api.js deleted file mode 100644 index 9aa061fe10..0000000000 --- a/packages/unleash-frontend-next/src/data/strategy-api.js +++ /dev/null @@ -1,30 +0,0 @@ -import { throwIfNotSuccess, headers } from './helper'; - -const URI = '/strategies'; - -function fetchAll () { - return fetch(URI) - .then(throwIfNotSuccess) - .then(response => response.json()); -} - -function create (strategy) { - return fetch(URI, { - method: 'POST', - headers, - body: JSON.stringify(strategy), - }).then(throwIfNotSuccess); -} - -function remove (strategy) { - return fetch(`${URI}/${strategy.name}`, { - method: 'DELETE', - headers, - }).then(throwIfNotSuccess); -} - -module.exports = { - fetchAll, - create, - remove, -}; diff --git a/packages/unleash-frontend-next/src/index.jsx b/packages/unleash-frontend-next/src/index.jsx deleted file mode 100644 index 84fb685f3e..0000000000 --- a/packages/unleash-frontend-next/src/index.jsx +++ /dev/null @@ -1,46 +0,0 @@ -import React from 'react'; -import ReactDOM from 'react-dom'; -import { Router, Route, IndexRedirect, hashHistory } from 'react-router'; -import { Provider } from 'react-redux'; -import thunkMiddleware from 'redux-thunk'; -import { createStore, applyMiddleware } from 'redux'; - -import store from './store'; -import App from './component/app'; - -import Features from './page/features'; -import CreateFeatureToggle from './page/features/create'; -import EditFeatureToggle from './page/features/edit'; -import Strategies from './page/strategies'; -import CreateStrategies from './page/strategies/create'; -import HistoryPage from './page/history'; -import Archive from './page/archive'; -import Metrics from './page/metrics'; -import ClientStrategies from './page/client-strategies'; -import ClientInstances from './page/client-instances'; - -const unleashStore = createStore( - store, - applyMiddleware( - thunkMiddleware - ) -); - -ReactDOM.render( - - - - - - - - - - - - - - - - - , document.getElementById('app')); diff --git a/packages/unleash-frontend-next/src/page/archive/index.js b/packages/unleash-frontend-next/src/page/archive/index.js deleted file mode 100644 index c88ee8d0e1..0000000000 --- a/packages/unleash-frontend-next/src/page/archive/index.js +++ /dev/null @@ -1,6 +0,0 @@ -import React from 'react'; -import Archive from '../../component/archive/archive-container'; - -const render = () => ; - -export default render; diff --git a/packages/unleash-frontend-next/src/page/client-instances/index.js b/packages/unleash-frontend-next/src/page/client-instances/index.js deleted file mode 100644 index 75b27b52da..0000000000 --- a/packages/unleash-frontend-next/src/page/client-instances/index.js +++ /dev/null @@ -1,6 +0,0 @@ -import React from 'react'; -import ClientInstance from '../../component/client-instance/client-instance-container'; - -const render = () => ; - -export default render; diff --git a/packages/unleash-frontend-next/src/page/client-strategies/index.js b/packages/unleash-frontend-next/src/page/client-strategies/index.js deleted file mode 100644 index 1c5e66849c..0000000000 --- a/packages/unleash-frontend-next/src/page/client-strategies/index.js +++ /dev/null @@ -1,11 +0,0 @@ -import React from 'react'; -import ClientStrategy from '../../component/client-strategy/strategy-container'; - -const render = () => ( -
-
Client Strategies
- -
-); - -export default render; diff --git a/packages/unleash-frontend-next/src/page/features/create.js b/packages/unleash-frontend-next/src/page/features/create.js deleted file mode 100644 index ff9afd5e6f..0000000000 --- a/packages/unleash-frontend-next/src/page/features/create.js +++ /dev/null @@ -1,11 +0,0 @@ -import React from 'react'; -import AddFeatureToggleForm from '../../component/feature/form-add-container'; - -const render = () => ( -
-

Create feature toggle

- -
-); - -export default render; diff --git a/packages/unleash-frontend-next/src/page/features/edit.js b/packages/unleash-frontend-next/src/page/features/edit.js deleted file mode 100644 index fed77e7f18..0000000000 --- a/packages/unleash-frontend-next/src/page/features/edit.js +++ /dev/null @@ -1,19 +0,0 @@ -import React, { Component, PropTypes } from 'react'; -import EditFeatureToggleForm from '../../component/feature/form-edit-container'; - -export default class Features extends Component { - static propTypes () { - return { - params: PropTypes.object.isRequired, - }; - } - - render () { - return ( -
-

Edit feature toggle

- -
- ); - } -}; diff --git a/packages/unleash-frontend-next/src/page/features/index.js b/packages/unleash-frontend-next/src/page/features/index.js deleted file mode 100644 index b632addcd0..0000000000 --- a/packages/unleash-frontend-next/src/page/features/index.js +++ /dev/null @@ -1,8 +0,0 @@ -import React from 'react'; -import FeatureListContainer from '../../component/feature/list-container'; - -const render = () => (); - -export default render; - - diff --git a/packages/unleash-frontend-next/src/page/history/index.js b/packages/unleash-frontend-next/src/page/history/index.js deleted file mode 100644 index 8b2b5a8c3f..0000000000 --- a/packages/unleash-frontend-next/src/page/history/index.js +++ /dev/null @@ -1,6 +0,0 @@ -import React from 'react'; -import HistoryComponent from '../../component/history/history-container'; - -const render = () => ; - -export default render; diff --git a/packages/unleash-frontend-next/src/page/metrics/index.js b/packages/unleash-frontend-next/src/page/metrics/index.js deleted file mode 100644 index c18da93b5c..0000000000 --- a/packages/unleash-frontend-next/src/page/metrics/index.js +++ /dev/null @@ -1,6 +0,0 @@ -import React from 'react'; -import Metrics from '../../component/metrics/metrics-container'; - -const render = () => ; - -export default render; diff --git a/packages/unleash-frontend-next/src/page/strategies/create.js b/packages/unleash-frontend-next/src/page/strategies/create.js deleted file mode 100644 index bd94fcf7d1..0000000000 --- a/packages/unleash-frontend-next/src/page/strategies/create.js +++ /dev/null @@ -1,4 +0,0 @@ -import React from 'react'; -import AddStrategies from '../../component/strategies/add-container'; - -export default () => (); diff --git a/packages/unleash-frontend-next/src/page/strategies/index.js b/packages/unleash-frontend-next/src/page/strategies/index.js deleted file mode 100644 index 8f41038bd0..0000000000 --- a/packages/unleash-frontend-next/src/page/strategies/index.js +++ /dev/null @@ -1,4 +0,0 @@ -import React from 'react'; -import Strategies from '../../component/strategies/list-container'; - -export default () => (); diff --git a/packages/unleash-frontend-next/src/store/archive-actions.js b/packages/unleash-frontend-next/src/store/archive-actions.js deleted file mode 100644 index 07ea4cbc6d..0000000000 --- a/packages/unleash-frontend-next/src/store/archive-actions.js +++ /dev/null @@ -1,33 +0,0 @@ -import api from '../data/archive-api'; - -export const REVIVE_TOGGLE = 'REVIVE_TOGGLE'; -export const RECEIVE_ARCHIVE = 'RECEIVE_ARCHIVE'; -export const ERROR_RECEIVE_ARCHIVE = 'ERROR_RECEIVE_ARCHIVE'; - -const receiveArchive = (json) => ({ - type: RECEIVE_ARCHIVE, - value: json.features, -}); - -const reviveToggle = (archiveFeatureToggle) => ({ - type: REVIVE_TOGGLE, - value: archiveFeatureToggle, -}); - -const errorReceiveArchive = (statusCode) => ({ - type: ERROR_RECEIVE_ARCHIVE, - statusCode, -}); - -export function revive (featureToggle) { - return dispatch => api.revive(featureToggle) - .then(() => dispatch(reviveToggle(featureToggle))) - .catch(error => dispatch(errorReceiveArchive(error))); -} - - -export function fetchArchive () { - return dispatch => api.fetchAll() - .then(json => dispatch(receiveArchive(json))) - .catch(error => dispatch(errorReceiveArchive(error))); -} diff --git a/packages/unleash-frontend-next/src/store/archive-store.js b/packages/unleash-frontend-next/src/store/archive-store.js deleted file mode 100644 index 845b79d748..0000000000 --- a/packages/unleash-frontend-next/src/store/archive-store.js +++ /dev/null @@ -1,19 +0,0 @@ -import { List, Map as $Map } from 'immutable'; -import { RECEIVE_ARCHIVE, REVIVE_TOGGLE } from './archive-actions'; - -function getInitState () { - return new $Map({ list: new List() }); -} - -const archiveStore = (state = getInitState(), action) => { - switch (action.type) { - case REVIVE_TOGGLE: - return state.update('list', (list) => list.remove(list.indexOf(action.value))); - case RECEIVE_ARCHIVE: - return state.set('list', new List(action.value)); - default: - return state; - } -}; - -export default archiveStore; diff --git a/packages/unleash-frontend-next/src/store/client-instance-actions.js b/packages/unleash-frontend-next/src/store/client-instance-actions.js deleted file mode 100644 index 03de9edcf5..0000000000 --- a/packages/unleash-frontend-next/src/store/client-instance-actions.js +++ /dev/null @@ -1,20 +0,0 @@ -import api from '../data/client-instance-api'; - -export const RECEIVE_CLIENT_INSTANCES = 'RECEIVE_CLIENT_INSTANCES'; -export const ERROR_RECEIVE_CLIENT_INSTANCES = 'ERROR_RECEIVE_CLIENT_INSTANCES'; - -const receiveClientInstances = (json) => ({ - type: RECEIVE_CLIENT_INSTANCES, - value: json, -}); - -const errorReceiveClientInstances = (statusCode) => ({ - type: RECEIVE_CLIENT_INSTANCES, - statusCode, -}); - -export function fetchClientInstances () { - return dispatch => api.fetchAll() - .then(json => dispatch(receiveClientInstances(json))) - .catch(error => dispatch(errorReceiveClientInstances(error))); -} diff --git a/packages/unleash-frontend-next/src/store/client-instance-store.js b/packages/unleash-frontend-next/src/store/client-instance-store.js deleted file mode 100644 index d075fbf841..0000000000 --- a/packages/unleash-frontend-next/src/store/client-instance-store.js +++ /dev/null @@ -1,17 +0,0 @@ -import { fromJS } from 'immutable'; -import { RECEIVE_CLIENT_INSTANCES } from './client-instance-actions'; - -function getInitState () { - return fromJS([]); -} - -const store = (state = getInitState(), action) => { - switch (action.type) { - case RECEIVE_CLIENT_INSTANCES: - return fromJS(action.value); - default: - return state; - } -}; - -export default store; diff --git a/packages/unleash-frontend-next/src/store/client-strategy-actions.js b/packages/unleash-frontend-next/src/store/client-strategy-actions.js deleted file mode 100644 index b7a07a0dad..0000000000 --- a/packages/unleash-frontend-next/src/store/client-strategy-actions.js +++ /dev/null @@ -1,20 +0,0 @@ -import api from '../data/client-strategy-api'; - -export const RECEIVE_CLIENT_STRATEGIES = 'RECEIVE_CLIENT_STRATEGIES'; -export const ERROR_RECEIVE_CLIENT_STRATEGIES = 'ERROR_RECEIVE_CLIENT_STRATEGIES'; - -const receiveMetrics = (json) => ({ - type: RECEIVE_CLIENT_STRATEGIES, - value: json, -}); - -const errorReceiveMetrics = (statusCode) => ({ - type: RECEIVE_CLIENT_STRATEGIES, - statusCode, -}); - -export function fetchClientStrategies () { - return dispatch => api.fetchAll() - .then(json => dispatch(receiveMetrics(json))) - .catch(error => dispatch(errorReceiveMetrics(error))); -} diff --git a/packages/unleash-frontend-next/src/store/client-strategy-store.js b/packages/unleash-frontend-next/src/store/client-strategy-store.js deleted file mode 100644 index 1de24b1be0..0000000000 --- a/packages/unleash-frontend-next/src/store/client-strategy-store.js +++ /dev/null @@ -1,17 +0,0 @@ -import { fromJS } from 'immutable'; -import { RECEIVE_CLIENT_STRATEGIES } from './client-strategy-actions'; - -function getInitState () { - return fromJS([]); -} - -const store = (state = getInitState(), action) => { - switch (action.type) { - case RECEIVE_CLIENT_STRATEGIES: - return fromJS(action.value); - default: - return state; - } -}; - -export default store; diff --git a/packages/unleash-frontend-next/src/store/error-actions.js b/packages/unleash-frontend-next/src/store/error-actions.js deleted file mode 100644 index 5b8a3682df..0000000000 --- a/packages/unleash-frontend-next/src/store/error-actions.js +++ /dev/null @@ -1,8 +0,0 @@ -export const MUTE_ERRORS = 'MUTE_ERRORS'; -export const MUTE_ERROR = 'MUTE_ERROR'; - -export const muteErrors = () => ({ type: MUTE_ERRORS }); - -export const muteError = (error) => ({ type: MUTE_ERROR, error }); - - diff --git a/packages/unleash-frontend-next/src/store/error-store.js b/packages/unleash-frontend-next/src/store/error-store.js deleted file mode 100644 index 129f8b6c37..0000000000 --- a/packages/unleash-frontend-next/src/store/error-store.js +++ /dev/null @@ -1,40 +0,0 @@ -import { List, Map as $Map } from 'immutable'; -import { MUTE_ERROR } from './error-actions'; -import { - ERROR_FETCH_FEATURE_TOGGLES, - ERROR_CREATING_FEATURE_TOGGLE, - ERROR_REMOVE_FEATURE_TOGGLE, - ERROR_UPDATE_FEATURE_TOGGLE, -} from './feature-actions'; - -const debug = require('debug')('unleash:error-store'); - -function getInitState () { - return new $Map({ - list: new List(), - }); -} - -function addErrorIfNotAlreadyInList (state, error) { - debug('Got error', error); - if (state.get('list').indexOf(error) < 0) { - return state.update('list', (list) => list.push(error)); - } - return state; -} - -const strategies = (state = getInitState(), action) => { - switch (action.type) { - case ERROR_CREATING_FEATURE_TOGGLE: - case ERROR_REMOVE_FEATURE_TOGGLE: - case ERROR_FETCH_FEATURE_TOGGLES: - case ERROR_UPDATE_FEATURE_TOGGLE: - return addErrorIfNotAlreadyInList(state, action.error.message); - case MUTE_ERROR: - return state.update('list', (list) => list.remove(list.indexOf(action.error))); - default: - return state; - } -}; - -export default strategies; diff --git a/packages/unleash-frontend-next/src/store/feature-actions.js b/packages/unleash-frontend-next/src/store/feature-actions.js deleted file mode 100644 index c21304f8b7..0000000000 --- a/packages/unleash-frontend-next/src/store/feature-actions.js +++ /dev/null @@ -1,93 +0,0 @@ -import api from '../data/feature-api'; -const debug = require('debug')('unleash:feature-actions'); - -export const ADD_FEATURE_TOGGLE = 'ADD_FEATURE_TOGGLE'; -export const REMOVE_FEATURE_TOGGLE = 'REMOVE_FEATURE_TOGGLE'; -export const UPDATE_FEATURE_TOGGLE = 'UPDATE_FEATURE_TOGGLE'; -export const TOGGLE_FEATURE_TOGGLE = 'TOGGLE_FEATURE_TOGGLE'; -export const START_FETCH_FEATURE_TOGGLES = 'START_FETCH_FEATURE_TOGGLES'; -export const START_UPDATE_FEATURE_TOGGLE = 'START_UPDATE_FEATURE_TOGGLE'; -export const START_CREATE_FEATURE_TOGGLE = 'START_CREATE_FEATURE_TOGGLE'; -export const START_REMOVE_FEATURE_TOGGLE = 'START_REMOVE_FEATURE_TOGGLE'; -export const RECEIVE_FEATURE_TOGGLES = 'RECEIVE_FEATURE_TOGGLES'; -export const ERROR_FETCH_FEATURE_TOGGLES = 'ERROR_FETCH_FEATURE_TOGGLES'; -export const ERROR_CREATING_FEATURE_TOGGLE = 'ERROR_CREATING_FEATURE_TOGGLE'; -export const ERROR_UPDATE_FEATURE_TOGGLE = 'ERROR_UPDATE_FEATURE_TOGGLE'; -export const ERROR_REMOVE_FEATURE_TOGGLE = 'ERROR_REMOVE_FEATURE_TOGGLE'; - -export function toggleFeature (featureToggle) { - debug('Toggle feature toggle ', featureToggle); - return dispatch => { - const newValue = Object.assign({}, featureToggle, { enabled: !featureToggle.enabled }); - dispatch(requestUpdateFeatureToggle(newValue)); - }; -}; - -export function editFeatureToggle (featureToggle) { - debug('Update feature toggle ', featureToggle); - return dispatch => { - dispatch(requestUpdateFeatureToggle(featureToggle)); - }; -}; - - -function receiveFeatureToggles (json) { - debug('reviced feature toggles', json); - return { - type: RECEIVE_FEATURE_TOGGLES, - featureToggles: json.features.map(features => features), - receivedAt: Date.now(), - }; -} - -function dispatchAndThrow (dispatch, type) { - return (error) => { - dispatch({ type, error, receivedAt: Date.now() }); - throw error; - }; -} - -export function fetchFeatureToggles () { - debug('Start fetching feature toggles'); - return dispatch => { - dispatch({ type: START_FETCH_FEATURE_TOGGLES }); - - return api.fetchAll() - .then(json => dispatch(receiveFeatureToggles(json))) - .catch(dispatchAndThrow(dispatch, ERROR_FETCH_FEATURE_TOGGLES)); - }; -} - -export function createFeatureToggles (featureToggle) { - return dispatch => { - dispatch({ type: START_CREATE_FEATURE_TOGGLE }); - - return api.create(featureToggle) - .then(() => dispatch({ type: ADD_FEATURE_TOGGLE, featureToggle })) - .catch(dispatchAndThrow(dispatch, ERROR_CREATING_FEATURE_TOGGLE)); - }; -} - -export function requestUpdateFeatureToggle (featureToggle) { - return dispatch => { - dispatch({ type: START_UPDATE_FEATURE_TOGGLE }); - - return api.update(featureToggle) - .then(() => dispatch({ type: UPDATE_FEATURE_TOGGLE, featureToggle })) - .catch(dispatchAndThrow(dispatch, ERROR_UPDATE_FEATURE_TOGGLE)); - }; -} - -export function removeFeatureToggle (featureToggleName) { - return dispatch => { - dispatch({ type: START_REMOVE_FEATURE_TOGGLE }); - - return api.remove(featureToggleName) - .then(() => dispatch({ type: REMOVE_FEATURE_TOGGLE, featureToggleName })) - .catch(dispatchAndThrow(dispatch, ERROR_REMOVE_FEATURE_TOGGLE)); - }; -} - -export function validateName (featureToggleName) { - return api.validate({ name: featureToggleName }); -} diff --git a/packages/unleash-frontend-next/src/store/feature-metrics-actions.js b/packages/unleash-frontend-next/src/store/feature-metrics-actions.js deleted file mode 100644 index 4dc8eb66a6..0000000000 --- a/packages/unleash-frontend-next/src/store/feature-metrics-actions.js +++ /dev/null @@ -1,30 +0,0 @@ -import api from './feature-metrics-api'; - -export const START_FETCH_FEATURE_METRICS = 'START_FETCH_FEATURE_METRICS'; -export const RECEIVE_FEATURE_METRICS = 'RECEIVE_FEATURE_METRICS'; -export const ERROR_FETCH_FEATURE_TOGGLES = 'ERROR_FETCH_FEATURE_TOGGLES'; - -function receiveFeatureMetrics (json) { - return { - type: RECEIVE_FEATURE_METRICS, - metrics: json, - receivedAt: Date.now(), - }; -} - -function dispatchAndThrow (dispatch, type) { - return (error) => { - dispatch({ type, error, receivedAt: Date.now() }); - throw error; - }; -} - -export function fetchFeatureMetrics () { - return dispatch => { - dispatch({ type: START_FETCH_FEATURE_METRICS }); - - return api.fetchFeatureMetrics() - .then(json => dispatch(receiveFeatureMetrics(json))) - .catch(dispatchAndThrow(dispatch, ERROR_FETCH_FEATURE_TOGGLES)); - }; -} diff --git a/packages/unleash-frontend-next/src/store/feature-metrics-api.js b/packages/unleash-frontend-next/src/store/feature-metrics-api.js deleted file mode 100644 index cc4d28cac1..0000000000 --- a/packages/unleash-frontend-next/src/store/feature-metrics-api.js +++ /dev/null @@ -1,29 +0,0 @@ -const defaultErrorMessage = 'Unexptected exception when talking to unleash-api'; - -function throwIfNotSuccess (response) { - if (!response.ok) { - if (response.status > 400 && response.status < 404) { - return new Promise((resolve, reject) => { - response.json().then(body => { - const errorMsg = body && body.length > 0 ? body[0].msg : defaultErrorMessage; - let error = new Error(errorMsg); - error.statusCode = response.status; - reject(error); - }); - }); - } else { - return Promise.reject(new Error(defaultErrorMessage)); - } - } - return Promise.resolve(response); -} - -function fetchFeatureMetrics () { - return fetch('/metrics/features') - .then(throwIfNotSuccess) - .then(response => response.json()); -} - -module.exports = { - fetchFeatureMetrics, -}; diff --git a/packages/unleash-frontend-next/src/store/feature-metrics-store.js b/packages/unleash-frontend-next/src/store/feature-metrics-store.js deleted file mode 100644 index 87d7459686..0000000000 --- a/packages/unleash-frontend-next/src/store/feature-metrics-store.js +++ /dev/null @@ -1,21 +0,0 @@ -import { Map as $Map, fromJS } from 'immutable'; - -import { - RECEIVE_FEATURE_METRICS, -} from './feature-metrics-actions'; - - -const metrics = (state = fromJS({ lastHour: {}, lastMinute: {} }), action) => { - switch (action.type) { - case RECEIVE_FEATURE_METRICS: - return state.withMutations((ctx) => { - ctx.set('lastHour', new $Map(action.metrics.lastHour)); - ctx.set('lastMinute', new $Map(action.metrics.lastMinute)); - return ctx; - }); - default: - return state; - } -}; - -export default metrics; diff --git a/packages/unleash-frontend-next/src/store/feature-store.js b/packages/unleash-frontend-next/src/store/feature-store.js deleted file mode 100644 index ef17ff6663..0000000000 --- a/packages/unleash-frontend-next/src/store/feature-store.js +++ /dev/null @@ -1,38 +0,0 @@ -import { List, Map as $Map } from 'immutable'; -const debug = require('debug')('unleash:feature-store'); - - -import { - ADD_FEATURE_TOGGLE, - RECEIVE_FEATURE_TOGGLES, - UPDATE_FEATURE_TOGGLE, - REMOVE_FEATURE_TOGGLE, -} from './feature-actions'; - - -const features = (state = new List([]), action) => { - switch (action.type) { - case ADD_FEATURE_TOGGLE: - debug(ADD_FEATURE_TOGGLE, action); - return state.push(new $Map(action.featureToggle)); - case REMOVE_FEATURE_TOGGLE: - debug(REMOVE_FEATURE_TOGGLE, action); - return state.filter(toggle => toggle.get('name') !== action.featureToggleName); - case UPDATE_FEATURE_TOGGLE: - debug(UPDATE_FEATURE_TOGGLE, action); - return state.map(toggle => { - if (toggle.get('name') === action.featureToggle.name) { - return new $Map(action.featureToggle); - } else { - return toggle; - } - }); - case RECEIVE_FEATURE_TOGGLES: - debug(RECEIVE_FEATURE_TOGGLES, action); - return new List(action.featureToggles.map($Map)); - default: - return state; - } -}; - -export default features; diff --git a/packages/unleash-frontend-next/src/store/history-actions.js b/packages/unleash-frontend-next/src/store/history-actions.js deleted file mode 100644 index 7a45e89d0c..0000000000 --- a/packages/unleash-frontend-next/src/store/history-actions.js +++ /dev/null @@ -1,20 +0,0 @@ -import api from '../data/history-api'; - -export const RECEIVE_HISTORY = 'RECEIVE_HISTORY'; -export const ERROR_RECEIVE_HISTORY = 'ERROR_RECEIVE_HISTORY'; - -const receiveHistory = (json) => ({ - type: RECEIVE_HISTORY, - value: json.events, -}); - -const errorReceiveHistory = (statusCode) => ({ - type: ERROR_RECEIVE_HISTORY, - statusCode, -}); - -export function fetchHistory () { - return dispatch => api.fetchAll() - .then(json => dispatch(receiveHistory(json))) - .catch(error => dispatch(errorReceiveHistory(error))); -} diff --git a/packages/unleash-frontend-next/src/store/history-store.js b/packages/unleash-frontend-next/src/store/history-store.js deleted file mode 100644 index 790d85ec18..0000000000 --- a/packages/unleash-frontend-next/src/store/history-store.js +++ /dev/null @@ -1,17 +0,0 @@ -import { List, Map as $Map } from 'immutable'; -import { RECEIVE_HISTORY } from './history-actions'; - -function getInitState () { - return new $Map({ list: new List() }); -} - -const historyStore = (state = getInitState(), action) => { - switch (action.type) { - case RECEIVE_HISTORY: - return state.set('list', new List(action.value)); - default: - return state; - } -}; - -export default historyStore; diff --git a/packages/unleash-frontend-next/src/store/index.js b/packages/unleash-frontend-next/src/store/index.js deleted file mode 100644 index 2710c6cc1e..0000000000 --- a/packages/unleash-frontend-next/src/store/index.js +++ /dev/null @@ -1,26 +0,0 @@ -import { combineReducers } from 'redux'; -import features from './feature-store'; -import featureMetrics from './feature-metrics-store'; -import strategies from './strategy-store'; -import input from './input-store'; -import history from './history-store'; // eslint-disable-line -import archive from './archive-store'; -import error from './error-store'; -import metrics from './metrics-store'; -import clientStrategies from './client-strategy-store'; -import clientInstances from './client-instance-store'; - -const unleashStore = combineReducers({ - features, - featureMetrics, - strategies, - input, - history, - archive, - error, - metrics, - clientStrategies, - clientInstances, -}); - -export default unleashStore; diff --git a/packages/unleash-frontend-next/src/store/input-actions.js b/packages/unleash-frontend-next/src/store/input-actions.js deleted file mode 100644 index f94fe5a09f..0000000000 --- a/packages/unleash-frontend-next/src/store/input-actions.js +++ /dev/null @@ -1,19 +0,0 @@ -export const actions = { - SET_VALUE: 'SET_VALUE', - INCREMENT_VALUE: 'INCREMENT_VALUE', - LIST_PUSH: 'LIST_PUSH', - LIST_POP: 'LIST_POP', - LIST_UP: 'LIST_UP', - CLEAR: 'CLEAR', - INIT: 'INIT', -}; - -export const createInit = ({ id, value }) => ({ type: actions.INIT, id, value }); -export const createInc = ({ id, key }) => ({ type: actions.INCREMENT_VALUE, id, key }); -export const createSet = ({ id, key, value }) => ({ type: actions.SET_VALUE, id, key, value }); -export const createPush = ({ id, key, value }) => ({ type: actions.LIST_PUSH, id, key, value }); -export const createPop = ({ id, key, value }) => ({ type: actions.LIST_POP, id, key, value }); -export const createUp = ({ id, key, value, newValue }) => ({ type: actions.LIST_UP, id, key, value, newValue }); -export const createClear = ({ id }) => ({ type: actions.CLEAR, id }); - -export default actions; diff --git a/packages/unleash-frontend-next/src/store/input-store.js b/packages/unleash-frontend-next/src/store/input-store.js deleted file mode 100644 index 3379123398..0000000000 --- a/packages/unleash-frontend-next/src/store/input-store.js +++ /dev/null @@ -1,94 +0,0 @@ -import { Map as $Map, List, fromJS } from 'immutable'; -import actions from './input-actions'; - -function getInitState () { - return new $Map(); -} - -function init (state, { id, value }) { - state = assertId(state, id); - return state.setIn(id, fromJS(value)); -} - -function assertId (state, id) { - if (!state.hasIn(id)) { - return state.setIn(id, new $Map({ inputId: id })); - } - return state; -} - -function assertList (state, id, key) { - if (!state.getIn(id).has(key)) { - return state.setIn(id.concat([key]), new List()); - } - return state; -} - -function setKeyValue (state, { id, key, value }) { - state = assertId(state, id); - return state.setIn(id.concat([key]), value); -} - -function increment (state, { id, key }) { - state = assertId(state, id); - return state.updateIn(id.concat([key]), (value = 0) => value + 1); -} - -function clear (state, { id }) { - if (state.hasIn(id)) { - return state.removeIn(id); - } - return state; -} - -function addToList (state, { id, key, value }) { - state = assertId(state, id); - state = assertList(state, id, key); - - return state.updateIn(id.concat([key]), (list) => list.push(value)); -} - -function updateInList (state, { id, key, value, newValue }) { - state = assertId(state, id); - state = assertList(state, id, key); - - return state.updateIn(id.concat([key]), (list) => list.set(list.indexOf(value), newValue)); -} - -function removeFromList (state, { id, key, value }) { - state = assertId(state, id); - state = assertList(state, id, key); - - return state.updateIn(id.concat([key]), (list) => list.remove(list.indexOf(value))); -} - -const inputState = (state = getInitState(), action) => { - if (!action.id) { - return state; - } - - switch (action.type) { - case actions.INIT: - return init(state, action); - case actions.SET_VALUE: - if (actions.key != null && actions.value != null) { - throw new Error('Missing required key / value'); - } - return setKeyValue(state, action); - case actions.INCREMENT_VALUE: - return increment(state, action); - case actions.LIST_PUSH: - return addToList(state, action); - case actions.LIST_POP: - return removeFromList(state, action); - case actions.LIST_UP: - return updateInList(state, action); - case actions.CLEAR: - return clear(state, action); - default: - // console.log('TYPE', action.type, action); - return state; - } -}; - -export default inputState; diff --git a/packages/unleash-frontend-next/src/store/metrics-actions.js b/packages/unleash-frontend-next/src/store/metrics-actions.js deleted file mode 100644 index 7010d3857d..0000000000 --- a/packages/unleash-frontend-next/src/store/metrics-actions.js +++ /dev/null @@ -1,20 +0,0 @@ -import api from '../data/metrics-api'; - -export const RECEIVE_METRICS = 'RECEIVE_METRICS'; -export const ERROR_RECEIVE_METRICS = 'ERROR_RECEIVE_METRICS'; - -const receiveMetrics = (json) => ({ - type: RECEIVE_METRICS, - value: json, -}); - -const errorReceiveMetrics = (statusCode) => ({ - type: ERROR_RECEIVE_METRICS, - statusCode, -}); - -export function fetchMetrics () { - return dispatch => api.fetchAll() - .then(json => dispatch(receiveMetrics(json))) - .catch(error => dispatch(errorReceiveMetrics(error))); -} diff --git a/packages/unleash-frontend-next/src/store/metrics-store.js b/packages/unleash-frontend-next/src/store/metrics-store.js deleted file mode 100644 index f0b7a4a650..0000000000 --- a/packages/unleash-frontend-next/src/store/metrics-store.js +++ /dev/null @@ -1,21 +0,0 @@ -import { fromJS } from 'immutable'; -import { RECEIVE_METRICS } from './metrics-actions'; - -function getInitState () { - return fromJS({ - totalCount: 0, - apps: [], - clients: {}, - }); -} - -const historyStore = (state = getInitState(), action) => { - switch (action.type) { - case RECEIVE_METRICS: - return fromJS(action.value); - default: - return state; - } -}; - -export default historyStore; diff --git a/packages/unleash-frontend-next/src/store/strategy-actions.js b/packages/unleash-frontend-next/src/store/strategy-actions.js deleted file mode 100644 index 8421a1384c..0000000000 --- a/packages/unleash-frontend-next/src/store/strategy-actions.js +++ /dev/null @@ -1,61 +0,0 @@ -import api from '../data/strategy-api'; - -export const ADD_STRATEGY = 'ADD_STRATEGY'; -export const REMOVE_STRATEGY = 'REMOVE_STRATEGY'; -export const REQUEST_STRATEGIES = 'REQUEST_STRATEGIES'; -export const START_CREATE_STRATEGY = 'START_CREATE_STRATEGY'; -export const RECEIVE_STRATEGIES = 'RECEIVE_STRATEGIES'; -export const ERROR_RECEIVE_STRATEGIES = 'ERROR_RECEIVE_STRATEGIES'; -export const ERROR_CREATING_STRATEGY = 'ERROR_CREATING_STRATEGY'; - -const addStrategy = (strategy) => ({ type: ADD_STRATEGY, strategy }); -const createRemoveStrategy = (strategy) => ({ type: REMOVE_STRATEGY, strategy }); - -const errorCreatingStrategy = (statusCode) => ({ - type: ERROR_CREATING_STRATEGY, - statusCode, -}); - -const startRequest = () => ({ type: REQUEST_STRATEGIES }); - - -const receiveStrategies = (json) => ({ - type: RECEIVE_STRATEGIES, - value: json.strategies, -}); - -const startCreate = () => ({ type: START_CREATE_STRATEGY }); - -const errorReceiveStrategies = (statusCode) => ({ - type: ERROR_RECEIVE_STRATEGIES, - statusCode, -}); - -export function fetchStrategies () { - return dispatch => { - dispatch(startRequest()); - - return api.fetchAll() - .then(json => dispatch(receiveStrategies(json))) - .catch(error => dispatch(errorReceiveStrategies(error))); - }; -} - -export function createStrategy (strategy) { - return dispatch => { - dispatch(startCreate()); - - return api.create(strategy) - .then(() => dispatch(addStrategy(strategy))) - .catch(error => dispatch(errorCreatingStrategy(error))); - }; -} - - -export function removeStrategy (strategy) { - return dispatch => api.remove(strategy) - .then(() => dispatch(createRemoveStrategy(strategy))) - .catch(error => dispatch(errorCreatingStrategy(error))); -} - - diff --git a/packages/unleash-frontend-next/src/store/strategy-store.js b/packages/unleash-frontend-next/src/store/strategy-store.js deleted file mode 100644 index 72900eaf22..0000000000 --- a/packages/unleash-frontend-next/src/store/strategy-store.js +++ /dev/null @@ -1,29 +0,0 @@ -import { List, Map as $Map } from 'immutable'; -import { RECEIVE_STRATEGIES, REMOVE_STRATEGY, ADD_STRATEGY } from './strategy-actions'; - -function getInitState () { - return new $Map({ list: new List() }); -} - -function removeStrategy (state, action) { - const indexToRemove = state.get('list').indexOf(action.strategy); - if (indexToRemove !== -1) { - return state.update('list', (list) => list.remove(indexToRemove)); - } - return state; -} - -const strategies = (state = getInitState(), action) => { - switch (action.type) { - case RECEIVE_STRATEGIES: - return state.set('list', new List(action.value)); - case REMOVE_STRATEGY: - return removeStrategy(state, action); - case ADD_STRATEGY: - return state.update('list', (list) => list.push(action.strategy)); - default: - return state; - } -}; - -export default strategies; diff --git a/packages/unleash-frontend-next/src/theme/_config.scss b/packages/unleash-frontend-next/src/theme/_config.scss deleted file mode 100644 index 23243086ea..0000000000 --- a/packages/unleash-frontend-next/src/theme/_config.scss +++ /dev/null @@ -1,31 +0,0 @@ -@import "~react-toolbox/lib/colors"; -@import "~react-toolbox/lib/globals"; -@import "~react-toolbox/lib/mixins"; -@import "~react-toolbox/lib/commons"; - -$color-primary:$palette-blue-400; -$color-primary-dark: $palette-blue-700; - -$navigation-drawer-desktop-width: 4 * $standard-increment-desktop !default; -$navigation-drawer-max-desktop-width: 70 * $unit !default; - -// Mobile: -// Width = Screen width − 56 dp -// Maximum width: 320dp -$navigation-drawer-mobile-width: 5 * $standard-increment-mobile !default; - -// sass doesn't like use of variable here: calc(100% - $standard-increment-mobile); -$navigation-drawer-max-mobile-width: calc(100% - 5.6rem) !default; - -.appBar { - .leftIcon { - transition-timing-function: $animation-curve-default; - transition-duration: $animation-duration; - transition-property: width, min-width; - } - @media screen and (min-width: $layout-breakpoint-sm) { - .leftIcon { - display: none; - } - } -} \ No newline at end of file diff --git a/packages/unleash-frontend-next/webpack.config.js b/packages/unleash-frontend-next/webpack.config.js deleted file mode 100644 index b3d338f878..0000000000 --- a/packages/unleash-frontend-next/webpack.config.js +++ /dev/null @@ -1,86 +0,0 @@ -// docs: http://webpack.github.io/docs/configuration.html -'use strict'; - -const path = require('path'); -const webpack = require('webpack'); -const ExtractTextPlugin = require('extract-text-webpack-plugin'); - -module.exports = { - entry: [ - 'webpack-dev-server/client?http://localhost:3000', - 'webpack/hot/only-dev-server', - './src/index', - ], - - resolve: { - root: [path.join(__dirname, 'src')], - extensions: ['', '.scss', '.css', '.js', '.jsx', '.json'], - }, - - output: { - path: path.join(__dirname, 'dist'), - filename: 'bundle.js', - publicPath: '/static/', - }, - - module: { - loaders: [ - { - test: /\.jsx?$/, - exclude: /node_modules/, - loaders: ['babel'], - include: path.join(__dirname, 'src'), - }, - { - test: /(\.scss|\.css)$/, - loader: ExtractTextPlugin.extract('style', - 'css?sourceMap&modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!postcss!sass'), - }, - ], - }, - - plugins: [ - new ExtractTextPlugin('bundle.css', { allChunks: true }), - new webpack.HotModuleReplacementPlugin(), - ], - - sassLoader: { - data: '@import "theme/_config.scss";', - includePaths: [path.resolve(__dirname, './src')], - }, - - devtool: 'source-map', - - externals: { - // stuff not in node_modules can be resolved here. - }, - - devServer: { - proxy: { - '/features': { - target: 'http://localhost:4242', - secure: false, - }, - '/strategies': { - target: 'http://localhost:4242', - secure: false, - }, - '/archive': { - target: 'http://localhost:4242', - secure: false, - }, - '/events': { - target: 'http://localhost:4242', - secure: false, - }, - '/metrics': { - target: 'http://localhost:4242', - secure: false, - }, - '/client': { - target: 'http://localhost:4242', - secure: false, - }, - }, - }, -};