How to use the utility/input.isEmpty 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 / components / BackupConfig / Review.js View on Github external
handleSubmit() {
        const { submitState, setSubmitState, update, id } = this.props;

        if(submitState == SUBMITSTATES.SUBMITTING) {
            return;
        }

        setSubmitState(SUBMITSTATES.SUBMITTING);

        const backupConfig = object.clone(this.props.backupConfig);
        for(const key in backupConfig) {
            if(input.isEmpty(backupConfig[key])) {
                delete backupConfig[key];
                continue;
            }
            if(key == "duration" || key == "interval") {
                backupConfig[key] = time.convertToMilliseconds(backupConfig[key]);
            }
        }

        if(!update) {
            //create a new backup
            backups.newBackupConfig(backupConfig)
                    .then(response => {
                        this.submitErr = response.data.message;
                        // redirect to the main page
                        hashHistory.push('/');
                    })
github XiaocongDong / mongodb-backup-manager / frontend / src / components / LocalDBs / index.js View on Github external
search() {
        let filteredDBs = this.copyDBs;
        const { startTime, endTime } = this.timeFilters;
        if(!input.isEmpty(startTime)) {
            try {
                filteredDBs = filteredDBs.filter(db => {
                    return startTime.isSameOrBefore(new Date(db.createdTime))
                })
            }catch (e) {console.error(e)}
        }

        if(!input.isEmpty(endTime)) {
            try {
                filteredDBs = filteredDBs.filter(db => {
                    return endTime.isSameOrAfter(new Date(db.createdTime));
                })
            }catch (e) {}
        }

        this.filteredDBs = filteredDBs;
        this.forceUpdate();
    }
github XiaocongDong / mongodb-backup-manager / frontend / src / components / LocalDBs / index.js View on Github external
search() {
        let filteredDBs = this.copyDBs;
        const { startTime, endTime } = this.timeFilters;
        if(!input.isEmpty(startTime)) {
            try {
                filteredDBs = filteredDBs.filter(db => {
                    return startTime.isSameOrBefore(new Date(db.createdTime))
                })
            }catch (e) {console.error(e)}
        }

        if(!input.isEmpty(endTime)) {
            try {
                filteredDBs = filteredDBs.filter(db => {
                    return endTime.isSameOrAfter(new Date(db.createdTime));
                })
            }catch (e) {}
        }

        this.filteredDBs = filteredDBs;
github XiaocongDong / mongodb-backup-manager / frontend / src / components / BackupConfig / Review.js View on Github external
getValue(key) {
        const { backupConfig } = this.props;
        let value = backupConfig[key];

        if(!input.isEmpty(value) && (key == "duration" || key == "interval")) {
            let displayValue = "";

            if(key == "duration" || key == "interval") {
                for(const k in value) {
                    displayValue += `${ value[k] } ${ k } `;
                }
            }
            
            value = displayValue;
        }

        if(!input.isEmpty(value) && (key == "startTime")) {
             value = new Date(value).toLocaleString();

        }
github XiaocongDong / mongodb-backup-manager / frontend / src / components / CollectionViewer / index.js View on Github external
onSearchClick(event) {
        event.preventDefault();

        const queryString = this.input.value;

        if(input.isEmpty(queryString)) {
            this.filteredData = this.data;
            this.queryStringError = null;
        }else {
            try {
                const query = JSON.parse(queryString);
                this.filteredData = sift(query, this.data);
                this.queryStringError = null;
            } catch (e) {
                this.queryStringError = e.message;
            }
        }

        this.input.blur();
        if(this.queryStringError) {
            this.forceUpdate();
        }else {
github XiaocongDong / mongodb-backup-manager / frontend / src / components / BackupConfig / Review.js View on Github external
if(key == "duration" || key == "interval") {
                for(const k in value) {
                    displayValue += `${ value[k] } ${ k } `;
                }
            }
            
            value = displayValue;
        }

        if(!input.isEmpty(value) && (key == "startTime")) {
             value = new Date(value).toLocaleString();

        }

        if(key == "collections" && !input.isEmpty(value)) {
            let displayValue = "";

            for(const i in value) {
                displayValue += value[i] + (i !== value.length - 1? "   ": "");
            }

            value = displayValue;
        }

        return value;
    }
github XiaocongDong / mongodb-backup-manager / frontend / src / components / BackupConfig / Review.js View on Github external
const { backupConfig } = this.props;
        let value = backupConfig[key];

        if(!input.isEmpty(value) && (key == "duration" || key == "interval")) {
            let displayValue = "";

            if(key == "duration" || key == "interval") {
                for(const k in value) {
                    displayValue += `${ value[k] } ${ k } `;
                }
            }
            
            value = displayValue;
        }

        if(!input.isEmpty(value) && (key == "startTime")) {
             value = new Date(value).toLocaleString();

        }

        if(key == "collections" && !input.isEmpty(value)) {
            let displayValue = "";

            for(const i in value) {
                displayValue += value[i] + (i !== value.length - 1? "   ": "");
            }

            value = displayValue;
        }

        return value;
    }
github XiaocongDong / mongodb-backup-manager / frontend / src / containers / Login / index.js View on Github external
handleKeyPress(name, event) {
        const code = event.which;

        if(code !== 13) {
            return;
        }

        const username = this.inputs['name'].value;
        const password = this.inputs['password'].value;

        if(input.isEmpty(username)) {
            this.inputs['name'].focus();
            return;
        }

        if(input.isEmpty(password)) {
            this.inputs['password'].focus();
            return;
        }

        this.handleSubmit.call(this);
    }