Skip to content

Commit

Permalink
Merge branch 'main' into oidc-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
himanshusinghs committed Jan 10, 2024
2 parents 0d2e2d1 + 6f2017f commit 1fa0014
Show file tree
Hide file tree
Showing 19 changed files with 892 additions and 64 deletions.
23 changes: 21 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,27 @@
# Change Log

## [v1.4.0](https://github.com/mongodb-js/vscode/releases/tag/untagged-cda8b18ef8ec5f1910ea) - null
## [v1.4.0](https://github.com/mongodb-js/vscode/releases/tag/v1.4.0) - 2024-01-09

Edit the release notes before publishing.
## What's Changed
* feat: send logs to a LogOutputChannel VSCODE-429 by @baileympearson in https://github.com/mongodb-js/vscode/pull/616
* feat: enable language server logs to be opened as a log file VSCODE-429 by @baileympearson in https://github.com/mongodb-js/vscode/pull/618
* fix(explorer): auto-open connection when done connecting, fix auto open on delete VSCODE-325 VSCODE-398 by @Anemy in https://github.com/mongodb-js/vscode/pull/619
* feat: adds a new overview screen based on LeafyGreen components VSCODE-485 by @himanshusinghs in https://github.com/mongodb-js/vscode/pull/617
* chore(playground): codelens for active connection will inform about default connected database VSCODE-316 by @himanshusinghs in https://github.com/mongodb-js/vscode/pull/621
* feat(webview): use Compass' connection form in the new overview page VSCODE-488 by @Anemy in https://github.com/mongodb-js/vscode/pull/622
* chore(connections): remove keytar, keytar migration, and connection model migration VSCODE-499 by @Anemy in https://github.com/mongodb-js/vscode/pull/625
* chore: add connection storage, simplify connection controller and storage controller interfaces by @Anemy in https://github.com/mongodb-js/vscode/pull/627
* chore: update segment client VSCODE-498, VSCODE-501 by @mcasimir in https://github.com/mongodb-js/vscode/pull/626
* chore(ci): sign vsix file VSCODE-493 by @mcasimir in https://github.com/mongodb-js/vscode/pull/632
* feat(webview): update feature flag to always show new connection form VSCODE-490 by @Anemy in https://github.com/mongodb-js/vscode/pull/637
* feat: add OIDC auth support, enable in new form VSCODE-354 by @Anemy in https://github.com/mongodb-js/vscode/pull/630
* VSCODE-504: streams support in playgrounds by @shaketbaby in https://github.com/mongodb-js/vscode/pull/633

## New Contributors
* @baileympearson made their first contribution in https://github.com/mongodb-js/vscode/pull/616
* @shaketbaby made their first contribution in https://github.com/mongodb-js/vscode/pull/633

**Full Changelog**: https://github.com/mongodb-js/vscode/compare/v1.3.1...v1.4.0


## [v1.3.1](https://github.com/mongodb-js/vscode/releases/tag/v1.3.1) - 2023-10-09
Expand Down
11 changes: 11 additions & 0 deletions images/dark/stream-processor.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions images/light/stream-processor.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

