mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	add metricsdb, fix lint
This commit is contained in:
		
							parent
							
								
									5b41bf4b84
								
							
						
					
					
						commit
						0a73ea0574
					
				@ -17,7 +17,6 @@ module.exports = function (app, config) {
 | 
				
			|||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    app.post('/metrics', (req, res) => {
 | 
					    app.post('/metrics', (req, res) => {
 | 
				
			||||||
        
 | 
					 | 
				
			||||||
        // TODO: validate input and reply with http errorcode
 | 
					        // TODO: validate input and reply with http errorcode
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            // not required with header: Content-Type: application/json
 | 
					            // not required with header: Content-Type: application/json
 | 
				
			||||||
 | 
				
			|||||||
@ -11,6 +11,8 @@ const EventStore = require('../../lib/event-store');
 | 
				
			|||||||
const eventStore = new EventStore(eventDb);
 | 
					const eventStore = new EventStore(eventDb);
 | 
				
			||||||
const featureDb = require('../../lib/db/feature')(knex, eventStore);
 | 
					const featureDb = require('../../lib/db/feature')(knex, eventStore);
 | 
				
			||||||
const strategyDb = require('../../lib/db/strategy')(knex, eventStore);
 | 
					const strategyDb = require('../../lib/db/strategy')(knex, eventStore);
 | 
				
			||||||
 | 
					const metricsDb = require('../../lib/db/metrics')(knex);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const app = require('../../app')({
 | 
					const app = require('../../app')({
 | 
				
			||||||
    baseUriPath: '',
 | 
					    baseUriPath: '',
 | 
				
			||||||
@ -19,6 +21,7 @@ const app = require('../../app')({
 | 
				
			|||||||
    eventStore,
 | 
					    eventStore,
 | 
				
			||||||
    featureDb,
 | 
					    featureDb,
 | 
				
			||||||
    strategyDb,
 | 
					    strategyDb,
 | 
				
			||||||
 | 
					    metricsDb,
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
BPromise.promisifyAll(request);
 | 
					BPromise.promisifyAll(request);
 | 
				
			||||||
 | 
				
			|||||||
@ -18,5 +18,8 @@
 | 
				
			|||||||
            "spread":true,
 | 
					            "spread":true,
 | 
				
			||||||
            "restParams": true
 | 
					            "restParams": true
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "rules": {
 | 
				
			||||||
 | 
					        "no-shadow": 0
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -3,7 +3,7 @@ import ListComponent from './archive-list-component';
 | 
				
			|||||||
import { fetchArchive, revive } from '../../store/archive-actions';
 | 
					import { fetchArchive, revive } from '../../store/archive-actions';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const mapStateToProps = (state) => {
 | 
					const mapStateToProps = (state) => {
 | 
				
			||||||
    const archive = state.archive.get('list').toArray(); // eslint-disable-line no-shadow
 | 
					    const archive = state.archive.get('list').toArray();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return {
 | 
					    return {
 | 
				
			||||||
        archive,
 | 
					        archive,
 | 
				
			||||||
 | 
				
			|||||||
@ -5,7 +5,7 @@ import Chip from 'react-toolbox/lib/chip';
 | 
				
			|||||||
import Switch from 'react-toolbox/lib/switch';
 | 
					import Switch from 'react-toolbox/lib/switch';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const ArchivedFeature = ({ feature, revive }) => {
 | 
					const ArchivedFeature = ({ feature, revive }) => {
 | 
				
			||||||
    const { name, description, enabled, strategies } = feature; // eslint-disable-line no-shadow
 | 
					    const { name, description, enabled, strategies } = feature;
 | 
				
			||||||
    const actions = [
 | 
					    const actions = [
 | 
				
			||||||
        <div>{strategies && strategies.map(s => <Chip><small>{s.name}</small></Chip>)}</div>,
 | 
					        <div>{strategies && strategies.map(s => <Chip><small>{s.name}</small></Chip>)}</div>,
 | 
				
			||||||
        <FontIcon style={{ cursor: 'pointer' }} value="restore" onClick={() => revive(feature)} />,
 | 
					        <FontIcon style={{ cursor: 'pointer' }} value="restore" onClick={() => revive(feature)} />,
 | 
				
			||||||
 | 
				
			|||||||
@ -9,7 +9,7 @@ import Chip from 'react-toolbox/lib/chip';
 | 
				
			|||||||
import style from './feature.scss';
 | 
					import style from './feature.scss';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const Feature = ({ feature, onFeatureClick, onFeatureRemove }) => {
 | 
					const Feature = ({ feature, onFeatureClick, onFeatureRemove }) => {
 | 
				
			||||||
    const { name, description, enabled, strategies } = feature; // eslint-disable-line no-shadow
 | 
					    const { name, description, enabled, strategies } = feature;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const actions = [
 | 
					    const actions = [
 | 
				
			||||||
        <div key="strategies">{strategies && strategies.map((s, i) => <Chip key={i}><small>{s.name}</small></Chip>)}</div>,
 | 
					        <div key="strategies">{strategies && strategies.map((s, i) => <Chip key={i}><small>{s.name}</small></Chip>)}</div>,
 | 
				
			||||||
 | 
				
			|||||||
@ -3,7 +3,7 @@ import ListComponent from './history-list-component';
 | 
				
			|||||||
import { fetchHistory } from '../../store/history-actions';
 | 
					import { fetchHistory } from '../../store/history-actions';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const mapStateToProps = (state) => {
 | 
					const mapStateToProps = (state) => {
 | 
				
			||||||
    const history = state.history.get('list').toArray(); // eslint-disable-line no-shadow
 | 
					    const history = state.history.get('list').toArray();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return {
 | 
					    return {
 | 
				
			||||||
        history,
 | 
					        history,
 | 
				
			||||||
 | 
				
			|||||||
@ -27,7 +27,7 @@ class HistoryList extends Component {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    render () {
 | 
					    render () {
 | 
				
			||||||
        const { history } = this.props; // eslint-disable-line no-shadow
 | 
					        const { history } = this.props;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return (
 | 
					        return (
 | 
				
			||||||
            <List ripple >
 | 
					            <List ripple >
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user