Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
}
};
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);
};
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;
}
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
}
};
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
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
}
};
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);
}