agendash 4.0.0 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +25 -0
- package/README.md +109 -200
- package/dist/AgendashController.d.ts +50 -0
- package/dist/AgendashController.js +176 -0
- package/dist/AgendashController.js.map +1 -0
- package/dist/csp.d.ts +1 -0
- package/dist/csp.js +15 -0
- package/dist/csp.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/middlewares/express.d.ts +22 -0
- package/dist/middlewares/express.js +119 -0
- package/dist/middlewares/express.js.map +1 -0
- package/dist/middlewares/fastify.d.ts +18 -0
- package/dist/middlewares/fastify.js +129 -0
- package/dist/middlewares/fastify.js.map +1 -0
- package/dist/middlewares/hapi.d.ts +28 -0
- package/dist/middlewares/hapi.js +198 -0
- package/dist/middlewares/hapi.js.map +1 -0
- package/dist/middlewares/koa.d.ts +25 -0
- package/dist/middlewares/koa.js +139 -0
- package/dist/middlewares/koa.js.map +1 -0
- package/dist/types.d.ts +154 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +77 -62
- package/public/assets/index-CIdOb8D1.css +5 -0
- package/public/assets/index-Ct6Ovrls.js +17 -0
- package/public/index.html +11 -52
- package/public/site.webmanifest +8 -1
- package/Dockerfile +0 -23
- package/History.md +0 -118
- package/LICENSE +0 -21
- package/all-jobs.png +0 -0
- package/app.js +0 -23
- package/bin/agendash-standalone-fastify.js +0 -61
- package/bin/agendash-standalone-hapi.js +0 -60
- package/bin/agendash-standalone-koa.js +0 -56
- package/bin/agendash-standalone.js +0 -64
- package/create-job.png +0 -0
- package/entrypoint.sh +0 -5
- package/lib/controllers/agendash.js +0 -341
- package/lib/csp.js +0 -28
- package/lib/middlewares/README.md +0 -59
- package/lib/middlewares/express.js +0 -80
- package/lib/middlewares/fastify.js +0 -77
- package/lib/middlewares/hapi.js +0 -101
- package/lib/middlewares/koa.js +0 -77
- package/mobile-ui-sm.png +0 -0
- package/mobile-ui-xs.png +0 -0
- package/public/android-chrome-192x192.png +0 -0
- package/public/android-chrome-512x512.png +0 -0
- package/public/app/assets/ArgensdashV2Logo.svg +0 -18
- package/public/app/css/styles.css +0 -233
- package/public/app/js/confirmDelete.js +0 -40
- package/public/app/js/confirmDeleteMulti.js +0 -45
- package/public/app/js/confirmRequeue.js +0 -40
- package/public/app/js/confirmRequeueMulti.js +0 -45
- package/public/app/js/confirms.js +0 -8
- package/public/app/js/jobdetail.js +0 -48
- package/public/app/js/joblist.js +0 -248
- package/public/app/js/main.js +0 -283
- package/public/app/js/newJob.js +0 -89
- package/public/app/js/sidebar.js +0 -121
- package/public/app/js/topbar.js +0 -95
- package/public/apple-touch-icon.png +0 -0
- package/public/favicon-16x16.png +0 -0
- package/public/favicon-32x32.png +0 -0
- package/public/favicon.ico +0 -0
- package/search.png +0 -0
package/public/app/js/joblist.js
DELETED
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
const jobList = Vue.component("job-list", {
|
|
2
|
-
data: () => ({
|
|
3
|
-
multijobs: [],
|
|
4
|
-
currentSort: "name",
|
|
5
|
-
currentSortDir: "asc",
|
|
6
|
-
}),
|
|
7
|
-
props: ["jobs", "pagesize", "pagenumber", "totalPages", "sendClean", "loading"],
|
|
8
|
-
computed: {
|
|
9
|
-
sortedJobs: function () {
|
|
10
|
-
var sortedJobs = this.jobs.sort((a, b) => {
|
|
11
|
-
let displayA, displayB;
|
|
12
|
-
if (this.currentSort === "name") {
|
|
13
|
-
displayA = a.job[this.currentSort]
|
|
14
|
-
? a.job[this.currentSort].toLowerCase()
|
|
15
|
-
: "";
|
|
16
|
-
displayB = a.job[this.currentSort]
|
|
17
|
-
? b.job[this.currentSort].toLowerCase()
|
|
18
|
-
: "";
|
|
19
|
-
} else {
|
|
20
|
-
displayA = moment(a.job[this.currentSort]);
|
|
21
|
-
displayB = moment(b.job[this.currentSort]);
|
|
22
|
-
}
|
|
23
|
-
let modifier = 1;
|
|
24
|
-
if (this.currentSortDir === "desc") modifier = -1;
|
|
25
|
-
if (displayA < displayB) return -1 * modifier;
|
|
26
|
-
if (displayA > displayB) return 1 * modifier;
|
|
27
|
-
return 0;
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
/** Show recurring jobs first */
|
|
31
|
-
return Array.prototype.concat(
|
|
32
|
-
sortedJobs.filter(job => job.repeating === true),
|
|
33
|
-
sortedJobs.filter(job => job.repeating === false),
|
|
34
|
-
)
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
watch: {
|
|
38
|
-
jobs() {
|
|
39
|
-
// reset multijobs when jobs have changed
|
|
40
|
-
this.multijobs = [];
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
methods: {
|
|
44
|
-
sort(s) {
|
|
45
|
-
//if s == current sort, reverse
|
|
46
|
-
if (s === this.currentSort) {
|
|
47
|
-
this.currentSortDir = this.currentSortDir === "asc" ? "desc" : "asc";
|
|
48
|
-
}
|
|
49
|
-
this.currentSort = s;
|
|
50
|
-
},
|
|
51
|
-
sendQueued() {
|
|
52
|
-
this.$emit("confirm-multi-requeue", this.multijobs);
|
|
53
|
-
// this.multijobs = []
|
|
54
|
-
},
|
|
55
|
-
sendDelete() {
|
|
56
|
-
this.$emit("confirm-multi-delete", this.multijobs);
|
|
57
|
-
// this.multijobs = []
|
|
58
|
-
},
|
|
59
|
-
cleanMulti() {
|
|
60
|
-
return console.log("received Clean Multi");
|
|
61
|
-
},
|
|
62
|
-
formatTitle(date) {
|
|
63
|
-
if (!date) return;
|
|
64
|
-
return moment(date).format();
|
|
65
|
-
},
|
|
66
|
-
formatDate(date) {
|
|
67
|
-
if (!date) return;
|
|
68
|
-
return moment(date).fromNow();
|
|
69
|
-
},
|
|
70
|
-
checkAllCheckboxes() {
|
|
71
|
-
const checkboxes = document.querySelectorAll(".checkbox-triggerable");
|
|
72
|
-
for (const checkbox of checkboxes) {
|
|
73
|
-
checkbox.click();
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
toggleList(job) {
|
|
77
|
-
if (this.multijobs.includes(job.job._id)) {
|
|
78
|
-
this.multijobs.splice(this.multijobs.indexOf(job.job._id), 1);
|
|
79
|
-
} else {
|
|
80
|
-
this.multijobs.push(job.job._id);
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
template: `
|
|
85
|
-
<div v-on:sendClean="cleanMulti">
|
|
86
|
-
<div >
|
|
87
|
-
<div class="d-flex justify-content-end mb-2">
|
|
88
|
-
<span class="mr-2">{{ multijobs.length }} jobs selected</span>
|
|
89
|
-
<button :disabled="!multijobs.length" data-toggle="modal" data-target="#modalRequeueSureMulti" @click="sendQueued" class="btn btn-primary mr-2" data-placement="top" title="Requeue list of selecteds Jobs"> Multiple Requeue </button>
|
|
90
|
-
<button :disabled="!multijobs.length" data-toggle="modal" data-target="#modalDeleteSureMulti" @click="sendDelete" class="btn btn-danger" data-placement="top" title="Delete list of selecteds Jobs"> Multiple Delete </button>
|
|
91
|
-
</div>
|
|
92
|
-
</div>
|
|
93
|
-
|
|
94
|
-
<table class="table table-striped d-none d-xl-table">
|
|
95
|
-
<thead class="thead-dark">
|
|
96
|
-
<tr>
|
|
97
|
-
<th @click="checkAllCheckboxes()" scope="col"> Multi </th>
|
|
98
|
-
<th @click="sort('status')" scope="col"> Status </th>
|
|
99
|
-
<th @click="sort('name')" scope="col"> Name <i v-if="currentSort === 'name' && currentSortDir === 'asc'" class="material-icons sortable" title="Sort Z to A">arrow_drop_down</i>
|
|
100
|
-
<i v-else-if="currentSort === 'name' && currentSortDir === 'desc'" class="material-icons sortable" title="Sort A to Z">arrow_drop_up</i>
|
|
101
|
-
<i v-else class="material-icons sortableinactive" title="Sort A to Z">arrow_drop_down</i>
|
|
102
|
-
</th>
|
|
103
|
-
<th @click="sort('lastRunAt')" scope="col"> Last run started <i v-if="currentSort === 'lastRunAt' && currentSortDir === 'asc'" class="material-icons sortable" title="Sort Z to A">arrow_drop_up</i>
|
|
104
|
-
<i v-else-if="currentSort === 'lastRunAt' && currentSortDir === 'desc'" class="material-icons sortable" title="Sort A to Z">arrow_drop_down</i>
|
|
105
|
-
<i v-else class="material-icons sortableinactive" title="Sort A to Z">arrow_drop_down</i>
|
|
106
|
-
</th>
|
|
107
|
-
<th @click="sort('nextRunAt')" scope="col"> Next run starts
|
|
108
|
-
<i v-if="currentSort === 'nextRunAt' && currentSortDir === 'asc'" class="material-icons sortable" title="Sort Z to A">arrow_drop_up</i>
|
|
109
|
-
<i v-else-if="currentSort === 'nextRunAt' && currentSortDir === 'desc'" class="material-icons sortable" title="Sort A to Z">arrow_drop_down</i>
|
|
110
|
-
<i v-else class="material-icons sortableinactive" title="Sort A to Z">arrow_drop_down</i>
|
|
111
|
-
|
|
112
|
-
</th>
|
|
113
|
-
<th @click="sort('lastFinishedAt')" scope="col"> Last finished
|
|
114
|
-
<i v-if="currentSort === 'lastFinishedAt' && currentSortDir === 'asc'" class="material-icons sortable" title="Sort Z to A">arrow_drop_up</i>
|
|
115
|
-
<i v-else-if="currentSort === 'lastFinishedAt' && currentSortDir === 'desc'" class="material-icons sortable" title="Sort A to Z">arrow_drop_down</i>
|
|
116
|
-
<i v-else class="material-icons sortableinactive" title="Sort A to Z">arrow_drop_down</i>
|
|
117
|
-
</th>
|
|
118
|
-
<th scope="col"> Locked </th>
|
|
119
|
-
<th scope="col"> Actions </th>
|
|
120
|
-
</tr>
|
|
121
|
-
</thead>
|
|
122
|
-
<tbody v-if="loading">
|
|
123
|
-
<tr>
|
|
124
|
-
<td colspan='10' scope="row">
|
|
125
|
-
<div class="col-12 my-5 ml-auto text-center">
|
|
126
|
-
<div class="text-center my-5 py-5">
|
|
127
|
-
<div class="spinner-border" role="status">
|
|
128
|
-
</div>
|
|
129
|
-
<div>
|
|
130
|
-
<span class="">Loading Jobs...</span>
|
|
131
|
-
</div>
|
|
132
|
-
</div>
|
|
133
|
-
</div>
|
|
134
|
-
</td>
|
|
135
|
-
</tr>
|
|
136
|
-
</tbody>
|
|
137
|
-
|
|
138
|
-
<tbody v-else>
|
|
139
|
-
<tr v-for="job in sortedJobs">
|
|
140
|
-
<td width="10" class="mult-select">
|
|
141
|
-
<input v-model="multijobs" :id='job.job._id' class="checkbox-triggerable" type="checkbox" :value="job.job._id"></input>
|
|
142
|
-
</td>
|
|
143
|
-
<td th scope="row" class="job-name">
|
|
144
|
-
<i v-if="job.repeating" class="oi oi-timer pill-own bg-info"><span>{{job.job.repeatInterval}}</span></i>
|
|
145
|
-
<i v-if="job.scheduled" class="pill-own bg-info pill-withoutIcon"><span>Scheduled</span></i>
|
|
146
|
-
<i v-if="job.completed" class="pill-own bg-success pill-withoutIcon"><span>Completed</span></i>
|
|
147
|
-
<i v-if="job.queued" class="pill-own bg-primary pill-withoutIcon"><span>Queued</span></i>
|
|
148
|
-
<i v-if="job.failed" class="pill-own bg-danger pill-withoutIcon"><span>Failed</span></i>
|
|
149
|
-
<i v-if="job.running" class="pill-own bg-warning pill-withoutIcon"><span>Running</span></i>
|
|
150
|
-
</td>
|
|
151
|
-
<td class="job-name" @click="toggleList(job)"> {{job.job.name}} </td>
|
|
152
|
-
<td class="job-lastRunAt" :title="formatTitle(job.job.lastRunAt)" @click="toggleList(job)"> {{ formatDate(job.job.lastRunAt) }} </td>
|
|
153
|
-
<td class="job-nextRunAt" :title="formatTitle(job.job.nextRunAt)" @click="toggleList(job)"> {{ formatDate(job.job.nextRunAt) }} </td>
|
|
154
|
-
<td class="job-finishedAt" :title="formatTitle(job.job.lastFinishedAt)" @click="toggleList(job)"> {{ formatDate(job.job.lastFinishedAt) }} </td>
|
|
155
|
-
<td class="job-lockedAt" :title="formatTitle(job.job.lockedAt)" @click="toggleList(job)"> {{ formatDate(job.job.lockedAt) }} </td>
|
|
156
|
-
<td class="job-actions">
|
|
157
|
-
<i class="material-icons md-dark md-custom action-btn viewData text-primary" data-toggle="modal" data-target="#modalRequeueSure" @click="$emit('confirm-requeue', job)" data-placement="left" title="Requeue">update</i>
|
|
158
|
-
<i class="material-icons md-dark md-custom action-btn viewData text-success" data-toggle="modal" data-target="#modalData" @click="$emit('show-job-detail', job)" data-placement="top" title="Job Data">visibility</i>
|
|
159
|
-
<i class="material-icons md-dark md-custom action-btn viewData text-danger" data-toggle="modal" data-target="#modalDeleteSure" @click="$emit('confirm-delete', job)" data-placement="top" title="Delete permanently">delete_forever</i>
|
|
160
|
-
</td>
|
|
161
|
-
</tr>
|
|
162
|
-
</tbody>
|
|
163
|
-
</table>
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
<div class="d-xl-none">
|
|
167
|
-
<div class="row">
|
|
168
|
-
<div v-for="job in sortedJobs" class="col col-xs-6 order-1 p-1">
|
|
169
|
-
<div class="card bg-light" >
|
|
170
|
-
<div class="card-header card-responsive-title-container">
|
|
171
|
-
<div class="card-responsive-name" @click="toggleList(job)">
|
|
172
|
-
{{job.job.name}}
|
|
173
|
-
</div>
|
|
174
|
-
<div class="d-flex align-items-center">
|
|
175
|
-
<div class="card-responsive-status-title mr-2" style="font-size: 18px; display: flex; align-items: center">
|
|
176
|
-
<input v-model="multijobs" :id='job.job._id' type="checkbox" :value="job.job._id" class="card-responsive-checkbox"></input>
|
|
177
|
-
</div>
|
|
178
|
-
<i class="material-icons md-dark md-custom action-btn viewData text-primary material-icons-size mr-1" data-toggle="modal" data-target="#modalRequeueSure" @click="$emit('confirm-requeue', job)" data-placement="left" title="Requeue">update</i>
|
|
179
|
-
<i class="material-icons md-dark md-custom action-btn viewData text-success material-icons-size mr-1" data-toggle="modal" data-target="#modalData" @click="$emit('show-job-detail', job)" data-placement="top" title="Job Data">visibility</i>
|
|
180
|
-
<i class="material-icons md-dark md-custom action-btn viewData text-danger material-icons-size" data-toggle="modal" data-target="#modalDeleteSure" @click="$emit('confirm-delete', job)" data-placement="top" title="Delete permanently">delete_forever</i>
|
|
181
|
-
</div>
|
|
182
|
-
</div>
|
|
183
|
-
<div class="card-body">
|
|
184
|
-
<div class="d-flex justify-content-center mb-2">
|
|
185
|
-
<i v-if="job.repeating" class="oi oi-timer pill-own mr-2 bg-info pill-own-card"><span class="pill-own-card-info">{{job.job.repeatInterval}}</span></i>
|
|
186
|
-
<i v-if="job.scheduled" class="pill-own mr-2 bg-info pill-withoutIcon pill-own-card"><span class="pill-own-card-info">Scheduled</span></i>
|
|
187
|
-
<i v-if="job.completed" class="pill-own mr-2 bg-success pill-withoutIcon pill-own-card"><span class="pill-own-card-info">Completed</span></i>
|
|
188
|
-
<i v-if="job.queued" class="pill-own mr-2 bg-primary pill-withoutIcon pill-own-card"><span class="pill-own-card-info">Queued</span></i>
|
|
189
|
-
<i v-if="job.failed" class="pill-own mr-2 bg-danger pill-withoutIcon pill-own-card"><span class="pill-own-card-info">Failed</span></i>
|
|
190
|
-
<i v-if="job.running" class="pill-own mr-2 bg-warning pill-withoutIcon pill-own-card"><span class="pill-own-card-info">Running</span></i>
|
|
191
|
-
</div>
|
|
192
|
-
<div class="row">
|
|
193
|
-
<div class="col col-md-6 text-center">
|
|
194
|
-
<div class="card-responsive-status-title">
|
|
195
|
-
Last run started
|
|
196
|
-
</div>
|
|
197
|
-
<div class="mb-3" :title="formatTitle(job.job.lastRunAt)">
|
|
198
|
-
{{ formatDate(job.job.lastRunAt) }}
|
|
199
|
-
</div>
|
|
200
|
-
<div class="card-responsive-status-title">
|
|
201
|
-
Last finished
|
|
202
|
-
</div>
|
|
203
|
-
<div :title="formatTitle(job.job.lastFinishedAt)">
|
|
204
|
-
{{ formatDate(job.job.lastFinishedAt) }}
|
|
205
|
-
</div>
|
|
206
|
-
</div>
|
|
207
|
-
<div class="col col-md-6 text-center">
|
|
208
|
-
<div class="card-responsive-status-title">
|
|
209
|
-
Next run starts
|
|
210
|
-
</div>
|
|
211
|
-
<div class="mb-3" :title="formatTitle(job.job.nextRunAt)">
|
|
212
|
-
{{ formatDate(job.job.nextRunAt) }}
|
|
213
|
-
</div>
|
|
214
|
-
<div class="card-responsive-status-title">
|
|
215
|
-
Locked
|
|
216
|
-
</div>
|
|
217
|
-
<div :title="formatTitle(job.job.lockedAt)">
|
|
218
|
-
{{ formatDate(job.job.lockedAt) || "-" }}
|
|
219
|
-
</div>
|
|
220
|
-
</div>
|
|
221
|
-
</div>
|
|
222
|
-
<div></div>
|
|
223
|
-
</div>
|
|
224
|
-
</div>
|
|
225
|
-
</div>
|
|
226
|
-
</div>
|
|
227
|
-
</div>
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
<div class="row">
|
|
231
|
-
<div class="col d-flex justify-content-center">
|
|
232
|
-
<nav aria-label="Page navigation example">
|
|
233
|
-
<ul class="pagination">
|
|
234
|
-
<li class="page-item" :class="pagenumber === 1 ? 'disabled': ''"><a class="page-link" @click="$emit('pagechange', 'prev')">Previous</a></li>
|
|
235
|
-
<li class="page-item" :class="pagenumber >= totalPages ? 'disabled': ''"> <a style="cursor:pointer;" class="page-link" @click="$emit('pagechange', 'next')">Next</a> </li>
|
|
236
|
-
</ul>
|
|
237
|
-
</nav>
|
|
238
|
-
</div>
|
|
239
|
-
</div>
|
|
240
|
-
|
|
241
|
-
<div class="row">
|
|
242
|
-
<div class="col d-flex justify-content-center">
|
|
243
|
-
Page: {{pagenumber}} / {{totalPages}}
|
|
244
|
-
</div>
|
|
245
|
-
</div>
|
|
246
|
-
</div>
|
|
247
|
-
`,
|
|
248
|
-
});
|
package/public/app/js/main.js
DELETED
|
@@ -1,283 +0,0 @@
|
|
|
1
|
-
const app = Vue.component("app", {
|
|
2
|
-
data: () => ({
|
|
3
|
-
jobs: [],
|
|
4
|
-
overview: [],
|
|
5
|
-
refresh: 30,
|
|
6
|
-
showDetail: false,
|
|
7
|
-
pagenumber: 1,
|
|
8
|
-
totalPages: 0,
|
|
9
|
-
showConfirm: false,
|
|
10
|
-
showConfirmMulti: false,
|
|
11
|
-
showConfirmRequeue: false,
|
|
12
|
-
showConfirmRequeueMulti: false,
|
|
13
|
-
showNewJob: false,
|
|
14
|
-
jobData: {},
|
|
15
|
-
deletec: false,
|
|
16
|
-
requeuec: false,
|
|
17
|
-
pagesize: 50,
|
|
18
|
-
sendClean: false,
|
|
19
|
-
createc: false,
|
|
20
|
-
property: "",
|
|
21
|
-
search: "",
|
|
22
|
-
object: "",
|
|
23
|
-
newLimit: null,
|
|
24
|
-
skip: 0,
|
|
25
|
-
name: "",
|
|
26
|
-
state: "",
|
|
27
|
-
nameprop: "",
|
|
28
|
-
loading: false,
|
|
29
|
-
hideSlide: true,
|
|
30
|
-
}),
|
|
31
|
-
methods: {
|
|
32
|
-
openNav() {
|
|
33
|
-
document.getElementById("mySidebar").style.width = "100%";
|
|
34
|
-
document.getElementById("main").style.marginLeft = "100%";
|
|
35
|
-
this.hideSlide = false;
|
|
36
|
-
},
|
|
37
|
-
closeNav() {
|
|
38
|
-
document.getElementById("mySidebar").style.width = "0";
|
|
39
|
-
document.getElementById("main").style.marginLeft = "0";
|
|
40
|
-
this.hideSlide = true;
|
|
41
|
-
},
|
|
42
|
-
showJobDetail(data) {
|
|
43
|
-
this.jobData = data;
|
|
44
|
-
this.showDetail = true;
|
|
45
|
-
},
|
|
46
|
-
readyClean() {
|
|
47
|
-
this.sendClean = true;
|
|
48
|
-
},
|
|
49
|
-
confirmDelete(data) {
|
|
50
|
-
this.jobData = data;
|
|
51
|
-
this.showConfirm = true;
|
|
52
|
-
},
|
|
53
|
-
confirmDeleteMulti(data) {
|
|
54
|
-
this.jobData = data;
|
|
55
|
-
this.showConfirmMulti = true;
|
|
56
|
-
},
|
|
57
|
-
confirmRequeue(data) {
|
|
58
|
-
this.jobData = data;
|
|
59
|
-
this.showConfirmRequeue = true;
|
|
60
|
-
},
|
|
61
|
-
confirmRequeueMulti(data) {
|
|
62
|
-
this.jobData = data;
|
|
63
|
-
this.showConfirmRequeueMulti = true;
|
|
64
|
-
},
|
|
65
|
-
newJob(data) {
|
|
66
|
-
this.jobData = data;
|
|
67
|
-
this.showNewJob = true;
|
|
68
|
-
},
|
|
69
|
-
searchForm(name, search, property, limit, skip, refresh, state, object) {
|
|
70
|
-
this.pagesize = limit ? limit : this.pagesize
|
|
71
|
-
this.name = name
|
|
72
|
-
this.search = search
|
|
73
|
-
this.property = property
|
|
74
|
-
this.skip = skip
|
|
75
|
-
this.refresh = refresh
|
|
76
|
-
this.state = state
|
|
77
|
-
this.object = object ? object : this.object
|
|
78
|
-
|
|
79
|
-
// Form changed, reset the pagination state
|
|
80
|
-
this.pagenumber = 1
|
|
81
|
-
this.totalPages = 1
|
|
82
|
-
|
|
83
|
-
this.fetchData(
|
|
84
|
-
this.name,
|
|
85
|
-
this.search,
|
|
86
|
-
this.property,
|
|
87
|
-
this.pagesize,
|
|
88
|
-
this.skip,
|
|
89
|
-
this.refresh,
|
|
90
|
-
this.state,
|
|
91
|
-
this.object
|
|
92
|
-
);
|
|
93
|
-
},
|
|
94
|
-
refreshData() {
|
|
95
|
-
this.fetchData(
|
|
96
|
-
this.name,
|
|
97
|
-
this.search,
|
|
98
|
-
this.property,
|
|
99
|
-
this.pagesize,
|
|
100
|
-
this.skip,
|
|
101
|
-
this.refresh,
|
|
102
|
-
this.state,
|
|
103
|
-
this.object
|
|
104
|
-
);
|
|
105
|
-
},
|
|
106
|
-
pagechange(action) {
|
|
107
|
-
if (action === "next") {
|
|
108
|
-
this.pagenumber++;
|
|
109
|
-
}
|
|
110
|
-
if (action === "prev") {
|
|
111
|
-
this.pagenumber--;
|
|
112
|
-
}
|
|
113
|
-
this.skip = (this.pagenumber - 1) * this.pagesize;
|
|
114
|
-
this.fetchData(
|
|
115
|
-
this.name,
|
|
116
|
-
this.search,
|
|
117
|
-
this.property,
|
|
118
|
-
this.pagesize,
|
|
119
|
-
this.skip,
|
|
120
|
-
this.refresh,
|
|
121
|
-
this.state,
|
|
122
|
-
this.object
|
|
123
|
-
);
|
|
124
|
-
},
|
|
125
|
-
fetchData(
|
|
126
|
-
name = "",
|
|
127
|
-
search = "",
|
|
128
|
-
property = "",
|
|
129
|
-
limit = 50,
|
|
130
|
-
skip = 0,
|
|
131
|
-
refresh = 30,
|
|
132
|
-
state = "",
|
|
133
|
-
object
|
|
134
|
-
) {
|
|
135
|
-
this.loading = true;
|
|
136
|
-
this.pagesize = this.pagesize === 0 ? parseInt(limit) : this.pagesize;
|
|
137
|
-
this.refresh = parseFloat(refresh);
|
|
138
|
-
const url = `api?limit=${limit}&job=${name}&skip=${skip}&property=${property}${
|
|
139
|
-
object ? "&isObjectId=true" : ""
|
|
140
|
-
}${state ? `&state=${state}` : ""}&q=${search}`;
|
|
141
|
-
return axios
|
|
142
|
-
.get(url)
|
|
143
|
-
.then((result) => result.data)
|
|
144
|
-
.then(
|
|
145
|
-
(data) => {
|
|
146
|
-
this.jobs = data.jobs;
|
|
147
|
-
this.search = search;
|
|
148
|
-
this.property = property;
|
|
149
|
-
this.object = object;
|
|
150
|
-
this.overview = data.overview;
|
|
151
|
-
this.loading = false;
|
|
152
|
-
this.totalPages = data.totalPages;
|
|
153
|
-
},
|
|
154
|
-
() => {
|
|
155
|
-
this.loading = false;
|
|
156
|
-
this.jobs = [];
|
|
157
|
-
}
|
|
158
|
-
)
|
|
159
|
-
.catch(console.log);
|
|
160
|
-
},
|
|
161
|
-
|
|
162
|
-
popupmessage(data) {
|
|
163
|
-
if (data === "delete") {
|
|
164
|
-
this.deletec = true;
|
|
165
|
-
setTimeout(() => {
|
|
166
|
-
this.deletec = false;
|
|
167
|
-
}, 2000);
|
|
168
|
-
}
|
|
169
|
-
if (data === "multidelete") {
|
|
170
|
-
this.deletec = true;
|
|
171
|
-
setTimeout(() => {
|
|
172
|
-
this.deletec = false;
|
|
173
|
-
}, 2000);
|
|
174
|
-
}
|
|
175
|
-
if (data === "requeue") {
|
|
176
|
-
this.requeuec = true;
|
|
177
|
-
setTimeout(() => {
|
|
178
|
-
this.requeuec = false;
|
|
179
|
-
}, 2000);
|
|
180
|
-
}
|
|
181
|
-
if (data === "multirequeue") {
|
|
182
|
-
this.requeuec = true;
|
|
183
|
-
setTimeout(() => {
|
|
184
|
-
this.requeuec = false;
|
|
185
|
-
}, 2000);
|
|
186
|
-
}
|
|
187
|
-
if (data === "create") {
|
|
188
|
-
this.createc = true;
|
|
189
|
-
setTimeout(() => {
|
|
190
|
-
this.createc = false;
|
|
191
|
-
}, 2000);
|
|
192
|
-
}
|
|
193
|
-
},
|
|
194
|
-
},
|
|
195
|
-
created() {
|
|
196
|
-
return this.fetchData();
|
|
197
|
-
},
|
|
198
|
-
template: `
|
|
199
|
-
|
|
200
|
-
<div class="container-fluid">
|
|
201
|
-
<div class="">
|
|
202
|
-
<div class="navbar navbar-dark fixed-top bg-dark flex-md-nowrap p-0 shadow">
|
|
203
|
-
<div class="d-flex">
|
|
204
|
-
<div>
|
|
205
|
-
<a class="navbar-brand col-sm-10 col-md-10 mr-0 tittle"> Agendash</a>
|
|
206
|
-
</div>
|
|
207
|
-
<div class='d-md-none w-50'>
|
|
208
|
-
<div id="mySidebar" class="sidebar-collapse" @click="closeNav()">
|
|
209
|
-
<a href="javascript:void(0)" class="closebtn" @click="closeNav()">×</a>
|
|
210
|
-
<div v-if="hideSlide === false" class="bg-light overflow-auto">
|
|
211
|
-
<sidebar
|
|
212
|
-
v-on:search-sidebar="searchForm"
|
|
213
|
-
v-on:new-job="newJob"
|
|
214
|
-
:overview="overview"
|
|
215
|
-
:pagesize="pagesize"
|
|
216
|
-
:loading="loading"
|
|
217
|
-
>
|
|
218
|
-
</sidebar>
|
|
219
|
-
</div>
|
|
220
|
-
</div>
|
|
221
|
-
<div class="slidebar-container-button" id="main">
|
|
222
|
-
<button class="openbtn" @click="openNav()">☰</button>
|
|
223
|
-
</div>
|
|
224
|
-
</div>
|
|
225
|
-
</div>
|
|
226
|
-
</div>
|
|
227
|
-
</div>
|
|
228
|
-
<div class="row pt-5">
|
|
229
|
-
<div v-if="hideSlide === true" class="col-md-2 d-none d-md-block bg-light overflow-auto">
|
|
230
|
-
<sidebar
|
|
231
|
-
v-on:search-sidebar="searchForm"
|
|
232
|
-
v-on:new-job="newJob"
|
|
233
|
-
:overview="overview"
|
|
234
|
-
:pagesize="pagesize"
|
|
235
|
-
:loading="loading"
|
|
236
|
-
>
|
|
237
|
-
</sidebar>
|
|
238
|
-
</div>
|
|
239
|
-
<main role="main" class="col-md-10 ml-sm-auto col-lg-10 px-4 pt-3 pb-5">
|
|
240
|
-
<div class="col-12">
|
|
241
|
-
<topbar v-on:search-form="searchForm"
|
|
242
|
-
:name='name'
|
|
243
|
-
:state='state'
|
|
244
|
-
:search='search'
|
|
245
|
-
:property='property'
|
|
246
|
-
>
|
|
247
|
-
</topbar>
|
|
248
|
-
</div>
|
|
249
|
-
<div class="col-12 ">
|
|
250
|
-
<job-list
|
|
251
|
-
v-on:confirm-delete="confirmDelete"
|
|
252
|
-
v-on:confirm-multi-delete="confirmDeleteMulti"
|
|
253
|
-
v-on:confirm-requeue="confirmRequeue"
|
|
254
|
-
v-on:confirm-multi-requeue="confirmRequeueMulti"
|
|
255
|
-
v-on:show-job-detail="showJobDetail"
|
|
256
|
-
v-on:pagechange="pagechange"
|
|
257
|
-
:pagesize="pagesize"
|
|
258
|
-
:pagenumber='pagenumber'
|
|
259
|
-
:totalPages='totalPages'
|
|
260
|
-
:skip="skip"
|
|
261
|
-
:jobs="jobs"
|
|
262
|
-
:sendClean='sendClean'
|
|
263
|
-
:loading='loading'
|
|
264
|
-
>
|
|
265
|
-
</job-list>
|
|
266
|
-
</div>
|
|
267
|
-
</main>
|
|
268
|
-
</div>
|
|
269
|
-
<div class="row bg-dark py-3">
|
|
270
|
-
<div class="col-6 m-auto text-light text-center">
|
|
271
|
-
<small>UI written by <a class="text-light" href="https://www.softwareontheroad.com/about" target="_BLANK">Sam Quinn</a>. Backend by Agenda team.</small>
|
|
272
|
-
</div>
|
|
273
|
-
</div>
|
|
274
|
-
<job-detail v-if="showDetail" v-bind:job="jobData"></job-detail>
|
|
275
|
-
<confirm-delete v-if="showConfirm" v-on:popup-message="popupmessage('delete')" v-on:refresh-data="refreshData" v-bind:job="jobData"></confirm-delete>
|
|
276
|
-
<confirm-multi-delete v-if="showConfirmMulti" v-on:ready-clean="readyClean" v-on:popup-message="popupmessage('multidelete')" v-on:refresh-data="refreshData" v-bind:jobs="jobData"></confirm-multi-delete>
|
|
277
|
-
<confirm-requeue v-if="showConfirmRequeue" v-on:popup-message="popupmessage('requeue')" v-on:refresh-data="refreshData" v-bind:job="jobData"></confirm-requeue>
|
|
278
|
-
<confirm-multi-requeue v-if="showConfirmRequeueMulti" v-on:ready-clean="readyClean" v-on:popup-message="popupmessage('multirequeue')" v-on:refresh-data="refreshData" v-bind:jobs="jobData"></confirm-multi-requeue>
|
|
279
|
-
<popup-message :deletec="deletec" :requeuec="requeuec" :createc="createc"></popup-message>
|
|
280
|
-
<new-job v-if="showNewJob" v-on:popup-message="popupmessage('create')" v-on:refresh-data="fetchData"></new-job>
|
|
281
|
-
</div>
|
|
282
|
-
`,
|
|
283
|
-
});
|
package/public/app/js/newJob.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
const newJob = Vue.component("new-job", {
|
|
2
|
-
data: () => ({
|
|
3
|
-
jobDataParseError: "",
|
|
4
|
-
jobName: "",
|
|
5
|
-
jobSchedule: "",
|
|
6
|
-
jobRepeatEvery: "",
|
|
7
|
-
jobData: `{ "name": "Your medatada goes here..." }`,
|
|
8
|
-
}),
|
|
9
|
-
props: ["job"],
|
|
10
|
-
methods: {
|
|
11
|
-
clear() {
|
|
12
|
-
(this.jobDataParseError = ""),
|
|
13
|
-
(this.jobName = ""),
|
|
14
|
-
(this.jobSchedule = ""),
|
|
15
|
-
(this.jobRepeatEvery = ""),
|
|
16
|
-
(this.jobData = `{ "name": "Your medatada goes here..." }`);
|
|
17
|
-
},
|
|
18
|
-
create() {
|
|
19
|
-
const url = `api/jobs/create`;
|
|
20
|
-
|
|
21
|
-
let jobData = "";
|
|
22
|
-
try {
|
|
23
|
-
jobData = JSON.parse(this.jobData);
|
|
24
|
-
} catch (err) {
|
|
25
|
-
this.jobDataParseError = err.message;
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
let body = {
|
|
30
|
-
jobName: this.jobName,
|
|
31
|
-
jobSchedule: this.jobSchedule,
|
|
32
|
-
jobRepeatEvery: this.jobRepeatEvery,
|
|
33
|
-
jobData: jobData,
|
|
34
|
-
};
|
|
35
|
-
return axios
|
|
36
|
-
.post(url, body)
|
|
37
|
-
.then((result) => result.data)
|
|
38
|
-
.then((data) => {
|
|
39
|
-
this.$emit("popup-message");
|
|
40
|
-
this.$emit("refresh-data");
|
|
41
|
-
this.$refs.Close.click();
|
|
42
|
-
this.clear();
|
|
43
|
-
})
|
|
44
|
-
.catch(console.log);
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
template: `
|
|
48
|
-
<div class="modal fade" id="modalNewJob" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
|
49
|
-
<!-- Modal -->
|
|
50
|
-
<div class="modal-dialog" role="document">
|
|
51
|
-
<div class="modal-content">
|
|
52
|
-
<div class="modal-header">
|
|
53
|
-
<h5 class="modal-title" id="exampleModalLabel">Create Job</h5>
|
|
54
|
-
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
55
|
-
<span aria-hidden="true">×</span>
|
|
56
|
-
</button>
|
|
57
|
-
</div>
|
|
58
|
-
<div class="modal-body">
|
|
59
|
-
<form>
|
|
60
|
-
<div class="form-group">
|
|
61
|
-
<label for="jobname">Job Name</label>
|
|
62
|
-
<input v-model="jobName" type="text" class="form-control" id="jobname" aria-describedby="jobname">
|
|
63
|
-
</div>
|
|
64
|
-
<div class="form-group">
|
|
65
|
-
<label for="jobSchedule">Job Schedule</label>
|
|
66
|
-
<input v-model="jobSchedule" type="text" class="form-control" id="jobSchedule" aria-describedby="jobSchedule">
|
|
67
|
-
<small id="jobSchedule" class="form-text text-muted">Number/Every Unit i.e: "1 seconds" or "3 days" (check npmjs.com/human-interval)</small>
|
|
68
|
-
</div>
|
|
69
|
-
<div class="form-group">
|
|
70
|
-
<label for="jobRepeatEvery">Job Repeat Every</label>
|
|
71
|
-
<input v-model="jobRepeatEvery" type="text" class="form-control" id="jobRepeatEvery" aria-describedby="jobRepeatEvery">
|
|
72
|
-
<small id="jobRepeatEvery" class="form-text text-muted">Number/Every Unit i.e: "1 month" or "3 hours"</small>
|
|
73
|
-
</div>
|
|
74
|
-
<div class="form-group">
|
|
75
|
-
<label for="jobData">Job Metadata</label>
|
|
76
|
-
<prism-editor class="json-editor" :lineNumbers="true" v-model="jobData" language="json"></prism-editor>
|
|
77
|
-
<small class="form-text text-muted">{{jobDataParseError}}</small>
|
|
78
|
-
</div>
|
|
79
|
-
</form>
|
|
80
|
-
</div>
|
|
81
|
-
<div class="modal-footer">
|
|
82
|
-
<button type="button" class="btn btn-info" @click="create()">Create Job</button>
|
|
83
|
-
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
|
84
|
-
</div>
|
|
85
|
-
</div>
|
|
86
|
-
</div>
|
|
87
|
-
</div>
|
|
88
|
-
`,
|
|
89
|
-
});
|