Skip to content

Commit 82118a2

Browse files
t-rufangEskibear
authored andcommitted
Fix storage info check not work for spark on ADL issue
1 parent 35695bf commit 82118a2

File tree

2 files changed

+24
-18
lines changed

2 files changed

+24
-18
lines changed

PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/azure/hdinsight/spark/ui/SparkSubmissionContentPanelConfigurable.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
package com.microsoft.azure.hdinsight.spark.ui;
2323

2424
import com.google.common.collect.ImmutableSortedSet;
25+
import com.intellij.execution.configurations.RuntimeConfigurationError;
2526
import com.intellij.openapi.application.ApplicationManager;
2627
import com.intellij.openapi.application.ModalityState;
2728
import com.intellij.openapi.options.ConfigurationException;
@@ -65,6 +66,8 @@ public class SparkSubmissionContentPanelConfigurable implements SettableControl<
6566
private final Project myProject;
6667

6768
private SparkSubmissionContentPanel submissionPanel;
69+
private SparkSubmissionJobUploadStorageWithUploadPathPanel storageWithUploadPathPanel;
70+
private SparkSubmissionJobUploadStorageCtrl jobUploadStorageCtrl;
6871
private JPanel myWholePanel;
6972

7073
// Cluster refresh publish subject with preselected cluster name as event
@@ -73,8 +76,17 @@ public class SparkSubmissionContentPanelConfigurable implements SettableControl<
7376

7477
public SparkSubmissionContentPanelConfigurable(@NotNull Project project, @NotNull SparkSubmissionContentPanel submissionPanel) {
7578
this.submissionPanel = submissionPanel;
79+
this.storageWithUploadPathPanel = submissionPanel.storageWithUploadPathPanel;
7680
this.myProject = project;
7781

82+
this.jobUploadStorageCtrl = new SparkSubmissionJobUploadStorageCtrl(this.storageWithUploadPathPanel) {
83+
@Nullable
84+
@Override
85+
public String getClusterName() {
86+
IClusterDetail clusterDetail = getSelectedClusterDetail();
87+
return clusterDetail == null ? null : clusterDetail.getName();
88+
}
89+
};
7890
this.clustersRefreshSub = BehaviorSubject.create();
7991
}
8092

@@ -200,6 +212,7 @@ private DefaultComboBoxModel<IClusterDetail> getClusterComboBoxModel() {
200212

201213
protected void onClusterSelected(@NotNull IClusterDetail cluster) {
202214
getSubmissionPanel().getClusterSelectedSubject().onNext(cluster.getName());
215+
jobUploadStorageCtrl.selectCluster(cluster.getName());
203216
}
204217

205218
private synchronized void refreshClusterListAsync(@Nullable String preSelectedClusterName) {
@@ -288,6 +301,9 @@ public void setData(@NotNull SparkSubmitModel data) {
288301

289302
refreshAndSelectArtifact(data.getArtifactName());
290303
}, ModalityState.any());
304+
305+
// set Job Upload Storage panel data
306+
storageWithUploadPathPanel.setData(data.getJobUploadStorageModel());
291307
}
292308

293309
@Override
@@ -336,6 +352,9 @@ public void getData(@NotNull SparkSubmitModel data) {
336352
data.setCommandLineArgs(argsList);
337353

338354
data.setTableModel(tableModel);
355+
356+
// get Job upload storage panel data
357+
storageWithUploadPathPanel.getData(data.getJobUploadStorageModel());
339358
}
340359

341360
@Nullable
@@ -345,6 +364,11 @@ public IClusterDetail getSelectedClusterDetail() {
345364

346365
public void validate() throws ConfigurationException {
347366
getSubmissionPanel().checkInputs();
367+
368+
if (!jobUploadStorageCtrl.isCheckPassed()) {
369+
throw new RuntimeConfigurationError("Can't save the configuration since "
370+
+ jobUploadStorageCtrl.getResultMessage().toLowerCase());
371+
}
348372
}
349373

350374
public SparkSubmissionContentPanel getSubmissionPanel() {

PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/azure/hdinsight/spark/ui/SparkSubmissionDebuggablePanelConfigurable.kt

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,14 @@ class SparkSubmissionDebuggablePanelConfigurable(project: Project,
3939
private val advancedConfigPanel
4040
get() = submissionDebuggablePanel.advancedConfigPanel
4141

42-
private val storageWithUploadPathPanel
43-
get() = submissionDebuggablePanel.storageWithUploadPathPanel
44-
4542
private val advancedConfigCtrl = object : SparkSubmissionAdvancedConfigCtrl(advancedConfigPanel) {
4643
override fun getClusterNameToCheck(): String? = selectedClusterDetail?.name
4744
}
4845

49-
private val jobUploadStorageCtrl = object: SparkSubmissionJobUploadStorageCtrl(storageWithUploadPathPanel) {
50-
override fun getClusterName(): String? = selectedClusterDetail?.name
51-
}
52-
5346
override fun onClusterSelected(cluster: IClusterDetail) {
5447
super.onClusterSelected(cluster)
5548

5649
advancedConfigCtrl.selectCluster(cluster.name)
57-
jobUploadStorageCtrl.selectCluster(cluster.name)
5850
}
5951

6052
override fun setData(data: SparkSubmitModel) {
@@ -63,9 +55,6 @@ class SparkSubmissionDebuggablePanelConfigurable(project: Project,
6355

6456
// Advanced Configuration panel
6557
advancedConfigPanel.setData(data.advancedConfigModel.apply { clusterName = data.clusterName })
66-
67-
// Job Upload Storage panel
68-
storageWithUploadPathPanel.setData(data.jobUploadStorageModel)
6958
}
7059

7160
override fun getData(data: SparkSubmitModel) {
@@ -75,18 +64,11 @@ class SparkSubmissionDebuggablePanelConfigurable(project: Project,
7564
// Advanced Configuration panel
7665
advancedConfigPanel.getData(data.advancedConfigModel)
7766
data.advancedConfigModel.clusterName = selectedClusterDetail?.name
78-
79-
// Job upload storage panel
80-
storageWithUploadPathPanel.getData(data.jobUploadStorageModel)
8167
}
8268

8369
override fun validate() {
8470
super.validate()
8571

86-
if (!jobUploadStorageCtrl.isCheckPassed) {
87-
throw RuntimeConfigurationError("Can't save the configuration since ${jobUploadStorageCtrl.resultMessage}")
88-
}
89-
9072
if (advancedConfigPanel.isRemoteDebugEnabled) {
9173
if (advancedConfigCtrl.resultMessage.isNotBlank() &&
9274
!advancedConfigCtrl.isCheckPassed) {

0 commit comments

Comments
 (0)