mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Fix filtering for resource viewer (#13141)
This commit is contained in:
@@ -45,18 +45,17 @@ export class AzureDataGridProvider implements azdata.DataGridProvider {
|
|||||||
.map(item => {
|
.map(item => {
|
||||||
return <azdata.DataGridItem>{
|
return <azdata.DataGridItem>{
|
||||||
id: item.id,
|
id: item.id,
|
||||||
fieldValues: {
|
// Property values
|
||||||
nameLink: <azdata.DataGridHyperlinkInfo>{ displayText: item.name, linkOrCommand: 'https://microsoft.com' },
|
nameLink: <azdata.DataGridHyperlinkInfo>{ displayText: item.name, linkOrCommand: 'https://microsoft.com' },
|
||||||
name: item.name,
|
name: item.name,
|
||||||
resourceGroup: item.resourceGroup,
|
resourceGroup: item.resourceGroup,
|
||||||
subscriptionId: item.subscriptionId,
|
subscriptionId: item.subscriptionId,
|
||||||
subscriptionName: subscriptions.find(subscription => subscription.id === item.subscriptionId)?.name ?? item.subscriptionId,
|
subscriptionName: subscriptions.find(subscription => subscription.id === item.subscriptionId)?.name ?? item.subscriptionId,
|
||||||
locationDisplayName: utils.getRegionDisplayName(item.location),
|
locationDisplayName: utils.getRegionDisplayName(item.location),
|
||||||
type: item.type,
|
type: item.type,
|
||||||
typeDisplayName: utils.getResourceTypeDisplayName(item.type),
|
typeDisplayName: utils.getResourceTypeDisplayName(item.type),
|
||||||
iconPath: utils.getResourceTypeIcon(this._appContext, item.type),
|
iconPath: utils.getResourceTypeIcon(this._appContext, item.type),
|
||||||
portalEndpoint: account.properties.providerSettings.settings.portalEndpoint
|
portalEndpoint: account.properties.providerSettings.settings.portalEndpoint
|
||||||
}
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
items.push(...newItems);
|
items.push(...newItems);
|
||||||
|
|||||||
@@ -92,11 +92,11 @@ export async function activate(context: vscode.ExtensionContext): Promise<azurec
|
|||||||
registerAzureResourceCommands(appContext, [azureResourceTree, connectionDialogTree]);
|
registerAzureResourceCommands(appContext, [azureResourceTree, connectionDialogTree]);
|
||||||
azdata.dataprotocol.registerDataGridProvider(new AzureDataGridProvider(appContext));
|
azdata.dataprotocol.registerDataGridProvider(new AzureDataGridProvider(appContext));
|
||||||
vscode.commands.registerCommand('azure.dataGrid.openInAzurePortal', async (item: azdata.DataGridItem) => {
|
vscode.commands.registerCommand('azure.dataGrid.openInAzurePortal', async (item: azdata.DataGridItem) => {
|
||||||
const portalEndpoint = item.fieldValues.portalEndpoint;
|
const portalEndpoint = item.portalEndpoint;
|
||||||
const subscriptionId = item.fieldValues.subscriptionId;
|
const subscriptionId = item.subscriptionId;
|
||||||
const resourceGroup = item.fieldValues.resourceGroup;
|
const resourceGroup = item.resourceGroup;
|
||||||
const type = item.fieldValues.type;
|
const type = item.type;
|
||||||
const name = item.fieldValues.name;
|
const name = item.name;
|
||||||
if (portalEndpoint && subscriptionId && resourceGroup && type && name) {
|
if (portalEndpoint && subscriptionId && resourceGroup && type && name) {
|
||||||
await vscode.env.openExternal(vscode.Uri.parse(`${portalEndpoint}/#resource/subscriptions/${subscriptionId}/resourceGroups/${resourceGroup}/providers/${type}/${name}`));
|
await vscode.env.openExternal(vscode.Uri.parse(`${portalEndpoint}/#resource/subscriptions/${subscriptionId}/resourceGroups/${resourceGroup}/providers/${type}/${name}`));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
2
src/sql/azdata.proposed.d.ts
vendored
2
src/sql/azdata.proposed.d.ts
vendored
@@ -238,7 +238,7 @@ declare module 'azdata' {
|
|||||||
/**
|
/**
|
||||||
* The other properties that will be displayed in the grid columns
|
* The other properties that will be displayed in the grid columns
|
||||||
*/
|
*/
|
||||||
fieldValues: { [key: string]: string | DataGridHyperlinkInfo }
|
[key: string]: string | DataGridHyperlinkInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ export class ResourceViewerTable extends Disposable {
|
|||||||
forceFitColumns: true
|
forceFitColumns: true
|
||||||
}));
|
}));
|
||||||
this._resourceViewerTable.setSelectionModel(new RowSelectionModel());
|
this._resourceViewerTable.setSelectionModel(new RowSelectionModel());
|
||||||
let filterPlugin = new HeaderFilter<Slick.SlickData>();
|
let filterPlugin = new HeaderFilter<azdata.DataGridItem>();
|
||||||
this._register(attachButtonStyler(filterPlugin, this._themeService));
|
this._register(attachButtonStyler(filterPlugin, this._themeService));
|
||||||
this._register(attachTableStyler(this._resourceViewerTable, this._themeService));
|
this._register(attachTableStyler(this._resourceViewerTable, this._themeService));
|
||||||
this._register(this._resourceViewerTable.onClick(this.onTableClick, this));
|
this._register(this._resourceViewerTable.onClick(this.onTableClick, this));
|
||||||
@@ -130,7 +130,7 @@ export class ResourceViewerTable extends Disposable {
|
|||||||
const column = this._resourceViewerTable.columns[event.cell.cell] as ColumnDefinition;
|
const column = this._resourceViewerTable.columns[event.cell.cell] as ColumnDefinition;
|
||||||
if (column) {
|
if (column) {
|
||||||
const row = this._dataView.getItem(event.cell.row);
|
const row = this._dataView.getItem(event.cell.row);
|
||||||
const value = row.fieldValues[column.field];
|
const value = row[column.field];
|
||||||
if (isHyperlinkCellValue(value)) {
|
if (isHyperlinkCellValue(value)) {
|
||||||
if (isString(value.linkOrCommand)) {
|
if (isString(value.linkOrCommand)) {
|
||||||
try {
|
try {
|
||||||
@@ -154,7 +154,7 @@ export class ResourceViewerTable extends Disposable {
|
|||||||
* Extracts the specified field into the expected object to be handled by SlickGrid and/or formatters as needed.
|
* Extracts the specified field into the expected object to be handled by SlickGrid and/or formatters as needed.
|
||||||
*/
|
*/
|
||||||
function dataGridColumnValueExtractor(value: azdata.DataGridItem, columnDef: ColumnDefinition): TextCellValue | HyperlinkCellValue {
|
function dataGridColumnValueExtractor(value: azdata.DataGridItem, columnDef: ColumnDefinition): TextCellValue | HyperlinkCellValue {
|
||||||
const fieldValue = value.fieldValues[columnDef.field];
|
const fieldValue = value[columnDef.field];
|
||||||
if (columnDef.type === 'hyperlink') {
|
if (columnDef.type === 'hyperlink') {
|
||||||
return fieldValue as HyperlinkCellValue;
|
return fieldValue as HyperlinkCellValue;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user