in Utils/azure-toolkit-ide-hdinsight-libs/hdinsight-node-common/src/com/microsoft/azure/hdinsight/serverexplore/hdinsightnode/ClusterNode.java [40:143]
protected void loadActions() {
super.loadActions();
if (ClusterManagerEx.getInstance().isHdiReaderCluster(clusterDetail)) {
// We need to refresh the whole HDInsight root node when we successfully linked the cluster
// So we have to pass "hdinsightRootModule" to the link cluster action
HDInsightRootModule hdinsightRootModule = (HDInsightRootModule) this.getParent();
NodeActionListener linkClusterActionListener =
HDInsightLoader.getHDInsightHelper().createAddNewHDInsightReaderClusterAction(hdinsightRootModule,
(ClusterDetail) clusterDetail);
addAction("Link This Cluster", linkClusterActionListener);
}
if (clusterDetail instanceof ClusterDetail || clusterDetail instanceof HDInsightAdditionalClusterDetail ||
clusterDetail instanceof EmulatorClusterDetail) {
addAction("Open Spark History UI", new NodeActionListener() {
@Override
protected void actionPerformed(NodeActionEvent e) {
String sparkHistoryUrl = clusterDetail.isEmulator() ?
((EmulatorClusterDetail)clusterDetail).getSparkHistoryEndpoint() :
ClusterManagerEx.getInstance().getClusterConnectionString(clusterDetail.getName()) + "/sparkhistory";
openUrlLink(sparkHistoryUrl);
}
});
addAction("Open Azure Storage Explorer for storage", new NodeActionListener() {
@Override
protected void actionPerformed(NodeActionEvent e) {
final AzureString title = OperationBundle.description("user/storage.open_azure_storage_explorer.account", clusterDetail.getName());
AzureTaskManager.getInstance().runInBackground(new AzureTask<>(title, () -> {
OpenHDIAzureStorageExplorerAction openHDIAzureStorageExplorerAction = new OpenHDIAzureStorageExplorerAction();
openHDIAzureStorageExplorerAction.openResource(clusterDetail);
}));
}
});
addAction("Open Cluster Management Portal(Ambari)", new NodeActionListener() {
@Override
protected void actionPerformed(NodeActionEvent e) {
String ambariUrl = clusterDetail.isEmulator() ?
((EmulatorClusterDetail)clusterDetail).getAmbariEndpoint() :
ClusterManagerEx.getInstance().getClusterConnectionString(clusterDetail.getName());
openUrlLink(ambariUrl);
}
});
}
if (clusterDetail instanceof ClusterDetail) {
addAction("Open Jupyter Notebook", new NodeActionListener() {
@Override
protected void actionPerformed(NodeActionEvent e) {
final String jupyterUrl = ClusterManagerEx.getInstance().getClusterConnectionString(clusterDetail.getName()) + "/jupyter/tree";
openUrlLink(jupyterUrl);
}
});
addAction("Open Azure Management Portal", new NodeActionListener() {
@Override
protected void actionPerformed(NodeActionEvent e) {
String resourceGroupName = clusterDetail.getResourceGroup();
if (resourceGroupName != null) {
String webPortHttpLink = String.format(HDIEnvironment.getHDIEnvironment().getPortal() + "#resource/subscriptions/%s/resourcegroups/%s/providers/Microsoft.HDInsight/clusters/%s",
clusterDetail.getSubscription().getId(),
resourceGroupName,
clusterDetail.getName());
openUrlLink(webPortHttpLink);
} else {
DefaultLoader.getUIHelper().showError("Failed to get resource group name.", "HDInsight Explorer");
}
}
});
}
if (clusterDetail instanceof HDInsightAdditionalClusterDetail || clusterDetail instanceof HDInsightLivyLinkClusterDetail) {
NodeActionListener listener = new NodeActionListener() {
@Override
protected void actionPerformed(NodeActionEvent e) {
boolean choice = DefaultLoader.getUIHelper().showConfirmation("Do you really want to unlink the HDInsight cluster?",
"Unlink HDInsight Cluster", new String[]{"Yes", "No"}, null);
if (choice) {
ClusterManagerEx.getInstance().removeAdditionalCluster(clusterDetail);
((RefreshableNode) getParent()).load(false);
}
}
};
addAction("Unlink", new WrappedTelemetryNodeActionListener(
getServiceName(), TelemetryConstants.UNLINK_SPARK_CLUSTER, listener));
} else if (clusterDetail instanceof EmulatorClusterDetail) {
NodeActionListener listener = new NodeActionListener() {
@Override
protected void actionPerformed(NodeActionEvent e) {
boolean choice = DefaultLoader.getUIHelper().showConfirmation("Do you really want to unlink the Emulator cluster?",
"Unlink Emulator Cluster", new String[]{"Yes", "No"}, null);
if (choice) {
ClusterManagerEx.getInstance().removeEmulatorCluster((EmulatorClusterDetail) clusterDetail);
((RefreshableNode) getParent()).load(false);
}
}
};
addAction("Unlink", new WrappedTelemetryNodeActionListener(
getServiceName(), TelemetryConstants.UNLINK_SPARK_CLUSTER, listener));
}
}