mirror of
https://github.com/adobe/brackets.git
synced 2024-11-20 18:02:54 +01:00
Merge pull request #11516 from adobe/abose/healthInstant
Health logs for find / replace in files, instant search usage.
This commit is contained in:
commit
a233bb36bb
@ -40,7 +40,8 @@ define(function (require, exports, module) {
|
||||
MainViewManager = require("view/MainViewManager"),
|
||||
Strings = require("strings"),
|
||||
ViewUtils = require("utils/ViewUtils"),
|
||||
FindUtils = require("search/FindUtils");
|
||||
FindUtils = require("search/FindUtils"),
|
||||
HealthLogger = require("utils/HealthLogger");
|
||||
|
||||
/**
|
||||
* @private
|
||||
@ -236,6 +237,9 @@ define(function (require, exports, module) {
|
||||
// close the old Find bar (with no animation) before creating a new one.
|
||||
// TODO: see note above - this will move to ModalBar eventually.
|
||||
FindBar._closeFindBars();
|
||||
if (this._options.multifile) {
|
||||
HealthLogger.searchDone(HealthLogger.SEARCH_NEW);
|
||||
}
|
||||
|
||||
var templateVars = _.clone(this._options);
|
||||
templateVars.Strings = Strings;
|
||||
@ -290,6 +294,7 @@ define(function (require, exports, module) {
|
||||
if (self._options.multifile) {
|
||||
if ($(e.target).is("#find-what")) {
|
||||
if (!self._options.replace) {
|
||||
HealthLogger.searchDone(HealthLogger.SEARCH_INSTANT);
|
||||
self.trigger("doFind");
|
||||
lastQueriedText = self.getQueryInfo().query;
|
||||
}
|
||||
@ -309,10 +314,12 @@ define(function (require, exports, module) {
|
||||
// Just set focus to the Replace field.
|
||||
self.focusReplace();
|
||||
} else {
|
||||
HealthLogger.searchDone(HealthLogger.SEARCH_ON_RETURN_KEY);
|
||||
// Trigger a Find (which really means "Find All" in this context).
|
||||
self.trigger("doFind");
|
||||
}
|
||||
} else {
|
||||
HealthLogger.searchDone(HealthLogger.SEARCH_REPLACE_ALL);
|
||||
self.trigger("doReplaceAll");
|
||||
}
|
||||
} else {
|
||||
|
@ -51,6 +51,7 @@ define(function (require, exports, module) {
|
||||
StatusBar = require("widgets/StatusBar"),
|
||||
Strings = require("strings"),
|
||||
StringUtils = require("utils/StringUtils"),
|
||||
HealthLogger = require("utils/HealthLogger"),
|
||||
_ = require("thirdparty/lodash");
|
||||
|
||||
|
||||
@ -186,6 +187,12 @@ define(function (require, exports, module) {
|
||||
if (queryInfo && queryInfo.query) {
|
||||
_findBar.enable(!disableFindBar);
|
||||
StatusBar.showBusyIndicator(disableFindBar);
|
||||
if (queryInfo.isRegexp) {
|
||||
HealthLogger.searchDone(HealthLogger.SEARCH_REGEXP);
|
||||
}
|
||||
if (queryInfo.isCaseSensitive) {
|
||||
HealthLogger.searchDone(HealthLogger.SEARCH_CASE_SENSITIVE);
|
||||
}
|
||||
|
||||
var filter;
|
||||
if (filterPicker) {
|
||||
|
@ -41,6 +41,7 @@ define(function (require, exports, module) {
|
||||
WorkspaceManager = require("view/WorkspaceManager"),
|
||||
StringUtils = require("utils/StringUtils"),
|
||||
Strings = require("strings"),
|
||||
HealthLogger = require("utils/HealthLogger"),
|
||||
_ = require("thirdparty/lodash"),
|
||||
|
||||
searchPanelTemplate = require("text!htmlContent/search-panel.html"),
|
||||
@ -158,19 +159,23 @@ define(function (require, exports, module) {
|
||||
.on("click.searchResults", ".first-page:not(.disabled)", function () {
|
||||
self._currentStart = 0;
|
||||
self._render();
|
||||
HealthLogger.searchDone(HealthLogger.SEARCH_FIRST_PAGE);
|
||||
})
|
||||
// The link to go the previous page
|
||||
.on("click.searchResults", ".prev-page:not(.disabled)", function () {
|
||||
self._currentStart -= RESULTS_PER_PAGE;
|
||||
self._render();
|
||||
HealthLogger.searchDone(HealthLogger.SEARCH_PREV_PAGE);
|
||||
})
|
||||
// The link to go to the next page
|
||||
.on("click.searchResults", ".next-page:not(.disabled)", function () {
|
||||
self.trigger('getNextPage');
|
||||
HealthLogger.searchDone(HealthLogger.SEARCH_NEXT_PAGE);
|
||||
})
|
||||
// The link to go to the last page
|
||||
.on("click.searchResults", ".last-page:not(.disabled)", function () {
|
||||
self.trigger('getLastPage');
|
||||
HealthLogger.searchDone(HealthLogger.SEARCH_LAST_PAGE);
|
||||
})
|
||||
|
||||
// Add the file to the working set on double click
|
||||
|
@ -174,6 +174,22 @@ define(function (require, exports, module) {
|
||||
setHealthDataLog("ProjectDetails", FIFLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* Increments health log count for a particular kind of search done
|
||||
* @param {string} searchType The kind of search type that needs to be logged- should be a js var compatible string
|
||||
*/
|
||||
function searchDone(searchType) {
|
||||
var searchDetails = getHealthDataLog("searchDetails");
|
||||
if (!searchDetails) {
|
||||
searchDetails = {};
|
||||
}
|
||||
if (!searchDetails[searchType]) {
|
||||
searchDetails[searchType] = 0;
|
||||
}
|
||||
searchDetails[searchType]++;
|
||||
setHealthDataLog("searchDetails", searchDetails);
|
||||
}
|
||||
|
||||
// Define public API
|
||||
exports.getHealthDataLog = getHealthDataLog;
|
||||
exports.setHealthDataLog = setHealthDataLog;
|
||||
@ -181,7 +197,22 @@ define(function (require, exports, module) {
|
||||
exports.clearHealthData = clearHealthData;
|
||||
exports.fileOpened = fileOpened;
|
||||
exports.setProjectDetail = setProjectDetail;
|
||||
exports.searchDone = searchDone;
|
||||
exports.setHealthLogsEnabled = setHealthLogsEnabled;
|
||||
exports.shouldLogHealthData = shouldLogHealthData;
|
||||
exports.init = init;
|
||||
|
||||
// constants
|
||||
// searchType for searchDone()
|
||||
exports.SEARCH_INSTANT = "searchInstant";
|
||||
exports.SEARCH_ON_RETURN_KEY = "searchOnReturnKey";
|
||||
exports.SEARCH_REPLACE_ALL = "searchReplaceAll";
|
||||
exports.SEARCH_NEXT_PAGE = "searchNextPage";
|
||||
exports.SEARCH_PREV_PAGE = "searchPrevPage";
|
||||
exports.SEARCH_LAST_PAGE = "searchLastPage";
|
||||
exports.SEARCH_FIRST_PAGE = "searchFirstPage";
|
||||
exports.SEARCH_REGEXP = "searchRegExp";
|
||||
exports.SEARCH_CASE_SENSITIVE = "searchCaseSensitive";
|
||||
// A new search context on search bar up-Gives an idea of number of times user did a discrete search
|
||||
exports.SEARCH_NEW = "searchNew";
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user