Skip to content
This repository was archived by the owner on Feb 21, 2024. It is now read-only.

Commit 624bef5

Browse files
authored
Merge pull request #31 from develop-for-apache-pulsar/28-function-manifest-code-lens
28 function manifest code lens
2 parents 4dd7635 + d7bfdb5 commit 624bef5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+2506
-625
lines changed

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,28 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.5.0]
9+
10+
### Added
11+
12+
- Progress runner for long-running actions
13+
- Zip utility for packaging functions
14+
- Code lens for yaml function manifests
15+
- Document helper to open json & yaml files
16+
- Output logger
17+
18+
### Changed
19+
20+
- Folder structure to be more like a microservice controller/service style
21+
- Function management to use the new task runner
22+
- Function management to use the new zip utility
23+
- Function management to use the new code lens
24+
- Topics to use the new document helper
25+
- Function to use the new document helper
26+
- All debugging outputs to use the new output logger
27+
28+
Contributors: ddieruf
29+
830
## [0.4.0]
931

1032
### Fixed

README.adoc

Lines changed: 72 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,17 @@ This extension provides support for https://pulsar.apache.org/[Apache Pulsar^] i
2525
- Start, stop, restart, delete function
2626
- Start, stop function instances
2727
- Delete function
28+
- Create new function**
29+
- Auto sense a function manifest and show deploy shortcuts**
30+
- Auto sense a function manifest and show runtime package options
31+
+
32+
----
33+
py: choose .py file or choose a folder to (automatically) zip
34+
java: choose .jar or .nar file
35+
go: choose go executable
36+
----
37+
38+
**{sp}This feature is not compatible with Pulsar 3.0
2839
2940
== Getting Started
3041
@@ -60,10 +71,69 @@ If you work with a managed provider of Apache Pulsar, let's create a provider fo
6071
6172
Not all providers are created the same. Some use tokens some don't. Some managed version of Pulsar don't support all the features of an OSS cluster. This extension tries to be as flexible as possible to support all the different providers, while still giving the consumer a consistent experience.
6273
63-
== Contributing
74+
== Output for debugging
6475
65-
All contributors are welcome! It helps if you are familiar with Typescript (that's what the extension is written in), but it's not required. If you are interested in contributing, please reach out to us.
76+
While using the extension you may want to see output of what is going on in the background. To do this, open the VSCode output panel and select the 'Develop for Apache Pulsar' output channel. This will show you the logs from the extension.
6677
6778
== Roadmap of your ideas
6879
6980
We've got high hopes for this extension. If you have an idea of a feature that would make it even better, please open an issue and let's discuss it! You can review the current roadmap in https://github.com/orgs/develop-for-apache-pulsar/projects/1[the GitHub project].
81+
82+
== Contributing
83+
84+
All contributors are welcome! It helps if you are familiar with Typescript (that's what the extension is written in), but it's not required. If you are interested in contributing, please reach out to us.
85+
86+
=== Project Structure
87+
88+
Let's use the folder structure of the project to explain how things are laid out.
89+
90+
==== images
91+
92+
This is a folder for images used in the README and other documentation. All features that include icons and images should respect the chosen theme. If you are adding a new feature, please add a light and dark version of the image. No matter where the image in used in code, it should be referenced from this folder. VSCode is picky about svg's sometimes, so if you are having trouble with an image, try converting it to a png.
93+
94+
==== scripts
95+
96+
This is a folder for javascript used in webpanels. A webpanel is just a mini browser serving up html, with support for javascript actions. VSCode provides workers to do messaging between the browser and the background process. No matter where the javascript is used, it should be references from this folder.
97+
98+
==== src
99+
100+
**common** - holds .ts classes that are commonly used throughout the project. Currently, it's just the constants.
101+
102+
**controllers** - think of this in the same way a microservice's folders are laid out. The public facing functions (endpoints) are the controllers. The endpoints declared in a controller have no logic. They just marshall request/response actions. Like cancellation tokens, global libs, and translating exceptions to response statuses.
103+
104+
In this project, a controller is allowed to reference the (global) vscode lib but all lower classes that the controller depends on can not import vscode. If something is needed (like a context value), the contoller needs to handle getting that info to the dependent lib.
105+
106+
The execution of a controller almost always traces back to a declared VSCode command.
107+
108+
TODO: Controllers are fire and forget
109+
110+
**providers** - these are extensions of VSCode objects. Typically, when an extension wants to implement a given feature of VSCode (like a folder tree or a document editor) it uses the provided interface from the vscode lib. Each folder in this folder represent an implementation of the given object.
111+
112+
**pulsarAdminProviders** - this is specific to this extension. The idea is to make adding providers as easy and clear as possible. Each provider is a folder within this folder. There are 2 required files in a given provider's folder. +
113+
114+
- provider.ts: this is the provider's implementation of pulsar admin. Typically it's going to take a signature of:
115+
+
116+
[source, typescript]
117+
====
118+
export class Provider extends BaseProvider implements TPulsarAdmin {}
119+
====
120+
121+
- settings.ts: this is the provider's declaration of its service (icon, display name, etc). Nested in this class is the provider's onboarding implementation. That is how one discovers their pulsar clusters hosted with the provider and saves a reference in this extension.
122+
123+
There is also a 'base' provider. Most providers will extend the base and override functions when needed.
124+
125+
**services** - these are classes that are used throughout the project. They hold the logic of how the given function is completed while interacting with a Pulsar cluster. They are not dependent on vscode so testing should be quite easy.
126+
127+
**test** - this is where... you guess it, tests are located. Testing VSCode extensions are notoriously hard. But the founder of this project is a big believer in test driven development, so a compromise had to be met. The 'integration' folder holds tests that use the recommended electron approach. Attempting to run VSCode in memory and test an extension's features. The 'unit' folder holds smaller bite size tests that don't need VSCode. Remember the design of controllers and providers? Their dependent classes don't import vscode which makes them very testable.
128+
129+
**types** - all declared typescript types in this project live here. For the most part, interfaces are not used. Instead, they are a 'type'.
130+
131+
**utils** - simple utility classes used throughout the project.
132+
133+
**wizards** - certain actions (like creating a topic or discovering new clusters) have multiple steps for completion. These wizards are used throughout the project.
134+
135+
**extension.ts** - VSCode's activation of the extension and all it's features.
136+
137+
==== styles
138+
139+
A complement to the scripts folder, holding styles used in webpanels. Same rules apply.

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,16 @@ This extension provides support for [Apache Pulsar](https://pulsar.apache.org/)
2222
- Start, stop, restart, delete function
2323
- Start, stop function instances
2424
- Delete function
25+
- Create new function**
26+
- Auto sense a function manifest and show deploy shortcuts**
27+
- Auto sense a function manifest and show runtime package options
28+
29+
```
30+
py: choose .py file or choose a folder to (automatically) zip
31+
java: choose .jar or .nar file
32+
go: choose go executable
33+
```
34+
35+
** This feature is not compatible with Pulsar 3.0
2536
2637
Once installed you'll notice a new Pulsar icon in the activity bar. Click it to activate the extension and see the option to save your providers' configuration.

package-lock.json

Lines changed: 15 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "develop-for-apache-pulsar",
33
"displayName": "Develop for Apache Pulsar",
44
"description": "Develop applications that use Apache Pulsar",
5-
"version": "0.4.0",
5+
"version": "0.5.0",
66
"publisher": "DataStax",
77
"engines": {
88
"vscode": "^1.77.0"
@@ -60,6 +60,7 @@
6060
"chai": "^4.3.7",
6161
"css-loader": "^6.7.3",
6262
"eslint": "^8.39.0",
63+
"fflate": "^0.8.0",
6364
"file-loader": "^6.2.0",
6465
"glob": "^8.1.0",
6566
"mocha": "^10.2.0",
@@ -172,7 +173,11 @@
172173
"when": "view == extension.vsPulsarClusterExplorer && viewItem == vsDevelopPulsar.namespace",
173174
"group": "0@1"
174175
},
175-
176+
{
177+
"command": "extension.vsDevelopPulsarCreateFunction",
178+
"when": "view == extension.vsPulsarClusterExplorer && viewItem == vsDevelopPulsar.namespace",
179+
"group": "0@2"
180+
},
176181
{
177182
"command": "extension.vsDevelopPulsarTopicStatistics",
178183
"when": "view == extension.vsPulsarClusterExplorer && viewItem =~ /vsDevelopPulsar\\.topic/i",
@@ -183,6 +188,11 @@
183188
"when": "view == extension.vsPulsarClusterExplorer && viewItem =~ /vsDevelopPulsar\\.topic/i",
184189
"group": "0@2"
185190
},
191+
{
192+
"command": "extension.vsDevelopPulsarTopicCopyAddress",
193+
"when": "view == extension.vsPulsarClusterExplorer && viewItem =~ /vsDevelopPulsar\\.topic/i",
194+
"group": "0@3"
195+
},
186196
{
187197
"command": "extension.vsDevelopPulsarWatchTopicMessages",
188198
"when": "view == extension.vsPulsarClusterExplorer && viewItem =~ /vsDevelopPulsar\\.topic/i",
@@ -198,7 +208,6 @@
198208
"when": "view == extension.vsPulsarClusterExplorer && viewItem =~ /vsDevelopPulsar\\.topic/i",
199209
"group": "2@1"
200210
},
201-
202211
{
203212
"command": "extension.vsDevelopPulsarFunctionInfo",
204213
"when": "view == extension.vsPulsarClusterExplorer && viewItem =~ /vsDevelopPulsar\\.function\\.function\\..*/i",
@@ -239,8 +248,6 @@
239248
"when": "view == extension.vsPulsarClusterExplorer && viewItem =~ /vsDevelopPulsar\\.function\\.function\\..*/i",
240249
"group": "2@0"
241250
},
242-
243-
244251
{
245252
"command": "extension.vsDevelopPulsarStartFunctionInstance",
246253
"when": "view == extension.vsPulsarClusterExplorer && viewItem =~ /vsDevelopPulsar\\.function\\.instance\\..*\\.stopped/i",
@@ -283,7 +290,12 @@
283290
},
284291
{
285292
"command": "extension.vsDevelopPulsarCreateTopic",
286-
"title": "Create topic",
293+
"title": "New topic",
294+
"category": "DevelopPulsar"
295+
},
296+
{
297+
"command": "extension.vsDevelopPulsarCreateFunction",
298+
"title": "New function",
287299
"category": "DevelopPulsar"
288300
},
289301
{
@@ -296,6 +308,11 @@
296308
"title": "Statistics",
297309
"category": "DevelopPulsar"
298310
},
311+
{
312+
"command": "extension.vsDevelopPulsarTopicCopyAddress",
313+
"title": "Copy address",
314+
"category": "DevelopPulsar"
315+
},
299316
{
300317
"command": "extension.vsDevelopPulsarTopicProperties",
301318
"title": "Properties",
@@ -306,8 +323,6 @@
306323
"title": "Delete",
307324
"category": "DevelopPulsar"
308325
},
309-
310-
311326
{
312327
"command": "extension.vsDevelopPulsarStartFunction",
313328
"title": "Start",
@@ -348,8 +363,6 @@
348363
"title": "Delete",
349364
"category": "DevelopPulsar"
350365
},
351-
352-
353366
{
354367
"command": "extension.vsDevelopPulsarStartFunctionInstance",
355368
"title": "Start",

src/common/constants.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ export const COMMAND_ADD_CLUSTER_CONFIG = 'extension.vsDevelopPulsarAddClusterCo
1515
export const COMMAND_REMOVE_CLUSTER_CONFIG = 'extension.vsDevelopPulsarRemoveClusterConfig';
1616
export const COMMAND_WATCH_TOPIC_MESSAGES = 'extension.vsDevelopPulsarWatchTopicMessages';
1717
export const COMMAND_CREATE_TOPIC = 'extension.vsDevelopPulsarCreateTopic';
18+
export const COMMAND_CREATE_FUNCTION = 'extension.vsDevelopPulsarCreateFunction';
1819
export const COMMAND_SHOW_TOPIC_SCHEMA = 'extension.vsDevelopPulsarShowTopicSchema';
1920
export const COMMAND_TOPIC_STATISTICS = 'extension.vsDevelopPulsarTopicStatistics';
2021
export const COMMAND_TOPIC_PROPERTIES = 'extension.vsDevelopPulsarTopicProperties';
22+
export const COMMAND_TOPIC_COPY_ADDRESS = 'extension.vsDevelopPulsarTopicCopyAddress';
2123
export const COMMAND_DELETE_TOPIC = 'extension.vsDevelopPulsarDeleteTopic';
2224
export const COMMAND_STOP_FUNCTION = 'extension.vsDevelopPulsarStopFunction';
2325
export const COMMAND_RESTART_FUNCTION = 'extension.vsDevelopPulsarRestartFunction';
@@ -27,15 +29,16 @@ export const COMMAND_FUNCTION_STATUS = 'extension.vsDevelopPulsarFunctionStatus'
2729
export const COMMAND_FUNCTION_INFO = 'extension.vsDevelopPulsarFunctionInfo';
2830
export const COMMAND_FUNCTION_DELETE = 'extension.vsDevelopPulsarFunctionDelete';
2931
export const COMMAND_FUNCTION_WATCH_TOPICS = 'extension.vsDevelopPulsarWatchFunctionTopics';
32+
export const COMMAND_DEPLOY_FUNCTION = 'extension.vsDevelopPulsarDeployFunction';
3033
export const COMMAND_STOP_FUNCTION_INSTANCE = 'extension.vsDevelopPulsarStopFunctionInstance';
3134
export const COMMAND_RESTART_FUNCTION_INSTANCE = 'extension.vsDevelopPulsarRestartFunctionInstance';
3235
export const COMMAND_START_FUNCTION_INSTANCE = 'extension.vsDevelopPulsarStartFunctionInstance';
36+
export const COMMAND_FUNCTION_PACKAGE_CHOOSER = 'extension.vsDevelopPulsarFunctionPackageChooser';
3337

3438
// PROVIDERS
3539
export const PROVIDER_CLUSTER_TREE = 'extension.vsPulsarClusterExplorer';
3640
export const TOPIC_MESSAGE_CUSTOM_EDITOR_VIEW_TYPE = 'extension.topicMessageView';
3741

38-
3942
export const CONTEXT_VALUES = {
4043
error: 'vsDevelopPulsar.error',
4144
message: 'vsDevelopPulsar.message',

0 commit comments

Comments
 (0)