{"size": 926, "ext": "js", "max_stars_repo_path": "client/acp/stores/utils-store.js", "max_stars_repo_name": "NicolasSiver/nodebb-plugin-ns-utils", "max_stars_repo_stars_event_min_datetime": "2015-10-18T16:23:34.000Z", "max_stars_repo_stars_event_max_datetime": "2016-03-10T05:06:45.000Z", "max_issues_repo_path": "client/acp/stores/utils-store.js", "max_issues_repo_name": "NicolasSiver/nodebb-plugin-ns-utils", "max_issues_repo_issues_event_min_datetime": "2021-01-03T07:32:23.000Z", "max_issues_repo_issues_event_max_datetime": "2021-01-05T05:37:49.000Z", "max_forks_repo_path": "client/acp/stores/utils-store.js", "max_forks_repo_name": "NicolasSiver/nodebb-plugin-ns-utils", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 2, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 23.15, "max_line_length": 94, "alphanum_fraction": 0.5097192225}
import Actions from '../actions';
import alt from '../alt';
import Util from '../models/util';

class UtilsStore {
    constructor() {
        this.bindListeners({
            selectUtil: Actions.selectUtil
        });

        this.state = {
            selected: null,
            utils   : [
                {utilId: Util.PURGE_CHATS, name: 'Purge Chats', description: ''},
                {utilId: Util.SANITIZE_DOCUMENTS, name: 'Sanitize Documents', description: ''}
            ]
        };
    }

    static getItemById(utilId) {
        let result = null;

        for (let util of this.state.utils) {
            if(util.utilId === utilId){
                result = util;
                break;
            }
        }

        return result;
    }

    selectUtil(utilItem) {
        this.setState({
            selected: utilItem.utilId
        });
    }
}

export default alt.createStore(UtilsStore, 'UtilsStore');