forked from chriskinsman/github-action-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathroutes.js
More file actions
53 lines (44 loc) · 1.45 KB
/
Copy pathroutes.js
File metadata and controls
53 lines (44 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
const debug = require("debug")("action-dashboard:routes");
class Routes {
constructor(actions, owner) {
this._owner = owner;
this._actions = actions;
}
attach(router) {
router.get("/owner", (req, res, next) => {
debug(`/owner ${this._owner}`);
res.send(this._owner);
});
router.get("/initialData", (req, res, next) => {
const initialData = this._actions.getInitialData();
res.send(initialData);
});
router.get("/refreshRuns", (req, res, next) => {
const data = this._actions.refreshRuns()
res.send(data)
})
router.get("/downloadReport/:owner/:repo/:run_id", (req, res, next) => {
this._actions.downloadWorkflowRunArtifact(req.params.owner, req.params.repo, req.params.run_id)
.then((artifacts) => {
res.send(artifacts);
})
});
router.get("/showReport/:run_id", (req, res, next) => {
const data = this._actions.getReportData(req.params.run_id)
res.send(data);
})
router.get("/downloadArtifact/:owner/:repo/:artifact_id", (req, res, next) => {
this._actions.downloadArtifact(req.params.owner, req.params.repo, req.params.artifact_id);
res.send();
})
router.get("/runs/:owner/:repo/:workflow_id", (req, res, next) => {
this._actions.refreshWorkflow(
req.params.owner,
req.params.repo,
parseInt(req.params.workflow_id)
);
res.send();
});
}
}
module.exports = Routes;