diff --git a/templates/scheduler/index.html b/templates/scheduler/index.html
index 7b4f17c..d444f15 100644
--- a/templates/scheduler/index.html
+++ b/templates/scheduler/index.html
@@ -51,11 +51,11 @@
Schedule
- todo: add shortcut buttons here: daily, hourly, etc.
+
@@ -165,8 +165,10 @@ Schedule
mixins: [windowMixin],
data: function () {
return {
+ jobStates: {}, // A data property to keep track of button states for each id
wallets: [],
jobs: [],
+ shortcuts: ['@reboot','@hourly','@daily','@weekly','@monthly','@yearly'],
slots: ['minute', 'hour', 'day', 'month', 'weekday'],
cron: {
minute: '*',
@@ -328,12 +330,28 @@ Schedule
})
})
},
-
+ toggleButton(id) {
+ this.$set(this.jobStates, id, !this.jobStates[id]);
+ this.pauseJob(id, !this.jobStates[id]);
+ },
+ getButtonIcon(id) {
+ return this.jobStates[id] ? 'play_arrow' : 'stop';
+ },
+ getButtonText(id) {
+ return this.jobStates[id] ? 'Play' : 'Stop';
+ },
+ getButtonColor(id) {
+ return this.jobStates[id] ? 'green' : 'red';
+ },
pauseJob: function (jobId, status) {
var self = this
- console.log(jobId)
+ console.log(jobId, status)
+ let confirm_msg = 'Are you sure you want to Stop this Job?'
+ if (status) {
+ confirm_msg = 'Are you sure you want to Start this Job?'
+ }
LNbits.utils
- .confirmDialog('Are you sure you want to stop this Job?')
+ .confirmDialog(confirm_msg)
.onOk(function () {
LNbits.api
.request(
@@ -353,15 +371,17 @@ Schedule
})
})
},
-
- // add start job method here
-
-
exportJobsCSV: function () {
LNbits.utils.exportCSV(this.jobsTable.columns, this.jobs)
},
},
+ props: {
+ row: {
+ type: Object,
+ default: () => ({ id: null }) // Define a default row object if none is provided
+ }
+ },
created: function () {
if (this.g.user.wallets.length) {
this.getJobs()