hide empty changes

This commit is contained in:
Davide Alberani 2018-01-23 23:12:25 +01:00
parent ae7ef48dfb
commit 1f9ae66df8
2 changed files with 17 additions and 4 deletions

2
dist/base.html vendored
View file

@ -7,13 +7,11 @@
<link rel="stylesheet" href="/static/css/vue-material.min.css"> <link rel="stylesheet" href="/static/css/vue-material.min.css">
<link rel="stylesheet" href="/static/css/themes/default.css"> <link rel="stylesheet" href="/static/css/themes/default.css">
<link rel="stylesheet" href="/static/css/diff2html.css"> <link rel="stylesheet" href="/static/css/diff2html.css">
<script type="text/javascript" src="/static/js/jquery-3.3.1.min.js"></script>
<script src="/static/js/lodash.min.js"></script> <script src="/static/js/lodash.min.js"></script>
<script src="/static/js/vue.js"></script> <script src="/static/js/vue.js"></script>
<script src="/static/js/vue-material.min.js"></script> <script src="/static/js/vue-material.min.js"></script>
<script src="/static/js/axios.min.js"></script> <script src="/static/js/axios.min.js"></script>
<script src="/static/js/diff2html.js"></script> <script src="/static/js/diff2html.js"></script>
<script type="text/javascript" src="/static/js/diff2html-ui.min.js"></script>
</head> </head>
<body> <body>
{% block body %}{% end %} {% block body %}{% end %}

19
dist/history.html vendored
View file

@ -15,9 +15,9 @@
</md-card-header> </md-card-header>
<md-card-content> <md-card-content>
<md-table id="history-table" v-model="history"> <md-table id="history-table" v-model="filtered_history">
<md-table-toolbar> <md-table-toolbar>
<h1 class="md-title">History</h1> <md-switch v-model="show_empty" @change="toggleShowEmpty">show entries with no changes</md-switch>
</md-table-toolbar> </md-table-toolbar>
<md-table-row slot="md-table-row" slot-scope="{item}"> <md-table-row slot="md-table-row" slot-scope="{item}">
<md-table-cell> <md-table-cell>
@ -44,8 +44,10 @@ var app = new Vue({
el: '#app', el: '#app',
delimiters: ['${', '}'], delimiters: ['${', '}'],
data: { data: {
show_empty: false,
schedule: {}, schedule: {},
history: [], history: [],
filtered_history: [],
oldid: null, oldid: null,
diff: null, diff: null,
lasstid: null, lasstid: null,
@ -63,9 +65,22 @@ var app = new Vue({
self = this; self = this;
var data = axios.get('/api/history/' + this.id).then(function(response) { var data = axios.get('/api/history/' + this.id).then(function(response) {
self.history = response.data.history; self.history = response.data.history;
self.updateFilter();
self.schedule = response.data.schedule; self.schedule = response.data.schedule;
self.lastid = response.data.lastid; self.lastid = response.data.lastid;
}); });
},
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();
} }
} }
}); });