Skip to content

Commit

Permalink
Add prettier and eslint. Prettify all the things. Remove xo. (#165)
Browse files Browse the repository at this point in the history
* Add prettier and eslint. Prettify all the things. Remove xo.

* Better GH Action Job names
  • Loading branch information
koresar authored Feb 8, 2021
1 parent cbdfb03 commit bbc4ce0
Show file tree
Hide file tree
Showing 28 changed files with 1,295 additions and 4,581 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: CI
on: [push, pull_request]
jobs:
test:
name: Test with Node.js v${{ matrix.node }}
name: Node ${{ matrix.node }}, Mongo ${{ matrix.mongodb-version }}, Agenda ${{ matrix.agenda-version }}
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -25,7 +25,7 @@ jobs:
- run: npm install

- name: Install agenda
run: npm i agenda@${{matrix.agenda-version}}
run: npm i agenda@${{ matrix.agenda-version }}

- run: npm test
env:
Expand Down
132 changes: 59 additions & 73 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,106 +1,92 @@
2.0.0 - First public release of v2 as Agendash proper
====
# 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.8.2 / 2020-12-04 - As agendash2, in parallel repository https://github.com/agenda/agendash-v2

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
- 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)

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**)
# 2.0.0-beta0.1.0 / 2020-04-30 - First public release of Agendash2 in parallel repository https://github.com/agenda/agendash-v2

0.5.0 / 2019-02-25
====
- New frontend written from scratch in Vue.js
- Add search
- Add pagination
- Change default refresh interval to 60 seconds

