2018-01-16 22:24:30 +01:00
|
|
|
{% extends "base.html" %}
|
|
|
|
|
|
|
|
{% block body %}
|
2018-01-17 22:54:06 +01:00
|
|
|
<div id="app">
|
|
|
|
<div class="md-layout">
|
2018-01-23 18:22:08 +01:00
|
|
|
<div class="md-layout-item">
|
|
|
|
<md-card id="main-card">
|
|
|
|
<md-card-header>
|
|
|
|
<div class="md-title">
|
2018-01-23 22:41:32 +01:00
|
|
|
<md-button href="/" class="md-icon-button md-primary">
|
|
|
|
<md-icon>home</md-icon>
|
|
|
|
</md-button>
|
2018-01-23 18:45:41 +01:00
|
|
|
Diffido
|
2018-01-23 18:22:08 +01:00
|
|
|
<md-button href="/schedule.html" class="md-icon-button md-primary">
|
|
|
|
<md-icon>add_circle_outline</md-icon>
|
|
|
|
</md-button>
|
|
|
|
</div>
|
|
|
|
</md-card-header>
|
|
|
|
|
|
|
|
<md-card-content>
|
|
|
|
<md-table id="schedules-table" v-model="schedules">
|
|
|
|
<md-table-row slot="md-table-row" slot-scope="{item}">
|
|
|
|
<md-table-cell md-label="#" md-sort-by="id" md-numeric><a :href="'/schedule.html?id=' + item.id">${ item.id }</a></md-table-cell>
|
|
|
|
<md-table-cell md-label="title" md-sort-by="title"><a :href="'/schedule.html?id=' + item.id">${ item.title }</a></md-table-cell>
|
|
|
|
<md-table-cell md-label="url" md-sort-by="email"><a :href="item.url" target="_new">${ item.url }</a></md-table-cell>
|
2018-01-24 18:45:13 +01:00
|
|
|
<md-table-cell md-label="trigger" md-sort-by="trigger">${ triggerString(item) }</md-table-cell>
|
2018-01-23 22:41:32 +01:00
|
|
|
<md-table-cell md-label="history" md-sort-by="email">
|
|
|
|
<md-button :href="'/history.html?id=' + item.id" class="md-icon-button md-primary">
|
|
|
|
<md-icon>history</md-icon>
|
|
|
|
</md-button>
|
|
|
|
</md-table-cell>
|
2018-01-23 18:22:08 +01:00
|
|
|
</md-table-row>
|
|
|
|
</md-table>
|
|
|
|
</md-card-content>
|
|
|
|
</md-card>
|
2018-01-17 22:54:06 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
Vue.use(VueMaterial.default);
|
|
|
|
|
|
|
|
var app = new Vue({
|
2018-01-18 22:46:48 +01:00
|
|
|
el: '#app',
|
|
|
|
delimiters: ['${', '}'],
|
|
|
|
data: {
|
|
|
|
schedules: []
|
|
|
|
},
|
|
|
|
mounted: function() {
|
|
|
|
this.getSchedules();
|
|
|
|
},
|
2018-01-20 14:56:34 +01:00
|
|
|
computed: {
|
|
|
|
},
|
2018-01-18 22:46:48 +01:00
|
|
|
methods: {
|
|
|
|
getSchedules: function() {
|
|
|
|
self = this;
|
|
|
|
var data = axios.get('/api/schedules').then(function(response) {
|
2018-01-20 14:56:34 +01:00
|
|
|
var schedules = [];
|
|
|
|
_.forEach(response.data.schedules || {}, function(value, key) {
|
|
|
|
value.id = key;
|
|
|
|
schedules.push(value);
|
|
|
|
});
|
|
|
|
self.schedules = schedules;
|
2018-01-18 22:46:48 +01:00
|
|
|
});
|
2018-01-24 18:45:13 +01:00
|
|
|
},
|
|
|
|
triggerString: function(item) {
|
|
|
|
if (item.trigger == 'cron') {
|
|
|
|
return 'cron: ' + item.cron_crontab;
|
|
|
|
}
|
|
|
|
if (item.trigger == 'interval') {
|
|
|
|
trigger = 'interval: ';
|
|
|
|
_.each(['weeks', 'days', 'hours', 'minutes', 'seconds'], function(value, key) {
|
|
|
|
if ('interval_' + value) {
|
|
|
|
if (trigger) {
|
|
|
|
trigger = trigger + ' ';
|
|
|
|
}
|
|
|
|
trigger = trigger + ''
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return trigger;
|
|
|
|
}
|
|
|
|
return '';
|
2018-01-18 22:46:48 +01:00
|
|
|
}
|
|
|
|
}
|
2018-01-17 22:54:06 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
</script>
|
|
|
|
<style>
|
|
|
|
|
|
|
|
body {
|
|
|
|
background-color: white;
|
2018-01-23 18:22:08 +01:00
|
|
|
padding: 6px;
|
2018-01-17 22:54:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
.md-table {
|
2018-01-23 18:22:08 +01:00
|
|
|
height: 80%;
|
2018-01-17 22:54:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|
2018-01-16 22:24:30 +01:00
|
|
|
{% end %}
|