Skip to content

Commit 6a6b7f4

Browse files

File tree

5 files changed

+33
-13
lines changed

5 files changed

+33
-13
lines changed

packages/databricks-vscode/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,12 +282,12 @@
282282
},
283283
{
284284
"command": "databricks.cluster.stop",
285-
"when": "view == configurationView && viewItem == clusterRunning || view == configurationView && viewItem == clusterPending",
285+
"when": "view == configurationView && viewItem =~ /^databricks.cluster.(running|pending)$/",
286286
"group": "inline@0"
287287
},
288288
{
289289
"command": "databricks.cluster.start",
290-
"when": "view == configurationView && viewItem == clusterStopped",
290+
"when": "view == configurationView && viewItem == databricks.cluster.terminated",
291291
"group": "inline@0"
292292
},
293293
{

packages/databricks-vscode/src/cluster/ClusterListDataProvider.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
Event,
44
EventEmitter,
55
ProviderResult,
6+
ThemeColor,
67
ThemeIcon,
78
TreeDataProvider,
89
TreeItem,
@@ -84,7 +85,10 @@ export class ClusterListDataProvider
8485
break;
8586

8687
case "TERMINATING":
87-
icon = new ThemeIcon("stop-circle");
88+
icon = new ThemeIcon(
89+
"stop-circle",
90+
new ThemeColor("notificationsErrorIcon.foreground")
91+
);
8892
break;
8993

9094
case "TERMINATED":

packages/databricks-vscode/src/cluster/ClusterManager.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ export class ClusterManager implements Disposable {
5454
this.cancellationTokenSource?.cancel();
5555
this.cancellationTokenSource = new CancellationTokenSource();
5656

57-
//TODO: add cancellation and onProgress cb after adding these to API generator
5857
await this.cluster.stop(
5958
this.cancellationTokenSource.token,
6059
async (clusterInfo: cluster.ClusterInfo) =>

packages/databricks-vscode/src/configuration/ConfigurationDataProvider.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ describe(__filename, () => {
132132
},
133133
{
134134
collapsibleState: 2,
135-
contextValue: "clusterStopped",
135+
contextValue: "databricks.cluster.terminated",
136136
iconPath: {
137137
color: undefined,
138138
id: "server",

packages/databricks-vscode/src/configuration/ConfigurationDataProvider.ts

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,36 @@ export class ConfigurationDataProvider
8282
});
8383

8484
if (cluster) {
85+
let contextValue:
86+
| "databricks.cluster.running"
87+
| "databricks.cluster.pending"
88+
| "databricks.cluster.terminating"
89+
| "databricks.cluster.terminated" =
90+
"databricks.cluster.terminated";
91+
92+
switch (cluster.state) {
93+
case "RUNNING":
94+
contextValue = "databricks.cluster.running";
95+
break;
96+
case "PENDING":
97+
case "RESIZING":
98+
case "RESTARTING":
99+
contextValue = "databricks.cluster.pending";
100+
break;
101+
case "TERMINATING":
102+
contextValue = "databricks.cluster.terminating";
103+
break;
104+
case "TERMINATED":
105+
contextValue = "databricks.cluster.terminated";
106+
break;
107+
}
108+
85109
children.push({
86110
label: "Cluster",
87111
iconPath: new ThemeIcon("server"),
88112
id: "CLUSTER",
89113
collapsibleState: TreeItemCollapsibleState.Expanded,
90-
contextValue:
91-
cluster.state === "RUNNING"
92-
? "clusterRunning"
93-
: ["PENDING", "RESIZING", "RESTARTING"].includes(
94-
cluster.state
95-
)
96-
? "clusterPending"
97-
: "clusterStopped",
114+
contextValue,
98115
});
99116
} else {
100117
children.push({

0 commit comments

Comments
 (0)