* 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](https://www.npmjs.com/package/ava) (#70)
* Docker support (#54) by WoLfulus
* Fix 404 errors when deleting and re-queuing jobs (#61) by koresar
# 1.0.0 / 2019-02-25

0.4.0 / 2016-10-27
==================
- Add Hapi v17 middleware, drop support for Node.js v6 & v7 (#81) by umens (**BREAKING**)
- Support Agenda version 2 by alexkwolfe (**BREAKING**)

* (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.5.0 / 2019-02-25

0.3.2 / 2016-06-30
==================
- 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](https://www.npmjs.com/package/ava) (#70)
- Docker support (#54) by WoLfulus
- Fix 404 errors when deleting and re-queuing jobs (#61) by koresar

* (HugoCornu) Fix #19 "Schedule Job" - Don't repeat job if user didn't want it repeated
# 0.4.0 / 2016-10-27

0.3.1 / 2016-04-12
==================
- (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.

* (simison) Add engines key to package.json
# 0.3.2 / 2016-06-30

0.3.0 / 2016-04-04
==================
- (HugoCornu) Fix #19 "Schedule Job" - Don't repeat job if user didn't want it repeated

* (bh-chaker) Schedule Job Feature - create new jobs from the UI
* Limit to 200 jobs on page, no UI for configuration
# 0.3.1 / 2016-04-12

0.2.1 / 2016-03-25
==================
- (simison) Add engines key to package.json

* (vziukas) Recurring job count and labels
* Fixed "queued" label colors
# 0.3.0 / 2016-04-04

0.2.0 / 2016-03-18
==================
- (bh-chaker) Schedule Job Feature - create new jobs from the UI
- Limit to 200 jobs on page, no UI for configuration

* (vziukas) Configurable title
* Middleware option moved to "options" object
# 0.2.1 / 2016-03-25

0.1.1 / 2016-03-17
==================
- (vziukas) Recurring job count and labels
- Fixed "queued" label colors

* (vziukas) multiple instances of agendash can each have a separate agenda
# 0.2.0 / 2016-03-18

0.1.0 / 2016-03-15
==================
- (vziukas) Configurable title
- Middleware option moved to "options" object

* (rapidia) remove "arrow function" syntax for non-chrome browsers
* (ebourmalo) Fix the middleware usage and use a proper structure
# 0.1.1 / 2016-03-17

0.0.5 / 2016-02-24
==================
- (vziukas) multiple instances of agendash can each have a separate agenda

* Batch requeue and delete
* Select All and Select None
# 0.1.0 / 2016-03-15

0.0.4 / 2016-02-24
==================
- (rapidia) remove "arrow function" syntax for non-chrome browsers
- (ebourmalo) Fix the middleware usage and use a proper structure

* Select multiple jobs
# 0.0.5 / 2016-02-24

0.0.2 / 2016-02-23
==================
- Batch requeue and delete
- Select All and Select None

* version bump so npm will update docs
* Added screenshots
# 0.0.4 / 2016-02-24

0.0.1 / 2016-02-23
==================
- Select multiple jobs

* Initial Release
# 0.0.2 / 2016-02-23

- version bump so npm will update docs
- Added screenshots

# 0.0.1 / 2016-02-23

- Initial Release
54 changes: 32 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ A Dashboard for [Agenda](https://github.com/agenda/agenda).

![Mobile UI small devices](mobile-ui-sm.png)



![Mobile UI extra small devices](mobile-ui-xs.png)

---
Expand Down Expand Up @@ -75,7 +73,7 @@ db.agendaJobs.ensureIndex({
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()`.
_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

Expand All @@ -86,19 +84,19 @@ make Agendash available on your site at the `/dash` path. Note: Do not try to mo
at the root level like `app.use('/', Agendash(agenda))`.

```js
var express = require('express');
var express = require("express");
var app = express();

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

var Agenda = require('agenda');
var Agendash = require('agendash');
var Agenda = require("agenda");
var Agendash = require("agendash");

var agenda = new Agenda({db: {address: 'mongodb://127.0.0.1/agendaDb'}});
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));
app.use("/dash", Agendash(agenda));

// ... your other routes

Expand All @@ -110,7 +108,8 @@ own authentication for that path. For example if you have an authenticated
session using passport, you can protect the dashboard path like this:

```js
app.use('/dash',
app.use(
"/dash",
function (req, res, next) {
if (!req.user || !req.user.is_admin) {
res.send(401);
Expand All @@ -126,9 +125,12 @@ 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:

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

Note that if you use a CSRF protection middleware like [`csurf`](https://www.npmjs.com/package/csurf), you might need to [configure it off](https://github.com/agenda/agendash/issues/23#issuecomment-270917949) for Agendash-routes.
Expand All @@ -142,16 +144,21 @@ npm i @hapi/inert @hapi/hapi
```

```js
const agenda = new Agenda().database("mongodb://127.0.0.1/agendaDb", "agendaJobs");
const agenda = new Agenda().database(
"mongodb://127.0.0.1/agendaDb",
"agendaJobs"
);

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

await server.start();
```
Expand All @@ -165,12 +172,15 @@ npm i koa koa-bodyparser koa-router koa-static
```

```js
const agenda = new Agenda().database("mongodb://127.0.0.1/agendaDb", "agendaJobs");
const agenda = new Agenda().database(
"mongodb://127.0.0.1/agendaDb",
"agendaJobs"
);

const Koa = require('koa');
const Koa = require("koa");
const app = new Koa();
const middlewares = Agendash(agenda, {
middleware: 'koa'
middleware: "koa",
});
for (const middleware of middlewares) {
app.use(middleware);
Expand Down
14 changes: 9 additions & 5 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
'use strict';
const path = require('path');
"use strict";
const path = require("path");

module.exports = (agenda, options) => {
options = options || {};
if (!options.middleware) {
options.middleware = 'express';
options.middleware = "express";
}

const agendash = require('./lib/controllers/agendash')(agenda, options);
const middlewarePath = path.join(__dirname, './lib/middlewares', options.middleware);
const agendash = require("./lib/controllers/agendash")(agenda, options);
const middlewarePath = path.join(
__dirname,
"./lib/middlewares",
options.middleware
);

try {
return require(middlewarePath)(agendash);
Expand Down
Loading

0 comments on commit bbc4ce0

Please sign in to comment.