-
Notifications
You must be signed in to change notification settings - Fork 16
Allow submitting statement w/o catalog/database #2404
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -34,6 +34,8 @@ | |||||
| placeHolder?: string; | ||||||
| /** Function to filter the list of Kafka clusters before making quickpick items. */ | ||||||
| filter?: KafkaClusterFilter; | ||||||
| /** When true, adds a "Skip" option at the bottom of the list that returns undefined when selected */ | ||||||
| allowSkip?: boolean; | ||||||
| }; | ||||||
|
|
||||||
| /** | ||||||
|
|
@@ -56,7 +58,7 @@ | |||||
| * ---------------------------------- Other: directEnv1 | ||||||
| * direct-cluster1 (direct-cluster-id1) | ||||||
| */ | ||||||
| export async function kafkaClusterQuickPick( | ||||||
| options: KafkaClusterQuickPickOptions = {}, | ||||||
| ): Promise<KafkaCluster | undefined> { | ||||||
| const environments: Environment[] = []; | ||||||
|
|
@@ -157,6 +159,20 @@ | |||||
| }); | ||||||
| } | ||||||
|
|
||||||
| // Add skip option at the bottom if requested | ||||||
| if (options.allowSkip) { | ||||||
| clusterItems.push({ | ||||||
| kind: QuickPickItemKind.Separator, | ||||||
| label: "Must use fully qualified table name", | ||||||
| }); | ||||||
| clusterItems.push({ | ||||||
| label: "Skip", | ||||||
| description: "Continue without selecting a database", | ||||||
| iconPath: new ThemeIcon("testing-skipped-icon"), | ||||||
| value: null as any, | ||||||
| }); | ||||||
| } | ||||||
|
|
||||||
| // prompt the user to select a Kafka Cluster | ||||||
| const chosenClusterItem: QuickPickItemWithValue<KafkaCluster> | undefined = | ||||||
| await window.showQuickPick(clusterItems, { | ||||||
|
|
@@ -171,14 +187,15 @@ | |||||
| * @param computePool The compute pool to use as the context for the quickpick (limits to clusters in same cloud provider/region). | ||||||
| * @param placeholder Optionally override the placeholder text for the quickpick. | ||||||
| * Defaults to "Select the Kafka cluster to use as the default database for the statement". | ||||||
| * @returns chosen Kafka cluster or undefined if the user cancels the quickpick. | ||||||
| * @returns chosen Kafka cluster or undefined if the user cancels the quickpick or selects "Skip". | ||||||
|
||||||
| * @returns chosen Kafka cluster or undefined if the user cancels the quickpick or selects "Skip". | |
| * @returns chosen Kafka cluster, `null` if the user choose "Skip" (for Flink SQL statements), or undefined if the user cancels |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should update the return type of kafkaClusterQuickPick() as well as here:
| ): Promise<KafkaCluster | undefined> { | |
| ): Promise<KafkaCluster | null | undefined> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's also add allowSkip as a parameter to the flinkDatabaseQuickpick() function so it can be passed through from any callers. Currently, any callers of flinkDatabaseQuickpick() (like setting Flink defaults for the language server integration) will show the option to skip, and we only want this for the codelens implementation and setting document metadata, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using
null as anybypasses TypeScript's type safety. Consider defining the type properly or usingundefinedconsistently with the return typeKafkaCluster | undefined."There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@derek1ee I disagree with Copilot here and would rather we use
nullexplicitly so the extension can treat it as "user intentionally chose to skip" rather than the current cancellation treatment.