How to use the utility/object.filterArrWithKeyValue function in utility

To help you get started, we’ve selected a few utility examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github XiaocongDong / mongodb-backup-manager / frontend / src / containers / BackupDetails / index.js View on Github external
const mapStateToProps = (state, ownProps) => {
    const backupConfigs = state.get("data").getIn(["backupConfigs", "data"]);
    const id = ownProps.params.backupId;

    const backupConfig = object.filterArrWithKeyValue("id", id, backupConfigs)[0];
    const allCopyDBs = state.get("data").getIn(["copyDBs", "data"]);
    const copyDBs = object.filterArrWithKeyValue("id", id, allCopyDBs);

    const remoteDBs = state.get("data").getIn(["remoteDBs", "data"]);
    const remoteDB = object.filterArrWithKeyValue("id", id, remoteDBs)[0];
    const allLogs = state.get("data").getIn(["logs", "data"]);
    const logs = object.filterArrWithKeyValue("id", id, allLogs);

    const ids = backupConfigs.map(backupConfig => backupConfig.id);

    return {
        backupConfig,
        copyDBs,
        remoteDB,
        logs,
        ids
    }
};
github XiaocongDong / mongodb-backup-manager / frontend / src / components / BackupConfig / Credential.js View on Github external
createNewConnection(connection) {
        connection = object.clone(connection);
        const id = connection.username? `${ connection.username }@${ connection.server}`: `${ connection.server }`;
        connection.id = id;
        if(this.connections == null) {
            this.connections = [];
        }

        const filteredConnections = object.filterArrWithKeyValue("id", id, this.connections);

        if(filteredConnections.length > 0) {
            object.updateArrWithKeyValue('id', id, this.connections, connection);
        }else {
            this.connections.push(connection);
        }

        localStore.setItem('connections', this.connections);
    };
github XiaocongDong / mongodb-backup-manager / frontend / src / components / BackupConfig / Config.js View on Github external
getCollOpts(db) {
        if(db == null) {
            return [];
        }

        const dbsColls = this.props.dbsColls;
        const filteredDbsColls = object.filterArrWithKeyValue("db", db, dbsColls);

        if(filteredDbsColls.length == 0) {
            return [];
        }

        return filteredDbsColls[0].collections;
    }
github XiaocongDong / mongodb-backup-manager / frontend / src / containers / BackupDetails / index.js View on Github external
const mapStateToProps = (state, ownProps) => {
    const backupConfigs = state.get("data").getIn(["backupConfigs", "data"]);
    const id = ownProps.params.backupId;

    const backupConfig = object.filterArrWithKeyValue("id", id, backupConfigs)[0];
    const allCopyDBs = state.get("data").getIn(["copyDBs", "data"]);
    const copyDBs = object.filterArrWithKeyValue("id", id, allCopyDBs);

    const remoteDBs = state.get("data").getIn(["remoteDBs", "data"]);
    const remoteDB = object.filterArrWithKeyValue("id", id, remoteDBs)[0];
    const allLogs = state.get("data").getIn(["logs", "data"]);
    const logs = object.filterArrWithKeyValue("id", id, allLogs);

    const ids = backupConfigs.map(backupConfig => backupConfig.id);

    return {
        backupConfig,
        copyDBs,
        remoteDB,
        logs,
        ids
    }
};
github XiaocongDong / mongodb-backup-manager / frontend / src / containers / BackupDetails / index.js View on Github external
const mapStateToProps = (state, ownProps) => {
    const backupConfigs = state.get("data").getIn(["backupConfigs", "data"]);
    const id = ownProps.params.backupId;

    const backupConfig = object.filterArrWithKeyValue("id", id, backupConfigs)[0];
    const allCopyDBs = state.get("data").getIn(["copyDBs", "data"]);
    const copyDBs = object.filterArrWithKeyValue("id", id, allCopyDBs);

    const remoteDBs = state.get("data").getIn(["remoteDBs", "data"]);
    const remoteDB = object.filterArrWithKeyValue("id", id, remoteDBs)[0];
    const allLogs = state.get("data").getIn(["logs", "data"]);
    const logs = object.filterArrWithKeyValue("id", id, allLogs);

    const ids = backupConfigs.map(backupConfig => backupConfig.id);

    return {
        backupConfig,
        copyDBs,
        remoteDB,
        logs,
        ids
github XiaocongDong / mongodb-backup-manager / frontend / src / containers / BackupDetails / index.js View on Github external
const mapStateToProps = (state, ownProps) => {
    const backupConfigs = state.get("data").getIn(["backupConfigs", "data"]);
    const id = ownProps.params.backupId;

    const backupConfig = object.filterArrWithKeyValue("id", id, backupConfigs)[0];
    const allCopyDBs = state.get("data").getIn(["copyDBs", "data"]);
    const copyDBs = object.filterArrWithKeyValue("id", id, allCopyDBs);

    const remoteDBs = state.get("data").getIn(["remoteDBs", "data"]);
    const remoteDB = object.filterArrWithKeyValue("id", id, remoteDBs)[0];
    const allLogs = state.get("data").getIn(["logs", "data"]);
    const logs = object.filterArrWithKeyValue("id", id, allLogs);

    const ids = backupConfigs.map(backupConfig => backupConfig.id);

    return {
        backupConfig,
        copyDBs,
        remoteDB,
        logs,
        ids
    }
};
github XiaocongDong / mongodb-backup-manager / frontend / src / components / BackupConfig / ConnHistory.js View on Github external
selectConnection() {
        const selectedIds = this.state.selectedIds;

        if(selectedIds.length != 1) {
            return;
        }

        const id = selectedIds[0];
        const connection = object.filterArrWithKeyValue('id', id, this.props.connections)[0];
        this.props.setCredentials(connection);
    }