agendash_aist

1.0.5 • Public • Published

Agendash_AIST

A Dashboard for Agenda. Note: It is a copy from Agendash.


Amendments

  • Fix Modal Not closing after submit
  • Minor UI Changes
  • Can Add Notes

Screenshots

Dashboard

Auto-refresh list of jobs


Create jobs

See job details, requeue or delete jobs


Search by name, metadata, job status

Search for a job by name or metadata


Adding Notes

Add note inside json

Add note inside json


Install

npm install --save agendash_aist

Note: Agendash_aist requires mongodb version >2.6.0 to perform the needed aggregate queries. This is your mongo database version, not your node package version! To check your database version, connect to mongo and run db.version().

Middleware usage

Express

Agendash_aist provides Express middleware you can use at a specified path, for example this will make Agendash available on your site at the /dash path. Note: Do not try to mount Agendash at the root level like app.use('/', Agendash(agenda)).

var express = require("express");
var app = express();

// ... your other express middleware like body-parser

var Agenda = require("agenda");
var Agendash = require("agendash_aist");

var agenda = new Agenda({ db: { address: "mongodb://127.0.0.1/agendaDb" } });
// or provide your own mongo client:
// var agenda = new Agenda({mongo: myMongoClient})
agenda.define('<your-task-name>', async (job) => {
  const metadata = job.attrs.data; // Access the metadata within the job function
  console.log('Job triggered with metadata:', metadata);
  // Add your job logic here
});

agenda.start();

app.use("/dash", Agendash(agenda));

// ... your other routes

// ... start your server

By mounting Agendash as middleware on a specific path, you may provide your own authentication for that path. For example if you have an authenticated session using passport, you can protect the dashboard path like this:

app.use(
  "/dash",
  function (req, res, next) {
    if (!req.user || !req.user.is_admin) {
      res.send(401);
    } else {
      next();
    }
  },
  Agendash(agenda)
);

Other middlewares will come soon in the folder /lib/middlewares/. You'll just have to update the last line to require the middleware you need:

app.use(
  "/agendash",
  Agendash(agenda, {
    middleware: "connect",
  })
);

Note that if you use a CSRF protection middleware like csurf, you might need to configure it off for Agendash-routes.

Set Failed Status

agenda.define('<your-task-name>', async (job) => {
  throw new Error('Some Error Message')
});

Standalone usage

Agendash comes with a standalone Express app which you can use like this:

./node_modules/.bin/agendash --db=mongodb://localhost/agendaDb --collection=agendaCollection --port=3002

or like this, for default collection agendaJobs and default port 3000:

./node_modules/.bin/agendash --db=mongodb://localhost/agendaDb

If you are using npm >= 5.2, then you can use npx:

npx agendash --db=mongodb://localhost/agendaDb --collection=agendaCollection --port=3002

Then browse to http://localhost:3002/.

Docker usage

Agendash can also be run within a Docker container like this:

docker run -p 3000:3000 \
  --env MONGODB_URI=mongo://myUser:myPass@myHost/myDb \
  --env COLLECTION=myAgendaCollection agenda/agendash

Then browse to http://localhost:3000/.

Package Sidebar

Install

npm i agendash_aist

Weekly Downloads

0

Version

1.0.5

License

MIT

Unpacked Size

739 kB

Total Files

45

Last publish

Collaborators

  • htoominshein