diffido/dist/history.html

102 lines
3.4 KiB
HTML
Raw Normal View History

2018-01-21 01:26:46 +01:00
{% extends "base.html" %}
{% block body %}
<div id="app">
<div class="md-layout">
<div class="md-layout-item" md-card>
2018-01-23 22:41:32 +01:00
<md-card id="main-card">
<md-card-header>
<div class="md-title">
<md-button href="/" class="md-icon-button md-primary">
<md-icon>home</md-icon>
</md-button>
Diffido - ${schedule && schedule.title} history
</div>
</md-card-header>
<md-card-content>
2018-01-23 23:12:25 +01:00
<md-table id="history-table" v-model="filtered_history">
2018-01-23 22:41:32 +01:00
<md-table-toolbar>
2018-01-23 23:12:25 +01:00
<md-switch v-model="show_empty" @change="toggleShowEmpty">show entries with no changes</md-switch>
2018-01-23 22:41:32 +01:00
</md-table-toolbar>
<md-table-row slot="md-table-row" slot-scope="{item}">
<md-table-cell>
(<a v-if="item.seq > 1" :href="'/diff.html?id=' + id + '&oldid=' + item.id + '&diff=' + lastid">cur</a><span v-if="item.seq == 1">cur</span> | <a :href="'/diff.html?id=' + id + '&diff=' + item.id">prev</a>)
<md-radio name="oldid" v-model="oldid" :value="item.id" v-if="item.seq > 1" :seq="item.seq"></md-radio><span id="placeholder" v-if="item.seq == 1"> ---- </span>
<md-radio name="diff" v-model="diff" :value="item.id" :seq="item.seq"></md-radio>
</md-table-cell>
<md-table-cell md-label="commit ID" md-sort-by="id">${ item.id }</md-table-cell>
<md-table-cell md-label="message" md-sort-by="message">${ item.message }</md-table-cell>
<md-table-cell md-label="changes" md-sort-by="message">+${ item.insertions || 0 },-${ item.deletions || 0 }</md-table-cell>
</md-table-row>
</md-table>
</md-card-content>
</md-card>
2018-01-21 01:26:46 +01:00
</div>
</div>
</div>
<script>
Vue.use(VueMaterial.default);
var app = new Vue({
el: '#app',
delimiters: ['${', '}'],
data: {
2018-01-23 23:12:25 +01:00
show_empty: false,
2018-01-23 22:41:32 +01:00
schedule: {},
2018-01-21 01:26:46 +01:00
history: [],
2018-01-23 23:12:25 +01:00
filtered_history: [],
2018-01-21 11:20:42 +01:00
oldid: null,
diff: null,
lasstid: null,
2018-01-21 01:26:46 +01:00
{% if isinstance(id, str) %}
id: "{{id}}",
{% else %}
id: null,
{% end %}
},
mounted: function() {
this.getHistory();
},
methods: {
getHistory: function() {
self = this;
var data = axios.get('/api/history/' + this.id).then(function(response) {
self.history = response.data.history;
2018-01-23 23:12:25 +01:00
self.updateFilter();
2018-01-23 22:41:32 +01:00
self.schedule = response.data.schedule;
2018-01-21 11:20:42 +01:00
self.lastid = response.data.lastid;
2018-01-21 01:26:46 +01:00
});
2018-01-23 23:12:25 +01:00
},
updateFilter: function() {
self = this;
this.filtered_history = _.filter(self.history, function(o) {
if (self.show_empty) {
return true;
}
return o.changes;
});
},
toggleShowEmpty: function() {
this.updateFilter();
2018-01-21 01:26:46 +01:00
}
}
});
</script>
<style>
body {
background-color: white;
2018-01-23 22:41:32 +01:00
padding: 6px;
2018-01-21 01:26:46 +01:00
}
.md-table {
2018-01-23 22:41:32 +01:00
height: 80%;
2018-01-21 01:26:46 +01:00
}
</style>
{% end %}