76 changes: 67 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,26 @@
{
"command": "mdb.deleteDocumentFromTreeView",
"title": "Delete Document..."
},
{
"command": "mdb.addStreamProcessor",
"title": "Add StreamProcessor...",
"icon": {
"light": "images/light/plus-circle.svg",
"dark": "images/dark/plus-circle.svg"
}
},
{
"command": "mdb.startStreamProcessor",
"title": "Start Stream Processor"
},
{
"command": "mdb.stopStreamProcessor",
"title": "Stop Stream Processor"
},
{
"command": "mdb.dropStreamProcessor",
"title": "Drop Stream Processor..."
}
],
"menus": {
Expand Down Expand Up @@ -428,12 +448,22 @@
"view/item/context": [
{
"command": "mdb.addDatabase",
"when": "view == mongoDBConnectionExplorer && viewItem == connectedConnectionTreeItem",
"when": "view == mongoDBConnectionExplorer && viewItem == connectedConnectionTreeItem && mdb.isAtlasStreams == false",
"group": "inline"
},
{
"command": "mdb.addDatabase",
"when": "view == mongoDBConnectionExplorer && viewItem == connectedConnectionTreeItem",
"when": "view == mongoDBConnectionExplorer && viewItem == connectedConnectionTreeItem && mdb.isAtlasStreams == false",
"group": "1@1"
},
{
"command": "mdb.addStreamProcessor",
"when": "view == mongoDBConnectionExplorer && viewItem == connectedConnectionTreeItem && mdb.isAtlasStreams == true",
"group": "inline"
},
{
"command": "mdb.addStreamProcessor",
"when": "view == mongoDBConnectionExplorer && viewItem == connectedConnectionTreeItem && mdb.isAtlasStreams == true",
"group": "1@1"
},
{
Expand Down Expand Up @@ -611,6 +641,18 @@
"command": "mdb.deleteDocumentFromTreeView",
"when": "view == mongoDBConnectionExplorer && viewItem == documentTreeItem",
"group": "3@1"
},
{
"command": "mdb.startStreamProcessor",
"when": "view == mongoDBConnectionExplorer && viewItem == streamProcessorTreeItem"
},
{
"command": "mdb.stopStreamProcessor",
"when": "view == mongoDBConnectionExplorer && viewItem == streamProcessorTreeItem"
},
{
"command": "mdb.dropStreamProcessor",
"when": "view == mongoDBConnectionExplorer && viewItem == streamProcessorTreeItem"
}
],
"editor/title": [
Expand Down Expand Up @@ -639,27 +681,27 @@
},
{
"command": "mdb.exportToRuby",
"when": "mdb.isPlayground == true && mdb.connectedToMongoDB == true"
"when": "mdb.isPlayground == true && mdb.connectedToMongoDB == true && mdb.isAtlasStreams == false"
},
{
"command": "mdb.exportToPython",
"when": "mdb.isPlayground == true && mdb.connectedToMongoDB == true"
"when": "mdb.isPlayground == true && mdb.connectedToMongoDB == true && mdb.isAtlasStreams == false"
},
{
"command": "mdb.exportToJava",
"when": "mdb.isPlayground == true && mdb.connectedToMongoDB == true"
"when": "mdb.isPlayground == true && mdb.connectedToMongoDB == true && mdb.isAtlasStreams == false"
},
{
"command": "mdb.exportToCsharp",
"when": "mdb.isPlayground == true && mdb.connectedToMongoDB == true"
"when": "mdb.isPlayground == true && mdb.connectedToMongoDB == true && mdb.isAtlasStreams == false"
},
{
"command": "mdb.exportToNode",
"when": "mdb.isPlayground == true && mdb.connectedToMongoDB == true"
"when": "mdb.isPlayground == true && mdb.connectedToMongoDB == true && mdb.isAtlasStreams == false"
},
{
"command": "mdb.exportToGo",
"when": "mdb.isPlayground == true && mdb.connectedToMongoDB == true"
"when": "mdb.isPlayground == true && mdb.connectedToMongoDB == true && mdb.isAtlasStreams == false"
},
{
"command": "mdb.refreshPlaygroundsFromTreeView",
Expand Down Expand Up @@ -804,6 +846,22 @@
{
"command": "mdb.deleteDocumentFromTreeView",
"when": "false"
},
{
"command": "mdb.addStreamProcessor",
"when": "false"
},
{
"command": "mdb.startStreamProcessor",
"when": "false"
},
{
"command": "mdb.stopStreamProcessor",
"when": "false"
},
{
"command": "mdb.dropStreamProcessor",
"when": "false"
}
]
},
Expand Down Expand Up @@ -1007,7 +1065,7 @@
"mongodb-build-info": "^1.6.2",
"mongodb-cloud-info": "^2.1.0",
"mongodb-connection-string-url": "^2.6.0",
"mongodb-data-service": "^22.17.0",
"mongodb-data-service": "^22.17.1",
"mongodb-data-service-legacy": "npm:[email protected]",
"mongodb-log-writer": "^1.4.0",
"mongodb-query-parser": "^3.1.3",
Expand Down
4 changes: 4 additions & 0 deletions src/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ enum EXTENSION_COMMANDS {
MDB_COPY_DOCUMENT_CONTENTS_FROM_TREE_VIEW = 'mdb.copyDocumentContentsFromTreeView',
MDB_CLONE_DOCUMENT_FROM_TREE_VIEW = 'mdb.cloneDocumentFromTreeView',
MDB_DELETE_DOCUMENT_FROM_TREE_VIEW = 'mdb.deleteDocumentFromTreeView',
MDB_ADD_STREAM_PROCESSOR = 'mdb.addStreamProcessor',
MDB_START_STREAM_PROCESSOR = 'mdb.startStreamProcessor',
MDB_STOP_STREAM_PROCESSOR = 'mdb.stopStreamProcessor',
MDB_DROP_STREAM_PROCESSOR = 'mdb.dropStreamProcessor',
}

