history.html 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. {% extends "base.html" %}
  2. {% block body %}
  3. <div id="app">
  4. <div class="md-layout">
  5. <div class="md-layout-item" md-card>
  6. <md-card id="main-card">
  7. <md-card-header>
  8. <div class="md-title">
  9. <md-button href="/" class="md-icon-button md-primary">
  10. <md-icon>home</md-icon>
  11. </md-button>
  12. Diffido - ${schedule && schedule.title} history
  13. </div>
  14. </md-card-header>
  15. <md-card-content>
  16. <md-table id="history-table" v-model="history">
  17. <md-table-toolbar>
  18. <h1 class="md-title">History</h1>
  19. </md-table-toolbar>
  20. <md-table-row slot="md-table-row" slot-scope="{item}">
  21. <md-table-cell>
  22. (<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>)
  23. <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>
  24. <md-radio name="diff" v-model="diff" :value="item.id" :seq="item.seq"></md-radio>
  25. </md-table-cell>
  26. <md-table-cell md-label="commit ID" md-sort-by="id">${ item.id }</md-table-cell>
  27. <md-table-cell md-label="message" md-sort-by="message">${ item.message }</md-table-cell>
  28. <md-table-cell md-label="changes" md-sort-by="message">+${ item.insertions || 0 },-${ item.deletions || 0 }</md-table-cell>
  29. </md-table-row>
  30. </md-table>
  31. </md-card-content>
  32. </md-card>
  33. </div>
  34. </div>
  35. </div>
  36. <script>
  37. Vue.use(VueMaterial.default);
  38. var app = new Vue({
  39. el: '#app',
  40. delimiters: ['${', '}'],
  41. data: {
  42. schedule: {},
  43. history: [],
  44. oldid: null,
  45. diff: null,
  46. lasstid: null,
  47. {% if isinstance(id, str) %}
  48. id: "{{id}}",
  49. {% else %}
  50. id: null,
  51. {% end %}
  52. },
  53. mounted: function() {
  54. this.getHistory();
  55. },
  56. methods: {
  57. getHistory: function() {
  58. self = this;
  59. var data = axios.get('/api/history/' + this.id).then(function(response) {
  60. self.history = response.data.history;
  61. self.schedule = response.data.schedule;
  62. self.lastid = response.data.lastid;
  63. });
  64. }
  65. }
  66. });
  67. </script>
  68. <style>
  69. body {
  70. background-color: white;
  71. padding: 6px;
  72. }
  73. .md-table {
  74. height: 80%;
  75. }
  76. </style>
  77. {% end %}