Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection pane improvements #29

Closed

Conversation

skodman
Copy link
Contributor

@skodman skodman commented Mar 6, 2023

Created brixter.env environment to hold the data and reduce the number of API calls (if possible). I wanted to separate clusters by their purpose so I've added skodman_test element to the connections tree list with two leafs under neath: Personal and Job (left Pools from the list as we are not using those so i can't test, should probably be be added). Have a look at the brixter.env environment, get_clusters_2 and filter_clusters functions below. Was wondering if this is something you might want to consider and if so i can cleanup the code.
I've also made some changes to fix the name of the workspace in the Connections tab.

Nenad Nikolic and others added 8 commits January 26, 2023 19:16
…iew from the UC

2. changed get_tables() in connection-pane.R to receive dataframe containing table name and type extracted from UC
3. changed open_workspace() in connection-pane.R to use db_wsid() for workspace name
Added filtering function for clusters and sub-nodes for job and personal clusters. Dropped the data container file
@@ -2,6 +2,11 @@
# - can only return so many objects at once, how to paginate via UI?
# - impacts experiments, model registry, etc.

# adding new environment to hold the data.
brixter.env <- new.env()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added brixter.env to hold the data which can then be filtered without API calls

@codecov-commenter
Copy link

Codecov Report

Merging #29 (a7c1217) into main (c111be3) will decrease coverage by 0.16%.
The diff coverage is 0.00%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##             main      #29      +/-   ##
==========================================
- Coverage   11.74%   11.59%   -0.16%     
==========================================
  Files          22       22              
  Lines        2682     2717      +35     
==========================================
  Hits          315      315              
- Misses       2367     2402      +35     
Impacted Files Coverage Δ
R/connection-pane.R 0.00% <0.00%> (ø)
R/unity-catalog.R 0.00% <0.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

list(
name = as.character(glue::glue("[{x$state}] {x$cluster_name} ({x$cluster_id})")),
type = "cluster"
)
})
}


get_clusters_2 <- function(host, token) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function loads clusters into the brixter.env and just shows two leaves underneath. Those leaves are expanded on consecutive click when clusters are filtered from the brixter.env$cluster


}

filter_clusters <-function(lFilter){
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filter selected branch of clusters

...) {

if (!is.null(skodman_test)) {
#browser()
if(is.null(brixter.env$clusters)){
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checks if clusters are already loaded into the brixter.env

@@ -841,12 +916,14 @@ preview_object <- function(host, token, rowLimit,
#' open_workspace(host = db_host(), token = db_token, name = "MyWorkspace")
#' }
#' @importFrom glue glue
open_workspace <- function(host = db_host(), token = db_token(), name = NULL) {
open_workspace <- function(host = db_host(), token = db_token(), name = db_wsid()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes the name for Connections tab

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be open to making db_host() the default for name - that seems very sensible!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Id's tend to be tricky for people to remember which is which

Copy link
Contributor Author

@skodman skodman Mar 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, although the db_host() is equally confusing for me. Maybe introducing workspace alias (which would be up to user to define in .databrickscfg) is the way to go. There user could define test-ws, prod-ws etc, something that is readable.

@@ -925,9 +1005,13 @@ close_workspace <- function(host = db_host()) {
if (!is.null(observer)) {
observer$connectionClosed(type = "workspace", host = host)
}

# clean up .rs.WorkingDataEnv
rm(list=ls(envir =brixter.env),envir=brixter.env)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cleans up brixter.env variables

))
)
}


# clusters = list(contains = list(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll remove this

@zacdav-db
Copy link
Contributor

Will close this for now and re-visit connection pane ideas once I've implemented some changes to it's core behaviour that are required.

@zacdav-db zacdav-db closed this Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants