So, in my Index.cshtml
page, when I initially load up the page I have:
@inherits ViewPage
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="ext-all-debug.js"></script>
<script type="text/javascript" src="app.js"></script>
<script type="text/javascript" src="app.ext.js"></script>
<script type="text/javascript" src="dump.js"></script>
@ServiceStack.MiniProfiler.Profiler.RenderIncludes().AsRaw()
</head>
<body>
</body>
</html>
All good, I can see it profiling index, a bunch of ExtJS, and the 1st ajax call to my ServiceStack on server side (in /api/session).
Now, in my ExtJS form I have a Customers tab when I click it sends ajax request to /api/customers
and I have a tab when I click it calls /api/orders
.
But, then when I start to click on, say Customers tab, Miniprofiler does not add any subsequent ajax requests into the list any more? I thought Miniprofiler can log ajax requests nothing special needs to be done? Why is it not logging subsequent ajax requests for me? I am missing something?
I know this is a little bit old, but if anyone is interested the implementation for using miniprofiler with angularjs is as follows:
app.config(['$httpProvider', function ($httpProvider) {
$httpProvider.interceptors.push(["$q", function ($q) {
return {
'response': function (response) {
if (typeof (MiniProfiler) != 'undefined' && response.config.url.indexOf(".html") < 0) {
var stringIds = response.headers('X-MiniProfiler-Ids');
if (stringIds) {
MiniProfiler.fetchResultsExposed(angular.fromJson(stringIds));
}
}
return response || $q.when(response);
}
};
}]);
}]);
The current version available through Nuget doesn't support intercepting ExtJS ajax calls. It seems that there is a pull request for that feature, but it isn't available yet.
Here's what I had to do to get around that:
Ext.require('Ext.Ajax');
Ext.onReady(function () {
Ext.Ajax.on('requestcomplete', function (e, xhr, settings) {
if (typeof (MiniProfiler) != 'undefined') {
var stringIds = xhr.getResponseHeader('X-MiniProfiler-Ids');
if (stringIds) {
var ids = typeof JSON != 'undefined' ? JSON.parse(stringIds) : eval(stringIds);
MiniProfiler.fetchResultsExposed(ids);
}
}
});
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With