improve schedule layout

This commit is contained in:
Davide Alberani 2018-01-23 18:45:41 +01:00
parent 86bfa4035e
commit 3df77754cd
4 changed files with 116 additions and 67 deletions

View file

@ -213,6 +213,7 @@ def get_history(id_):
def get_diff(id_, commit_id='HEAD', old_commit_id=None): def get_diff(id_, commit_id='HEAD', old_commit_id=None):
logger.warn('MEHHHH %s %s %s' % (id_, commit_id, old_commit_id))
def _history(id_, commit_id, old_commit_id, queue): def _history(id_, commit_id, old_commit_id, queue):
os.chdir('storage/%s' % id_) os.chdir('storage/%s' % id_)
p = subprocess.Popen([GIT_CMD, 'commit_id', old_commit_id or '%s~' % commit_id, commit_id], p = subprocess.Popen([GIT_CMD, 'commit_id', old_commit_id or '%s~' % commit_id, commit_id],

1
dist/diff.html vendored
View file

@ -42,7 +42,6 @@ var app = new Vue({
getDiff: function() { getDiff: function() {
self = this; self = this;
var data = axios.get('/api/diff/' + this.id + '/' + this.diff + '/' + (this.oldid || '')).then(function(response) { var data = axios.get('/api/diff/' + this.id + '/' + this.diff + '/' + (this.oldid || '')).then(function(response) {
console.log(response);
self.difftext = response.data.diff; self.difftext = response.data.diff;
var pretty_diff = Diff2Html.getPrettyHtml(self.difftext); var pretty_diff = Diff2Html.getPrettyHtml(self.difftext);
document.getElementById('diffpanel').innerHTML = pretty_diff; document.getElementById('diffpanel').innerHTML = pretty_diff;

2
dist/index.html vendored
View file

@ -7,7 +7,7 @@
<md-card id="main-card"> <md-card id="main-card">
<md-card-header> <md-card-header>
<div class="md-title"> <div class="md-title">
Card without hover effect Diffido
<md-button href="/schedule.html" class="md-icon-button md-primary"> <md-button href="/schedule.html" class="md-icon-button md-primary">
<md-icon>add_circle_outline</md-icon> <md-icon>add_circle_outline</md-icon>
</md-button> </md-button>

179
dist/schedule.html vendored
View file

@ -3,72 +3,115 @@
{% block body %} {% block body %}
<div id="app"> <div id="app">
<div class="md-layout"> <div class="md-layout">
<div class="md-layout-item" md-card> <div class="md-layout-item">
<md-field> <md-card id="main-card">
<label>title</label> <md-card-header>
<md-input v-model="schedule.title"></md-input> <div class="md-title">
</md-field> <md-button href="/" class="md-icon-button md-primary">
<md-field> <md-icon>home</md-icon>
<label>url</label> </md-button>
<md-input v-model="schedule.url"></md-input> Schedule ${schedule && schedule.title}
</md-field> </div>
</md-card-header>
<md-field> <md-card-content>
<label>trigger</label>
<md-select v-model="schedule.trigger">
<md-option value="interval">interval</md-option>
<md-option value="cron">cron</md-option>
</md-select>
</md-field>
<div v-if="schedule.trigger == 'interval'"> <div class="md-layout md-gutter">
<md-field> <div class="md-layout-item">
<label>weeks</label> <md-field>
<md-input v-model="schedule.interval_weeks" type="number"></md-input> <label>title</label>
</md-field> <md-input v-model="schedule.title"></md-input>
<md-field> </md-field>
<label>days</label> </div>
<md-input v-model="schedule.interval_days" type="number"></md-input> <div class="md-layout-item">
</md-field> <md-field>
<md-field> <label>url</label>
<label>hours</label> <md-input v-model="schedule.url"></md-input>
<md-input v-model="schedule.interval_hours" type="number"></md-input> </md-field>
</md-field> </div>
<md-field> </div>
<label>minutes</label>
<md-input v-model="schedule.interval_minutes" type="number"></md-input>
</md-field>
<md-field>
<label>seconds</label>
<md-input v-model="schedule.interval_seconds" type="number"></md-input>
</md-field>
</div>
<div v-if="schedule.trigger == 'cron'"> <div class="md-layout md-gutter">
<md-field> <div class="md-layout-item md-size-25">
<label>crontab</label> <md-field>
<md-input v-model="schedule.cron_crontab"></md-input> <label>trigger</label>
</md-field> <md-select v-model="schedule.trigger">
</div> <md-option value="interval">interval</md-option>
<md-option value="cron">cron</md-option>
</md-select>
</md-field>
</div>
<div class="md-layout-item md-size-25">
<div v-if="schedule.trigger == 'cron'">
<md-field>
<label>crontab</label>
<md-input v-model="schedule.cron_crontab"></md-input>
</md-field>
</div>
</div>
</div>
<md-field> <div v-if="schedule.trigger == 'interval'" class="md-layout md-gutter">
<label>notify email</label> <div class="md-layout-item md-size-20">
<md-input v-model="schedule.email" type="email"></md-input> <md-field>
</md-field> <label>weeks</label>
<md-field> <md-input v-model="schedule.interval_weeks" type="number"></md-input>
<label>XPath selector</label> </md-field>
<md-input v-model="schedule.xpath"></md-input> </div>
</md-field> <div class="md-layout-item md-size-20">
<md-field> <md-field>
<label>minimum change</label> <label>days</label>
<md-input v-model="schedule.minimum_change"></md-input> <md-input v-model="schedule.interval_days" type="number"></md-input>
</md-field> </md-field>
<md-switch v-model="schedule.enabled">enabled</md-switch> </div>
<div class="md-layout-item md-size-20">
<br /> <md-field>
<md-button class="md-raised md-primary" @click="saveSchedule()">save</md-button> <label>hours</label>
<md-button class="md-raised md-accent" :disabled="!hasID()" @click="deleteSchedule()">delete</md-button> <md-input v-model="schedule.interval_hours" type="number"></md-input>
<md-button href="/">back</md-button> </md-field>
</div>
<div class="md-layout-item md-size-20">
<md-field>
<label>minutes</label>
<md-input v-model="schedule.interval_minutes" type="number"></md-input>
</md-field>
</div>
<div class="md-layout-item md-size-20">
<md-field>
<label>seconds</label>
<md-input v-model="schedule.interval_seconds" type="number"></md-input>
</md-field>
</div>
</div>
<div class="md-layout md-gutter">
<div class="md-layout-item md-size-33">
<md-field>
<label>notify email</label>
<md-input v-model="schedule.email" type="email"></md-input>
</md-field>
</div>
<div class="md-layout-item md-size-33">
<md-field>
<label>XPath selector</label>
<md-input v-model="schedule.xpath"></md-input>
</md-field>
</div>
<div class="md-layout-item md-size-33">
<md-field>
<label>minimum change</label>
<md-input v-model="schedule.minimum_change"></md-input>
</md-field>
</div>
</div>
<md-switch v-model="schedule.enabled">enabled</md-switch>
<br />
<md-button class="md-raised md-primary" @click="saveSchedule()">save</md-button>
<md-button class="md-raised md-accent" :disabled="!hasID()" @click="deleteSchedule()">delete</md-button>
<md-button href="/">back</md-button>
</md-card-content>
</md-card>
</div> </div>
</div> </div>
</div> </div>
@ -112,12 +155,12 @@ var app = new Vue({
var data = this.schedule; var data = this.schedule;
if (this.hasID()) { if (this.hasID()) {
axios.put('/api/schedules/' + this.id, data).then(function(response) { axios.put('/api/schedules/' + this.id, data).then(function(response) {
console.log(response); window.location = '/';
}); });
} else { } else {
axios.post('/api/schedules', data).then(function(response) { axios.post('/api/schedules', data).then(function(response) {
console.log(response); window.location = '/';
window.location = '/schedule.html?id=' + response.data.id; /* window.location = '/schedule.html?id=' + response.data.id; */
}); });
} }
}, },
@ -137,7 +180,13 @@ var app = new Vue({
body { body {
background-color: white; background-color: white;
padding: 6px;
} }
.md-table {
height: 80%;
}
</style> </style>
{% end %} {% end %}