瀏覽代碼

style: Linting fixes

version-14
Aditya Hase 6 年之前
父節點
當前提交
9be311cc51
共有 4 個文件被更改,包括 43 次插入45 次删除
  1. +36
    -38
      frappe/public/js/frappe/recorder/RecorderDetail.vue
  2. +2
    -2
      frappe/public/js/frappe/recorder/RequestDetail.vue
  3. +2
    -2
      frappe/public/js/frappe/recorder/SQLDetail.vue
  4. +3
    -3
      frappe/public/js/frappe/recorder/recorder.js

+ 36
- 38
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;
}
}
};


+ 2
- 2
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;
});
},
};
</script>

+ 2
- 2
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];
});
},
};
</script>

+ 3
- 3
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,
}
})
})
});
});

Loading…
取消
儲存