Skip to content

Commit 9db90f8

Browse files
authored
Context menus everywhere (#1461)
## Changes + Sadly all commands had to be duplicated in the package.json + Fix small issues with pipeline manager Screenshots: <img width="512" alt="Screenshot 2024-11-20 at 16 47 02" src="https://github.com/user-attachments/assets/584acf85-487f-4651-945d-1bd14da39bd7"> <img width="730" alt="Screenshot 2024-11-20 at 16 46 30" src="https://github.com/user-attachments/assets/ecf643f6-0244-436e-a241-dda4160496ca"> <img width="591" alt="Screenshot 2024-11-20 at 16 46 42" src="https://github.com/user-attachments/assets/08f63ed2-4d65-4005-b8dc-daeb2a70e424"> ## Tests <!-- How is this tested? -->
1 parent 910dccb commit 9db90f8

File tree

3 files changed

+116
-4
lines changed

3 files changed

+116
-4
lines changed

packages/databricks-vscode/package.json

Lines changed: 85 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,92 +533,176 @@
533533
"when": "viewItem =~ /^databricks.*\\.(has-url).*$/ && databricks.context.bundle.deploymentState == idle",
534534
"group": "inline@1"
535535
},
536+
{
537+
"command": "databricks.utils.openExternal",
538+
"when": "viewItem =~ /^databricks.*\\.(has-url).*$/ && databricks.context.bundle.deploymentState == idle",
539+
"group": "navigation_2@0"
540+
},
536541
{
537542
"command": "databricks.connection.attachCluster",
538543
"when": "view == clusterView && databricks.context.bundle.deploymentState == idle",
539544
"group": "inline@2"
540545
},
546+
{
547+
"command": "databricks.connection.attachCluster",
548+
"when": "view == clusterView && databricks.context.bundle.deploymentState == idle",
549+
"group": "navigation@2"
550+
},
541551
{
542552
"command": "databricks.connection.bundle.selectTarget",
543553
"when": "view == configurationView && viewItem =~ /^databricks.configuration.target.*$/ && databricks.context.bundle.deploymentState == idle",
544554
"group": "inline@2"
545555
},
556+
{
557+
"command": "databricks.connection.bundle.selectTarget",
558+
"when": "view == configurationView && viewItem =~ /^databricks.configuration.target.*$/ && databricks.context.bundle.deploymentState == idle",
559+
"group": "navigation@2"
560+
},
546561
{
547562
"command": "databricks.connection.configureLogin",
548563
"when": "view == configurationView && viewItem =~ /^databricks.configuration.authType.*$/ && databricks.context.bundle.deploymentState == idle",
549564
"group": "inline@2"
550565
},
566+
{
567+
"command": "databricks.connection.configureLogin",
568+
"when": "view == configurationView && viewItem =~ /^databricks.configuration.authType.*$/ && databricks.context.bundle.deploymentState == idle",
569+
"group": "navigation@2"
570+
},
551571
{
552572
"command": "databricks.connection.attachClusterQuickPick",
553573
"when": "view == configurationView && viewItem =~ /^databricks.configuration.cluster.*$/ && databricks.context.bundle.deploymentState == idle",
554574
"group": "inline@2"
555575
},
576+
{
577+
"command": "databricks.connection.attachClusterQuickPick",
578+
"when": "view == configurationView && viewItem =~ /^databricks.configuration.cluster.*$/ && databricks.context.bundle.deploymentState == idle",
579+
"group": "navigation@2"
580+
},
556581
{
557582
"command": "databricks.cluster.stop",
558583
"when": "view == configurationView && viewItem =~ /^databricks.configuration.cluster.*\\.(running|pending).*$/ && databricks.context.bundle.deploymentState == idle",
559584
"group": "inline@0"
560585
},
586+
{
587+
"command": "databricks.cluster.stop",
588+
"when": "view == configurationView && viewItem =~ /^databricks.configuration.cluster.*\\.(running|pending).*$/ && databricks.context.bundle.deploymentState == idle",
589+
"group": "navigation@0"
590+
},
561591
{
562592
"command": "databricks.cluster.start",
563593
"when": "view == configurationView && viewItem =~ /databricks.configuration.cluster.*\\.terminated.*/ && databricks.context.bundle.deploymentState == idle",
564594
"group": "inline@0"
565595
},
596+
{
597+
"command": "databricks.cluster.start",
598+
"when": "view == configurationView && viewItem =~ /databricks.configuration.cluster.*\\.terminated.*/ && databricks.context.bundle.deploymentState == idle",
599+
"group": "navigation@0"
600+
},
566601
{
567602
"command": "databricks.bundle.deployAndRunJob",
568603
"when": "view == dabsResourceExplorerView && viewItem =~ /^databricks.bundle.resource=jobs.runnable.*$/ && databricks.context.bundle.deploymentState == idle",
569604
"group": "inline@0"
570605
},
606+
{
607+
"command": "databricks.bundle.deployAndRunJob",
608+
"when": "view == dabsResourceExplorerView && viewItem =~ /^databricks.bundle.resource=jobs.runnable.*$/ && databricks.context.bundle.deploymentState == idle",
609+
"group": "navigation@0"
610+
},
571611
{
572612
"command": "databricks.bundle.deployAndRunPipeline",
573613
"when": "view == dabsResourceExplorerView && viewItem =~ /^databricks.bundle.resource=pipelines.runnable.*$/ && databricks.context.bundle.deploymentState == idle",
574614
"group": "inline@0"
575615
},
616+
{
617+
"command": "databricks.bundle.deployAndRunPipeline",
618+
"when": "view == dabsResourceExplorerView && viewItem =~ /^databricks.bundle.resource=pipelines.runnable.*$/ && databricks.context.bundle.deploymentState == idle",
619+
"group": "navigation@0"
620+
},
576621
{
577622
"command": "databricks.bundle.deployAndValidatePipeline",
578623
"when": "view == dabsResourceExplorerView && viewItem =~ /^databricks.bundle.resource=pipelines.runnable.*$/ && databricks.context.bundle.deploymentState == idle",
579624
"group": "inline@0"
580625
},
626+
{
627+
"command": "databricks.bundle.deployAndValidatePipeline",
628+
"when": "view == dabsResourceExplorerView && viewItem =~ /^databricks.bundle.resource=pipelines.runnable.*$/ && databricks.context.bundle.deploymentState == idle",
629+
"group": "navigation@0"
630+
},
581631
{
582632
"command": "databricks.bundle.deployAndRunSelectedTables",
583633
"when": "view == dabsResourceExplorerView && viewItem =~ /^databricks.bundle.resource=pipelines.runnable.*$/ && databricks.context.bundle.deploymentState == idle",
584634
"group": "inline@0"
585635
},
636+
{
637+
"command": "databricks.bundle.deployAndRunSelectedTables",
638+
"when": "view == dabsResourceExplorerView && viewItem =~ /^databricks.bundle.resource=pipelines.runnable.*$/ && databricks.context.bundle.deploymentState == idle",
639+
"group": "navigation@0"
640+
},
586641
{
587642
"command": "databricks.bundle.cancelRun",
588643
"when": "view == dabsResourceExplorerView && viewItem =~ /^databricks.bundle.*.cancellable.*$/ && databricks.context.bundle.deploymentState == idle",
589644
"group": "inline@0"
590645
},
591646
{
592647
"command": "databricks.utils.copy",
593-
"when": "view == dabsResourceExplorerView || view == configurationView"
648+
"when": "view == dabsResourceExplorerView || view == configurationView",
649+
"group": "navigation_2@0"
594650
},
595651
{
596652
"command": "databricks.environment.refresh",
597653
"when": "view == configurationView && viewItem =~ /^databricks.environment.root.(success|error)$/",
598654
"group": "inline@0",
599655
"icon": "$(refresh)"
600656
},
657+
{
658+
"command": "databricks.environment.refresh",
659+
"when": "view == configurationView && viewItem =~ /^databricks.environment.root.(success|error)$/",
660+
"group": "navigation@0",
661+
"icon": "$(refresh)"
662+
},
601663
{
602664
"command": "databricks.environment.selectPythonInterpreter",
603665
"when": "view == configurationView && viewItem =~ /^databricks.environment.checkPythonEnvironment.success$/",
604666
"group": "inline@0",
605667
"icon": "$(gear)"
606668
},
669+
{
670+
"command": "databricks.environment.selectPythonInterpreter",
671+
"when": "view == configurationView && viewItem =~ /^databricks.environment.checkPythonEnvironment.success$/",
672+
"group": "navigation@0",
673+
"icon": "$(gear)"
674+
},
607675
{
608676
"command": "databricks.environment.reinstallDBConnect",
609677
"when": "view == configurationView && viewItem =~ /^databricks.environment.checkEnvironmentDependencies.success$/",
610678
"group": "inline@0",
611679
"icon": "$(gear)"
612680
},
681+
{
682+
"command": "databricks.environment.reinstallDBConnect",
683+
"when": "view == configurationView && viewItem =~ /^databricks.environment.checkEnvironmentDependencies.success$/",
684+
"group": "navigation@0",
685+
"icon": "$(gear)"
686+
},
613687
{
614688
"command": "databricks.sync.start",
615689
"when": "view == configurationView && viewItem =~ /^databricks.*sync.*is-stopped.*$/ && databricks.context.bundle.isDevTarget",
616690
"group": "inline@0"
617691
},
692+
{
693+
"command": "databricks.sync.start",
694+
"when": "view == configurationView && viewItem =~ /^databricks.*sync.*is-stopped.*$/ && databricks.context.bundle.isDevTarget",
695+
"group": "navigation@0"
696+
},
618697
{
619698
"command": "databricks.sync.stop",
620699
"when": "view == configurationView && viewItem =~ /^databricks.*sync.*is-running.*$/ && databricks.context.bundle.isDevTarget",
621700
"group": "inline@0"
701+
},
702+
{
703+
"command": "databricks.sync.stop",
704+
"when": "view == configurationView && viewItem =~ /^databricks.*sync.*is-running.*$/ && databricks.context.bundle.isDevTarget",
705+
"group": "navigation@0"
622706
}
623707
],
624708
"editor/title": [

packages/databricks-vscode/src/bundle/BundlePipelinesManager.test.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,35 @@ describe(__filename, () => {
9191
assert(datasets.has("table3"));
9292
assert(datasets.has("table4"));
9393

94+
/* eslint-disable @typescript-eslint/naming-convention */
95+
const uncompletedFullRefreshRun = {
96+
data: {
97+
creation_time: 200,
98+
refresh_selection: [],
99+
state: "RUNNING",
100+
},
101+
events: [
102+
{origin: {dataset_name: "table_new"}},
103+
{origin: {not_a_dataset_name: "not a table"}},
104+
{origin: {dataset_name: "table_final"}},
105+
],
106+
};
107+
/* eslint-enable @typescript-eslint/naming-convention */
108+
runStatuses.set("pipelines.pipeline1", uncompletedFullRefreshRun);
109+
eventEmitter.fire();
110+
await clock.runToLastAsync();
111+
112+
datasets = manager.getDatasets("pipeline1");
113+
assert.strictEqual(datasets.size, 6);
114+
assert(datasets.has("table_new"));
115+
assert(datasets.has("table_final"));
116+
94117
/* eslint-disable @typescript-eslint/naming-convention */
95118
const finalFullRefreshRun = {
96119
data: {
97120
creation_time: 200,
98121
refresh_selection: [],
122+
state: "COMPLETED",
99123
},
100124
events: [
101125
{origin: {dataset_name: "table_new"}},

packages/databricks-vscode/src/bundle/BundlePipelinesManager.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,11 @@ export class BundlePipelinesManager {
229229
disposables.forEach((d) => d.dispose());
230230
ui.dispose();
231231
isUIVisible = false;
232-
if (isPickSelected(ui, fullRefreshPick)) {
232+
if (
233+
selectedTables &&
234+
selectedTables.length > 0 &&
235+
isPickSelected(ui, fullRefreshPick)
236+
) {
233237
switch (await confirmFullRefresh()) {
234238
case "Yes":
235239
return {tables: selectedTables, fullRefresh: true};
@@ -260,7 +264,7 @@ async function confirmFullRefresh() {
260264
}
261265

262266
function isFullGraphUpdate(update?: UpdateInfo) {
263-
if (!update) {
267+
if (!update || update.state !== "COMPLETED") {
264268
return false;
265269
}
266270
return (
@@ -321,7 +325,7 @@ function createPicks(datasets: Set<string>, manualValue?: string) {
321325
};
322326
const fullRefreshPick: Pick = {
323327
label: "Full Refresh",
324-
description: "Truncate and recopmute tables",
328+
description: "Truncate and recopmute selected tables",
325329
alwaysShow: true,
326330
};
327331
const ui = window.createQuickPick<Pick>();

0 commit comments

Comments
 (0)