Skip to content

Commit 9cbccfd

Browse files
committed
Added openHelp command, capitalize resource role
1 parent 9374ec4 commit 9cbccfd

File tree

7 files changed

+34
-8
lines changed

7 files changed

+34
-8
lines changed

packages/core/package.json

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2006,7 +2006,8 @@
20062006
},
20072007
{
20082008
"command": "aws.docdb.createCluster",
2009-
"when": "view == aws.explorer && viewItem == awsDocDBNode"
2009+
"when": "view == aws.explorer && viewItem == awsDocDBNode",
2010+
"group": "0@1"
20102011
},
20112012
{
20122013
"command": "aws.docdb.startCluster",
@@ -2073,6 +2074,10 @@
20732074
"when": "viewItem =~ /^awsDocDB-/",
20742075
"group": "0@1"
20752076
},
2077+
{
2078+
"command": "aws.docdb.openHelp",
2079+
"when": "viewItem == awsDocDBNode"
2080+
},
20762081
{
20772082
"command": "aws.docdb.copyEndpoint",
20782083
"when": "viewItem =~ /^awsDocDB-/",
@@ -3748,6 +3753,17 @@
37483753
}
37493754
}
37503755
},
3756+
{
3757+
"command": "aws.docdb.openHelp",
3758+
"title": "%AWS.command.docdb.openHelp%",
3759+
"category": "%AWS.title%",
3760+
"enablement": "(isCloud9 || !aws.isWebExtHost)",
3761+
"cloud9": {
3762+
"cn": {
3763+
"category": "%AWS.title.cn%"
3764+
}
3765+
}
3766+
},
37513767
{
37523768
"command": "aws.docdb.copyEndpoint",
37533769
"title": "%AWS.command.docdb.copyEndpoint%",

packages/core/package.nls.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@
212212
"AWS.command.docdb.stopCluster": "Stop Cluster",
213213
"AWS.command.docdb.tags": "Tags...",
214214
"AWS.command.docdb.open": "Open in Browser",
215+
"AWS.command.docdb.openHelp": "Open Getting Started Guide",
215216
"AWS.command.docdb.copyEndpoint": "Copy Endpoint",
216217
"AWS.command.docdb.addRegion": "Add region...",
217218
"AWS.command.resources.copyIdentifier": "Copy Identifier",

packages/core/src/docdb/activation.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { modifyInstance } from './commands/modifyInstance'
2121
import { rebootInstance } from './commands/rebootInstance'
2222
import { renameInstance } from './commands/renameInstance'
2323
import { addTag, listTags, removeTag } from './commands/tagCommands'
24+
import { env, Uri } from 'vscode'
2425

2526
/**
2627
* Activates DocumentDB components.
@@ -88,6 +89,11 @@ export async function activate(ctx: ExtContext): Promise<void> {
8889
await node?.openInBrowser()
8990
}),
9091

92+
Commands.register('aws.docdb.openHelp', async (node?: DBResourceNode) => {
93+
const url = Uri.parse('https://docs.aws.amazon.com/documentdb/latest/developerguide/get-started-guide.html')
94+
await env.openExternal(url)
95+
}),
96+
9197
Commands.register('aws.docdb.copyEndpoint', async (node?: DBResourceNode) => {
9298
await node?.copyEndpoint()
9399
})

packages/core/src/docdb/explorer/dbClusterNode.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { DBInstanceNode } from './dbInstanceNode'
1717
import { PlaceholderNode } from '../../shared/treeview/nodes/placeholderNode'
1818
import { DBInstance, DocumentDBClient } from '../../shared/clients/docdbClient'
1919
import { DocDBContext } from './docdbContext'
20+
import { toTitleCase } from '../../shared'
2021

2122
export type DBClusterRole = 'global' | 'regional' | 'primary' | 'secondary'
2223

@@ -83,10 +84,11 @@ export class DBClusterNode extends DBResourceNode {
8384
}
8485

8586
public getDescription(): string | boolean {
87+
const role = toTitleCase(this.clusterRole)
8688
if (!this.isAvailable) {
87-
return `${this.clusterRole} cluster • ${this.status}`
89+
return `${role} cluster • ${toTitleCase(this.status ?? ' ')}`
8890
}
89-
return `${this.clusterRole} cluster`
91+
return `${role} cluster`
9092
}
9193

9294
public async createInstance(request: CreateDBInstanceMessage): Promise<DBInstance | undefined> {

packages/core/src/docdb/explorer/dbElasticClusterNode.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ export class DBElasticClusterNode extends DBResourceNode {
4444

4545
public getDescription(): string | boolean {
4646
if (!this.isAvailable) {
47-
return `elastic cluster • ${this.status}`
47+
return `Elastic cluster • ${this.status}`
4848
}
49-
return 'elastic cluster'
49+
return 'Elastic cluster'
5050
}
5151

5252
public async deleteCluster(finalSnapshotId: string | undefined): Promise<DBElasticCluster | undefined> {

packages/core/src/docdb/explorer/dbGlobalClusterNode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export class DBGlobalClusterNode extends DBResourceNode {
4343
this.name = cluster.GlobalClusterIdentifier ?? ''
4444
this.contextValue = this.getContext()
4545
this.iconPath = new vscode.ThemeIcon('globe') //TODO: determine icon for global cluster
46-
this.description = 'global cluster'
46+
this.description = 'Global cluster'
4747
this.tooltip = `${this.name}\nEngine: ${this.cluster.EngineVersion}\nStatus: ${this.cluster.Status} (read-only)`
4848
}
4949

packages/core/src/docdb/explorer/dbInstanceNode.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { DBResourceNode } from './dbResourceNode'
1111
import { DBClusterNode } from './dbClusterNode'
1212
import { ModifyDBInstanceMessage } from '@aws-sdk/client-docdb'
1313
import { copyToClipboard } from '../../shared/utilities/messages'
14+
import { toTitleCase } from '../../shared'
1415

1516
/**
1617
* An AWS Explorer node representing a DocumentDB instance.
@@ -31,9 +32,9 @@ export class DBInstanceNode extends DBResourceNode {
3132
}
3233

3334
private makeDescription(): string {
34-
const type = this.instance.IsClusterWriter ? 'primary' : 'replica'
35+
const type = this.instance.IsClusterWriter ? 'Primary' : 'Replica'
3536
if (this.getContext() !== DocDBContext.InstanceAvailable) {
36-
return `${this.status} ${type} instance`
37+
return `${toTitleCase(this.status ?? ' ')} ${type} instance`
3738
}
3839
return `${type} instance • ${this.instance.DBInstanceClass}`
3940
}

0 commit comments

Comments
 (0)