mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Bring in all the extensibility updates we added during the hackathon (#2056)
Extensibility updates
This commit is contained in:
@@ -36,10 +36,7 @@ export enum DeclarativeDataType {
|
|||||||
<thead>
|
<thead>
|
||||||
<tr style="display:block;">
|
<tr style="display:block;">
|
||||||
<ng-container *ngFor="let column of columns;let h = index">
|
<ng-container *ngFor="let column of columns;let h = index">
|
||||||
|
|
||||||
<td class="declarative-table-header" tabindex="-1" [style.width]="getColumnWidth(h)" role="button" aria-sort="none">{{column.displayName}}</td>
|
<td class="declarative-table-header" tabindex="-1" [style.width]="getColumnWidth(h)" role="button" aria-sort="none">{{column.displayName}}</td>
|
||||||
|
|
||||||
|
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -183,7 +180,13 @@ export default class DeclarativeTableComponent extends ComponentBase implements
|
|||||||
let cellData = this.data[row][cell];
|
let cellData = this.data[row][cell];
|
||||||
if (cellData && column.categoryValues) {
|
if (cellData && column.categoryValues) {
|
||||||
let category = column.categoryValues.find(v => v.name === cellData);
|
let category = column.categoryValues.find(v => v.name === cellData);
|
||||||
|
if (category) {
|
||||||
return category.displayName;
|
return category.displayName;
|
||||||
|
} else if (this.isEditableSelectBox(cell)) {
|
||||||
|
return cellData;
|
||||||
|
} else {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
.declarative-table {
|
.declarative-table {
|
||||||
padding: 5px 30px 0px 30px;
|
padding: 5px 30px 0px 30px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import { RowSelectionModel } from 'sql/base/browser/ui/table/plugins/rowSelectio
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'modelview-table',
|
selector: 'modelview-table',
|
||||||
template: `
|
template: `
|
||||||
<div #table style="width: 100%;height:100%"></div>
|
<div #table style="width: 100%;height:100%" [style.font-size]="fontSize"></div>
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
export default class TableComponent extends ComponentBase implements IComponent, OnDestroy, AfterViewInit {
|
export default class TableComponent extends ComponentBase implements IComponent, OnDestroy, AfterViewInit {
|
||||||
@@ -98,7 +98,7 @@ export default class TableComponent extends ComponentBase implements IComponent,
|
|||||||
syncColumnCellResize: true,
|
syncColumnCellResize: true,
|
||||||
enableColumnReorder: false,
|
enableColumnReorder: false,
|
||||||
enableCellNavigation: true,
|
enableCellNavigation: true,
|
||||||
forceFitColumns: true,
|
forceFitColumns: true
|
||||||
};
|
};
|
||||||
|
|
||||||
this._table = new Table<Slick.SlickData>(this._inputContainer.nativeElement, this._tableData, this._tableColumns, options);
|
this._table = new Table<Slick.SlickData>(this._inputContainer.nativeElement, this._tableData, this._tableColumns, options);
|
||||||
@@ -178,6 +178,10 @@ export default class TableComponent extends ComponentBase implements IComponent,
|
|||||||
return this.getPropertyOrDefault<sqlops.TableComponentProperties, string[]>((props) => props.columns, []);
|
return this.getPropertyOrDefault<sqlops.TableComponentProperties, string[]>((props) => props.columns, []);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get fontSize(): number | string {
|
||||||
|
return this.getPropertyOrDefault<sqlops.TableComponentProperties, number | string>((props) => props.fontSize, '');
|
||||||
|
}
|
||||||
|
|
||||||
public set columns(newValue: string[]) {
|
public set columns(newValue: string[]) {
|
||||||
this.setPropertyFromUI<sqlops.TableComponentProperties, string[]>((props, value) => props.columns = value, newValue);
|
this.setPropertyFromUI<sqlops.TableComponentProperties, string[]>((props, value) => props.columns = value, newValue);
|
||||||
}
|
}
|
||||||
|
|||||||
18
src/sql/sqlops.proposed.d.ts
vendored
18
src/sql/sqlops.proposed.d.ts
vendored
@@ -376,6 +376,7 @@ declare module 'sqlops' {
|
|||||||
export interface TableComponentProperties extends ComponentProperties {
|
export interface TableComponentProperties extends ComponentProperties {
|
||||||
data: any[][];
|
data: any[][];
|
||||||
columns: string[] | TableColumn[];
|
columns: string[] | TableColumn[];
|
||||||
|
fontSize?: number | string;
|
||||||
selectedRows?: number[];
|
selectedRows?: number[];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1108,4 +1109,21 @@ declare module 'sqlops' {
|
|||||||
export function startBackgroundOperation(operationInfo: BackgroundOperationInfo): void;
|
export function startBackgroundOperation(operationInfo: BackgroundOperationInfo): void;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export namespace connection {
|
||||||
|
/**
|
||||||
|
* List the databases that can be accessed from the given connection
|
||||||
|
* @param {string} connectionId The ID of the connection
|
||||||
|
* @returns {string[]} An list of names of databases
|
||||||
|
*/
|
||||||
|
export function listDatabases(connectionId: string): Thenable<string[]>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a URI corresponding to the given connection so that it can be used with data
|
||||||
|
* providers and other APIs that require a connection API.
|
||||||
|
* Note: If the given connection corresponds to multiple URIs this may return any of them
|
||||||
|
* @param connectionId The ID of the connection
|
||||||
|
*/
|
||||||
|
export function getUriForConnection(connectionId: string): Thenable<string>;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,4 +30,12 @@ export class ExtHostConnectionManagement extends ExtHostConnectionManagementShap
|
|||||||
public $getCredentials(connectionId: string): Thenable<{ [name: string]: string }> {
|
public $getCredentials(connectionId: string): Thenable<{ [name: string]: string }> {
|
||||||
return this._proxy.$getCredentials(connectionId);
|
return this._proxy.$getCredentials(connectionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public $listDatabases(connectionId: string): Thenable<string[]> {
|
||||||
|
return this._proxy.$listDatabases(connectionId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public $getUriForConnection(connectionId: string): Thenable<string> {
|
||||||
|
return this._proxy.$getUriForConnection(connectionId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -847,6 +847,14 @@ class TableComponentWrapper extends ComponentWrapper implements sqlops.TableComp
|
|||||||
this.setProperty('columns', v);
|
this.setProperty('columns', v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get fontSize(): number | string {
|
||||||
|
return this.properties['fontSize'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public set fontSize(size: number | string) {
|
||||||
|
this.setProperty('fontSize', size);
|
||||||
|
}
|
||||||
|
|
||||||
public get selectedRows(): number[] {
|
public get selectedRows(): number[] {
|
||||||
return this.properties['selectedRows'];
|
return this.properties['selectedRows'];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,18 @@ export class MainThreadConnectionManagement implements MainThreadConnectionManag
|
|||||||
return Promise.resolve(this._connectionManagementService.getActiveConnectionCredentials(connectionId));
|
return Promise.resolve(this._connectionManagementService.getActiveConnectionCredentials(connectionId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async $listDatabases(connectionId: string): Promise<string[]> {
|
||||||
|
let connection = this._connectionManagementService.getActiveConnections().find(profile => profile.id === connectionId);
|
||||||
|
let connectionUri = this._connectionManagementService.getConnectionId(connection);
|
||||||
|
let result = await this._connectionManagementService.listDatabases(connectionUri);
|
||||||
|
return result.databaseNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
public $getUriForConnection(connectionId: string): Thenable<string> {
|
||||||
|
let connection = this._connectionManagementService.getActiveConnections().find(profile => profile.id === connectionId);
|
||||||
|
return Promise.resolve(this._connectionManagementService.getConnectionId(connection));
|
||||||
|
}
|
||||||
|
|
||||||
private convertConnection(profile: IConnectionProfile): sqlops.connection.Connection {
|
private convertConnection(profile: IConnectionProfile): sqlops.connection.Connection {
|
||||||
if (!profile) {
|
if (!profile) {
|
||||||
return undefined;
|
return undefined;
|
||||||
|
|||||||
@@ -101,6 +101,12 @@ export function createApiFactory(
|
|||||||
},
|
},
|
||||||
getCredentials(connectionId: string): Thenable<{ [name: string]: string }> {
|
getCredentials(connectionId: string): Thenable<{ [name: string]: string }> {
|
||||||
return extHostConnectionManagement.$getCredentials(connectionId);
|
return extHostConnectionManagement.$getCredentials(connectionId);
|
||||||
|
},
|
||||||
|
listDatabases(connectionId: string): Thenable<string[]> {
|
||||||
|
return extHostConnectionManagement.$listDatabases(connectionId);
|
||||||
|
},
|
||||||
|
getUriForConnection(connectionId: string): Thenable<string> {
|
||||||
|
return extHostConnectionManagement.$getUriForConnection(connectionId);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -473,6 +473,8 @@ export interface MainThreadConnectionManagementShape extends IDisposable {
|
|||||||
$getActiveConnections(): Thenable<sqlops.connection.Connection[]>;
|
$getActiveConnections(): Thenable<sqlops.connection.Connection[]>;
|
||||||
$getCurrentConnection(): Thenable<sqlops.connection.Connection>;
|
$getCurrentConnection(): Thenable<sqlops.connection.Connection>;
|
||||||
$getCredentials(connectionId: string): Thenable<{ [name: string]: string }>;
|
$getCredentials(connectionId: string): Thenable<{ [name: string]: string }>;
|
||||||
|
$listDatabases(connectionId: string): Thenable<string[]>;
|
||||||
|
$getUriForConnection(connectionId: string): Thenable<string>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MainThreadCredentialManagementShape extends IDisposable {
|
export interface MainThreadCredentialManagementShape extends IDisposable {
|
||||||
|
|||||||
Reference in New Issue
Block a user