mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[vcs-log] cleanup trigger events
FUS-397, FUS-411 GitOrigin-RevId: eb106661843fe848072f522b2e66d248213d1e0d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
072df66870
commit
e6e9f98e8a
+4
-3
@@ -77,9 +77,10 @@ class VcsLogFileHistoryProviderImpl : VcsLogFileHistoryProvider {
|
||||
}
|
||||
|
||||
private fun triggerFileHistoryUsage(paths: Collection<FilePath>, hash: Hash?) {
|
||||
val name = if (paths.size > 1) "MultiplePaths" else if (paths.first().isDirectory) "Folder" else "File"
|
||||
val suffix = if (hash != null) "ForRevision" else ""
|
||||
VcsLogUsageTriggerCollector.triggerUsage("Show" + name + "History" + suffix)
|
||||
VcsLogUsageTriggerCollector.triggerUsage("history.shown") { data ->
|
||||
val kind = if (paths.size > 1) "multiple" else if (paths.first().isDirectory) "folder" else "file"
|
||||
data.addData("kind", kind).addData("has.revision", hash != null)
|
||||
}
|
||||
}
|
||||
|
||||
private fun findOrOpenHistory(project: Project, logManager: VcsLogManager,
|
||||
|
||||
@@ -159,7 +159,7 @@ public class VcsLogTabsWatcher implements Disposable {
|
||||
window -> window instanceof VcsLogTab && ((VcsLogTab)window).myTabId.equals(tabId));
|
||||
if (logWindow != null) {
|
||||
LOG.debug("Selected log window \'" + logWindow + "\'");
|
||||
VcsLogUsageTriggerCollector.triggerUsage("TabNavigation");
|
||||
VcsLogUsageTriggerCollector.triggerUsage("tab.navigated", null);
|
||||
myRefresher.refresherActivated(logWindow.getRefresher(), false);
|
||||
}
|
||||
}
|
||||
|
||||
+21
-13
@@ -8,29 +8,37 @@ import com.intellij.vcs.log.ui.VcsLogInternalDataKeys;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class VcsLogUsageTriggerCollector {
|
||||
|
||||
public static void triggerUsage(@NotNull AnActionEvent e, @NotNull Object action) {
|
||||
triggerUsage(e, action.getClass().getName());
|
||||
triggerUsage(e, action, null);
|
||||
}
|
||||
|
||||
public static void triggerUsage(@NotNull AnActionEvent e, @NotNull String text) {
|
||||
triggerUsage(text, e.getData(VcsLogInternalDataKeys.FILE_HISTORY_UI) != null, e);
|
||||
public static void triggerUsage(@NotNull AnActionEvent e, @NotNull Object action, @Nullable Consumer<FeatureUsageData> configurator) {
|
||||
triggerUsage("action.called", data -> {
|
||||
addContext(data, e.getData(VcsLogInternalDataKeys.FILE_HISTORY_UI) != null);
|
||||
data.addInputEvent(e);
|
||||
data.addData("class", action.getClass().getName());
|
||||
if (configurator != null) configurator.accept(data);
|
||||
});
|
||||
}
|
||||
|
||||
public static void triggerUsage(@NotNull String text) {
|
||||
triggerUsage(text, "", null);
|
||||
public static void triggerUsage(@NotNull String text, boolean isFromHistory, @Nullable Consumer<FeatureUsageData> configurator) {
|
||||
triggerUsage(text, data -> {
|
||||
addContext(data, isFromHistory);
|
||||
if (configurator != null) configurator.accept(data);
|
||||
});
|
||||
}
|
||||
|
||||
public static void triggerUsage(@NotNull String text, boolean isFromHistory, @Nullable AnActionEvent e) {
|
||||
triggerUsage(text, isFromHistory ? "history" : "log", e);
|
||||
public static void triggerUsage(@NotNull String text, @Nullable Consumer<FeatureUsageData> configurator) {
|
||||
FeatureUsageData data = new FeatureUsageData();
|
||||
if (configurator != null) configurator.accept(data);
|
||||
FUCounterUsageLogger.getInstance().logEvent("vcs.log.trigger", text, data);
|
||||
}
|
||||
|
||||
private static void triggerUsage(@NotNull String text, @NotNull String context, @Nullable AnActionEvent event) {
|
||||
FeatureUsageData featureUsageData = new FeatureUsageData().addData("context", context);
|
||||
if (event != null) {
|
||||
featureUsageData.addInputEvent(event);
|
||||
}
|
||||
FUCounterUsageLogger.getInstance().logEvent("vcs.log.trigger", text, featureUsageData);
|
||||
private static void addContext(@NotNull FeatureUsageData data, boolean isFromHistory) {
|
||||
data.addData("context", isFromHistory ? "history" : "log");
|
||||
}
|
||||
}
|
||||
|
||||
+6
-2
@@ -32,7 +32,7 @@ open class GoToParentOrChildAction(val parent: Boolean) : DumbAwareAction() {
|
||||
}
|
||||
|
||||
override fun actionPerformed(e: AnActionEvent) {
|
||||
VcsLogUsageTriggerCollector.triggerUsage(e, this)
|
||||
triggerUsage(e)
|
||||
|
||||
val ui = e.getRequiredData(VcsLogDataKeys.VCS_LOG_UI) as AbstractVcsLogUi
|
||||
val rows = getRowsToJump(ui)
|
||||
@@ -58,7 +58,7 @@ open class GoToParentOrChildAction(val parent: Boolean) : DumbAwareAction() {
|
||||
val text = getActionText(ui.table.model.getCommitMetadata(row))
|
||||
object : DumbAwareAction(text, "Navigate to $text", null) {
|
||||
override fun actionPerformed(e: AnActionEvent) {
|
||||
VcsLogUsageTriggerCollector.triggerUsage(e, "Go to ${if (parent) "Parent" else "Child"} Commit.Select from Popup")
|
||||
triggerUsage(e)
|
||||
ui.jumpToRow(row)
|
||||
}
|
||||
}
|
||||
@@ -66,6 +66,10 @@ open class GoToParentOrChildAction(val parent: Boolean) : DumbAwareAction() {
|
||||
return DefaultActionGroup(actions)
|
||||
}
|
||||
|
||||
private fun DumbAwareAction.triggerUsage(e: AnActionEvent) {
|
||||
VcsLogUsageTriggerCollector.triggerUsage(e, this) { data -> data.addData("parent.commit", parent) }
|
||||
}
|
||||
|
||||
private fun getActionText(commitMetadata: VcsCommitMetadata): String {
|
||||
var text = commitMetadata.id.toShortString()
|
||||
if (commitMetadata !is LoadingDetails) {
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
package com.intellij.vcs.log.ui.filter;
|
||||
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.vcs.log.VcsLogDataPack;
|
||||
import com.intellij.vcs.log.VcsLogFilter;
|
||||
import com.intellij.vcs.log.VcsLogFilterCollection;
|
||||
@@ -65,7 +64,8 @@ abstract class FilterModel<Filter> {
|
||||
}
|
||||
|
||||
protected static void triggerFilterSet(@NotNull String name) {
|
||||
VcsLogUsageTriggerCollector.triggerUsage(StringUtil.capitalize(name) + "FilterSet", false, null);
|
||||
VcsLogUsageTriggerCollector.triggerUsage("filter.set", false,
|
||||
data -> data.addData("filter_name", name));
|
||||
}
|
||||
|
||||
protected static <FilterObject, F> void triggerFilterSet(@Nullable FilterObject filter,
|
||||
|
||||
@@ -209,22 +209,27 @@ public class GraphTableController {
|
||||
|
||||
private void performRootColumnAction() {
|
||||
if (myColorManager.hasMultiplePaths() && myProperties.exists(CommonUiProperties.SHOW_ROOT_NAMES)) {
|
||||
VcsLogUsageTriggerCollector.triggerUsage("RootColumnClick");
|
||||
triggerClick("root.column");
|
||||
myProperties.set(CommonUiProperties.SHOW_ROOT_NAMES, !myProperties.get(CommonUiProperties.SHOW_ROOT_NAMES));
|
||||
}
|
||||
}
|
||||
|
||||
private static void triggerElementClick(@NotNull PrintElement printElement) {
|
||||
if (printElement instanceof NodePrintElement) {
|
||||
VcsLogUsageTriggerCollector.triggerUsage("GraphNodeClick");
|
||||
triggerClick("node");
|
||||
}
|
||||
else if (printElement instanceof EdgePrintElement) {
|
||||
if (((EdgePrintElement)printElement).hasArrow()) {
|
||||
VcsLogUsageTriggerCollector.triggerUsage("GraphArrowClick");
|
||||
triggerClick("arrow");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void triggerClick(@NotNull String target) {
|
||||
VcsLogUsageTriggerCollector.triggerUsage("table.clicked",
|
||||
data -> data.addData("target", target));
|
||||
}
|
||||
|
||||
protected int getColumnLeftXCoordinate(int viewColumnIndex) {
|
||||
int x = 0;
|
||||
for (int i = 0; i < viewColumnIndex; i++) {
|
||||
|
||||
@@ -278,7 +278,7 @@ public class VcsLogGraphTable extends TableWithProgress implements DataProvider,
|
||||
}
|
||||
|
||||
public void resetColumnWidth(int column) {
|
||||
VcsLogUsageTriggerCollector.triggerUsage("ColumnWidthReset");
|
||||
VcsLogUsageTriggerCollector.triggerUsage("column.reset", null);
|
||||
if (CommonUiProperties.getColumnWidth(myProperties, column) != -1) {
|
||||
CommonUiProperties.saveColumnWidth(myProperties, column, -1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user