Search in sources :

Example 1 with NamespaceNode

use of com.redhat.devtools.intellij.tektoncd.tree.NamespaceNode in project intellij-tekton by redhat-developer.

the class StartLastRunAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent anActionEvent, TreePath path, Object selected, Tkn tkncli) {
    telemetry = TelemetryService.instance().action(NAME_PREFIX_START_STOP + "start last run");
    ExecHelper.submit(() -> {
        ParentableNode<? extends ParentableNode<NamespaceNode>> element = getElement(selected);
        String namespace = element.getParent().getParent().getName();
        try {
            String runName = startRun(tkncli, element, namespace);
            FollowLogsAction.run(namespace, runName, element.getClass(), tkncli);
            ((TektonTreeStructure) getTree(anActionEvent).getClientProperty(Constants.STRUCTURE_PROPERTY)).fireModified(element);
            telemetry.send();
        } catch (IOException e) {
            String errorMessage = element.getName() + " in namespace " + namespace + " failed to start\n" + e.getLocalizedMessage();
            telemetry.error(anonymizeResource(element.getName(), namespace, errorMessage)).send();
            Notification notification = new Notification(NOTIFICATION_ID, "Error", errorMessage, NotificationType.ERROR);
            Notifications.Bus.notify(notification);
            logger.warn("Error: " + e.getLocalizedMessage(), e);
        }
    });
}
Also used : TektonTreeStructure(com.redhat.devtools.intellij.tektoncd.tree.TektonTreeStructure) NamespaceNode(com.redhat.devtools.intellij.tektoncd.tree.NamespaceNode) IOException(java.io.IOException) Notification(com.intellij.notification.Notification)

Aggregations

Notification (com.intellij.notification.Notification)1 NamespaceNode (com.redhat.devtools.intellij.tektoncd.tree.NamespaceNode)1 TektonTreeStructure (com.redhat.devtools.intellij.tektoncd.tree.TektonTreeStructure)1 IOException (java.io.IOException)1