Skip to content
Merged
5 changes: 3 additions & 2 deletions l10n/bundle.l10n.json
Original file line number Diff line number Diff line change
Expand Up @@ -590,11 +590,12 @@
"Good": "Good",
"Got a moment? Share your feedback on DocumentDB for VS Code!": "Got a moment? Share your feedback on DocumentDB for VS Code!",
"Helped me understand the query execution": "Helped me understand the query execution",
"hidden": "hidden",
"hide": "hide",
"Hide index \"{indexName}\" from collection \"{collectionName}\"?": "Hide index \"{indexName}\" from collection \"{collectionName}\"?",
"Hide index?": "Hide index?",
"Hide Index…": "Hide Index…",
"Hiding index…": "Hiding index…",
"Hiding…": "Hiding…",
"High efficiency ratio": "High efficiency ratio",
"High multikey expansion": "High multikey expansion",
"HIGH PRIORITY": "HIGH PRIORITY",
Expand Down Expand Up @@ -1193,7 +1194,7 @@
"Unhide index \"{indexName}\" from collection \"{collectionName}\"?": "Unhide index \"{indexName}\" from collection \"{collectionName}\"?",
"Unhide index?": "Unhide index?",
"Unhide Index…": "Unhide Index…",
"Unhiding index…": "Unhiding index…",
"Unhiding…": "Unhiding…",
"Unknown command type: {type}": "Unknown command type: {type}",
"Unknown conflict resolution strategy: {0}": "Unknown conflict resolution strategy: {0}",
"Unknown constructor '{0}'. Expected a BSON constructor (e.g., ObjectId, ISODate) or a known global (e.g., Date, RegExp).": "Unknown constructor '{0}'. Expected a BSON constructor (e.g., ObjectId, ISODate) or a known global (e.g., Date, RegExp).",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -881,13 +881,13 @@
{
"//": "[Index] Hide Index",
"command": "vscode-documentdb.command.hideIndex",
"when": "view =~ /connectionsView|discoveryView|azure(ResourceGroups|FocusView)/ && viewItem =~ /\\btreeitem_index\\b/i && viewItem =~ /\\bexperience_(documentDB|mongoRU)\\b/i",
"when": "view =~ /connectionsView|discoveryView|azure(ResourceGroups|FocusView)/ && viewItem =~ /\\btreeitem_index\\b/i && !(viewItem =~ /\\bstate_hidden\\b/i) && !(viewItem =~ /\\bstate_default\\b/i) && viewItem =~ /\\bexperience_(documentDB|mongoRU)\\b/i",
"group": "3@1"
},
{
"//": "[Index] Unhide Index",
"command": "vscode-documentdb.command.unhideIndex",
"when": "view =~ /connectionsView|discoveryView|azure(ResourceGroups|FocusView)/ && viewItem =~ /\\btreeitem_index\\b/i && viewItem =~ /\\bexperience_(documentDB|mongoRU)\\b/i",
"when": "view =~ /connectionsView|discoveryView|azure(ResourceGroups|FocusView)/ && viewItem =~ /\\btreeitem_index\\b/i && viewItem =~ /\\bstate_hidden\\b/i && viewItem =~ /\\bexperience_(documentDB|mongoRU)\\b/i",
"group": "3@2"
},
{
Expand Down
2 changes: 1 addition & 1 deletion src/commands/index.hideIndex/hideIndex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export async function hideIndex(context: IActionContext, node: IndexItem): Promi
const client = await ClustersClient.getClient(node.cluster.clusterId);

let success = false;
await ext.state.showCreatingChild(node.id, l10n.t('Hiding index…'), async () => {
await ext.state.runWithTemporaryDescription(node.id, l10n.t('Hiding…'), async () => {
const result = await client.hideIndex(
node.databaseInfo.name,
node.collectionInfo.name,
Expand Down
2 changes: 1 addition & 1 deletion src/commands/index.unhideIndex/unhideIndex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export async function unhideIndex(context: IActionContext, node: IndexItem): Pro
const client = await ClustersClient.getClient(node.cluster.clusterId);

let success = false;
await ext.state.showCreatingChild(node.id, l10n.t('Unhiding index…'), async () => {
await ext.state.runWithTemporaryDescription(node.id, l10n.t('Unhiding…'), async () => {
const result = await client.unhideIndex(
node.databaseInfo.name,
node.collectionInfo.name,
Expand Down
10 changes: 9 additions & 1 deletion src/tree/documentdb/IndexItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,15 @@ export class IndexItem implements TreeElement, TreeElementWithExperience, TreeEl
) {
this.id = `${cluster.treeId}/${databaseInfo.name}/${collectionInfo.name}/indexes/${indexInfo.name}`;
this.experience = cluster.dbExperience;
const contextValues = ['treeItem_index'];
if (this.indexInfo.name === '_id_') {
contextValues.push('state_default');
} else if (this.indexInfo.hidden) {
contextValues.push('state_hidden');
}
Comment thread
lte-z marked this conversation as resolved.
this.experienceContextValue = `experience_${this.experience.api}`;
this.contextValue = createContextValue([this.contextValue, this.experienceContextValue]);
contextValues.push(this.experienceContextValue);
this.contextValue = createContextValue(contextValues);
}

async getChildren(): Promise<TreeElement[]> {
Expand Down Expand Up @@ -63,6 +70,7 @@ export class IndexItem implements TreeElement, TreeElementWithExperience, TreeEl
id: this.id,
contextValue: this.contextValue,
label: this.indexInfo.name,
description: this.indexInfo.hidden ? `(${vscode.l10n.t('hidden')})` : undefined,
tooltip: this.buildTooltip(),
iconPath: new vscode.ThemeIcon('combine'), // TODO: create our onw icon here, this one's shape can change
collapsibleState: vscode.TreeItemCollapsibleState.Collapsed,
Expand Down