diff --git a/frappe/public/js/frappe/recorder/RecorderDetail.vue b/frappe/public/js/frappe/recorder/RecorderDetail.vue index cda8eebe30..8118ed5769 100644 --- a/frappe/public/js/frappe/recorder/RecorderDetail.vue +++ b/frappe/public/js/frappe/recorder/RecorderDetail.vue @@ -74,13 +74,14 @@ export default { }; }, mounted() { - frappe.socketio.init(9000) - this.fetch_status() + frappe.socketio.init(9000); + this.fetch_status(); + this.refresh(); }, computed: { pages: function() { - const current_page = this.query.pagination.page - const total_pages = this.query.pagination.total + const current_page = this.query.pagination.page; + const total_pages = this.query.pagination.total; return [{ label:"Previous", number: Math.max(current_page - 1, 1), @@ -93,53 +94,51 @@ export default { label:"Next", number: Math.min(current_page + 1, total_pages), status: (current_page == total_pages) ? "disabled" : "", - }] + }]; } }, methods: { filtered: function(requests) { - requests = requests.slice() - const filters = Object.entries(this.query.filters) + requests = requests.slice(); + const filters = Object.entries(this.query.filters); requests = requests.filter( (r) => filters.map((f) => (r[f[0]] || "").match(f[1])).every(Boolean) - ) - this.query.pagination.total = Math.ceil(requests.length / this.query.pagination.limit) - return requests + ); + this.query.pagination.total = Math.ceil(requests.length / this.query.pagination.limit); + return requests; }, paginated: function(requests) { - requests = requests.slice() - const begin = (this.query.pagination.page - 1) * (this.query.pagination.limit) - const end = begin + this.query.pagination.limit - return requests.slice(begin, end) + requests = requests.slice(); + const begin = (this.query.pagination.page - 1) * (this.query.pagination.limit); + const end = begin + this.query.pagination.limit; + return requests.slice(begin, end); }, sorted: function(requests) { - requests = requests.slice() - const order = (this.query.order == "asc") ? 1 : -1 - const sort = this.query.sort - return requests.sort((a,b) => (a[sort] > b[sort]) ? order : -order) + requests = requests.slice(); + const order = (this.query.order == "asc") ? 1 : -1; + const sort = this.query.sort; + return requests.sort((a,b) => (a[sort] > b[sort]) ? order : -order); }, sort: function(key) { if(key == this.query.sort) { - this.query.order = (this.query.order == "asc") ? "desc" : "asc" - } - else { - this.query.order = "asc" + this.query.order = (this.query.order == "asc") ? "desc" : "asc"; + } else { + this.query.order = "asc"; } - this.query.sort = key + this.query.sort = key; }, glyphicon: function(key) { if(key == this.query.sort) { - return (this.query.order == "asc") ? "glyphicon-sort-by-attributes" : "glyphicon-sort-by-attributes-alt" - } - else { - return "glyphicon-sort" + return (this.query.order == "asc") ? "glyphicon-sort-by-attributes" : "glyphicon-sort-by-attributes-alt"; + } else { + return "glyphicon-sort"; } }, refresh: function() { frappe.call("frappe.www.recorder.get_requests").then( r => { - this.requests = r.message - this.last_fetched = new Date() - }) + this.requests = r.message; + this.last_fetched = new Date(); + }); }, record: function(should_record) { frappe.call({ @@ -147,27 +146,26 @@ export default { args: { should_record: should_record } - }).then(r => this.update_status(r.message)) + }).then(r => this.update_status(r.message)); }, fetch_status: function() { - this.refresh() - frappe.call("frappe.www.recorder.get_status").then(r => this.update_status(r.message)) + frappe.call("frappe.www.recorder.get_status").then(r => this.update_status(r.message)); }, update_status: function(status) { - this.status = status + this.status = status; if(this.status.status == "Active") { - frappe.realtime.on("recorder-dump-event", this.refresh) + frappe.realtime.on("recorder-dump-event", this.refresh); } else { - frappe.realtime.off("recorder-dump-event", this.refresh) + frappe.realtime.off("recorder-dump-event", this.refresh); } }, }, filters: { elipsize: function (value) { - if (!value) return '' + if (!value) return ''; if (value.length > 30) return value.substring(0, 30-3)+'...'; - return value + return value; } } }; diff --git a/frappe/public/js/frappe/recorder/RequestDetail.vue b/frappe/public/js/frappe/recorder/RequestDetail.vue index 2d386b1c21..60c0d8adf0 100644 --- a/frappe/public/js/frappe/recorder/RequestDetail.vue +++ b/frappe/public/js/frappe/recorder/RequestDetail.vue @@ -36,8 +36,8 @@ export default { uuid: this.$route.params.request_uuid } }).then( r => { - this.calls = r.message.calls - }) + this.calls = r.message.calls; + }); }, }; diff --git a/frappe/public/js/frappe/recorder/SQLDetail.vue b/frappe/public/js/frappe/recorder/SQLDetail.vue index f794cb25cb..4047c6c480 100644 --- a/frappe/public/js/frappe/recorder/SQLDetail.vue +++ b/frappe/public/js/frappe/recorder/SQLDetail.vue @@ -59,8 +59,8 @@ export default { uuid: this.$route.params.request_uuid } }).then( r => { - this.call = r.message.calls[this.$route.params.call_index] - }) + this.call = r.message.calls[this.$route.params.call_index]; + }); }, }; diff --git a/frappe/public/js/frappe/recorder/recorder.js b/frappe/public/js/frappe/recorder/recorder.js index 5aaca9c67f..7ddaefe330 100644 --- a/frappe/public/js/frappe/recorder/recorder.js +++ b/frappe/public/js/frappe/recorder/recorder.js @@ -31,7 +31,7 @@ frappe.ready(function() { mode: 'hash', base: "/recorder/", routes: routes, - }) + }); new Vue({ el: "#recorder", @@ -40,5 +40,5 @@ frappe.ready(function() { components: { RecorderRoot, } - }) -}) + }); +});