export default EXTENSION_COMMANDS;
19 changes: 19 additions & 0 deletions src/connectionController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { openLink } from './utils/linkHelper';
import type { LoadedConnection } from './storage/connectionStorage';
import { ConnectionStorage } from './storage/connectionStorage';
import LINKS from './utils/links';
import { isAtlasStream } from 'mongodb-build-info';

// eslint-disable-next-line @typescript-eslint/no-var-requires
const packageJSON = require('../package.json');
Expand Down Expand Up @@ -402,6 +403,12 @@ export default class ConnectionController {
true
);

void vscode.commands.executeCommand(
'setContext',
'mdb.isAtlasStreams',
this.isConnectedToAtlasStreams()
);

void this.onConnectSuccess({
connectionInfo,
dataService,
Expand Down Expand Up @@ -548,6 +555,11 @@ export default class ConnectionController {
'mdb.connectedToMongoDB',
false
);
void vscode.commands.executeCommand(
'setContext',
'mdb.isAtlasStreams',
false
);
} catch (error) {
// Show an error, however we still reset the active connection to free up the extension.
void vscode.window.showErrorMessage(
Expand Down Expand Up @@ -775,6 +787,13 @@ export default class ConnectionController {
return connectionStringData.toString();
}

isConnectedToAtlasStreams() {
return (
this.isCurrentlyConnected() &&
isAtlasStream(this.getActiveConnectionString())
);
}

getActiveConnectionString(): string {
const mongoClientConnectionOptions = this.getMongoClientConnectionOptions();
const connectionString = mongoClientConnectionOptions?.url;
Expand Down
18 changes: 17 additions & 1 deletion src/editors/playgroundController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import playgroundCreateIndexTemplate from '../templates/playgroundCreateIndexTem
import playgroundCreateCollectionTemplate from '../templates/playgroundCreateCollectionTemplate';
import playgroundCloneDocumentTemplate from '../templates/playgroundCloneDocumentTemplate';
import playgroundInsertDocumentTemplate from '../templates/playgroundInsertDocumentTemplate';
import playgroundStreamsTemplate from '../templates/playgroundStreamsTemplate';
import playgroundCreateStreamProcessorTemplate from '../templates/playgroundCreateStreamProcessorTemplate';
import type {
PlaygroundResult,
ShellEvaluateResult,
Expand Down Expand Up @@ -391,11 +393,25 @@ export default class PlaygroundController {
return this._createPlaygroundFileWithContent(content);
}

async createPlaygroundForCreateStreamProcessor(
element: ConnectionTreeItem
): Promise<boolean> {
const content = playgroundCreateStreamProcessorTemplate;

element.cacheIsUpToDate = false;

this._telemetryService.trackPlaygroundCreated('createStreamProcessor');

return this._createPlaygroundFileWithContent(content);
}

async createPlayground(): Promise<boolean> {
const useDefaultTemplate = !!vscode.workspace
.getConfiguration('mdb')
.get('useDefaultTemplateForPlayground');
const content = useDefaultTemplate ? playgroundTemplate : '';
const isStreams = this._connectionController.isConnectedToAtlasStreams();
const template = isStreams ? playgroundStreamsTemplate : playgroundTemplate;
const content = useDefaultTemplate ? template : '';

this._telemetryService.trackPlaygroundCreated('crud');
return this._createPlaygroundFileWithContent(content);
Expand Down
Loading

0 comments on commit 1fa0014

Please sign in to comment.