-
Notifications
You must be signed in to change notification settings - Fork 14
feat: add multi-mode view for Flink Artifacts/UDFs #2313
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
fbf4034
0b70dc3
b5b670f
013b312
bf594cc
b0a3869
3d7e5dd
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Disposable } from "vscode"; | ||
import { registerCommandWithLogging } from "."; | ||
import { ContextValues, setContextValue } from "../context/values"; | ||
import { flinkArtifactUDFViewMode } from "../emitters"; | ||
import { FlinkArtifactsViewProviderMode } from "../viewProviders/multiViewDelegates/constants"; | ||
|
||
export async function setFlinkArtifactsViewModeCommand() { | ||
flinkArtifactUDFViewMode.fire(FlinkArtifactsViewProviderMode.Artifacts); | ||
await setContextValue( | ||
ContextValues.flinkArtifactsUDFsViewMode, | ||
FlinkArtifactsViewProviderMode.Artifacts, | ||
); | ||
} | ||
|
||
export function registerFlinkArtifactCommands(): Disposable[] { | ||
return [ | ||
registerCommandWithLogging( | ||
"confluent.flink.setArtifactsViewMode", | ||
setFlinkArtifactsViewModeCommand, | ||
), | ||
]; | ||
} |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Cerchie what do you think about if we moved the uploadUDF command into here as a more generalized command area for UDFs? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that jives with what we have for Flink statements etc... sure! |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Disposable } from "vscode"; | ||
import { registerCommandWithLogging } from "."; | ||
import { ContextValues, setContextValue } from "../context/values"; | ||
import { flinkArtifactUDFViewMode } from "../emitters"; | ||
import { FlinkArtifactsViewProviderMode } from "../viewProviders/multiViewDelegates/constants"; | ||
|
||
export async function setFlinkUDFViewModeCommand() { | ||
flinkArtifactUDFViewMode.fire(FlinkArtifactsViewProviderMode.UDFs); | ||
await setContextValue( | ||
ContextValues.flinkArtifactsUDFsViewMode, | ||
FlinkArtifactsViewProviderMode.UDFs, | ||
); | ||
} | ||
|
||
export function registerFlinkUDFCommands(): Disposable[] { | ||
return [ | ||
registerCommandWithLogging("confluent.flink.setUDFsViewMode", setFlinkUDFViewModeCommand), | ||
]; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,16 +54,19 @@ export enum ContextValues { | |
directKafkaClusterAvailable = "confluent.directKafkaClusterAvailable", | ||
/** A direct connection has been made and a Schema Registry is available for selecting in the Schemas view. */ | ||
directSchemaRegistryAvailable = "confluent.directSchemaRegistryAvailable", | ||
|
||
/** A resource has been selected for comparison. */ | ||
resourceSelectedForCompare = "confluent.resourceSelectedForCompare", | ||
/** The user clicked a Kafka cluster tree item. */ | ||
|
||
/** The user focused a Kafka cluster for the Topics view. */ | ||
kafkaClusterSelected = "confluent.kafkaClusterSelected", | ||
/** The user clicked a Schema Registry tree item. */ | ||
/** The user focused a Schema Registry for the Schemas view. */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is for key-navigation? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, these comment changes were just for clarity/accuracy since the event can fire if the "Select Kafka Cluster / Schema Registry" can be triggered from a quickpick as well as clicking on their respective tree items |
||
schemaRegistrySelected = "confluent.schemaRegistrySelected", | ||
/** The user focused a Flink compute pool for the Flink Statements view. */ | ||
flinkStatementsPoolSelected = "confluent.flinkStatementsPoolSelected", | ||
/** The user focused a Flink compute pool for the Flink Artifacts view. */ | ||
flinkArtifactsPoolSelected = "confluent.flinkArtifactsPoolSelected", | ||
|
||
/** The user applied a search string to the Resources view. */ | ||
resourceSearchApplied = "confluent.resourceSearchApplied", | ||
/** The user applied a search string to the Topics view. */ | ||
|
@@ -74,6 +77,10 @@ export enum ContextValues { | |
flinkStatementsSearchApplied = "confluent.flinkStatementsSearchApplied", | ||
/** The user applied a search string to the Flink Artifacts view. */ | ||
flinkArtifactsSearchApplied = "confluent.flinkArtifactsSearchApplied", | ||
|
||
/** The user changed the mode of the Flink Artifacts/UDFs view. */ | ||
flinkArtifactsUDFsViewMode = "confluent.flinkArtifactsUDFsViewMode", | ||
|
||
/** | ||
* EXPERIMENTAL: Is the chat participant enabled? | ||
* (This should go away once the `confluent.experimental.enableChatParticipant` setting is removed.) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,8 +24,10 @@ import { registerDockerCommands } from "./commands/docker"; | |
import { registerDocumentCommands } from "./commands/documents"; | ||
import { registerEnvironmentCommands } from "./commands/environments"; | ||
import { registerExtraCommands } from "./commands/extra"; | ||
import { registerFlinkArtifactCommands } from "./commands/flinkArtifacts"; | ||
import { registerFlinkComputePoolCommands } from "./commands/flinkComputePools"; | ||
import { registerFlinkStatementCommands } from "./commands/flinkStatements"; | ||
import { registerFlinkUDFCommands } from "./commands/flinkUDFs"; | ||
import { registerKafkaClusterCommands } from "./commands/kafkaClusters"; | ||
import { registerOrganizationCommands } from "./commands/organizations"; | ||
import { registerNewResourceViewCommands } from "./commands/resources"; | ||
|
@@ -84,8 +86,9 @@ import { getTelemetryLogger } from "./telemetry/telemetryLogger"; | |
import { getUriHandler } from "./uriHandler"; | ||
import { WriteableTmpDir } from "./utils/file"; | ||
import { RefreshableTreeViewProvider } from "./viewProviders/baseModels/base"; | ||
import { FlinkArtifactsViewProvider } from "./viewProviders/flinkArtifacts"; | ||
import { FlinkArtifactsUDFsViewProvider } from "./viewProviders/flinkArtifacts"; | ||
import { FlinkStatementsViewProvider } from "./viewProviders/flinkStatements"; | ||
import { FlinkArtifactsViewProviderMode } from "./viewProviders/multiViewDelegates/constants"; | ||
import { NewResourceViewProvider } from "./viewProviders/newResources"; | ||
import { ResourceViewProvider } from "./viewProviders/resources"; | ||
import { SchemasViewProvider } from "./viewProviders/schemas"; | ||
|
@@ -208,7 +211,7 @@ async function _activateExtension( | |
const topicViewProvider = TopicViewProvider.getInstance(); | ||
const schemasViewProvider = SchemasViewProvider.getInstance(); | ||
const statementsViewProvider = FlinkStatementsViewProvider.getInstance(); | ||
const artifactsViewProvider = FlinkArtifactsViewProvider.getInstance(); | ||
const artifactsViewProvider = FlinkArtifactsUDFsViewProvider.getInstance(); | ||
const supportViewProvider = new SupportViewProvider(); | ||
const viewProviderDisposables: vscode.Disposable[] = [ | ||
resourceViewProviderInstance, | ||
|
@@ -252,8 +255,10 @@ async function _activateExtension( | |
...registerExtraCommands(), | ||
...registerDockerCommands(), | ||
...registerProjectGenerationCommands(), | ||
...registerFlinkArtifactCommands(), | ||
...registerFlinkComputePoolCommands(), | ||
...registerFlinkStatementCommands(), | ||
...registerFlinkUDFCommands(), | ||
...registerDocumentCommands(), | ||
...registerSearchCommands(), | ||
registerUploadUDFCommand(), | ||
|
@@ -407,6 +412,11 @@ async function setupContextValues() { | |
SCHEMA_URI_SCHEME, | ||
MESSAGE_URI_SCHEME, | ||
]); | ||
// set the initial Flink artifacts view mode to "Artifacts" so the UDF mode toggle is visible | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if there's a way to set it to something like "last resource touched". Like, if the user was looking at a UDF and re-opens the sidebar, they see UDFs. Might be impossible? |
||
const flinkViewMode = setContextValue( | ||
ContextValues.flinkArtifactsUDFsViewMode, | ||
FlinkArtifactsViewProviderMode.Artifacts, | ||
); | ||
await Promise.all([ | ||
chatParticipantEnabled, | ||
kafkaClusterSelected, | ||
|
@@ -417,6 +427,7 @@ async function setupContextValues() { | |
resourcesWithNames, | ||
resourcesWithURIs, | ||
diffableResources, | ||
flinkViewMode, | ||
]); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,61 @@ | ||||||||||
import { ThemeIcon, TreeItem, TreeItemCollapsibleState } from "vscode"; | ||||||||||
import { ConnectionType } from "../clients/sidecar"; | ||||||||||
import { IconNames } from "../constants"; | ||||||||||
import { IdItem } from "./main"; | ||||||||||
import { ConnectionId, EnvironmentId, IResourceBase, ISearchable } from "./resource"; | ||||||||||
|
||||||||||
export class FlinkUdf implements IResourceBase, IdItem, ISearchable { | ||||||||||
connectionId!: ConnectionId; | ||||||||||
connectionType!: ConnectionType; | ||||||||||
// shoup: update this once https://github.com/confluentinc/vscode/issues/1385 is done | ||||||||||
iconName: IconNames = "code" as IconNames; | ||||||||||
|
||||||||||
environmentId!: EnvironmentId; | ||||||||||
|
||||||||||
id!: string; | ||||||||||
name!: string; | ||||||||||
description!: string; | ||||||||||
|
||||||||||
provider!: string; // cloud | ||||||||||
region!: string; | ||||||||||
|
||||||||||
constructor( | ||||||||||
props: Pick< | ||||||||||
FlinkUdf, | ||||||||||
| "connectionId" | ||||||||||
| "connectionType" | ||||||||||
| "environmentId" | ||||||||||
| "id" | ||||||||||
| "name" | ||||||||||
| "description" | ||||||||||
| "provider" | ||||||||||
| "region" | ||||||||||
>, | ||||||||||
) { | ||||||||||
this.connectionId = props.connectionId; | ||||||||||
this.connectionType = props.connectionType; | ||||||||||
this.environmentId = props.environmentId; | ||||||||||
this.id = props.id; | ||||||||||
this.name = props.name; | ||||||||||
this.description = props.description; | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The constructor assigns
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||||||
} | ||||||||||
|
||||||||||
searchableText(): string { | ||||||||||
return `${this.name} ${this.description}`; | ||||||||||
} | ||||||||||
} | ||||||||||
|
||||||||||
export class FlinkUdfTreeItem extends TreeItem { | ||||||||||
resource: FlinkUdf; | ||||||||||
|
||||||||||
constructor(resource: FlinkUdf) { | ||||||||||
super(resource.name, TreeItemCollapsibleState.None); | ||||||||||
|
||||||||||
this.id = resource.id; | ||||||||||
this.resource = resource; | ||||||||||
this.contextValue = `${resource.connectionType.toLowerCase()}-flink-udf`; | ||||||||||
|
||||||||||
this.iconPath = new ThemeIcon(resource.iconName); | ||||||||||
this.description = resource.description; | ||||||||||
} | ||||||||||
} |
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.
These icons make sense given what we have to work with, but I'm still not feeling that the functionality is obvious. Plus, as you mentioned, there was the idea of cycling through 3 modalities as well. I'll be interested to hear what design has to say