Skip to content

Commit

Permalink
Context menus everywhere (#1461)
Browse files Browse the repository at this point in the history
## 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? -->
  • Loading branch information
ilia-db authored Nov 25, 2024
1 parent 910dccb commit 9db90f8
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 4 deletions.
86 changes: 85 additions & 1 deletion packages/databricks-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -533,92 +533,176 @@
"when": "viewItem =~ /^databricks.*\\.(has-url).*$/ && databricks.context.bundle.deploymentState == idle",
"group": "inline@1"
},
{
"command": "databricks.utils.openExternal",
"when": "viewItem =~ /^databricks.*\\.(has-url).*$/ && databricks.context.bundle.deploymentState == idle",
"group": "navigation_2@0"
},
{
"command": "databricks.connection.attachCluster",
"when": "view == clusterView && databricks.context.bundle.deploymentState == idle",
"group": "inline@2"
},
{
"command": "databricks.connection.attachCluster",
"when": "view == clusterView && databricks.context.bundle.deploymentState == idle",
"group": "navigation@2"
},
{
"command": "databricks.connection.bundle.selectTarget",
"when": "view == configurationView && viewItem =~ /^databricks.configuration.target.*$/ && databricks.context.bundle.deploymentState == idle",
"group": "inline@2"
},
{
"command": "databricks.connection.bundle.selectTarget",
"when": "view == configurationView && viewItem =~ /^databricks.configuration.target.*$/ && databricks.context.bundle.deploymentState == idle",
"group": "navigation@2"
},
{
"command": "databricks.connection.configureLogin",
"when": "view == configurationView && viewItem =~ /^databricks.configuration.authType.*$/ && databricks.context.bundle.deploymentState == idle",
"group": "inline@2"
},
{
"command": "databricks.connection.configureLogin",
"when": "view == configurationView && viewItem =~ /^databricks.configuration.authType.*$/ && databricks.context.bundle.deploymentState == idle",
"group": "navigation@2"
},
{
"command": "databricks.connection.attachClusterQuickPick",
"when": "view == configurationView && viewItem =~ /^databricks.configuration.cluster.*$/ && databricks.context.bundle.deploymentState == idle",
"group": "inline@2"
},
{
"command": "databricks.connection.attachClusterQuickPick",
"when": "view == configurationView && viewItem =~ /^databricks.configuration.cluster.*$/ && databricks.context.bundle.deploymentState == idle",
"group": "navigation@2"
},
{
"command": "databricks.cluster.stop",
"when": "view == configurationView && viewItem =~ /^databricks.configuration.cluster.*\\.(running|pending).*$/ && databricks.context.bundle.deploymentState == idle",
"group": "inline@0"
},
{
"command": "databricks.cluster.stop",
"when": "view == configurationView && viewItem =~ /^databricks.configuration.cluster.*\\.(running|pending).*$/ && databricks.context.bundle.deploymentState == idle",
"group": "navigation@0"
},
{
"command": "databricks.cluster.start",
"when": "view == configurationView && viewItem =~ /databricks.configuration.cluster.*\\.terminated.*/ && databricks.context.bundle.deploymentState == idle",
"group": "inline@0"
},
{
"command": "databricks.cluster.start",
"when": "view == configurationView && viewItem =~ /databricks.configuration.cluster.*\\.terminated.*/ && databricks.context.bundle.deploymentState == idle",
"group": "navigation@0"
},
{
"command": "databricks.bundle.deployAndRunJob",
"when": "view == dabsResourceExplorerView && viewItem =~ /^databricks.bundle.resource=jobs.runnable.*$/ && databricks.context.bundle.deploymentState == idle",
"group": "inline@0"
},
{
"command": "databricks.bundle.deployAndRunJob",
"when": "view == dabsResourceExplorerView && viewItem =~ /^databricks.bundle.resource=jobs.runnable.*$/ && databricks.context.bundle.deploymentState == idle",
"group": "navigation@0"
},
{
"command": "databricks.bundle.deployAndRunPipeline",
"when": "view == dabsResourceExplorerView && viewItem =~ /^databricks.bundle.resource=pipelines.runnable.*$/ && databricks.context.bundle.deploymentState == idle",
"group": "inline@0"
},
{
"command": "databricks.bundle.deployAndRunPipeline",
"when": "view == dabsResourceExplorerView && viewItem =~ /^databricks.bundle.resource=pipelines.runnable.*$/ && databricks.context.bundle.deploymentState == idle",
"group": "navigation@0"
},
{
"command": "databricks.bundle.deployAndValidatePipeline",
"when": "view == dabsResourceExplorerView && viewItem =~ /^databricks.bundle.resource=pipelines.runnable.*$/ && databricks.context.bundle.deploymentState == idle",
"group": "inline@0"
},
{
"command": "databricks.bundle.deployAndValidatePipeline",
"when": "view == dabsResourceExplorerView && viewItem =~ /^databricks.bundle.resource=pipelines.runnable.*$/ && databricks.context.bundle.deploymentState == idle",
"group": "navigation@0"
},
{
"command": "databricks.bundle.deployAndRunSelectedTables",
"when": "view == dabsResourceExplorerView && viewItem =~ /^databricks.bundle.resource=pipelines.runnable.*$/ && databricks.context.bundle.deploymentState == idle",
"group": "inline@0"
},
{
"command": "databricks.bundle.deployAndRunSelectedTables",
"when": "view == dabsResourceExplorerView && viewItem =~ /^databricks.bundle.resource=pipelines.runnable.*$/ && databricks.context.bundle.deploymentState == idle",
"group": "navigation@0"
},
{
"command": "databricks.bundle.cancelRun",
"when": "view == dabsResourceExplorerView && viewItem =~ /^databricks.bundle.*.cancellable.*$/ && databricks.context.bundle.deploymentState == idle",
"group": "inline@0"
},
{
"command": "databricks.utils.copy",
"when": "view == dabsResourceExplorerView || view == configurationView"
"when": "view == dabsResourceExplorerView || view == configurationView",
"group": "navigation_2@0"
},
{
"command": "databricks.environment.refresh",
"when": "view == configurationView && viewItem =~ /^databricks.environment.root.(success|error)$/",
"group": "inline@0",
"icon": "$(refresh)"
},
{
"command": "databricks.environment.refresh",
"when": "view == configurationView && viewItem =~ /^databricks.environment.root.(success|error)$/",
"group": "navigation@0",
"icon": "$(refresh)"
},
{
"command": "databricks.environment.selectPythonInterpreter",
"when": "view == configurationView && viewItem =~ /^databricks.environment.checkPythonEnvironment.success$/",
"group": "inline@0",
"icon": "$(gear)"
},
{
"command": "databricks.environment.selectPythonInterpreter",
"when": "view == configurationView && viewItem =~ /^databricks.environment.checkPythonEnvironment.success$/",
"group": "navigation@0",
"icon": "$(gear)"
},
{
"command": "databricks.environment.reinstallDBConnect",
"when": "view == configurationView && viewItem =~ /^databricks.environment.checkEnvironmentDependencies.success$/",
"group": "inline@0",
"icon": "$(gear)"
},
{
"command": "databricks.environment.reinstallDBConnect",
"when": "view == configurationView && viewItem =~ /^databricks.environment.checkEnvironmentDependencies.success$/",
"group": "navigation@0",
"icon": "$(gear)"
},
{
"command": "databricks.sync.start",
"when": "view == configurationView && viewItem =~ /^databricks.*sync.*is-stopped.*$/ && databricks.context.bundle.isDevTarget",
"group": "inline@0"
},
{
"command": "databricks.sync.start",
"when": "view == configurationView && viewItem =~ /^databricks.*sync.*is-stopped.*$/ && databricks.context.bundle.isDevTarget",
"group": "navigation@0"
},
{
"command": "databricks.sync.stop",
"when": "view == configurationView && viewItem =~ /^databricks.*sync.*is-running.*$/ && databricks.context.bundle.isDevTarget",
"group": "inline@0"
},
{
"command": "databricks.sync.stop",
"when": "view == configurationView && viewItem =~ /^databricks.*sync.*is-running.*$/ && databricks.context.bundle.isDevTarget",
"group": "navigation@0"
}
],
"editor/title": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,35 @@ describe(__filename, () => {
assert(datasets.has("table3"));
assert(datasets.has("table4"));

/* eslint-disable @typescript-eslint/naming-convention */
const uncompletedFullRefreshRun = {
data: {
creation_time: 200,
refresh_selection: [],
state: "RUNNING",
},
events: [
{origin: {dataset_name: "table_new"}},
{origin: {not_a_dataset_name: "not a table"}},
{origin: {dataset_name: "table_final"}},
],
};
/* eslint-enable @typescript-eslint/naming-convention */
runStatuses.set("pipelines.pipeline1", uncompletedFullRefreshRun);
eventEmitter.fire();
await clock.runToLastAsync();

datasets = manager.getDatasets("pipeline1");
assert.strictEqual(datasets.size, 6);
assert(datasets.has("table_new"));
assert(datasets.has("table_final"));

/* eslint-disable @typescript-eslint/naming-convention */
const finalFullRefreshRun = {
data: {
creation_time: 200,
refresh_selection: [],
state: "COMPLETED",
},
events: [
{origin: {dataset_name: "table_new"}},
Expand Down
10 changes: 7 additions & 3 deletions packages/databricks-vscode/src/bundle/BundlePipelinesManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,11 @@ export class BundlePipelinesManager {
disposables.forEach((d) => d.dispose());
ui.dispose();
isUIVisible = false;
if (isPickSelected(ui, fullRefreshPick)) {
if (
selectedTables &&
selectedTables.length > 0 &&
isPickSelected(ui, fullRefreshPick)
) {
switch (await confirmFullRefresh()) {
case "Yes":
return {tables: selectedTables, fullRefresh: true};
Expand Down Expand Up @@ -260,7 +264,7 @@ async function confirmFullRefresh() {
}

function isFullGraphUpdate(update?: UpdateInfo) {
if (!update) {
if (!update || update.state !== "COMPLETED") {
return false;
}
return (
Expand Down Expand Up @@ -321,7 +325,7 @@ function createPicks(datasets: Set<string>, manualValue?: string) {
};
const fullRefreshPick: Pick = {
label: "Full Refresh",
description: "Truncate and recopmute tables",
description: "Truncate and recopmute selected tables",
alwaysShow: true,
};
const ui = window.createQuickPick<Pick>();
Expand Down

0 comments on commit 9db90f8

Please sign in to comment.