use of com.redhat.devtools.intellij.telemetry.core.service.TelemetryMessageBuilder.ActionMessage in project intellij-tekton by redhat-developer.
the class ShowDiagnosticDataAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent anActionEvent, TreePath path, Object selected, Tkn tkncli) {
ActionMessage telemetry = instance().action(NAME_PREFIX_DIAG + "show diagnostic data");
ExecHelper.submit(() -> {
ParentableNode element = getElement(selected);
String namespace = element.getNamespace();
boolean hasDataToShow = false;
try {
if (element instanceof PipelineRunNode) {
telemetry.property(PROP_RESOURCE_KIND, Constants.KIND_PIPELINERUN);
hasDataToShow = tkncli.getDiagnosticData(namespace, "tekton.dev/pipelineRun", element.getName());
} else if (element instanceof TaskRunNode) {
telemetry.property(PROP_RESOURCE_KIND, Constants.KIND_TASKRUN);
hasDataToShow = tkncli.getDiagnosticData(namespace, "tekton.dev/taskRun", element.getName());
}
if (!hasDataToShow) {
String message = "No data available for " + element.getName() + " in namespace " + namespace + ".";
telemetry.result(anonymizeResource(element.getName(), namespace, message)).send();
UIHelper.executeInUI(() -> Messages.showWarningDialog("No data available for " + element.getName() + " in namespace " + namespace + ".", "Diagnostic Data"));
} else {
telemetry.success().send();
}
} catch (IOException e) {
telemetry.error(anonymizeResource(element.getName(), namespace, e.getMessage())).send();
UIHelper.executeInUI(() -> Messages.showErrorDialog("Failed to retrieve data for " + element.getName() + " in namespace " + namespace + ". An error occurred while retrieving them.\n" + e.getLocalizedMessage(), "Error"));
logger.warn("Error: " + e.getLocalizedMessage(), e);
return;
}
});
}
use of com.redhat.devtools.intellij.telemetry.core.service.TelemetryMessageBuilder.ActionMessage in project intellij-tekton by redhat-developer.
the class TektonHubAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent anActionEvent, TreePath path, Object selected, Tkn tkncli) {
ActionMessage telemetry = TelemetryService.instance().action(NAME_PREFIX_CRUD + "tekton hub");
ExecHelper.submit(() -> {
ParentableNode element = getElement(selected);
Project project = getEventProject(anActionEvent);
HubModel model = new HubModel(project, tkncli, element);
telemetry.send();
UIHelper.executeInUI(() -> {
HubDialog wizard = new HubDialog(project, model);
wizard.setModal(false);
wizard.show();
return wizard;
});
});
}
use of com.redhat.devtools.intellij.telemetry.core.service.TelemetryMessageBuilder.ActionMessage in project intellij-tekton by redhat-developer.
the class CreateClusterTaskAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent anActionEvent, TreePath path, Object selected, Tkn tkncli) {
ActionMessage telemetry = TelemetryService.instance().action(NAME_PREFIX_CRUD + "create cluster task").property(PROP_RESOURCE_KIND, KIND_CLUSTERTASK);
ClusterTasksNode item = getElement(selected);
String namespace = item.getParent().getName();
String content = getSnippet("Tekton: ClusterTask");
if (Strings.isNullOrEmpty(content)) {
telemetry.error("snippet content empty").send();
} else {
String name = "newclustertask.yaml";
try {
VirtualFileHelper.createAndOpenVirtualFile(anActionEvent.getProject(), namespace, name, content, KIND_CLUSTERTASKS, item);
telemetry.success().send();
} catch (IOException e) {
String errorMessage = "Could not create cluster cluster task: " + e.getLocalizedMessage();
telemetry.error(anonymizeResource(name, namespace, errorMessage)).send();
logger.warn(errorMessage, e);
}
}
}
use of com.redhat.devtools.intellij.telemetry.core.service.TelemetryMessageBuilder.ActionMessage in project intellij-tekton by redhat-developer.
the class CreatePipelineAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent anActionEvent, TreePath path, Object selected, Tkn tkncli) {
ActionMessage telemetry = TelemetryService.instance().action(NAME_PREFIX_CRUD + "create pipeline").property(PROP_RESOURCE_KIND, KIND_PIPELINE);
PipelinesNode item = getElement(selected);
String namespace = item.getParent().getName();
String content = getSnippet("Tekton: Pipeline");
if (Strings.isNullOrEmpty(content)) {
telemetry.error("snippet content empty").send();
} else {
String name = namespace + "-newpipeline.yaml";
try {
VirtualFileHelper.createAndOpenVirtualFile(anActionEvent.getProject(), namespace, name, content, KIND_PIPELINES, item);
telemetry.send();
} catch (IOException e) {
telemetry.error(anonymizeResource(name, namespace, e.getMessage())).send();
logger.warn("Could not create resource: " + e.getLocalizedMessage(), e);
}
}
}
Aggregations