Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

agendash

agenda87.3kMIT4.0.0

A modern dashboard for Agenda.js with Pagination and Search capabilities

agenda, agendash, dashboard, job-queues

readme

Agendash

A Dashboard for Agenda.


Features

  • Job status auto-refreshes: 60-second polling by default.
  • Schedule a new job from the UI.
  • Dive in to see more details about the job, like the json data.
  • Requeue a job. Clone the data and run immediately.
  • Delete jobs. Useful for cleaning up old completed jobs.
  • Search jobs by name and metadata. Supports querying by Mongo Object Id.
  • Pagination
  • Responsive UI

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


Responsive UI

Mobile UI small devices

Mobile UI extra small devices


Troubleshooting

Index for sorting

It may be required to create the following index for faster sorting (see #24)

db.agendaJobs.ensureIndex({
    "nextRunAt" : -1,
    "lastRunAt" : -1,
    "lastFinishedAt" : -1
}, "agendash")

Roadmap

  • <input disabled="" type="checkbox"> Get more test coverage
  • <input disabled="" type="checkbox"> Add middlewares for fastify, and other express-like libraries
  • <input disabled="" type="checkbox"> You decide! Submit a feature request

Install

npm install --save agendash

Note: Agendash 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 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");

var agenda = new Agenda({ db: { address: "mongodb://127.0.0.1/agendaDb" } });
// or provide your own mongo client:
// var agenda = new Agenda({mongo: myMongoClient})

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.

Hapi

A minimum Node.js version 12 is required for @hapi/hapi dependency.

npm i @hapi/inert @hapi/hapi
const agenda = new Agenda().database(
  "mongodb://127.0.0.1/agendaDb",
  "agendaJobs"
);

const server = require("@hapi/hapi").server({
  port: 3002,
  host: "localhost",
});
await server.register(require("@hapi/inert"));
await server.register(
  Agendash(agenda, {
    middleware: "hapi",
  })
);

await server.start();

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

Koa

npm i koa koa-bodyparser koa-router koa-static
const agenda = new Agenda().database(
  "mongodb://127.0.0.1/agendaDb",
  "agendaJobs"
);

const Koa = require("koa");
const app = new Koa();
const middlewares = Agendash(agenda, {
  middleware: "koa",
});
for (const middleware of middlewares) {
  app.use(middleware);
}

await app.listen(3002);

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

Fastify

npm i fastify
const agenda = new Agenda().database(
  "mongodb://127.0.0.1/agendaDb",
  "agendaJobs"
);

const Fastify = require("fastify");
const fastify = new Fastify();

fastify.register(
  Agendash(
    agenda, 
    { middleware: "fastify" }
  );
);

await fastify.listen(3002);

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

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/.

changelog

4.0.0

  • Drop support for node 12. Add support for node 18 and MongoDB 5.0.
  • Fastify upgraded to v4. #215
  • Various UI fixes. #212 #203
  • Vulnerability fixes. #220
  • Requeue and Delete job fixes. #226 #227

3.1.0

  • Add Content-Security-Policy header to all server implementations

3.0.0

  • BREAKING: Drop support for MongoDB v3.4, only >=v3.6 is supported now.
  • BREAKING: Drop support for node 10, but added node 16 support.
  • feat: add fastify support #194
  • fix: a lot of rendering issues
  • fix: newer version of mongodb compatibility #193

This file won't mention contributors anymore. Because all contributors are listed on the main page now. Thanks, GitHub!

2.1.0 - JSON validation when creating jobs

  • feat: Add json validator message when createJob #169 (thanks @love8587)

2.0.0 - First public release of v2 as Agendash proper

Complete rewrite of Agendash in Vue.js!

Supports Node.js 10 and up.

2.0.0-beta0.8.2 / 2020-12-04 - As agendash2, in parallel repository https://github.com/agenda/agendash-v2

  • fix: search by job name, small side bar design fix and toggle improvements (thanks @simllll)
  • fix: joblist reset fix (thanks @simllll)
  • fix: improve design on desktop + close sidebar on mobile when clicked on something (thanks @simllll)
  • feat: enable options.query as number (thanks @Enubia @simllll)
  • feat: multiselect checkboxes (thanks @Enubia @simllll)

2.0.0-beta0.1.0 / 2020-04-30 - First public release of Agendash2 in parallel repository https://github.com/agenda/agendash-v2

  • New frontend written from scratch in Vue.js
  • Add search
  • Add pagination
  • Change default refresh interval to 60 seconds

1.0.0 / 2019-02-25

  • Add Hapi v17 middleware, drop support for Node.js v6 & v7 (#81) by umens (BREAKING)
  • Support Agenda version 2 by alexkwolfe (BREAKING)

    0.5.0 / 2019-02-25

  • Update dependencies (#69, #70) (BREAKING)

    • Agenda >=0.7.0 <1.0.0^1.0.3 and thus require MongoDB v3+
    • async ^1.0.0^2.6.0
  • Drop support for Node.js v4 and v5 (might still work but we're stopping testing these) (BREAKING)
  • Switch testing with Mocha to Ava (#70)
  • Docker support (#54) by WoLfulus
  • Fix 404 errors when deleting and re-queuing jobs (#61) by koresar

    0.4.0 / 2016-10-27

    • (simison) Agenda dependency version <1.0.0 to avoid breaking dependency.
    • (loris) Fix #24 - Added indexes for faster queries.
    • Fix #28 - Removed dependency on Mongo Driver.
    • Added API tests with mocha and supertest. No frontend tests.

    0.3.2 / 2016-06-30

    • (HugoCornu) Fix #19 "Schedule Job" - Don't repeat job if user didn't want it repeated

    0.3.1 / 2016-04-12

    • (simison) Add engines key to package.json

    0.3.0 / 2016-04-04

    • (bh-chaker) Schedule Job Feature - create new jobs from the UI
    • Limit to 200 jobs on page, no UI for configuration

    0.2.1 / 2016-03-25

    • (vziukas) Recurring job count and labels
    • Fixed "queued" label colors

    0.2.0 / 2016-03-18

    • (vziukas) Configurable title
    • Middleware option moved to "options" object

    0.1.1 / 2016-03-17

    • (vziukas) multiple instances of agendash can each have a separate agenda

    0.1.0 / 2016-03-15

    • (rapidia) remove "arrow function" syntax for non-chrome browsers
    • (ebourmalo) Fix the middleware usage and use a proper structure

    0.0.5 / 2016-02-24

    • Batch requeue and delete
    • Select All and Select None

    0.0.4 / 2016-02-24

    • Select multiple jobs

    0.0.2 / 2016-02-23

    • version bump so npm will update docs
    • Added screenshots

    0.0.1 / 2016-02-23

    • Initial Release