Browse Source

hide empty changes

Davide Alberani 6 years ago
parent
commit
1f9ae66df8
2 changed files with 17 additions and 4 deletions
  1. 0 2
      dist/base.html
  2. 17 2
      dist/history.html

+ 0 - 2
dist/base.html

@@ -7,13 +7,11 @@
         <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/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/vue.js"></script>
         <script src="/static/js/vue-material.min.js"></script>
         <script src="/static/js/axios.min.js"></script>
         <script src="/static/js/diff2html.js"></script>
-        <script type="text/javascript" src="/static/js/diff2html-ui.min.js"></script>
     </head>
     <body>
         {% block body %}{% end %}

+ 17 - 2
dist/history.html

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