How to use progress - 10 common examples

To help you get started, we’ve selected a few progress 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 Tarnadas / smmdb / src / server / scripts / database.js View on Github external
let query = 'SELECT id,title,owner,coursetype,nintendoid,leveltype,difficulty,updatereq,hasthumbnail,hasimage,ispackage,downloadpath,' +
      'videoid,UNIX_TIMESTAMP(lastmodified) as lastmodified,UNIX_TIMESTAMP(uploaded) as uploaded FROM courses'

    // convert accounts
    let rows = (await this[mysqlConnection].execute('SELECT * FROM accounts'))[0]
    let accountIds = {}
    for (let i = 0; i < rows.length; i++) {
      let id = rows[i].id
      let account = new Account(Account.convertFromMySQL(rows[i]))
      accountIds[id] = (await this.addAccount(account)).insertedId
      account.setId()
    }

    // convert courses
    rows = (await this[mysqlConnection].execute(query))[0]
    let progress = new ProgressBar('  converting courses [:bar] :percent :etas', {
      complete: '=',
      incomplete: ' ',
      width: 40,
      total: rows.length
    })
    try {
      for (let i = 0; i < rows.length; i++) {
        let id = rows[i].id
        let courses = await Course.convertFromMySQL(rows[i])
        let thumbnail = path.join(__dirname, `../static/img/courses/${id}.pic`)
        for (let j = 0; j < courses.length; j++) {
          courses[j].owner = accountIds[courses[j].owner]
          let course = await (new Course(courses[j])).fix(thumbnail)
          await this.addCourse(course)
          await course.finalize()
          course.setId()
github ondras / cfo / src / js / operation / delete.js View on Github external
async _startDeleting(record) {
		let options = {
			title: "Deletion in progress",
			row1: "Deleting:",
			progress1: "Total:"
		}
		this._progress = new Progress(options);
		this._progress.onClose = () => this.abort();

		super.run(); // schedule progress window

		return this._delete(record);
	}
github ondras / cfo / src / js / operation / copy.js View on Github external
async run() {
		let scan = new Scan(this._sourcePath);
		let root = await scan.run();
		if (!root) { return false; }

		this._stats.total = root.size;

		let options = {
			title: this._texts.title,
			row1: this._texts.row1,
			row2: "To:",
			progress1: "File:",
			progress2: "Total:"
		}
		this._progress = new Progress(options);
		this._progress.update({progress1:0, progress2:0});
		this._progress.onClose = () => this.abort();

		super.run(); // schedule progress window

		let result = await this._copy(root, this._targetPath);

		this._end();
		return result;
	}
github thumbsup / thumbsup / src / utils / progress.js View on Github external
BetterProgressBar.prototype.render = function (tokens) {
  const str = formatEta(this.eta())
  const actualFormat = this.fmt
  // improve display of ETA
  this.fmt = this.fmt.replace(':eta', str)
  ProgressBar.prototype.render.call(this, tokens)
  this.fmt = actualFormat
}
github karthikv / tradeship / patches / progress.js View on Github external
const ProgressBar = require("progress");

// Monkey patch terminate() so it doesn't throw an exception when the stream
// isn't a TTY. See: https://github.com/visionmedia/node-progress/pull/138
const terminate = ProgressBar.prototype.terminate;
ProgressBar.prototype.terminate = function() {
  if (!this.stream.isTTY) {
    return;
  }
  terminate.apply(this, arguments);
};

module.exports = ProgressBar;
github karthikv / tradeship / patches / progress.js View on Github external
const ProgressBar = require("progress");

// Monkey patch terminate() so it doesn't throw an exception when the stream
// isn't a TTY. See: https://github.com/visionmedia/node-progress/pull/138
const terminate = ProgressBar.prototype.terminate;
ProgressBar.prototype.terminate = function() {
  if (!this.stream.isTTY) {
    return;
  }
  terminate.apply(this, arguments);
};

module.exports = ProgressBar;
github cofacts / rumors-api / test / evaluation / falsePositive.js View on Github external
async function main() {
  console.log('=== False Positive Validation ===');

  const samples = parse(fs.readFileSync(NON_DB_SAMPLES), { columns: true });
  console.log('Querying user input non-db samples in DB...');

  const progress = new Progress('[:bar] :current/:total :etas', { total: samples.length });

  const allResults = await Promise.all(samples.map(({ rumor }) =>
    gql`
      query ($text: String) {
        SearchArticles(text: $text) {
          edges {
            score
            node {
              id
              text
            }
          }
        }
      }
    `({
      text: rumor,
github robeio / robe-react-ui / __test__ / progress / Progress.spec.js View on Github external
it("Progress", () => {
        chai.assert.equal(Progress.instance().isStarted(), false);
        Progress.start();
        chai.assert.equal(Progress.instance().isStarted(), true);
        chai.assert.equal(Progress.instance().settings.showSpinner, false);

        Progress.configure({ showSpinner: true });
        chai.assert.equal(Progress.instance().settings.showSpinner, true);

        Progress.done();
        chai.assert.equal(Progress.instance().isStarted(), false);
    });
});
github robeio / robe-react-ui / __test__ / progress / Progress.spec.js View on Github external
it("Progress", () => {
        chai.assert.equal(Progress.instance().isStarted(), false);
        Progress.start();
        chai.assert.equal(Progress.instance().isStarted(), true);
        chai.assert.equal(Progress.instance().settings.showSpinner, false);

        Progress.configure({ showSpinner: true });
        chai.assert.equal(Progress.instance().settings.showSpinner, true);

        Progress.done();
        chai.assert.equal(Progress.instance().isStarted(), false);
    });
});
github robeio / robe-react-ui / __test__ / progress / Progress.spec.js View on Github external
it("Progress", () => {
        chai.assert.equal(Progress.instance().isStarted(), false);
        Progress.start();
        chai.assert.equal(Progress.instance().isStarted(), true);
        chai.assert.equal(Progress.instance().settings.showSpinner, false);

        Progress.configure({ showSpinner: true });
        chai.assert.equal(Progress.instance().settings.showSpinner, true);

        Progress.done();
        chai.assert.equal(Progress.instance().isStarted(), false);
    });
});