Skip to content

Commit

Permalink
refactor: use telemetry feedback API (#647)
Browse files Browse the repository at this point in the history
Signed-off-by: Andre Dietisheim <[email protected]>
  • Loading branch information
adietish committed Dec 14, 2023
1 parent 0d1487a commit 2d5e6e8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ intellij {
'JavaScript',
'com.intellij.css',
'yaml',
'com.redhat.devtools.intellij.telemetry:1.0.0.44',
'/Users/andredietisheim/Documents/jboss-workspaces/intellij-redhat-telemetry/build/idea-sandbox/plugins/Telemetry by Red Hat',
// 'com.redhat.devtools.intellij.telemetry:1.0.0.44',
'com.redhat.devtools.intellij.kubernetes:1.2.1.277'
]
updateSinceUntilBuild = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,34 @@

import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import org.jboss.tools.intellij.openshift.telemetry.TelemetrySender;
import com.redhat.devtools.intellij.telemetry.core.service.TelemetryMessageBuilder.FeedbackMessage;
import org.jboss.tools.intellij.openshift.telemetry.TelemetryService;
import org.jboss.tools.intellij.openshift.ui.feedback.FeedBackDialog;
import org.jetbrains.annotations.NotNull;

public class FeedBackAction extends AnAction {

protected TelemetrySender telemetrySender;

@Override
public void actionPerformed(@NotNull AnActionEvent e) {
telemetrySender = new TelemetrySender("feedback");
FeedbackMessage feedback = TelemetryService.instance().getBuilder().feedback("feedback");
FeedBackDialog dialog = new FeedBackDialog();
dialog.show();
if (dialog.isOK()) {
telemetrySender.addProperty("satisfaction", dialog.getSatisfaction());
telemetrySender.addProperty("satisfaction_comment", dialog.getSatisfactionComment());
telemetrySender.addProperty("recommendation", dialog.getRecommendation());
telemetrySender.addProperty("recommendation_comment", dialog.getRecommendationComment());
telemetrySender.addProperty("used_similar_extension", dialog.isUsedSimilarExtension());
telemetrySender.addProperty("used_similar_extension_name", dialog.getUsedSimilarExtensionName());
telemetrySender.addProperty("frustrating", dialog.getFrustratingFeature());
telemetrySender.addProperty("missing", dialog.getMissingFeature());
telemetrySender.addProperty("best", dialog.getBestFeature());
telemetrySender.addProperty("contact", dialog.getContact());
telemetrySender.sendTelemetryResults(TelemetryService.TelemetryResult.SUCCESS);
feedback.property("satisfaction", dialog.getSatisfaction())
.property("satisfaction_comment", dialog.getSatisfactionComment())
.property("recommendation", dialog.getRecommendation())
.property("recommendation_comment", dialog.getRecommendationComment())
.property("used_similar_extension", dialog.isUsedSimilarExtension())
.property("used_similar_extension_name", dialog.getUsedSimilarExtensionName())
.property("frustrating", dialog.getFrustratingFeature())
.property("missing", dialog.getMissingFeature())
.property("best", dialog.getBestFeature())
.property("contact", dialog.getContact())
.success()
.send();
} else {
telemetrySender.sendTelemetryResults(TelemetryService.TelemetryResult.ABORTED);
feedback.aborted()
.send();
}
}
}

0 comments on commit 2d5e6e8

Please sign in to comment.