Skip to content

Commit 51a054c

Browse files
committed
failed open browser windows in HDInsight job view
1 parent 8f7ffb5 commit 51a054c

File tree

2 files changed

+12
-30
lines changed
  • PluginsAndFeatures/azure-toolkit-for-intellij/resources/com/microsoft/intellij/hdinsight/messages
  • Utils/hdinsight-node-common/src/com/microsoft/azure/hdinsight/spark/jobs/framework

2 files changed

+12
-30
lines changed

PluginsAndFeatures/azure-toolkit-for-intellij/resources/com/microsoft/intellij/hdinsight/messages/messages.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# key work HDInsight or Spark should be included in value
1+
# HDInsight or Spark should be prefix in the value filed
22
SparkProjectSystemJavaCreation=SparkProjectSystemSparkProjectSystem.JavaCreation
33
SparkProjectSystemJavaSampleCreation=SparkProjectSystem.JavaSampleCreation
44
SparkProjectSystemScalaCreation=SparkProjectSystem.ScalaCreation

Utils/hdinsight-node-common/src/com/microsoft/azure/hdinsight/spark/jobs/framework/JobViewPanel.java

Lines changed: 11 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
public final class JobViewPanel extends JFXPanel {
3939

40-
private final Object jobUtil;
40+
private final JobUtils jobUtil;
4141
private final String rootPath;
4242
private final String id;
4343
private WebView webView;
@@ -52,42 +52,24 @@ public JobViewPanel(@NotNull String rootPath, @NotNull String uuid) {
5252
}
5353

5454
private void init(final JFXPanel panel) {
55-
String value = System.getProperty("my.debug");
5655
String url = rootPath + "/com.microsoft.hdinsight/hdinsight/job/html/index.html";
57-
if(!StringHelper.isNullOrWhiteSpace(value)) {
58-
url = "C:/Users/ltian/project/toolkit-branch2/Utils/HDInsightNodeCommon/resources/htmlResources/hdinsight/job/html/index.html";
59-
}
6056
url = url.replace("\\", "/");
6157
final String queryString = "?projectid=" + id + "&engintype=javafx";
6258
final String weburl = "file:///" + url + queryString;
6359

6460
Platform.setImplicitExit(false);
65-
Platform.runLater(new Runnable() {
66-
@Override
67-
public void run() {
68-
webView = new WebView();
69-
panel.setScene(new Scene(webView));
70-
webEngine = webView.getEngine();
71-
webEngine.setJavaScriptEnabled(true);
61+
Platform.runLater(()-> {
62+
webView = new WebView();
63+
webEngine = webView.getEngine();
64+
webEngine.setJavaScriptEnabled(true);
65+
JSObject win = (JSObject) webEngine.executeScript("window");
66+
win.setMember("JobUtils", jobUtil);
67+
panel.setScene(new Scene(webView));
7268

73-
if (!alreadyLoad) {
74-
webEngine.load(weburl);
75-
alreadyLoad = true;
76-
webEngine.getLoadWorker().stateProperty().addListener(
77-
new ChangeListener<Worker.State>() {
78-
@Override
79-
public void changed(ObservableValue<? extends Worker.State> ov,
80-
Worker.State oldState, Worker.State newState) {
81-
if (newState == Worker.State.SUCCEEDED) {
82-
JSObject win = (JSObject) webEngine.executeScript("window");
83-
win.setMember("JobUtils", jobUtil);
84-
}
85-
}
86-
}
87-
);
88-
}
69+
if (!alreadyLoad) {
70+
webEngine.load(weburl);
71+
alreadyLoad = true;
8972
}
9073
});
9174
}
92-
9375
}

0 commit comments

Comments
 (0)